Merge "libvirt: Configuration element for sVirt support"
This commit is contained in:
@@ -1567,3 +1567,24 @@ class LibvirtConfigGuestVideoTest(LibvirtConfigBaseTest):
|
||||
<video>
|
||||
<model type='qxl' vram='9216' heads='1'/>
|
||||
</video>""")
|
||||
|
||||
|
||||
class LibvirtConfigGuestSeclabel(LibvirtConfigBaseTest):
|
||||
|
||||
def test_config_seclabel_config(self):
|
||||
obj = config.LibvirtConfigSeclabel()
|
||||
|
||||
xml = obj.to_xml()
|
||||
self.assertXmlEqual(xml, """
|
||||
<seclabel type='dynamic'/>""")
|
||||
|
||||
def test_config_seclabel_baselabel(self):
|
||||
obj = config.LibvirtConfigSeclabel()
|
||||
obj.type = 'dynamic'
|
||||
obj.baselabel = 'system_u:system_r:my_svirt_t:s0'
|
||||
|
||||
xml = obj.to_xml()
|
||||
self.assertXmlEqual(xml, """
|
||||
<seclabel type='dynamic'>
|
||||
<baselabel>system_u:system_r:my_svirt_t:s0</baselabel>
|
||||
</seclabel>""")
|
||||
|
@@ -908,6 +908,24 @@ class LibvirtConfigGuestGraphics(LibvirtConfigGuestDevice):
|
||||
return dev
|
||||
|
||||
|
||||
class LibvirtConfigSeclabel(LibvirtConfigObject):
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super(LibvirtConfigSeclabel, self).__init__(root_name="seclabel",
|
||||
**kwargs)
|
||||
self.type = 'dynamic'
|
||||
self.baselabel = None
|
||||
|
||||
def format_dom(self):
|
||||
seclabel = super(LibvirtConfigSeclabel, self).format_dom()
|
||||
|
||||
seclabel.set('type', self.type)
|
||||
if self.baselabel:
|
||||
seclabel.append(self._text_node("baselabel", self.baselabel))
|
||||
|
||||
return seclabel
|
||||
|
||||
|
||||
class LibvirtConfigGuestVideo(LibvirtConfigGuestDevice):
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
|
Reference in New Issue
Block a user