guest: Allow parsing domain ID

This commit is contained in:
Cole Robinson 2013-09-23 21:27:42 -04:00
parent 8ba600a8e7
commit 737016c0cf
3 changed files with 3 additions and 1 deletions

View File

@ -1,4 +1,4 @@
<domain type="test">
<domain type="test" id="1234">
<name>change_name</name>
<currentMemory>1024000</currentMemory>
<memory>2048000</memory>

View File

@ -102,6 +102,7 @@ class XMLParseTest(unittest.TestCase):
check = self._make_checker(guest)
check("name", "TestGuest", "change_name")
check("id", None, 1234)
check("description", None, "Hey desc changed&")
check("vcpus", 5, 12)
check("curvcpus", None, 10)

View File

@ -156,6 +156,7 @@ class Guest(XMLBuilder):
validate_cb=lambda s, v: util.validate_uuid(v),
default_cb=_get_default_uuid)
id = XMLProperty("./@id", is_int=True)
type = XMLProperty("./@type", default_cb=lambda s: "xen")
hugepage = XMLProperty("./memoryBacking/hugepages", is_bool=True)
bootloader = XMLProperty("./bootloader")