guest stuff

This commit is contained in:
Cole Robinson 2013-09-20 10:47:36 -04:00
parent 38f110954d
commit a23f1794d0
2 changed files with 19 additions and 5 deletions

View File

@ -88,7 +88,7 @@ class Guest(XMLBuilder):
_XML_PROP_ORDER = ["type", "name", "uuid", "description",
"maxmemory", "memory", "hugepage", "vcpus", "curvcpus",
"numatune", "bootloader", "os", "features", "cpu", "clock",
"on_poweroff", "on_reboot", "on_crash", "emulator", "all_devices",
"on_poweroff", "on_reboot", "on_crash", "emulator", "_devices",
"seclabel"]
def __init__(self, *args, **kwargs):
@ -237,7 +237,6 @@ class Guest(XMLBuilder):
for devtype in VirtualDevice.virtual_device_types:
retlist.extend(self.get_devices(devtype))
return retlist
all_devices = property(lambda s: s.get_all_devices())
############################
@ -648,7 +647,7 @@ class Guest(XMLBuilder):
def _check_address_multi(self):
addresses = {}
for d in self.all_devices:
for d in self.get_all_devices():
if d.address.type != d.address.ADDRESS_TYPE_PCI:
continue

View File

@ -293,8 +293,23 @@ class XMLChildProperty(property):
for obj in self._get(xmlbuilder)[:]:
xmlbuilder._remove_child(obj)
def append(self, xmlbuilder, obj):
self._get(xmlbuilder).append(obj)
def append(self, xmlbuilder, newobj):
# Keep the list ordered by the order of passed in child classes
objlist = self._get(xmlbuilder)
if len(self.child_classes) == 1:
objlist.append(newobj)
return
idx = 0
for idx in range(len(objlist)):
obj = objlist[idx]
if (obj.__class__ not in self.child_classes or
(self.child_classes.index(newobj.__class__) <
self.child_classes.index(obj.__class__))):
break
idx += 1
objlist.insert(idx, newobj)
def remove(self, xmlbuilder, obj):
self._get(xmlbuilder).remove(obj)
def set(self, xmlbuilder, obj):