virtinst: Rename XMLBuilderDomain.py -> xmlbuilder.py
And XMLBuilderDomain -> XMLBuilder And _xml_property -> XMLProperty
This commit is contained in:
parent
4d5ca0ae5a
commit
b152e83fef
|
@ -92,7 +92,7 @@ class XMLParseTest(unittest.TestCase):
|
|||
def test000ClearProps(self):
|
||||
# pylint: disable=W0212
|
||||
# Access to protected member, needed to unittest stuff
|
||||
virtinst.XMLBuilderDomain._seenprops = []
|
||||
virtinst.xmlbuilder._seenprops = []
|
||||
|
||||
def testAlterGuest(self):
|
||||
"""
|
||||
|
@ -764,9 +764,8 @@ class XMLParseTest(unittest.TestCase):
|
|||
# test000ClearProps resets the 'set' list, and this test
|
||||
# ensures that every property we know about has been touched
|
||||
# by one of the above tests.
|
||||
from virtinst import XMLBuilderDomain
|
||||
fail = [p for p in XMLBuilderDomain._allprops
|
||||
if p not in XMLBuilderDomain._seenprops]
|
||||
fail = [p for p in virtinst.xmlbuilder._allprops
|
||||
if p not in virtinst.xmlbuilder._seenprops]
|
||||
try:
|
||||
self.assertEquals([], fail)
|
||||
except AssertionError:
|
||||
|
|
|
@ -18,11 +18,10 @@
|
|||
# MA 02110-1301 USA.
|
||||
|
||||
from virtinst import util
|
||||
from virtinst import XMLBuilderDomain
|
||||
from virtinst.XMLBuilderDomain import _xml_property
|
||||
from virtinst.xmlbuilder import XMLBuilder, XMLProperty
|
||||
|
||||
|
||||
class Boot(XMLBuilderDomain.XMLBuilderDomain):
|
||||
class Boot(XMLBuilder):
|
||||
"""
|
||||
Class for generating boot device related XML
|
||||
"""
|
||||
|
@ -36,7 +35,7 @@ class Boot(XMLBuilderDomain.XMLBuilderDomain):
|
|||
|
||||
_dumpxml_xpath = "/domain/os"
|
||||
def __init__(self, conn, parsexml=None, parsexmlnode=None):
|
||||
XMLBuilderDomain.XMLBuilderDomain.__init__(self, conn, parsexml,
|
||||
XMLBuilder.__init__(self, conn, parsexml,
|
||||
parsexmlnode)
|
||||
|
||||
self._bootorder = []
|
||||
|
@ -54,7 +53,7 @@ class Boot(XMLBuilderDomain.XMLBuilderDomain):
|
|||
if val is None:
|
||||
return None
|
||||
return bool(val == "yes")
|
||||
enable_bootmenu = _xml_property(_get_enable_bootmenu, _set_enable_bootmenu,
|
||||
enable_bootmenu = XMLProperty(_get_enable_bootmenu, _set_enable_bootmenu,
|
||||
get_converter=_get_menu_converter,
|
||||
set_converter=lambda s, x: x and "yes" or "no",
|
||||
xpath="./os/bootmenu/@enable")
|
||||
|
@ -63,7 +62,7 @@ class Boot(XMLBuilderDomain.XMLBuilderDomain):
|
|||
return self._bootorder
|
||||
def _set_bootorder(self, val):
|
||||
self._bootorder = val
|
||||
bootorder = _xml_property(_get_bootorder, _set_bootorder,
|
||||
bootorder = XMLProperty(_get_bootorder, _set_bootorder,
|
||||
is_multi=True,
|
||||
xpath="./os/boot/@dev")
|
||||
|
||||
|
@ -71,21 +70,21 @@ class Boot(XMLBuilderDomain.XMLBuilderDomain):
|
|||
return self._kernel
|
||||
def _set_kernel(self, val):
|
||||
self._kernel = val
|
||||
kernel = _xml_property(_get_kernel, _set_kernel,
|
||||
kernel = XMLProperty(_get_kernel, _set_kernel,
|
||||
xpath="./os/kernel")
|
||||
|
||||
def _get_initrd(self):
|
||||
return self._initrd
|
||||
def _set_initrd(self, val):
|
||||
self._initrd = val
|
||||
initrd = _xml_property(_get_initrd, _set_initrd,
|
||||
initrd = XMLProperty(_get_initrd, _set_initrd,
|
||||
xpath="./os/initrd")
|
||||
|
||||
def _get_kernel_args(self):
|
||||
return self._kernel_args
|
||||
def _set_kernel_args(self, val):
|
||||
self._kernel_args = val
|
||||
kernel_args = _xml_property(_get_kernel_args, _set_kernel_args,
|
||||
kernel_args = XMLProperty(_get_kernel_args, _set_kernel_args,
|
||||
xpath="./os/cmdline")
|
||||
|
||||
def _get_xml_config(self):
|
||||
|
|
|
@ -17,8 +17,7 @@
|
|||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
# MA 02110-1301 USA.
|
||||
|
||||
from virtinst import XMLBuilderDomain
|
||||
from virtinst.XMLBuilderDomain import _xml_property
|
||||
from virtinst.xmlbuilder import XMLBuilder, XMLProperty
|
||||
|
||||
import libxml2
|
||||
|
||||
|
@ -27,7 +26,7 @@ def _int_or_none(val):
|
|||
return val and int(val) or val
|
||||
|
||||
|
||||
class CPUFeature(XMLBuilderDomain.XMLBuilderDomain):
|
||||
class CPUFeature(XMLBuilder):
|
||||
"""
|
||||
Class for generating <cpu> child <feature> XML
|
||||
"""
|
||||
|
@ -35,7 +34,7 @@ class CPUFeature(XMLBuilderDomain.XMLBuilderDomain):
|
|||
POLICIES = ["force", "require", "optional", "disable", "forbid"]
|
||||
|
||||
def __init__(self, conn, parsexml=None, parsexmlnode=None):
|
||||
XMLBuilderDomain.XMLBuilderDomain.__init__(self, conn, parsexml,
|
||||
XMLBuilder.__init__(self, conn, parsexml,
|
||||
parsexmlnode)
|
||||
|
||||
self._name = None
|
||||
|
@ -48,14 +47,14 @@ class CPUFeature(XMLBuilderDomain.XMLBuilderDomain):
|
|||
return self._name
|
||||
def _set_name(self, val):
|
||||
self._name = val
|
||||
name = _xml_property(_get_name, _set_name,
|
||||
name = XMLProperty(_get_name, _set_name,
|
||||
xpath="./@name")
|
||||
|
||||
def _get_policy(self):
|
||||
return self._policy
|
||||
def _set_policy(self, val):
|
||||
self._policy = val
|
||||
policy = _xml_property(_get_policy, _set_policy,
|
||||
policy = XMLProperty(_get_policy, _set_policy,
|
||||
xpath="./@policy")
|
||||
|
||||
def _get_xml_config(self):
|
||||
|
@ -70,7 +69,7 @@ class CPUFeature(XMLBuilderDomain.XMLBuilderDomain):
|
|||
return xml
|
||||
|
||||
|
||||
class CPU(XMLBuilderDomain.XMLBuilderDomain):
|
||||
class CPU(XMLBuilder):
|
||||
"""
|
||||
Class for generating <cpu> XML
|
||||
"""
|
||||
|
@ -90,13 +89,13 @@ class CPU(XMLBuilderDomain.XMLBuilderDomain):
|
|||
self._cores = None
|
||||
self._threads = None
|
||||
|
||||
XMLBuilderDomain.XMLBuilderDomain.__init__(self, conn, parsexml,
|
||||
XMLBuilder.__init__(self, conn, parsexml,
|
||||
parsexmlnode)
|
||||
if self._is_parse():
|
||||
return
|
||||
|
||||
def _parsexml(self, xml, node):
|
||||
XMLBuilderDomain.XMLBuilderDomain._parsexml(self, xml, node)
|
||||
XMLBuilder._parsexml(self, xml, node)
|
||||
|
||||
for node in self._xml_node.children:
|
||||
if node.name != "feature":
|
||||
|
@ -106,7 +105,7 @@ class CPU(XMLBuilderDomain.XMLBuilderDomain):
|
|||
|
||||
def _get_features(self):
|
||||
return self._features[:]
|
||||
features = _xml_property(_get_features)
|
||||
features = XMLProperty(_get_features)
|
||||
|
||||
def add_feature(self, name, policy="require"):
|
||||
feature = CPUFeature(self.conn)
|
||||
|
@ -138,28 +137,28 @@ class CPU(XMLBuilderDomain.XMLBuilderDomain):
|
|||
if val and not self.match:
|
||||
self.match = "exact"
|
||||
self._model = val
|
||||
model = _xml_property(_get_model, _set_model,
|
||||
model = XMLProperty(_get_model, _set_model,
|
||||
xpath="./cpu/model")
|
||||
|
||||
def _get_match(self):
|
||||
return self._match
|
||||
def _set_match(self, val):
|
||||
self._match = val
|
||||
match = _xml_property(_get_match, _set_match,
|
||||
match = XMLProperty(_get_match, _set_match,
|
||||
xpath="./cpu/@match")
|
||||
|
||||
def _get_vendor(self):
|
||||
return self._vendor
|
||||
def _set_vendor(self, val):
|
||||
self._vendor = val
|
||||
vendor = _xml_property(_get_vendor, _set_vendor,
|
||||
vendor = XMLProperty(_get_vendor, _set_vendor,
|
||||
xpath="./cpu/vendor")
|
||||
|
||||
def _get_mode(self):
|
||||
return self._mode
|
||||
def _set_mode(self, val):
|
||||
self._mode = val
|
||||
mode = _xml_property(_get_mode, _set_mode,
|
||||
mode = XMLProperty(_get_mode, _set_mode,
|
||||
xpath="./cpu/@mode")
|
||||
|
||||
# Topology properties
|
||||
|
@ -167,7 +166,7 @@ class CPU(XMLBuilderDomain.XMLBuilderDomain):
|
|||
return self._sockets
|
||||
def _set_sockets(self, val):
|
||||
self._sockets = _int_or_none(val)
|
||||
sockets = _xml_property(_get_sockets, _set_sockets,
|
||||
sockets = XMLProperty(_get_sockets, _set_sockets,
|
||||
get_converter=lambda s, x: _int_or_none(x),
|
||||
xpath="./cpu/topology/@sockets")
|
||||
|
||||
|
@ -175,7 +174,7 @@ class CPU(XMLBuilderDomain.XMLBuilderDomain):
|
|||
return self._cores
|
||||
def _set_cores(self, val):
|
||||
self._cores = _int_or_none(val)
|
||||
cores = _xml_property(_get_cores, _set_cores,
|
||||
cores = XMLProperty(_get_cores, _set_cores,
|
||||
get_converter=lambda s, x: _int_or_none(x),
|
||||
xpath="./cpu/topology/@cores")
|
||||
|
||||
|
@ -183,7 +182,7 @@ class CPU(XMLBuilderDomain.XMLBuilderDomain):
|
|||
return self._threads
|
||||
def _set_threads(self, val):
|
||||
self._threads = _int_or_none(val)
|
||||
threads = _xml_property(_get_threads, _set_threads,
|
||||
threads = XMLProperty(_get_threads, _set_threads,
|
||||
get_converter=lambda s, x: _int_or_none(x),
|
||||
xpath="./cpu/topology/@threads")
|
||||
|
||||
|
|
|
@ -17,18 +17,17 @@
|
|||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
# MA 02110-1301 USA.
|
||||
|
||||
from virtinst import XMLBuilderDomain
|
||||
from virtinst.XMLBuilderDomain import _xml_property
|
||||
from virtinst.xmlbuilder import XMLBuilder, XMLProperty
|
||||
|
||||
|
||||
class Clock(XMLBuilderDomain.XMLBuilderDomain):
|
||||
class Clock(XMLBuilder):
|
||||
"""
|
||||
Class for generating <clock> XML
|
||||
"""
|
||||
|
||||
_dumpxml_xpath = "/domain/clock"
|
||||
def __init__(self, conn, parsexml=None, parsexmlnode=None):
|
||||
XMLBuilderDomain.XMLBuilderDomain.__init__(self, conn, parsexml,
|
||||
XMLBuilder.__init__(self, conn, parsexml,
|
||||
parsexmlnode)
|
||||
|
||||
self._offset = None
|
||||
|
@ -37,7 +36,7 @@ class Clock(XMLBuilderDomain.XMLBuilderDomain):
|
|||
return self._offset
|
||||
def set_offset(self, val):
|
||||
self._offset = val
|
||||
offset = _xml_property(get_offset, set_offset,
|
||||
offset = XMLProperty(get_offset, set_offset,
|
||||
xpath="./clock/@offset")
|
||||
|
||||
def _get_xml_config(self):
|
||||
|
|
|
@ -17,8 +17,7 @@
|
|||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
# MA 02110-1301 USA.
|
||||
|
||||
from virtinst import XMLBuilderDomain
|
||||
from virtinst.XMLBuilderDomain import _xml_property
|
||||
from virtinst.xmlbuilder import XMLBuilder, XMLProperty
|
||||
|
||||
|
||||
def _none_or_bool(val):
|
||||
|
@ -27,14 +26,14 @@ def _none_or_bool(val):
|
|||
return bool(val)
|
||||
|
||||
|
||||
class DomainFeatures(XMLBuilderDomain.XMLBuilderDomain):
|
||||
class DomainFeatures(XMLBuilder):
|
||||
"""
|
||||
Class for generating <features> XML
|
||||
"""
|
||||
|
||||
_dumpxml_xpath = "/domain/features"
|
||||
def __init__(self, conn, parsexml=None, parsexmlnode=None):
|
||||
XMLBuilderDomain.XMLBuilderDomain.__init__(self, conn, parsexml,
|
||||
XMLBuilder.__init__(self, conn, parsexml,
|
||||
parsexmlnode)
|
||||
|
||||
self._acpi = None
|
||||
|
@ -45,21 +44,21 @@ class DomainFeatures(XMLBuilderDomain.XMLBuilderDomain):
|
|||
return self._acpi
|
||||
def set_acpi(self, val):
|
||||
self._acpi = _none_or_bool(val)
|
||||
acpi = _xml_property(get_acpi, set_acpi,
|
||||
acpi = XMLProperty(get_acpi, set_acpi,
|
||||
xpath="./features/acpi", is_bool=True)
|
||||
|
||||
def get_apic(self):
|
||||
return self._apic
|
||||
def set_apic(self, val):
|
||||
self._apic = _none_or_bool(val)
|
||||
apic = _xml_property(get_apic, set_apic,
|
||||
apic = XMLProperty(get_apic, set_apic,
|
||||
xpath="./features/apic", is_bool=True)
|
||||
|
||||
def get_pae(self):
|
||||
return self._pae
|
||||
def set_pae(self, val):
|
||||
self._pae = _none_or_bool(val)
|
||||
pae = _xml_property(get_pae, set_pae,
|
||||
pae = XMLProperty(get_pae, set_pae,
|
||||
xpath="./features/pae", is_bool=True)
|
||||
|
||||
def __setitem__(self, attr, val):
|
||||
|
|
|
@ -19,8 +19,7 @@
|
|||
|
||||
import re
|
||||
|
||||
from virtinst import XMLBuilderDomain
|
||||
from virtinst.XMLBuilderDomain import _xml_property
|
||||
from virtinst.xmlbuilder import XMLBuilder, XMLProperty
|
||||
|
||||
|
||||
def get_phy_cpus(conn):
|
||||
|
@ -32,7 +31,7 @@ def get_phy_cpus(conn):
|
|||
return pcpus
|
||||
|
||||
|
||||
class DomainNumatune(XMLBuilderDomain.XMLBuilderDomain):
|
||||
class DomainNumatune(XMLBuilder):
|
||||
"""
|
||||
Class for generating <numatune> XML
|
||||
"""
|
||||
|
@ -101,7 +100,7 @@ class DomainNumatune(XMLBuilderDomain.XMLBuilderDomain):
|
|||
self._memory_nodeset = None
|
||||
self._memory_mode = None
|
||||
|
||||
XMLBuilderDomain.XMLBuilderDomain.__init__(self, conn, parsexml,
|
||||
XMLBuilder.__init__(self, conn, parsexml,
|
||||
parsexmlnode)
|
||||
if self._is_parse():
|
||||
return
|
||||
|
@ -110,7 +109,7 @@ class DomainNumatune(XMLBuilderDomain.XMLBuilderDomain):
|
|||
return self._memory_nodeset
|
||||
def _set_memory_nodeset(self, val):
|
||||
self._memory_nodeset = val
|
||||
memory_nodeset = _xml_property(_get_memory_nodeset,
|
||||
memory_nodeset = XMLProperty(_get_memory_nodeset,
|
||||
_set_memory_nodeset,
|
||||
xpath="./numatune/memory/@nodeset")
|
||||
|
||||
|
@ -118,7 +117,7 @@ class DomainNumatune(XMLBuilderDomain.XMLBuilderDomain):
|
|||
return self._memory_mode
|
||||
def _set_memory_mode(self, val):
|
||||
self._memory_mode = val
|
||||
memory_mode = _xml_property(_get_memory_mode,
|
||||
memory_mode = XMLProperty(_get_memory_mode,
|
||||
_set_memory_mode,
|
||||
xpath="./numatune/memory/@mode")
|
||||
|
||||
|
|
|
@ -30,9 +30,8 @@ import libxml2
|
|||
|
||||
from virtinst import util
|
||||
from virtinst import support
|
||||
from virtinst import XMLBuilderDomain
|
||||
import virtinst
|
||||
from virtinst.XMLBuilderDomain import _xml_property
|
||||
from virtinst.xmlbuilder import XMLBuilder, XMLProperty
|
||||
from virtinst.VirtualDevice import VirtualDevice
|
||||
from virtinst.VirtualDisk import VirtualDisk
|
||||
from virtinst.VirtualInputDevice import VirtualInputDevice
|
||||
|
@ -47,7 +46,7 @@ from virtinst.DomainFeatures import DomainFeatures
|
|||
from virtinst import osdict
|
||||
|
||||
|
||||
class Guest(XMLBuilderDomain.XMLBuilderDomain):
|
||||
class Guest(XMLBuilder):
|
||||
|
||||
# OS Dictionary static variables and methods
|
||||
_DEFAULTS = osdict.DEFAULTS
|
||||
|
@ -207,7 +206,7 @@ class Guest(XMLBuilderDomain.XMLBuilderDomain):
|
|||
self._default_input_device = None
|
||||
self._default_console_device = None
|
||||
|
||||
XMLBuilderDomain.XMLBuilderDomain.__init__(self, conn, parsexml)
|
||||
XMLBuilder.__init__(self, conn, parsexml)
|
||||
if self._is_parse():
|
||||
return
|
||||
|
||||
|
@ -282,7 +281,7 @@ class Guest(XMLBuilderDomain.XMLBuilderDomain):
|
|||
raise ValueError(_("Guest name '%s' is already in use.") % val)
|
||||
|
||||
self._name = val
|
||||
name = _xml_property(get_name, set_name,
|
||||
name = XMLProperty(get_name, set_name,
|
||||
xpath="./name")
|
||||
|
||||
# Memory allocated to the guest. Should be given in MB
|
||||
|
@ -298,7 +297,7 @@ class Guest(XMLBuilderDomain.XMLBuilderDomain):
|
|||
self.maxmemory = val
|
||||
def _xml_memory_value(self):
|
||||
return int(self.memory) * 1024
|
||||
memory = _xml_property(get_memory, set_memory,
|
||||
memory = XMLProperty(get_memory, set_memory,
|
||||
xpath="./currentMemory",
|
||||
get_converter=lambda s, x: int(x) / 1024,
|
||||
set_converter=lambda s, x: int(x) * 1024)
|
||||
|
@ -313,7 +312,7 @@ class Guest(XMLBuilderDomain.XMLBuilderDomain):
|
|||
self._maxmemory = val
|
||||
def _xml_maxmemory_value(self):
|
||||
return int(self.maxmemory) * 1024
|
||||
maxmemory = _xml_property(get_maxmemory, set_maxmemory,
|
||||
maxmemory = XMLProperty(get_maxmemory, set_maxmemory,
|
||||
xpath="./memory",
|
||||
get_converter=lambda s, x: int(x) / 1024,
|
||||
set_converter=lambda s, x: int(x) * 1024)
|
||||
|
@ -323,7 +322,7 @@ class Guest(XMLBuilderDomain.XMLBuilderDomain):
|
|||
if val is None:
|
||||
return val
|
||||
self._hugepage = bool(val)
|
||||
hugepage = _xml_property(get_hugepage, set_hugepage,
|
||||
hugepage = XMLProperty(get_hugepage, set_hugepage,
|
||||
xpath="./memoryBacking/hugepages", is_bool=True)
|
||||
|
||||
# UUID for the guest
|
||||
|
@ -332,7 +331,7 @@ class Guest(XMLBuilderDomain.XMLBuilderDomain):
|
|||
def set_uuid(self, val):
|
||||
val = util.validate_uuid(val)
|
||||
self._uuid = val
|
||||
uuid = _xml_property(get_uuid, set_uuid,
|
||||
uuid = XMLProperty(get_uuid, set_uuid,
|
||||
xpath="./uuid")
|
||||
|
||||
def __validate_cpus(self, val):
|
||||
|
@ -356,7 +355,7 @@ class Guest(XMLBuilderDomain.XMLBuilderDomain):
|
|||
if not val:
|
||||
val = self.maxvcpus
|
||||
return int(val)
|
||||
vcpus = _xml_property(get_vcpus, set_vcpus,
|
||||
vcpus = XMLProperty(get_vcpus, set_vcpus,
|
||||
xpath="./vcpu/@current",
|
||||
get_converter=_vcpus_get_converter)
|
||||
|
||||
|
@ -365,7 +364,7 @@ class Guest(XMLBuilderDomain.XMLBuilderDomain):
|
|||
def _set_maxvcpus(self, val):
|
||||
val = self.__validate_cpus(val)
|
||||
self._maxvcpus = val
|
||||
maxvcpus = _xml_property(_get_maxvcpus, _set_maxvcpus,
|
||||
maxvcpus = XMLProperty(_get_maxvcpus, _set_maxvcpus,
|
||||
xpath="./vcpu",
|
||||
get_converter=lambda s, x: int(x))
|
||||
|
||||
|
@ -379,7 +378,7 @@ class Guest(XMLBuilderDomain.XMLBuilderDomain):
|
|||
|
||||
DomainNumatune.validate_cpuset(self.conn, val)
|
||||
self._cpuset = val
|
||||
cpuset = _xml_property(get_cpuset, set_cpuset,
|
||||
cpuset = XMLProperty(get_cpuset, set_cpuset,
|
||||
xpath="./vcpu/@cpuset")
|
||||
|
||||
# GAH! - installer.os_type = "hvm" or "xen" (aka xen paravirt)
|
||||
|
@ -457,14 +456,14 @@ class Guest(XMLBuilderDomain.XMLBuilderDomain):
|
|||
return self._description
|
||||
def _set_description(self, val):
|
||||
self._description = val
|
||||
description = _xml_property(_get_description, _set_description,
|
||||
description = XMLProperty(_get_description, _set_description,
|
||||
xpath="./description")
|
||||
|
||||
def _get_emulator(self):
|
||||
return self._emulator
|
||||
def _set_emulator(self, val):
|
||||
self._emulator = val
|
||||
emulator = _xml_property(_get_emulator, _set_emulator,
|
||||
emulator = XMLProperty(_get_emulator, _set_emulator,
|
||||
xpath="./devices/emulator")
|
||||
|
||||
def _get_replace(self):
|
||||
|
@ -634,7 +633,7 @@ class Guest(XMLBuilderDomain.XMLBuilderDomain):
|
|||
################################
|
||||
|
||||
def _parsexml(self, xml, node):
|
||||
XMLBuilderDomain.XMLBuilderDomain._parsexml(self, xml, node)
|
||||
XMLBuilder._parsexml(self, xml, node)
|
||||
|
||||
device_mappings = {
|
||||
"disk" : virtinst.VirtualDisk,
|
||||
|
|
|
@ -26,15 +26,14 @@ import copy
|
|||
|
||||
from virtinst import util
|
||||
import virtinst
|
||||
from virtinst import XMLBuilderDomain
|
||||
from virtinst.XMLBuilderDomain import _xml_property
|
||||
from virtinst.xmlbuilder import XMLBuilder, XMLProperty
|
||||
from virtinst.Boot import Boot
|
||||
|
||||
XEN_SCRATCH = "/var/lib/xen"
|
||||
LIBVIRT_SCRATCH = "/var/lib/libvirt/boot"
|
||||
|
||||
|
||||
class Installer(XMLBuilderDomain.XMLBuilderDomain):
|
||||
class Installer(XMLBuilder):
|
||||
"""
|
||||
Installer classes attempt to encapsulate all the parameters needed
|
||||
to 'install' a guest: essentially, booting the guest with the correct
|
||||
|
@ -68,7 +67,7 @@ class Installer(XMLBuilderDomain.XMLBuilderDomain):
|
|||
# pylint: disable=W0622
|
||||
# Redefining built-in 'type', but it matches the XML so keep it
|
||||
|
||||
XMLBuilderDomain.XMLBuilderDomain.__init__(self, conn, parsexml,
|
||||
XMLBuilder.__init__(self, conn, parsexml,
|
||||
parsexmlnode)
|
||||
|
||||
self._type = None
|
||||
|
@ -117,7 +116,7 @@ class Installer(XMLBuilderDomain.XMLBuilderDomain):
|
|||
return self._type
|
||||
def set_type(self, val):
|
||||
self._type = val
|
||||
type = _xml_property(get_type, set_type,
|
||||
type = XMLProperty(get_type, set_type,
|
||||
xpath="./@type")
|
||||
|
||||
# Virtualization type ('xen' == xen paravirt, or 'hvm)
|
||||
|
@ -131,7 +130,7 @@ class Installer(XMLBuilderDomain.XMLBuilderDomain):
|
|||
|
||||
# XXX: Need to validate this: have some whitelist based on caps?
|
||||
self._os_type = val
|
||||
os_type = _xml_property(get_os_type, set_os_type,
|
||||
os_type = XMLProperty(get_os_type, set_os_type,
|
||||
xpath="./os/type")
|
||||
|
||||
def get_arch(self):
|
||||
|
@ -140,28 +139,28 @@ class Installer(XMLBuilderDomain.XMLBuilderDomain):
|
|||
# XXX: Sanitize to a consisten value (i368 -> i686)
|
||||
# XXX: Validate against caps
|
||||
self._arch = val
|
||||
arch = _xml_property(get_arch, set_arch,
|
||||
arch = XMLProperty(get_arch, set_arch,
|
||||
xpath="./os/type/@arch")
|
||||
|
||||
def _get_machine(self):
|
||||
return self._machine
|
||||
def _set_machine(self, val):
|
||||
self._machine = val
|
||||
machine = _xml_property(_get_machine, _set_machine,
|
||||
machine = XMLProperty(_get_machine, _set_machine,
|
||||
xpath="./os/type/@machine")
|
||||
|
||||
def _get_loader(self):
|
||||
return self._loader
|
||||
def _set_loader(self, val):
|
||||
self._loader = val
|
||||
loader = _xml_property(_get_loader, _set_loader,
|
||||
loader = XMLProperty(_get_loader, _set_loader,
|
||||
xpath="./os/loader")
|
||||
|
||||
def _get_init(self):
|
||||
return self._init
|
||||
def _set_init(self, val):
|
||||
self._init = val
|
||||
init = _xml_property(_get_init, _set_init,
|
||||
init = XMLProperty(_get_init, _set_init,
|
||||
xpath="./os/init")
|
||||
|
||||
def get_scratchdir(self):
|
||||
|
|
|
@ -17,11 +17,10 @@
|
|||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
# MA 02110-1301 USA.
|
||||
|
||||
from virtinst import XMLBuilderDomain
|
||||
from virtinst.XMLBuilderDomain import _xml_property
|
||||
from virtinst.xmlbuilder import XMLBuilder, XMLProperty
|
||||
|
||||
|
||||
class Seclabel(XMLBuilderDomain.XMLBuilderDomain):
|
||||
class Seclabel(XMLBuilder):
|
||||
"""
|
||||
Class for generating <seclabel> XML
|
||||
"""
|
||||
|
@ -43,7 +42,7 @@ class Seclabel(XMLBuilderDomain.XMLBuilderDomain):
|
|||
|
||||
_dumpxml_xpath = "/domain/seclabel"
|
||||
def __init__(self, conn, parsexml=None, parsexmlnode=None):
|
||||
XMLBuilderDomain.XMLBuilderDomain.__init__(self, conn, parsexml,
|
||||
XMLBuilder.__init__(self, conn, parsexml,
|
||||
parsexmlnode)
|
||||
|
||||
self._type = None
|
||||
|
@ -100,14 +99,14 @@ class Seclabel(XMLBuilderDomain.XMLBuilderDomain):
|
|||
val != self.SECLABEL_TYPE_DEFAULT):
|
||||
raise ValueError("Unknown security type '%s'" % val)
|
||||
self._type = val
|
||||
type = _xml_property(get_type, set_type,
|
||||
type = XMLProperty(get_type, set_type,
|
||||
xpath="./seclabel/@type")
|
||||
|
||||
def get_model(self):
|
||||
return self._model
|
||||
def set_model(self, val):
|
||||
self._model = val
|
||||
model = _xml_property(get_model, set_model,
|
||||
model = XMLProperty(get_model, set_model,
|
||||
xpath="./seclabel/@model",
|
||||
default_converter=_get_default_model)
|
||||
|
||||
|
@ -115,21 +114,21 @@ class Seclabel(XMLBuilderDomain.XMLBuilderDomain):
|
|||
return self._label
|
||||
def set_label(self, val):
|
||||
self._label = val
|
||||
label = _xml_property(get_label, set_label,
|
||||
label = XMLProperty(get_label, set_label,
|
||||
xpath="./seclabel/label")
|
||||
|
||||
def _get_relabel(self):
|
||||
return self._relabel
|
||||
def _set_relabel(self, val):
|
||||
self._relabel = val
|
||||
relabel = _xml_property(_get_relabel, _set_relabel,
|
||||
relabel = XMLProperty(_get_relabel, _set_relabel,
|
||||
xpath="./seclabel/@relabel")
|
||||
|
||||
def get_imagelabel(self):
|
||||
return self._imagelabel
|
||||
def set_imagelabel(self, val):
|
||||
self._imagelabel = val
|
||||
imagelabel = _xml_property(get_imagelabel, set_imagelabel,
|
||||
imagelabel = XMLProperty(get_imagelabel, set_imagelabel,
|
||||
xpath="./seclabel/imagelabel")
|
||||
|
||||
def _get_xml_config(self):
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# MA 02110-1301 USA.
|
||||
|
||||
from virtinst.VirtualDevice import VirtualDevice
|
||||
from virtinst.XMLBuilderDomain import _xml_property
|
||||
from virtinst.xmlbuilder import XMLProperty
|
||||
|
||||
|
||||
class VirtualAudio(VirtualDevice):
|
||||
|
@ -48,7 +48,7 @@ class VirtualAudio(VirtualDevice):
|
|||
if not self.MODELS.count(new_model):
|
||||
raise ValueError(_("Unsupported sound model '%s'" % new_model))
|
||||
self._model = new_model
|
||||
model = _xml_property(get_model, set_model,
|
||||
model = XMLProperty(get_model, set_model,
|
||||
xpath="./@model")
|
||||
|
||||
def _get_xml_config(self):
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
from virtinst.VirtualDevice import VirtualDevice
|
||||
from virtinst.util import xml_escape
|
||||
|
||||
from virtinst.XMLBuilderDomain import _xml_property
|
||||
from virtinst.xmlbuilder import XMLProperty
|
||||
|
||||
|
||||
class VirtualCharDevice(VirtualDevice):
|
||||
|
@ -249,7 +249,7 @@ class VirtualCharDevice(VirtualDevice):
|
|||
raise ValueError(_("Unknown character device type '%s'")
|
||||
% val)
|
||||
self._char_type = val
|
||||
char_type = _xml_property(get_char_type, set_char_type,
|
||||
char_type = XMLProperty(get_char_type, set_char_type,
|
||||
doc=_("Method used to expose character device in the host."),
|
||||
xpath="./@type")
|
||||
|
||||
|
@ -260,7 +260,7 @@ class VirtualCharDevice(VirtualDevice):
|
|||
self._source_path = val
|
||||
def _sourcepath_get_xpath(self):
|
||||
return "./source/@path | ./@tty"
|
||||
source_path = _xml_property(get_source_path, set_source_path,
|
||||
source_path = XMLProperty(get_source_path, set_source_path,
|
||||
xml_get_xpath=_sourcepath_get_xpath,
|
||||
xpath="./source/@path")
|
||||
|
||||
|
@ -274,7 +274,7 @@ class VirtualCharDevice(VirtualDevice):
|
|||
if self.char_type == self.CHAR_UDP:
|
||||
return "./source[@mode='connect']/@mode"
|
||||
return "./source/@mode"
|
||||
source_mode = _xml_property(get_source_mode, set_source_mode,
|
||||
source_mode = XMLProperty(get_source_mode, set_source_mode,
|
||||
xml_get_xpath=_sourcemode_xpath,
|
||||
xml_set_xpath=_sourcemode_xpath)
|
||||
|
||||
|
@ -284,7 +284,7 @@ class VirtualCharDevice(VirtualDevice):
|
|||
self._source_host = val
|
||||
def _sourcehost_xpath(self):
|
||||
return "./source[@mode='%s']/@host" % self.source_mode
|
||||
source_host = _xml_property(get_source_host, set_source_host,
|
||||
source_host = XMLProperty(get_source_host, set_source_host,
|
||||
xml_get_xpath=_sourcehost_xpath,
|
||||
xml_set_xpath=_sourcehost_xpath)
|
||||
|
||||
|
@ -294,7 +294,7 @@ class VirtualCharDevice(VirtualDevice):
|
|||
self._source_port = int(val)
|
||||
def _sourceport_xpath(self):
|
||||
return "./source[@mode='%s']/@service" % self.source_mode
|
||||
source_port = _xml_property(get_source_port, set_source_port,
|
||||
source_port = XMLProperty(get_source_port, set_source_port,
|
||||
xml_get_xpath=_sourceport_xpath,
|
||||
xml_set_xpath=_sourceport_xpath)
|
||||
|
||||
|
@ -302,14 +302,14 @@ class VirtualCharDevice(VirtualDevice):
|
|||
return self._bind_host
|
||||
def set_bind_host(self, val):
|
||||
self._bind_host = val
|
||||
bind_host = _xml_property(get_bind_host, set_bind_host,
|
||||
bind_host = XMLProperty(get_bind_host, set_bind_host,
|
||||
xpath="./source[@mode='bind']/@host")
|
||||
|
||||
def get_bind_port(self):
|
||||
return self._bind_port
|
||||
def set_bind_port(self, val):
|
||||
self._bind_port = int(val)
|
||||
bind_port = _xml_property(get_bind_port, set_bind_port,
|
||||
bind_port = XMLProperty(get_bind_port, set_bind_port,
|
||||
xpath="./source[@mode='bind']/@service")
|
||||
|
||||
def get_protocol(self):
|
||||
|
@ -318,7 +318,7 @@ class VirtualCharDevice(VirtualDevice):
|
|||
if val not in self.char_protocols:
|
||||
raise ValueError(_("Unknown protocol '%s'.") % val)
|
||||
self._protocol = val
|
||||
protocol = _xml_property(get_protocol, set_protocol,
|
||||
protocol = XMLProperty(get_protocol, set_protocol,
|
||||
xpath="./protocol/@type")
|
||||
|
||||
# GuestFWD target properties
|
||||
|
@ -329,7 +329,7 @@ class VirtualCharDevice(VirtualDevice):
|
|||
raise ValueError(_("Unknown target type '%s'. Must be in: ") % val,
|
||||
self.target_types)
|
||||
self._target_type = val
|
||||
target_type = _xml_property(get_target_type, set_target_type,
|
||||
target_type = XMLProperty(get_target_type, set_target_type,
|
||||
doc=_("Channel type as exposed in the guest."),
|
||||
xpath="./target/@type")
|
||||
|
||||
|
@ -337,7 +337,7 @@ class VirtualCharDevice(VirtualDevice):
|
|||
self._target_address = val
|
||||
def get_target_address(self):
|
||||
return self._target_address
|
||||
target_address = _xml_property(get_target_address, set_target_address,
|
||||
target_address = XMLProperty(get_target_address, set_target_address,
|
||||
doc=_("Guest forward channel address in the guest."),
|
||||
xpath="./target/@address")
|
||||
|
||||
|
@ -345,7 +345,7 @@ class VirtualCharDevice(VirtualDevice):
|
|||
self._target_port = val
|
||||
def get_target_port(self):
|
||||
return self._target_port
|
||||
target_port = _xml_property(get_target_port, set_target_port,
|
||||
target_port = XMLProperty(get_target_port, set_target_port,
|
||||
doc=_("Guest forward channel port in the guest."),
|
||||
xpath="./target/@port")
|
||||
|
||||
|
@ -353,7 +353,7 @@ class VirtualCharDevice(VirtualDevice):
|
|||
self._target_name = val
|
||||
def get_target_name(self):
|
||||
return self._target_name
|
||||
target_name = _xml_property(get_target_name, set_target_name,
|
||||
target_name = XMLProperty(get_target_name, set_target_name,
|
||||
doc=_("Sysfs name of virtio port in the guest"),
|
||||
xpath="./target/@name")
|
||||
|
||||
|
@ -364,7 +364,7 @@ class VirtualCharDevice(VirtualDevice):
|
|||
raise ValueError(_("Unknown address type '%s'. Must be in: ") % val,
|
||||
self.address_types)
|
||||
self._address_type = val
|
||||
address_type = _xml_property(get_address_type, set_address_type,
|
||||
address_type = XMLProperty(get_address_type, set_address_type,
|
||||
doc=_("Channel type as exposed in the guest."),
|
||||
xpath="./address/@type")
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# MA 02110-1301 USA.
|
||||
|
||||
from virtinst.VirtualDevice import VirtualDevice
|
||||
from virtinst.XMLBuilderDomain import XMLBuilderDomain, _xml_property
|
||||
from virtinst.xmlbuilder import XMLBuilder, XMLProperty
|
||||
import logging
|
||||
|
||||
|
||||
|
@ -94,35 +94,35 @@ class VirtualController(VirtualDevice):
|
|||
|
||||
def get_type(self):
|
||||
return self._controller_type
|
||||
type = _xml_property(get_type,
|
||||
type = XMLProperty(get_type,
|
||||
xpath="./@type")
|
||||
|
||||
def get_model(self):
|
||||
return self._model
|
||||
def set_model(self, model):
|
||||
self._model = model
|
||||
model = _xml_property(get_model, set_model,
|
||||
model = XMLProperty(get_model, set_model,
|
||||
xpath="./@model")
|
||||
|
||||
def get_index(self):
|
||||
return self._index
|
||||
def set_index(self, val):
|
||||
self._index = int(val)
|
||||
index = _xml_property(get_index, set_index,
|
||||
index = XMLProperty(get_index, set_index,
|
||||
xpath="./@index")
|
||||
|
||||
def get_vectors(self):
|
||||
return self._vectors
|
||||
def set_vectors(self, val):
|
||||
self._vectors = val
|
||||
vectors = _xml_property(get_vectors, set_vectors,
|
||||
vectors = XMLProperty(get_vectors, set_vectors,
|
||||
xpath="./@vectors")
|
||||
|
||||
def get_ports(self):
|
||||
return self._ports
|
||||
def set_ports(self, val):
|
||||
self._ports = val
|
||||
ports = _xml_property(get_ports, set_ports,
|
||||
ports = XMLProperty(get_ports, set_ports,
|
||||
xpath="./@ports")
|
||||
|
||||
def set_master(self, masterstr):
|
||||
|
@ -183,9 +183,9 @@ class VirtualControllerUSB(VirtualController):
|
|||
_controller_type = VirtualController.CONTROLLER_TYPE_USB
|
||||
|
||||
|
||||
class VirtualDeviceMaster(XMLBuilderDomain):
|
||||
class VirtualDeviceMaster(XMLBuilder):
|
||||
def __init__(self, conn, parsexml=None, parsexmlnode=None):
|
||||
XMLBuilderDomain.__init__(self, conn, parsexml, parsexmlnode)
|
||||
XMLBuilder.__init__(self, conn, parsexml, parsexmlnode)
|
||||
|
||||
self._startport = None
|
||||
|
||||
|
@ -201,7 +201,7 @@ class VirtualDeviceMaster(XMLBuilderDomain):
|
|||
return self._startport
|
||||
def _set_startport(self, val):
|
||||
self._startport = val
|
||||
startport = _xml_property(_get_startport, _set_startport, xpath="./master/@startport")
|
||||
startport = XMLProperty(_get_startport, _set_startport, xpath="./master/@startport")
|
||||
|
||||
def _get_xml_config(self):
|
||||
if self.startport is None:
|
||||
|
|
|
@ -19,11 +19,11 @@
|
|||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
# MA 02110-1301 USA.
|
||||
|
||||
from virtinst.XMLBuilderDomain import XMLBuilderDomain, _xml_property
|
||||
from virtinst.xmlbuilder import XMLBuilder, XMLProperty
|
||||
import logging
|
||||
|
||||
|
||||
class VirtualDevice(XMLBuilderDomain):
|
||||
class VirtualDevice(XMLBuilder):
|
||||
"""
|
||||
Base class for all domain xml device objects.
|
||||
"""
|
||||
|
@ -77,7 +77,7 @@ class VirtualDevice(XMLBuilderDomain):
|
|||
|
||||
@param conn: libvirt connection to validate device against
|
||||
"""
|
||||
XMLBuilderDomain.__init__(self, conn, parsexml, parsexmlnode)
|
||||
XMLBuilder.__init__(self, conn, parsexml, parsexmlnode)
|
||||
|
||||
self.alias = VirtualDeviceAlias(conn,
|
||||
parsexml=parsexml,
|
||||
|
@ -99,7 +99,7 @@ class VirtualDevice(XMLBuilderDomain):
|
|||
virtual_device_type = property(get_virtual_device_type)
|
||||
|
||||
def _get_xml_config(self):
|
||||
# See XMLBuilderDomain for docs
|
||||
# See XMLBuilder for docs
|
||||
raise NotImplementedError()
|
||||
|
||||
def setup(self, meter=None):
|
||||
|
@ -117,9 +117,9 @@ class VirtualDevice(XMLBuilderDomain):
|
|||
self.address = VirtualDeviceAddress(self.conn, addrstr=addrstr)
|
||||
|
||||
|
||||
class VirtualDeviceAlias(XMLBuilderDomain):
|
||||
class VirtualDeviceAlias(XMLBuilder):
|
||||
def __init__(self, conn, parsexml=None, parsexmlnode=None):
|
||||
XMLBuilderDomain.__init__(self, conn, parsexml, parsexmlnode)
|
||||
XMLBuilder.__init__(self, conn, parsexml, parsexmlnode)
|
||||
|
||||
self._name = None
|
||||
|
||||
|
@ -128,13 +128,13 @@ class VirtualDeviceAlias(XMLBuilderDomain):
|
|||
return self._name
|
||||
def _set_name(self, val):
|
||||
self._name = val
|
||||
name = _xml_property(_get_name, _set_name, xpath="./alias/@name")
|
||||
name = XMLProperty(_get_name, _set_name, xpath="./alias/@name")
|
||||
|
||||
def _get_xml_config(self):
|
||||
return ""
|
||||
|
||||
|
||||
class VirtualDeviceAddress(XMLBuilderDomain):
|
||||
class VirtualDeviceAddress(XMLBuilder):
|
||||
|
||||
ADDRESS_TYPE_PCI = "pci"
|
||||
ADDRESS_TYPE_DRIVE = "drive"
|
||||
|
@ -148,7 +148,7 @@ class VirtualDeviceAddress(XMLBuilderDomain):
|
|||
|
||||
def __init__(self, conn, parsexml=None, parsexmlnode=None,
|
||||
addrstr=None):
|
||||
XMLBuilderDomain.__init__(self, conn, parsexml, parsexmlnode)
|
||||
XMLBuilder.__init__(self, conn, parsexml, parsexmlnode)
|
||||
|
||||
self._type = None
|
||||
|
||||
|
@ -210,51 +210,51 @@ class VirtualDeviceAddress(XMLBuilderDomain):
|
|||
return self._type
|
||||
def _set_type(self, val):
|
||||
self._type = val
|
||||
type = _xml_property(_get_type, _set_type, xpath="./address/@type")
|
||||
type = XMLProperty(_get_type, _set_type, xpath="./address/@type")
|
||||
|
||||
def _get_domain(self):
|
||||
return self._domain
|
||||
def _set_domain(self, val):
|
||||
self._domain = val
|
||||
domain = _xml_property(_get_domain, _set_domain, xpath="./address/@domain")
|
||||
domain = XMLProperty(_get_domain, _set_domain, xpath="./address/@domain")
|
||||
|
||||
def _get_bus(self):
|
||||
return self._bus
|
||||
def _set_bus(self, val):
|
||||
self._bus = val
|
||||
bus = _xml_property(_get_bus, _set_bus, xpath="./address/@bus")
|
||||
bus = XMLProperty(_get_bus, _set_bus, xpath="./address/@bus")
|
||||
|
||||
def _get_slot(self):
|
||||
return self._slot
|
||||
def _set_slot(self, val):
|
||||
self._slot = val
|
||||
slot = _xml_property(_get_slot, _set_slot, xpath="./address/@slot")
|
||||
slot = XMLProperty(_get_slot, _set_slot, xpath="./address/@slot")
|
||||
|
||||
def _get_function(self):
|
||||
return self._function
|
||||
def _set_function(self, val):
|
||||
self._function = val
|
||||
function = _xml_property(_get_function, _set_function,
|
||||
function = XMLProperty(_get_function, _set_function,
|
||||
xpath="./address/@function")
|
||||
|
||||
def _get_controller(self):
|
||||
return self._controller
|
||||
def _set_controller(self, val):
|
||||
self._controller = val
|
||||
controller = _xml_property(_get_controller, _set_controller,
|
||||
controller = XMLProperty(_get_controller, _set_controller,
|
||||
xpath="./address/@controller")
|
||||
|
||||
def _get_unit(self):
|
||||
return self._unit
|
||||
def _set_unit(self, val):
|
||||
self._unit = val
|
||||
unit = _xml_property(_get_unit, _set_unit, xpath="./address/@unit")
|
||||
unit = XMLProperty(_get_unit, _set_unit, xpath="./address/@unit")
|
||||
|
||||
def _get_port(self):
|
||||
return self._port
|
||||
def _set_port(self, val):
|
||||
self._port = val
|
||||
port = _xml_property(_get_port, _set_port, xpath="./address/@port")
|
||||
port = XMLProperty(_get_port, _set_port, xpath="./address/@port")
|
||||
|
||||
def _get_xml_config(self):
|
||||
if not self.type:
|
||||
|
|
|
@ -32,7 +32,7 @@ import virtinst
|
|||
from virtinst import diskbackend
|
||||
from virtinst import util
|
||||
from virtinst.VirtualDevice import VirtualDevice
|
||||
from virtinst.XMLBuilderDomain import _xml_property
|
||||
from virtinst.xmlbuilder import XMLProperty
|
||||
|
||||
|
||||
def _qemu_sanitize_drvtype(phystype, fmt, manual_format=False):
|
||||
|
@ -484,7 +484,7 @@ class VirtualDisk(VirtualDevice):
|
|||
return ret
|
||||
def _xml_set_xpath(self):
|
||||
return "./source/@" + self.disk_type_to_target_prop(self.type)
|
||||
path = _xml_property(_get_path, _set_path,
|
||||
path = XMLProperty(_get_path, _set_path,
|
||||
xml_get_xpath=_xml_get_xpath,
|
||||
xml_set_xpath=_xml_set_xpath,
|
||||
clear_first=["./source/@" + target for target in
|
||||
|
@ -522,7 +522,7 @@ class VirtualDisk(VirtualDevice):
|
|||
def set_type(self, val):
|
||||
if self._override_default:
|
||||
self._type = val
|
||||
type = _xml_property(get_type, set_type,
|
||||
type = XMLProperty(get_type, set_type,
|
||||
xpath="./@type")
|
||||
|
||||
def get_device(self):
|
||||
|
@ -535,7 +535,7 @@ class VirtualDisk(VirtualDevice):
|
|||
self.bus = None
|
||||
self.target = None
|
||||
self._device = val
|
||||
device = _xml_property(get_device, set_device,
|
||||
device = XMLProperty(get_device, set_device,
|
||||
xpath="./@device")
|
||||
|
||||
def get_driver_name(self):
|
||||
|
@ -545,7 +545,7 @@ class VirtualDisk(VirtualDevice):
|
|||
def set_driver_name(self, val):
|
||||
if self._override_default:
|
||||
self._driverName = val
|
||||
driver_name = _xml_property(get_driver_name, set_driver_name,
|
||||
driver_name = XMLProperty(get_driver_name, set_driver_name,
|
||||
xpath="./driver/@name")
|
||||
|
||||
def get_driver_type(self):
|
||||
|
@ -555,41 +555,41 @@ class VirtualDisk(VirtualDevice):
|
|||
def set_driver_type(self, val):
|
||||
if self._override_default:
|
||||
self._driverType = val
|
||||
driver_type = _xml_property(get_driver_type, set_driver_type,
|
||||
driver_type = XMLProperty(get_driver_type, set_driver_type,
|
||||
xpath="./driver/@type")
|
||||
|
||||
def get_read_only(self):
|
||||
return self._readOnly
|
||||
def set_read_only(self, val):
|
||||
self._readOnly = val
|
||||
read_only = _xml_property(get_read_only, set_read_only,
|
||||
read_only = XMLProperty(get_read_only, set_read_only,
|
||||
xpath="./readonly", is_bool=True)
|
||||
|
||||
def _get_bus(self):
|
||||
return self._bus
|
||||
def _set_bus(self, val):
|
||||
self._bus = val
|
||||
bus = _xml_property(_get_bus, _set_bus,
|
||||
bus = XMLProperty(_get_bus, _set_bus,
|
||||
xpath="./target/@bus")
|
||||
def _get_target(self):
|
||||
return self._target
|
||||
def _set_target(self, val):
|
||||
self._target = val
|
||||
target = _xml_property(_get_target, _set_target,
|
||||
target = XMLProperty(_get_target, _set_target,
|
||||
xpath="./target/@dev")
|
||||
|
||||
def _get_shareable(self):
|
||||
return self._shareable
|
||||
def _set_shareable(self, val):
|
||||
self._shareable = val
|
||||
shareable = _xml_property(_get_shareable, _set_shareable,
|
||||
shareable = XMLProperty(_get_shareable, _set_shareable,
|
||||
xpath="./shareable", is_bool=True)
|
||||
|
||||
def _get_driver_cache(self):
|
||||
return self._driver_cache
|
||||
def _set_driver_cache(self, val):
|
||||
self._driver_cache = val
|
||||
driver_cache = _xml_property(_get_driver_cache, _set_driver_cache,
|
||||
driver_cache = XMLProperty(_get_driver_cache, _set_driver_cache,
|
||||
xpath="./driver/@cache")
|
||||
|
||||
|
||||
|
@ -597,28 +597,28 @@ class VirtualDisk(VirtualDevice):
|
|||
return self._driver_io
|
||||
def _set_driver_io(self, val):
|
||||
self._driver_io = val
|
||||
driver_io = _xml_property(_get_driver_io, _set_driver_io,
|
||||
driver_io = XMLProperty(_get_driver_io, _set_driver_io,
|
||||
xpath="./driver/@io")
|
||||
|
||||
error_policy = _xml_property(xpath="./driver/@error_policy")
|
||||
serial = _xml_property(xpath="./serial")
|
||||
error_policy = XMLProperty(xpath="./driver/@error_policy")
|
||||
serial = XMLProperty(xpath="./serial")
|
||||
|
||||
iotune_rbs = _xml_property(xpath="./iotune/read_bytes_sec",
|
||||
iotune_rbs = XMLProperty(xpath="./iotune/read_bytes_sec",
|
||||
get_converter=lambda s, x: int(x or 0),
|
||||
set_converter=lambda s, x: int(x))
|
||||
iotune_ris = _xml_property(xpath="./iotune/read_iops_sec",
|
||||
iotune_ris = XMLProperty(xpath="./iotune/read_iops_sec",
|
||||
get_converter=lambda s, x: int(x or 0),
|
||||
set_converter=lambda s, x: int(x))
|
||||
iotune_tbs = _xml_property(xpath="./iotune/total_bytes_sec",
|
||||
iotune_tbs = XMLProperty(xpath="./iotune/total_bytes_sec",
|
||||
get_converter=lambda s, x: int(x or 0),
|
||||
set_converter=lambda s, x: int(x))
|
||||
iotune_tis = _xml_property(xpath="./iotune/total_iops_sec",
|
||||
iotune_tis = XMLProperty(xpath="./iotune/total_iops_sec",
|
||||
get_converter=lambda s, x: int(x or 0),
|
||||
set_converter=lambda s, x: int(x))
|
||||
iotune_wbs = _xml_property(xpath="./iotune/write_bytes_sec",
|
||||
iotune_wbs = XMLProperty(xpath="./iotune/write_bytes_sec",
|
||||
get_converter=lambda s, x: int(x or 0),
|
||||
set_converter=lambda s, x: int(x))
|
||||
iotune_wis = _xml_property(xpath="./iotune/write_iops_sec",
|
||||
iotune_wis = XMLProperty(xpath="./iotune/write_iops_sec",
|
||||
get_converter=lambda s, x: int(x or 0),
|
||||
set_converter=lambda s, x: int(x))
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
import os
|
||||
|
||||
from virtinst.VirtualDevice import VirtualDevice
|
||||
from virtinst.XMLBuilderDomain import _xml_property
|
||||
from virtinst.xmlbuilder import XMLProperty
|
||||
|
||||
|
||||
class VirtualFilesystem(VirtualDevice):
|
||||
|
@ -95,7 +95,7 @@ class VirtualFilesystem(VirtualDevice):
|
|||
if val is not None and not self.TYPES.count(val):
|
||||
raise ValueError(_("Unsupported filesystem type '%s'" % val))
|
||||
self._type = val
|
||||
type = _xml_property(_get_type, _set_type, xpath="./@type")
|
||||
type = XMLProperty(_get_type, _set_type, xpath="./@type")
|
||||
|
||||
def _get_mode(self):
|
||||
return self._mode
|
||||
|
@ -103,7 +103,7 @@ class VirtualFilesystem(VirtualDevice):
|
|||
if val is not None and not self.MOUNT_MODES.count(val):
|
||||
raise ValueError(_("Unsupported filesystem mode '%s'" % val))
|
||||
self._mode = val
|
||||
mode = _xml_property(_get_mode, _set_mode, xpath="./@accessmode")
|
||||
mode = XMLProperty(_get_mode, _set_mode, xpath="./@accessmode")
|
||||
|
||||
def _get_wrpolicy(self):
|
||||
return self._wrpolicy
|
||||
|
@ -111,13 +111,13 @@ class VirtualFilesystem(VirtualDevice):
|
|||
if val is not None and not self.WRPOLICIES.count(val):
|
||||
raise ValueError(_("Unsupported filesystem write policy '%s'" % val))
|
||||
self._wrpolicy = val
|
||||
wrpolicy = _xml_property(_get_wrpolicy, _set_wrpolicy, xpath="./driver/@wrpolicy")
|
||||
wrpolicy = XMLProperty(_get_wrpolicy, _set_wrpolicy, xpath="./driver/@wrpolicy")
|
||||
|
||||
def _get_readonly(self):
|
||||
return self._readonly
|
||||
def _set_readonly(self, val):
|
||||
self._readonly = val
|
||||
readonly = _xml_property(_get_readonly, _set_readonly,
|
||||
readonly = XMLProperty(_get_readonly, _set_readonly,
|
||||
xpath="./readonly", is_bool=True)
|
||||
|
||||
def _get_driver(self):
|
||||
|
@ -126,7 +126,7 @@ class VirtualFilesystem(VirtualDevice):
|
|||
if val is not None and not self.DRIVER_TYPES.count(val):
|
||||
raise ValueError(_("Unsupported filesystem driver '%s'" % val))
|
||||
self._driver = val
|
||||
driver = _xml_property(_get_driver, _set_driver, xpath="./driver/@type")
|
||||
driver = XMLProperty(_get_driver, _set_driver, xpath="./driver/@type")
|
||||
|
||||
def _get_source(self):
|
||||
return self._source
|
||||
|
@ -146,7 +146,7 @@ class VirtualFilesystem(VirtualDevice):
|
|||
def _xml_set_source_xpath(self):
|
||||
ret = "./source/@" + self.type_to_source_prop(self.type)
|
||||
return ret
|
||||
source = _xml_property(_get_source, _set_source,
|
||||
source = XMLProperty(_get_source, _set_source,
|
||||
xml_get_xpath=_xml_get_source_xpath,
|
||||
xml_set_xpath=_xml_set_source_xpath)
|
||||
|
||||
|
@ -164,7 +164,7 @@ class VirtualFilesystem(VirtualDevice):
|
|||
raise ValueError(_("Filesystem target '%s' must be an absolute "
|
||||
"path") % val)
|
||||
self._target = val
|
||||
target = _xml_property(_get_target, _set_target, xpath="./target/@dir")
|
||||
target = XMLProperty(_get_target, _set_target, xpath="./target/@dir")
|
||||
|
||||
|
||||
def _get_xml_config(self):
|
||||
|
|
|
@ -21,7 +21,7 @@ import re
|
|||
import os
|
||||
|
||||
from virtinst.VirtualDevice import VirtualDevice
|
||||
from virtinst.XMLBuilderDomain import _xml_property
|
||||
from virtinst.xmlbuilder import XMLProperty
|
||||
|
||||
|
||||
def _get_mode_prop(channel_type):
|
||||
|
@ -31,7 +31,7 @@ def _get_mode_prop(channel_type):
|
|||
return s._channels.get(channel_type, None)
|
||||
def set_mode(s, val):
|
||||
s._channels[channel_type] = val
|
||||
return _xml_property(get_mode, set_mode, xpath=xpath)
|
||||
return XMLProperty(get_mode, set_mode, xpath=xpath)
|
||||
|
||||
|
||||
class VirtualGraphics(VirtualDevice):
|
||||
|
@ -147,21 +147,21 @@ class VirtualGraphics(VirtualDevice):
|
|||
raise ValueError(_("Unknown graphics type '%s'") % val)
|
||||
|
||||
self._type = val
|
||||
type = _xml_property(get_type, set_type,
|
||||
type = XMLProperty(get_type, set_type,
|
||||
xpath="./@type")
|
||||
|
||||
def _get_xauth(self):
|
||||
return self._xauth
|
||||
def _set_xauth(self, val):
|
||||
self._xauth = val
|
||||
xauth = _xml_property(_get_xauth, _set_xauth,
|
||||
xauth = XMLProperty(_get_xauth, _set_xauth,
|
||||
xpath="./@xauth")
|
||||
|
||||
def _get_display(self):
|
||||
return self._display
|
||||
def _set_display(self, val):
|
||||
self._display = val
|
||||
display = _xml_property(_get_display, _set_display,
|
||||
display = XMLProperty(_get_display, _set_display,
|
||||
xpath="./@display")
|
||||
|
||||
def get_keymap(self):
|
||||
|
@ -191,7 +191,7 @@ class VirtualGraphics(VirtualDevice):
|
|||
"'_', or '-' characters"))
|
||||
|
||||
self._keymap = val
|
||||
keymap = _xml_property(get_keymap, set_keymap,
|
||||
keymap = XMLProperty(get_keymap, set_keymap,
|
||||
xpath="./@keymap")
|
||||
|
||||
def get_port(self):
|
||||
|
@ -210,7 +210,7 @@ class VirtualGraphics(VirtualDevice):
|
|||
raise ValueError(_("VNC port must be a number between "
|
||||
"5900 and 65535, or -1 for auto allocation"))
|
||||
self._port = val
|
||||
port = _xml_property(get_port, set_port,
|
||||
port = XMLProperty(get_port, set_port,
|
||||
get_converter=lambda s, x: int(x or -1),
|
||||
xpath="./@port")
|
||||
|
||||
|
@ -218,28 +218,28 @@ class VirtualGraphics(VirtualDevice):
|
|||
return self._listen
|
||||
def set_listen(self, val):
|
||||
self._listen = val
|
||||
listen = _xml_property(get_listen, set_listen,
|
||||
listen = XMLProperty(get_listen, set_listen,
|
||||
xpath="./@listen")
|
||||
|
||||
def get_passwd(self):
|
||||
return self._passwd
|
||||
def set_passwd(self, val):
|
||||
self._passwd = val
|
||||
passwd = _xml_property(get_passwd, set_passwd,
|
||||
passwd = XMLProperty(get_passwd, set_passwd,
|
||||
xpath="./@passwd")
|
||||
|
||||
def get_passwdValidTo(self):
|
||||
return self._passwdValidTo
|
||||
def set_passwdValidTo(self, val):
|
||||
self._passwdValidTo = val
|
||||
passwdValidTo = _xml_property(get_passwdValidTo, set_passwdValidTo,
|
||||
passwdValidTo = XMLProperty(get_passwdValidTo, set_passwdValidTo,
|
||||
xpath="./@passwdValidTo")
|
||||
|
||||
def _get_socket(self):
|
||||
return self._socket
|
||||
def _set_socket(self, val):
|
||||
self._socket = val
|
||||
socket = _xml_property(_get_socket, _set_socket,
|
||||
socket = XMLProperty(_get_socket, _set_socket,
|
||||
xpath="./@socket")
|
||||
|
||||
def get_tlsPort(self):
|
||||
|
@ -258,7 +258,7 @@ class VirtualGraphics(VirtualDevice):
|
|||
raise ValueError(_("TLS port must be a number between "
|
||||
"5900 and 65535, or -1 for auto allocation"))
|
||||
self._tlsPort = val
|
||||
tlsPort = _xml_property(get_tlsPort, set_tlsPort,
|
||||
tlsPort = XMLProperty(get_tlsPort, set_tlsPort,
|
||||
get_converter=lambda s, x: int(x or -1),
|
||||
xpath="./@tlsPort")
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ from virtinst.VirtualDevice import VirtualDevice
|
|||
from virtinst import NodeDeviceParser
|
||||
import logging
|
||||
|
||||
from virtinst.XMLBuilderDomain import _xml_property
|
||||
from virtinst.xmlbuilder import XMLProperty
|
||||
|
||||
|
||||
class VirtualHostDevice(VirtualDevice):
|
||||
|
@ -105,21 +105,21 @@ class VirtualHostDevice(VirtualDevice):
|
|||
return self._mode
|
||||
def set_mode(self, val):
|
||||
self._mode = val
|
||||
mode = _xml_property(get_mode, set_mode,
|
||||
mode = XMLProperty(get_mode, set_mode,
|
||||
xpath="./@mode")
|
||||
|
||||
def get_type(self):
|
||||
return self._type
|
||||
def set_type(self, val):
|
||||
self._type = val
|
||||
type = _xml_property(get_type, set_type,
|
||||
type = XMLProperty(get_type, set_type,
|
||||
xpath="./@type")
|
||||
|
||||
def get_managed(self):
|
||||
return self._managed
|
||||
def set_managed(self, val):
|
||||
self._managed = bool(val)
|
||||
managed = _xml_property(get_managed, set_managed,
|
||||
managed = XMLProperty(get_managed, set_managed,
|
||||
get_converter=lambda s, x: bool(x == "yes"),
|
||||
set_converter=lambda s, x: x and "yes" or "no",
|
||||
xpath="./@managed")
|
||||
|
@ -128,49 +128,49 @@ class VirtualHostDevice(VirtualDevice):
|
|||
return self._vendor
|
||||
def set_vendor(self, val):
|
||||
self._vendor = val
|
||||
vendor = _xml_property(get_vendor, set_vendor,
|
||||
vendor = XMLProperty(get_vendor, set_vendor,
|
||||
xpath="./source/vendor/@id")
|
||||
|
||||
def get_product(self):
|
||||
return self._product
|
||||
def set_product(self, val):
|
||||
self._product = val
|
||||
product = _xml_property(get_product, set_product,
|
||||
product = XMLProperty(get_product, set_product,
|
||||
xpath="./source/product/@id")
|
||||
|
||||
def get_device(self):
|
||||
return self._device
|
||||
def set_device(self, val):
|
||||
self._device = val
|
||||
device = _xml_property(get_device, set_device,
|
||||
device = XMLProperty(get_device, set_device,
|
||||
xpath="./source/address/@device")
|
||||
|
||||
def get_bus(self):
|
||||
return self._bus
|
||||
def set_bus(self, val):
|
||||
self._bus = val
|
||||
bus = _xml_property(get_bus, set_bus,
|
||||
bus = XMLProperty(get_bus, set_bus,
|
||||
xpath="./source/address/@bus")
|
||||
|
||||
def get_function(self):
|
||||
return self._function
|
||||
def set_function(self, val):
|
||||
self._function = val
|
||||
function = _xml_property(get_function, set_function,
|
||||
function = XMLProperty(get_function, set_function,
|
||||
xpath="./source/address/@function")
|
||||
|
||||
def get_domain(self):
|
||||
return self._domain
|
||||
def set_domain(self, val):
|
||||
self._domain = val
|
||||
domain = _xml_property(get_domain, set_domain,
|
||||
domain = XMLProperty(get_domain, set_domain,
|
||||
xpath="./source/address/@domain")
|
||||
|
||||
def get_slot(self):
|
||||
return self._slot
|
||||
def set_slot(self, val):
|
||||
self._slot = val
|
||||
slot = _xml_property(get_slot, set_slot,
|
||||
slot = XMLProperty(get_slot, set_slot,
|
||||
xpath="./source/address/@slot")
|
||||
|
||||
def _get_source_xml(self):
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# MA 02110-1301 USA.
|
||||
|
||||
from virtinst.VirtualDevice import VirtualDevice
|
||||
from virtinst.XMLBuilderDomain import _xml_property
|
||||
from virtinst.xmlbuilder import XMLProperty
|
||||
|
||||
|
||||
class VirtualInputDevice(VirtualDevice):
|
||||
|
@ -64,7 +64,7 @@ class VirtualInputDevice(VirtualDevice):
|
|||
if val not in self.input_types:
|
||||
raise ValueError(_("Unknown input type '%s'.") % val)
|
||||
self._type = val
|
||||
type = _xml_property(get_type, set_type,
|
||||
type = XMLProperty(get_type, set_type,
|
||||
xpath="./@type")
|
||||
|
||||
def get_bus(self):
|
||||
|
@ -73,7 +73,7 @@ class VirtualInputDevice(VirtualDevice):
|
|||
if val not in self.input_buses:
|
||||
raise ValueError(_("Unknown input bus '%s'.") % val)
|
||||
self._bus = val
|
||||
bus = _xml_property(get_bus, set_bus,
|
||||
bus = XMLProperty(get_bus, set_bus,
|
||||
xpath="./@bus")
|
||||
|
||||
def _get_xml_config(self):
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# MA 02110-1301 USA.
|
||||
|
||||
from virtinst.VirtualDevice import VirtualDevice
|
||||
from virtinst.XMLBuilderDomain import _xml_property
|
||||
from virtinst.xmlbuilder import XMLProperty
|
||||
|
||||
|
||||
class VirtualMemballoon(VirtualDevice):
|
||||
|
@ -48,7 +48,7 @@ class VirtualMemballoon(VirtualDevice):
|
|||
if not self.MODELS.count(new_model):
|
||||
raise ValueError(_("Unsupported memballoon model '%s'" % new_model))
|
||||
self._model = new_model
|
||||
model = _xml_property(get_model, set_model,
|
||||
model = XMLProperty(get_model, set_model,
|
||||
xpath="./@model")
|
||||
|
||||
def _get_xml_config(self):
|
||||
|
|
|
@ -24,8 +24,7 @@ import libvirt
|
|||
|
||||
from virtinst import util
|
||||
from virtinst.VirtualDevice import VirtualDevice
|
||||
from virtinst import XMLBuilderDomain
|
||||
from virtinst.XMLBuilderDomain import _xml_property
|
||||
from virtinst.xmlbuilder import XMLBuilder, XMLProperty
|
||||
|
||||
|
||||
def _random_mac(conn):
|
||||
|
@ -55,10 +54,10 @@ def _random_mac(conn):
|
|||
return ':'.join(["%02x" % x for x in mac])
|
||||
|
||||
|
||||
class VirtualPort(XMLBuilderDomain.XMLBuilderDomain):
|
||||
class VirtualPort(XMLBuilder):
|
||||
|
||||
def __init__(self, conn, parsexml=None, parsexmlnode=None):
|
||||
XMLBuilderDomain.XMLBuilderDomain.__init__(self, conn, parsexml,
|
||||
XMLBuilder.__init__(self, conn, parsexml,
|
||||
parsexmlnode)
|
||||
self._type = None
|
||||
self._managerid = None
|
||||
|
@ -70,35 +69,35 @@ class VirtualPort(XMLBuilderDomain.XMLBuilderDomain):
|
|||
return self._type
|
||||
def set_type(self, val):
|
||||
self._type = val
|
||||
type = _xml_property(get_type, set_type,
|
||||
type = XMLProperty(get_type, set_type,
|
||||
xpath="./virtualport/@type")
|
||||
|
||||
def get_managerid(self):
|
||||
return self._managerid
|
||||
def set_managerid(self, val):
|
||||
self._managerid = val
|
||||
managerid = _xml_property(get_managerid, set_managerid,
|
||||
managerid = XMLProperty(get_managerid, set_managerid,
|
||||
xpath="./virtualport/parameters/@managerid")
|
||||
|
||||
def get_typeid(self):
|
||||
return self._typeid
|
||||
def set_typeid(self, val):
|
||||
self._typeid = val
|
||||
typeid = _xml_property(get_typeid, set_typeid,
|
||||
typeid = XMLProperty(get_typeid, set_typeid,
|
||||
xpath="./virtualport/parameters/@typeid")
|
||||
|
||||
def get_typeidversion(self):
|
||||
return self._typeidversion
|
||||
def set_typeidversion(self, val):
|
||||
self._typeidversion = val
|
||||
typeidversion = _xml_property(get_typeidversion, set_typeidversion,
|
||||
typeidversion = XMLProperty(get_typeidversion, set_typeidversion,
|
||||
xpath="./virtualport/parameters/@typeidversion")
|
||||
|
||||
def get_instanceid(self):
|
||||
return self._instanceid
|
||||
def set_instanceid(self, val):
|
||||
self._instanceid = val
|
||||
instanceid = _xml_property(get_instanceid, set_instanceid,
|
||||
instanceid = XMLProperty(get_instanceid, set_instanceid,
|
||||
xpath="./virtualport/parameters/@instanceid")
|
||||
|
||||
def _get_xml_config(self):
|
||||
|
@ -262,7 +261,7 @@ class VirtualNetworkInterface(VirtualDevice):
|
|||
if val not in self.network_types:
|
||||
raise ValueError(_("Unknown network type %s") % val)
|
||||
self._type = val
|
||||
type = _xml_property(get_type, set_type,
|
||||
type = XMLProperty(get_type, set_type,
|
||||
xpath="./@type")
|
||||
|
||||
def get_macaddr(self):
|
||||
|
@ -275,7 +274,7 @@ class VirtualNetworkInterface(VirtualDevice):
|
|||
def set_macaddr(self, val):
|
||||
util.validate_macaddr(val)
|
||||
self._macaddr = val
|
||||
macaddr = _xml_property(get_macaddr, set_macaddr,
|
||||
macaddr = XMLProperty(get_macaddr, set_macaddr,
|
||||
xpath="./mac/@address")
|
||||
|
||||
def get_network(self):
|
||||
|
@ -299,7 +298,7 @@ class VirtualNetworkInterface(VirtualDevice):
|
|||
"started.") % newnet)
|
||||
|
||||
self._network = newnet
|
||||
network = _xml_property(get_network, set_network,
|
||||
network = XMLProperty(get_network, set_network,
|
||||
xpath="./source/@network")
|
||||
|
||||
def get_bridge(self):
|
||||
|
@ -310,35 +309,35 @@ class VirtualNetworkInterface(VirtualDevice):
|
|||
return self._bridge
|
||||
def set_bridge(self, val):
|
||||
self._bridge = val
|
||||
bridge = _xml_property(get_bridge, set_bridge,
|
||||
bridge = XMLProperty(get_bridge, set_bridge,
|
||||
xpath="./source/@bridge")
|
||||
|
||||
def get_model(self):
|
||||
return self._model
|
||||
def set_model(self, val):
|
||||
self._model = val
|
||||
model = _xml_property(get_model, set_model,
|
||||
model = XMLProperty(get_model, set_model,
|
||||
xpath="./model/@type")
|
||||
|
||||
def get_target_dev(self):
|
||||
return self._target_dev
|
||||
def set_target_dev(self, val):
|
||||
self._target_dev = val
|
||||
target_dev = _xml_property(get_target_dev, set_target_dev,
|
||||
target_dev = XMLProperty(get_target_dev, set_target_dev,
|
||||
xpath="./target/@dev")
|
||||
|
||||
def get_source_dev(self):
|
||||
return self._source_dev
|
||||
def set_source_dev(self, val):
|
||||
self._source_dev = val
|
||||
source_dev = _xml_property(get_source_dev, set_source_dev,
|
||||
source_dev = XMLProperty(get_source_dev, set_source_dev,
|
||||
xpath="./source/@dev")
|
||||
|
||||
def get_source_mode(self):
|
||||
return self._source_mode
|
||||
def set_source_mode(self, newmode):
|
||||
self._source_mode = newmode
|
||||
source_mode = _xml_property(get_source_mode, set_source_mode,
|
||||
source_mode = XMLProperty(get_source_mode, set_source_mode,
|
||||
xpath="./source/@mode")
|
||||
|
||||
def setup(self, meter=None):
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
from virtinst.VirtualDevice import VirtualDevice
|
||||
|
||||
from virtinst.XMLBuilderDomain import _xml_property
|
||||
from virtinst.xmlbuilder import XMLProperty
|
||||
|
||||
|
||||
class VirtualRedirDevice(VirtualDevice):
|
||||
|
@ -58,7 +58,7 @@ class VirtualRedirDevice(VirtualDevice):
|
|||
if new_val not in self.buses:
|
||||
raise ValueError(_("Unsupported bus '%s'" % new_val))
|
||||
self._bus = new_val
|
||||
bus = _xml_property(get_bus, set_bus,
|
||||
bus = XMLProperty(get_bus, set_bus,
|
||||
xpath="./@bus")
|
||||
|
||||
def get_types(self):
|
||||
|
@ -71,7 +71,7 @@ class VirtualRedirDevice(VirtualDevice):
|
|||
if new_val not in self.types:
|
||||
raise ValueError(_("Unsupported redirection type '%s'" % new_val))
|
||||
self._type = new_val
|
||||
type = _xml_property(get_type, set_type,
|
||||
type = XMLProperty(get_type, set_type,
|
||||
xpath="./@type")
|
||||
|
||||
def get_host(self):
|
||||
|
@ -80,7 +80,7 @@ class VirtualRedirDevice(VirtualDevice):
|
|||
if len(val) == 0:
|
||||
raise ValueError(_("Invalid host value"))
|
||||
self._host = val
|
||||
host = _xml_property(get_host, set_host,
|
||||
host = XMLProperty(get_host, set_host,
|
||||
xpath="./source/@host")
|
||||
|
||||
def get_service(self):
|
||||
|
@ -88,7 +88,7 @@ class VirtualRedirDevice(VirtualDevice):
|
|||
def set_service(self, val):
|
||||
int(val)
|
||||
self._service = val
|
||||
service = _xml_property(get_service, set_service,
|
||||
service = XMLProperty(get_service, set_service,
|
||||
xpath="./source/@service")
|
||||
|
||||
def parse_friendly_server(self, serverstr):
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
# MA 02110-1301 USA.
|
||||
|
||||
from virtinst.VirtualDevice import VirtualDevice
|
||||
from virtinst.XMLBuilderDomain import _xml_property
|
||||
from virtinst.xmlbuilder import XMLProperty
|
||||
|
||||
|
||||
class VirtualSmartCardDevice(VirtualDevice):
|
||||
|
@ -56,7 +56,7 @@ class VirtualSmartCardDevice(VirtualDevice):
|
|||
if val not in self.modes:
|
||||
raise ValueError(_("Unknown smartcard mode '%s'") % val)
|
||||
self._mode = val
|
||||
mode = _xml_property(get_mode, set_mode,
|
||||
mode = XMLProperty(get_mode, set_mode,
|
||||
xpath="./@mode")
|
||||
|
||||
def get_types(self):
|
||||
|
@ -71,7 +71,7 @@ class VirtualSmartCardDevice(VirtualDevice):
|
|||
if val not in self.types:
|
||||
raise ValueError(_("Unknown smartcard type '%s'") % val)
|
||||
self._type = val
|
||||
type = _xml_property(get_type, set_type,
|
||||
type = XMLProperty(get_type, set_type,
|
||||
xpath="./@type")
|
||||
|
||||
def _get_xml_config(self):
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
# MA 02110-1301 USA.
|
||||
|
||||
from virtinst.VirtualDevice import VirtualDevice
|
||||
from virtinst.XMLBuilderDomain import _xml_property
|
||||
from virtinst.xmlbuilder import XMLProperty
|
||||
|
||||
|
||||
class VirtualTPMDevice(VirtualDevice):
|
||||
|
@ -81,7 +81,7 @@ class VirtualTPMDevice(VirtualDevice):
|
|||
if val not in self.types:
|
||||
raise ValueError(_("Unknown TPM type '%s'") % val)
|
||||
self._type = val
|
||||
type = _xml_property(get_type, set_type,
|
||||
type = XMLProperty(get_type, set_type,
|
||||
xpath="./backend/@type")
|
||||
|
||||
def get_models(self):
|
||||
|
@ -94,14 +94,14 @@ class VirtualTPMDevice(VirtualDevice):
|
|||
if val not in self.models:
|
||||
raise ValueError(_("Unknown TPM model '%s'") % val)
|
||||
self._model = val
|
||||
model = _xml_property(get_model, set_model,
|
||||
model = XMLProperty(get_model, set_model,
|
||||
xpath="./@model")
|
||||
|
||||
def get_device_path(self):
|
||||
return self._device_path
|
||||
def set_device_path(self, val):
|
||||
self._device_path = val
|
||||
device_path = _xml_property(get_device_path, set_device_path,
|
||||
device_path = XMLProperty(get_device_path, set_device_path,
|
||||
xpath="./backend/device/@path")
|
||||
|
||||
def supports_property(self, propname):
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# MA 02110-1301 USA.
|
||||
|
||||
from virtinst.VirtualDevice import VirtualDevice
|
||||
from virtinst.XMLBuilderDomain import _xml_property
|
||||
from virtinst.xmlbuilder import XMLProperty
|
||||
|
||||
|
||||
class VirtualVideoDevice(VirtualDevice):
|
||||
|
@ -55,16 +55,16 @@ class VirtualVideoDevice(VirtualDevice):
|
|||
return self._model_type
|
||||
def set_model_type(self, val):
|
||||
self._model_type = val
|
||||
model_type = _xml_property(get_model_type, set_model_type,
|
||||
model_type = XMLProperty(get_model_type, set_model_type,
|
||||
xpath="./model/@type")
|
||||
|
||||
def get_vram(self):
|
||||
return self._vram
|
||||
def set_vram(self, val):
|
||||
self._vram = val
|
||||
vram = _xml_property(get_vram, set_vram,
|
||||
vram = XMLProperty(get_vram, set_vram,
|
||||
xpath="./model/@vram")
|
||||
ram = _xml_property(lambda o: None, lambda o, v: None,
|
||||
ram = XMLProperty(lambda o: None, lambda o, v: None,
|
||||
xpath="./model/@ram")
|
||||
|
||||
|
||||
|
@ -72,7 +72,7 @@ class VirtualVideoDevice(VirtualDevice):
|
|||
return self._heads
|
||||
def set_heads(self, val):
|
||||
self._heads = val
|
||||
heads = _xml_property(get_heads, set_heads,
|
||||
heads = XMLProperty(get_heads, set_heads,
|
||||
xpath="./model/@heads")
|
||||
|
||||
def _get_xml_config(self):
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
# MA 02110-1301 USA.
|
||||
|
||||
from virtinst.VirtualDevice import VirtualDevice
|
||||
from virtinst.XMLBuilderDomain import _xml_property
|
||||
from virtinst.xmlbuilder import XMLProperty
|
||||
|
||||
|
||||
class VirtualWatchdog(VirtualDevice):
|
||||
|
@ -76,7 +76,7 @@ class VirtualWatchdog(VirtualDevice):
|
|||
if not self.MODELS.count(new_model):
|
||||
raise ValueError(_("Unsupported watchdog model '%s'" % new_model))
|
||||
self._model = new_model
|
||||
model = _xml_property(get_model, set_model,
|
||||
model = XMLProperty(get_model, set_model,
|
||||
xpath="./@model")
|
||||
|
||||
def get_action(self):
|
||||
|
@ -85,7 +85,7 @@ class VirtualWatchdog(VirtualDevice):
|
|||
if val not in self.ACTIONS:
|
||||
raise ValueError("Unknown watchdog action '%s'." % val)
|
||||
self._action = val
|
||||
action = _xml_property(get_action, set_action,
|
||||
action = XMLProperty(get_action, set_action,
|
||||
xpath="./@action")
|
||||
|
||||
def _get_xml_config(self):
|
||||
|
|
|
@ -211,7 +211,7 @@ def _remove_xpath_node(ctx, xpath, dofree=True):
|
|||
node.freeNode()
|
||||
|
||||
|
||||
class _xml_property(property):
|
||||
class XMLProperty(property):
|
||||
def __init__(self, fget=None, fset=None, doc=None,
|
||||
xpath=None, get_converter=None, set_converter=None,
|
||||
xml_get_xpath=None, xml_set_xpath=None,
|
||||
|
@ -221,7 +221,7 @@ class _xml_property(property):
|
|||
Set a XMLBuilder class property that represents a value in the
|
||||
<domain> XML. For example
|
||||
|
||||
name = _xml_property(get_name, set_name, xpath="/domain/name")
|
||||
name = XMLProperty(get_name, set_name, xpath="/domain/name")
|
||||
|
||||
When building XML from scratch (virt-install), name is a regular
|
||||
class property. When parsing and editting existing guest XML, we
|
||||
|
@ -472,7 +472,7 @@ class _xml_property(property):
|
|||
_remove_xpath_node(root_node, use_xpath)
|
||||
|
||||
|
||||
class XMLBuilderDomain(object):
|
||||
class XMLBuilder(object):
|
||||
"""
|
||||
Base for all classes which build or parse domain XML
|
||||
"""
|
Loading…
Reference in New Issue