diff --git a/tests/xmlparse-xml/change-disk-in.xml b/tests/xmlparse-xml/change-disk-in.xml index 3c4d7259e..22896ad82 100644 --- a/tests/xmlparse-xml/change-disk-in.xml +++ b/tests/xmlparse-xml/change-disk-in.xml @@ -26,7 +26,7 @@ - + diff --git a/tests/xmlparse-xml/change-disk-out.xml b/tests/xmlparse-xml/change-disk-out.xml index fe042f059..cc5eede8c 100644 --- a/tests/xmlparse-xml/change-disk-out.xml +++ b/tests/xmlparse-xml/change-disk-out.xml @@ -27,7 +27,9 @@ - + + + diff --git a/tests/xmlparse.py b/tests/xmlparse.py index 7a763b8eb..6db77db8e 100644 --- a/tests/xmlparse.py +++ b/tests/xmlparse.py @@ -352,7 +352,8 @@ class XMLParseTest(unittest.TestCase): disk = guest.get_devices("disk")[1] check = self._make_checker(disk.seclabel[1]) check("model", "dac") - check("type", "dynamic", "none") + check("relabel", None, True) + check("label", None, "foo-my-label") disk = _get_disk("hdc") check = self._make_checker(disk) diff --git a/virtinst/devicedisk.py b/virtinst/devicedisk.py index e2ae610f3..5270c1201 100644 --- a/virtinst/devicedisk.py +++ b/virtinst/devicedisk.py @@ -30,7 +30,7 @@ from . import diskbackend from . import util from .device import VirtualDevice from .seclabel import Seclabel -from .xmlbuilder import XMLChildProperty, XMLProperty +from .xmlbuilder import XMLBuilder, XMLChildProperty, XMLProperty def _qemu_sanitize_drvtype(phystype, fmt, manual_format=False): @@ -91,6 +91,17 @@ def _is_dir_searchable(uid, username, path): return bool(re.search("user:%s:..x" % username, out)) +class _DiskSeclabel(XMLBuilder): + """ + This is for disk source . It's similar to a domain + but has fewer options + """ + _XML_ROOT_NAME = "seclabel" + model = XMLProperty("./@model") + relabel = XMLProperty("./@relabel", is_yesno=True) + label = XMLProperty("./label") + + class VirtualDisk(VirtualDevice): virtual_device_type = VirtualDevice.VIRTUAL_DEV_DISK @@ -742,7 +753,7 @@ class VirtualDisk(VirtualDevice): iotune_wbs = XMLProperty("./iotune/write_bytes_sec", is_int=True) iotune_wis = XMLProperty("./iotune/write_iops_sec", is_int=True) - seclabel = XMLChildProperty(Seclabel, relative_xpath="./source") + seclabel = XMLChildProperty(_DiskSeclabel, relative_xpath="./source") #################################