mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
virtinst: move <domain> XML files to virtinst/domain
And give the classes consistent naming
This commit is contained in:
parent
b6dcee8eb7
commit
fe9ed2340c
@ -232,27 +232,27 @@ class TestXMLMisc(unittest.TestCase):
|
||||
|
||||
def testCPUTopology(self):
|
||||
# Test CPU topology determining
|
||||
cpu = virtinst.CPU(self.conn)
|
||||
cpu = virtinst.DomainCpu(self.conn)
|
||||
cpu.sockets = "2"
|
||||
cpu.set_topology_defaults(6)
|
||||
self.assertEqual([cpu.sockets, cpu.cores, cpu.threads], [2, 3, 1])
|
||||
|
||||
cpu = virtinst.CPU(self.conn)
|
||||
cpu = virtinst.DomainCpu(self.conn)
|
||||
cpu.cores = "4"
|
||||
cpu.set_topology_defaults(9)
|
||||
self.assertEqual([cpu.sockets, cpu.cores, cpu.threads], [2, 4, 1])
|
||||
|
||||
cpu = virtinst.CPU(self.conn)
|
||||
cpu = virtinst.DomainCpu(self.conn)
|
||||
cpu.threads = "3"
|
||||
cpu.set_topology_defaults(14)
|
||||
self.assertEqual([cpu.sockets, cpu.cores, cpu.threads], [4, 1, 3])
|
||||
|
||||
cpu = virtinst.CPU(self.conn)
|
||||
cpu = virtinst.DomainCpu(self.conn)
|
||||
cpu.sockets = 5
|
||||
cpu.cores = 2
|
||||
self.assertEqual(cpu.vcpus_from_topology(), 10)
|
||||
|
||||
cpu = virtinst.CPU(self.conn)
|
||||
cpu = virtinst.DomainCpu(self.conn)
|
||||
self.assertEqual(cpu.vcpus_from_topology(), 1)
|
||||
|
||||
def testAC97(self):
|
||||
|
@ -252,7 +252,7 @@ class XMLParseTest(unittest.TestCase):
|
||||
check("offset", None, "utc")
|
||||
self.assertTrue(guest.clock.get_xml_config().startswith("<clock"))
|
||||
|
||||
seclabel = virtinst.Seclabel(guest.conn)
|
||||
seclabel = virtinst.DomainSeclabel(guest.conn)
|
||||
guest.add_child(seclabel)
|
||||
seclabel.model = "testSecurity"
|
||||
seclabel.type = "static"
|
||||
|
@ -11,7 +11,7 @@ from gi.repository import Gio
|
||||
from gi.repository import GLib
|
||||
from gi.repository import Gtk
|
||||
|
||||
from virtinst import CPU
|
||||
from virtinst import DomainCpu
|
||||
|
||||
from .inspection import vmmInspection
|
||||
from .keyring import vmmKeyring, vmmSecret
|
||||
@ -192,7 +192,7 @@ class vmmConfig(object):
|
||||
self.hv_packages = ["qemu-kvm"]
|
||||
|
||||
self.default_storage_format_from_config = "qcow2"
|
||||
self.cpu_default_from_config = CPU.SPECIAL_MODE_HOST_MODEL_ONLY
|
||||
self.cpu_default_from_config = DomainCpu.SPECIAL_MODE_HOST_MODEL_ONLY
|
||||
self.default_console_resizeguest = 0
|
||||
self.default_add_spice_usbredir = "yes"
|
||||
|
||||
@ -521,9 +521,9 @@ class vmmConfig(object):
|
||||
|
||||
def get_default_cpu_setting(self, raw=False, for_cpu=False):
|
||||
ret = self.conf.get("/new-vm/cpu-default")
|
||||
whitelist = [CPU.SPECIAL_MODE_HOST_MODEL_ONLY,
|
||||
CPU.SPECIAL_MODE_HOST_MODEL,
|
||||
CPU.SPECIAL_MODE_HV_DEFAULT]
|
||||
whitelist = [DomainCpu.SPECIAL_MODE_HOST_MODEL_ONLY,
|
||||
DomainCpu.SPECIAL_MODE_HOST_MODEL,
|
||||
DomainCpu.SPECIAL_MODE_HV_DEFAULT]
|
||||
|
||||
if ret not in whitelist:
|
||||
ret = "default"
|
||||
@ -532,10 +532,10 @@ class vmmConfig(object):
|
||||
if ret not in whitelist:
|
||||
ret = whitelist[0]
|
||||
|
||||
if for_cpu and ret == CPU.SPECIAL_MODE_HOST_MODEL:
|
||||
if for_cpu and ret == DomainCpu.SPECIAL_MODE_HOST_MODEL:
|
||||
# host-model has known issues, so use our 'copy cpu'
|
||||
# behavior until host-model does what we need
|
||||
ret = CPU.SPECIAL_MODE_HOST_COPY
|
||||
ret = DomainCpu.SPECIAL_MODE_HOST_COPY
|
||||
|
||||
return ret
|
||||
def set_default_cpu_setting(self, val):
|
||||
|
@ -967,9 +967,9 @@ class vmmDetails(vmmGObjectUI):
|
||||
model.set_sort_column_id(1, Gtk.SortType.ASCENDING)
|
||||
model.append([_("Application Default"), "1", "appdefault", False])
|
||||
model.append([_("Hypervisor Default"), "2",
|
||||
virtinst.CPU.SPECIAL_MODE_HV_DEFAULT, False])
|
||||
virtinst.DomainCpu.SPECIAL_MODE_HV_DEFAULT, False])
|
||||
model.append([_("Clear CPU configuration"), "3",
|
||||
virtinst.CPU.SPECIAL_MODE_CLEAR, False])
|
||||
virtinst.DomainCpu.SPECIAL_MODE_CLEAR, False])
|
||||
model.append([None, None, None, True])
|
||||
for name in caps.get_cpu_values(self.vm.get_arch()):
|
||||
model.append([name, name, name, False])
|
||||
@ -1529,7 +1529,7 @@ class vmmDetails(vmmGObjectUI):
|
||||
text = cpu_list.get_child().get_text()
|
||||
|
||||
if self.widget("cpu-copy-host").get_active():
|
||||
return virtinst.CPU.SPECIAL_MODE_HOST_MODEL
|
||||
return virtinst.DomainCpu.SPECIAL_MODE_HOST_MODEL
|
||||
|
||||
key = None
|
||||
for row in cpu_list.get_model():
|
||||
@ -2539,7 +2539,7 @@ class vmmDetails(vmmGObjectUI):
|
||||
else:
|
||||
uiutil.set_list_selection(
|
||||
self.widget("cpu-model"),
|
||||
virtinst.CPU.SPECIAL_MODE_HV_DEFAULT, column=2)
|
||||
virtinst.DomainCpu.SPECIAL_MODE_HV_DEFAULT, column=2)
|
||||
|
||||
# Warn about hyper-threading setting
|
||||
cpu_model = self.get_config_cpu_model()
|
||||
|
@ -29,19 +29,7 @@ from virtinst import support
|
||||
from virtinst.uri import URI
|
||||
from virtinst.osdict import OSDB
|
||||
|
||||
from virtinst.osxml import OSXML
|
||||
from virtinst.domainfeatures import DomainFeatures
|
||||
from virtinst.domainnumatune import DomainNumatune
|
||||
from virtinst.domainblkiotune import DomainBlkiotune
|
||||
from virtinst.domainmemorytune import DomainMemorytune
|
||||
from virtinst.domainmemorybacking import DomainMemorybacking
|
||||
from virtinst.domainresource import DomainResource
|
||||
from virtinst.clock import Clock
|
||||
from virtinst.cpu import CPU, CPUFeature
|
||||
from virtinst.cputune import CPUTune
|
||||
from virtinst.seclabel import Seclabel
|
||||
from virtinst.pm import PM
|
||||
from virtinst.idmap import IdMap
|
||||
from virtinst.domain import * # pylint: disable=wildcard-import
|
||||
|
||||
from virtinst.capabilities import Capabilities
|
||||
from virtinst.domcapabilities import DomainCapabilities
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
import logging
|
||||
|
||||
from .cpu import CPU as DomainCPU
|
||||
from .domain import DomainCpu
|
||||
from .xmlbuilder import XMLBuilder, XMLChildProperty, XMLProperty
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ from .xmlbuilder import XMLBuilder, XMLChildProperty, XMLProperty
|
||||
# capabilities host <cpu> parsing #
|
||||
###################################
|
||||
|
||||
class _CapsCPU(DomainCPU):
|
||||
class _CapsCPU(DomainCpu):
|
||||
arch = XMLProperty("./arch")
|
||||
|
||||
# capabilities used to just expose these properties as bools
|
||||
|
124
virtinst/cli.py
124
virtinst/cli.py
@ -23,24 +23,10 @@ import libvirt
|
||||
from virtcli import CLIConfig
|
||||
|
||||
from . import util
|
||||
from .clock import Clock
|
||||
from .cpu import CPU
|
||||
from .cputune import CPUTune
|
||||
from .devices import * # pylint: disable=wildcard-import
|
||||
from .domainblkiotune import DomainBlkiotune
|
||||
from .domainfeatures import DomainFeatures
|
||||
from .domainmemorybacking import DomainMemorybacking
|
||||
from .domainmemorytune import DomainMemorytune
|
||||
from .domainnumatune import DomainNumatune
|
||||
from .domainresource import DomainResource
|
||||
from .idmap import IdMap
|
||||
from .domain import * # pylint: disable=wildcard-import
|
||||
from .nodedev import NodeDevice
|
||||
from .osxml import OSXML
|
||||
from .pm import PM
|
||||
from .seclabel import Seclabel
|
||||
from .storage import StoragePool, StorageVolume
|
||||
from .sysinfo import SYSInfo
|
||||
from .xmlnsqemu import XMLNSQemu
|
||||
|
||||
_ignore = Device
|
||||
|
||||
@ -1377,16 +1363,16 @@ ParserMemory.add_arg("hotplugmemoryslots", "hotplugmemoryslots")
|
||||
# --memtune parsing #
|
||||
#####################
|
||||
|
||||
class ParserMemorytune(VirtCLIParser):
|
||||
class ParserMemtune(VirtCLIParser):
|
||||
cli_arg_name = "memtune"
|
||||
objclass = DomainMemorytune
|
||||
objclass = DomainMemtune
|
||||
remove_first = "soft_limit"
|
||||
|
||||
_register_virt_parser(ParserMemorytune)
|
||||
ParserMemorytune.add_arg("hard_limit", "hard_limit")
|
||||
ParserMemorytune.add_arg("soft_limit", "soft_limit")
|
||||
ParserMemorytune.add_arg("swap_hard_limit", "swap_hard_limit")
|
||||
ParserMemorytune.add_arg("min_guarantee", "min_guarantee")
|
||||
_register_virt_parser(ParserMemtune)
|
||||
ParserMemtune.add_arg("hard_limit", "hard_limit")
|
||||
ParserMemtune.add_arg("soft_limit", "soft_limit")
|
||||
ParserMemtune.add_arg("swap_hard_limit", "swap_hard_limit")
|
||||
ParserMemtune.add_arg("min_guarantee", "min_guarantee")
|
||||
|
||||
|
||||
#######################
|
||||
@ -1408,17 +1394,17 @@ ParserBlkiotune.add_arg("device_weight", "device_weight")
|
||||
# --memorybacking parsing #
|
||||
###########################
|
||||
|
||||
class ParserMemorybacking(VirtCLIParser):
|
||||
class ParserMemoryBacking(VirtCLIParser):
|
||||
cli_arg_name = "memorybacking"
|
||||
objclass = DomainMemorybacking
|
||||
objclass = DomainMemoryBacking
|
||||
|
||||
_register_virt_parser(ParserMemorybacking)
|
||||
ParserMemorybacking.add_arg("hugepages", "hugepages", is_onoff=True)
|
||||
ParserMemorybacking.add_arg("page_size", "size")
|
||||
ParserMemorybacking.add_arg("page_unit", "unit")
|
||||
ParserMemorybacking.add_arg("page_nodeset", "nodeset", can_comma=True)
|
||||
ParserMemorybacking.add_arg("nosharepages", "nosharepages", is_onoff=True)
|
||||
ParserMemorybacking.add_arg("locked", "locked", is_onoff=True)
|
||||
_register_virt_parser(ParserMemoryBacking)
|
||||
ParserMemoryBacking.add_arg("hugepages", "hugepages", is_onoff=True)
|
||||
ParserMemoryBacking.add_arg("page_size", "size")
|
||||
ParserMemoryBacking.add_arg("page_unit", "unit")
|
||||
ParserMemoryBacking.add_arg("page_nodeset", "nodeset", can_comma=True)
|
||||
ParserMemoryBacking.add_arg("nosharepages", "nosharepages", is_onoff=True)
|
||||
ParserMemoryBacking.add_arg("locked", "locked", is_onoff=True)
|
||||
|
||||
|
||||
#################
|
||||
@ -1427,7 +1413,7 @@ ParserMemorybacking.add_arg("locked", "locked", is_onoff=True)
|
||||
|
||||
class ParserCPU(VirtCLIParser):
|
||||
cli_arg_name = "cpu"
|
||||
objclass = CPU
|
||||
objclass = DomainCpu
|
||||
remove_first = "model"
|
||||
stub_none = False
|
||||
|
||||
@ -1539,9 +1525,9 @@ ParserCPU.add_arg("level", "cache.level", find_inst_cb=ParserCPU.set_l3_cache_cb
|
||||
# --cputune parsing #
|
||||
#####################
|
||||
|
||||
class ParserCPUTune(VirtCLIParser):
|
||||
class ParserCputune(VirtCLIParser):
|
||||
cli_arg_name = "cputune"
|
||||
objclass = CPUTune
|
||||
objclass = DomainCputune
|
||||
remove_first = "model"
|
||||
stub_none = False
|
||||
|
||||
@ -1551,12 +1537,12 @@ class ParserCPUTune(VirtCLIParser):
|
||||
cb = self._make_find_inst_cb(cliarg, objpropname)
|
||||
return cb(*args, **kwargs)
|
||||
|
||||
_register_virt_parser(ParserCPUTune)
|
||||
_register_virt_parser(ParserCputune)
|
||||
# Options for CPU.vcpus config
|
||||
ParserCPUTune.add_arg("vcpu", "vcpupin[0-9]*.vcpu",
|
||||
find_inst_cb=ParserCPUTune.vcpu_find_inst_cb)
|
||||
ParserCPUTune.add_arg("cpuset", "vcpupin[0-9]*.cpuset", can_comma=True,
|
||||
find_inst_cb=ParserCPUTune.vcpu_find_inst_cb)
|
||||
ParserCputune.add_arg("vcpu", "vcpupin[0-9]*.vcpu",
|
||||
find_inst_cb=ParserCputune.vcpu_find_inst_cb)
|
||||
ParserCputune.add_arg("cpuset", "vcpupin[0-9]*.cpuset", can_comma=True,
|
||||
find_inst_cb=ParserCputune.vcpu_find_inst_cb)
|
||||
|
||||
|
||||
###################
|
||||
@ -1694,7 +1680,7 @@ ParserBoot.add_arg("os.smbios_mode", "smbios_mode",
|
||||
|
||||
# This is simply so the boot options are advertised with --boot help,
|
||||
# actual processing is handled by _parse
|
||||
for _bootdev in OSXML.BOOT_DEVICES:
|
||||
for _bootdev in DomainOs.BOOT_DEVICES:
|
||||
ParserBoot.add_arg(None, _bootdev, is_novalue=True, cb=ParserBoot.noset_cb)
|
||||
|
||||
|
||||
@ -1704,7 +1690,7 @@ for _bootdev in OSXML.BOOT_DEVICES:
|
||||
|
||||
class ParserIdmap(VirtCLIParser):
|
||||
cli_arg_name = "idmap"
|
||||
objclass = IdMap
|
||||
objclass = DomainIdmap
|
||||
|
||||
_register_virt_parser(ParserIdmap)
|
||||
ParserIdmap.add_arg("uid_start", "uid_start")
|
||||
@ -1721,7 +1707,7 @@ ParserIdmap.add_arg("gid_count", "gid_count")
|
||||
|
||||
class ParserSecurity(VirtCLIParser):
|
||||
cli_arg_name = "security"
|
||||
objclass = Seclabel
|
||||
objclass = DomainSeclabel
|
||||
|
||||
_register_virt_parser(ParserSecurity)
|
||||
ParserSecurity.add_arg("type", "type")
|
||||
@ -1779,7 +1765,7 @@ ParserFeatures.add_arg("vmcoreinfo", "vmcoreinfo", is_onoff=True)
|
||||
|
||||
class ParserClock(VirtCLIParser):
|
||||
cli_arg_name = "clock"
|
||||
objclass = Clock
|
||||
objclass = DomainClock
|
||||
|
||||
def set_timer(self, inst, val, virtarg):
|
||||
tname, attrname = virtarg.cliname.split("_")
|
||||
@ -1800,7 +1786,7 @@ class ParserClock(VirtCLIParser):
|
||||
_register_virt_parser(ParserClock)
|
||||
ParserClock.add_arg("offset", "offset")
|
||||
|
||||
for _tname in Clock.TIMER_NAMES:
|
||||
for _tname in DomainClock.TIMER_NAMES:
|
||||
ParserClock.add_arg(None, _tname + "_present",
|
||||
is_onoff=True,
|
||||
cb=ParserClock.set_timer)
|
||||
@ -1813,7 +1799,7 @@ for _tname in Clock.TIMER_NAMES:
|
||||
|
||||
class ParserPM(VirtCLIParser):
|
||||
cli_arg_name = "pm"
|
||||
objclass = PM
|
||||
objclass = DomainPm
|
||||
|
||||
_register_virt_parser(ParserPM)
|
||||
ParserPM.add_arg("suspend_to_mem", "suspend_to_mem", is_onoff=True)
|
||||
@ -1824,9 +1810,9 @@ ParserPM.add_arg("suspend_to_disk", "suspend_to_disk", is_onoff=True)
|
||||
# --sysinfo parsing #
|
||||
#####################
|
||||
|
||||
class ParserSYSInfo(VirtCLIParser):
|
||||
class ParserSysinfo(VirtCLIParser):
|
||||
cli_arg_name = "sysinfo"
|
||||
objclass = SYSInfo
|
||||
objclass = DomainSysinfo
|
||||
remove_first = "type"
|
||||
|
||||
def set_type_cb(self, inst, val, virtarg):
|
||||
@ -1856,34 +1842,34 @@ class ParserSYSInfo(VirtCLIParser):
|
||||
|
||||
return VirtCLIParser._parse(self, inst)
|
||||
|
||||
_register_virt_parser(ParserSYSInfo)
|
||||
_register_virt_parser(ParserSysinfo)
|
||||
# <sysinfo type='smbios'>
|
||||
ParserSYSInfo.add_arg("type", "type",
|
||||
cb=ParserSYSInfo.set_type_cb, can_comma=True)
|
||||
ParserSysinfo.add_arg("type", "type",
|
||||
cb=ParserSysinfo.set_type_cb, can_comma=True)
|
||||
|
||||
# <bios> type 0 BIOS Information
|
||||
ParserSYSInfo.add_arg("bios_vendor", "bios_vendor")
|
||||
ParserSYSInfo.add_arg("bios_version", "bios_version")
|
||||
ParserSYSInfo.add_arg("bios_date", "bios_date")
|
||||
ParserSYSInfo.add_arg("bios_release", "bios_release")
|
||||
ParserSysinfo.add_arg("bios_vendor", "bios_vendor")
|
||||
ParserSysinfo.add_arg("bios_version", "bios_version")
|
||||
ParserSysinfo.add_arg("bios_date", "bios_date")
|
||||
ParserSysinfo.add_arg("bios_release", "bios_release")
|
||||
|
||||
# <system> type 1 System Information
|
||||
ParserSYSInfo.add_arg("system_manufacturer", "system_manufacturer")
|
||||
ParserSYSInfo.add_arg("system_product", "system_product")
|
||||
ParserSYSInfo.add_arg("system_version", "system_version")
|
||||
ParserSYSInfo.add_arg("system_serial", "system_serial")
|
||||
ParserSYSInfo.add_arg("system_uuid", "system_uuid",
|
||||
cb=ParserSYSInfo.set_uuid_cb)
|
||||
ParserSYSInfo.add_arg("system_sku", "system_sku")
|
||||
ParserSYSInfo.add_arg("system_family", "system_family")
|
||||
ParserSysinfo.add_arg("system_manufacturer", "system_manufacturer")
|
||||
ParserSysinfo.add_arg("system_product", "system_product")
|
||||
ParserSysinfo.add_arg("system_version", "system_version")
|
||||
ParserSysinfo.add_arg("system_serial", "system_serial")
|
||||
ParserSysinfo.add_arg("system_uuid", "system_uuid",
|
||||
cb=ParserSysinfo.set_uuid_cb)
|
||||
ParserSysinfo.add_arg("system_sku", "system_sku")
|
||||
ParserSysinfo.add_arg("system_family", "system_family")
|
||||
|
||||
# <baseBoard> type 2 Baseboard (or Module) Information
|
||||
ParserSYSInfo.add_arg("baseBoard_manufacturer", "baseBoard_manufacturer")
|
||||
ParserSYSInfo.add_arg("baseBoard_product", "baseBoard_product")
|
||||
ParserSYSInfo.add_arg("baseBoard_version", "baseBoard_version")
|
||||
ParserSYSInfo.add_arg("baseBoard_serial", "baseBoard_serial")
|
||||
ParserSYSInfo.add_arg("baseBoard_asset", "baseBoard_asset")
|
||||
ParserSYSInfo.add_arg("baseBoard_location", "baseBoard_location")
|
||||
ParserSysinfo.add_arg("baseBoard_manufacturer", "baseBoard_manufacturer")
|
||||
ParserSysinfo.add_arg("baseBoard_product", "baseBoard_product")
|
||||
ParserSysinfo.add_arg("baseBoard_version", "baseBoard_version")
|
||||
ParserSysinfo.add_arg("baseBoard_serial", "baseBoard_serial")
|
||||
ParserSysinfo.add_arg("baseBoard_asset", "baseBoard_asset")
|
||||
ParserSysinfo.add_arg("baseBoard_location", "baseBoard_location")
|
||||
|
||||
|
||||
##############################
|
||||
@ -1892,7 +1878,7 @@ ParserSYSInfo.add_arg("baseBoard_location", "baseBoard_location")
|
||||
|
||||
class ParserQemuCLI(VirtCLIParser):
|
||||
cli_arg_name = "qemu_commandline"
|
||||
objclass = XMLNSQemu
|
||||
objclass = DomainXMLNSQemu
|
||||
|
||||
def args_cb(self, inst, val, virtarg):
|
||||
for opt in shlex.split(val):
|
||||
|
21
virtinst/domain/__init__.py
Normal file
21
virtinst/domain/__init__.py
Normal file
@ -0,0 +1,21 @@
|
||||
# This work is licensed under the GNU GPLv2.
|
||||
# See the COPYING file in the top-level directory.
|
||||
|
||||
|
||||
from .blkiotune import DomainBlkiotune
|
||||
from .clock import DomainClock
|
||||
from .cpu import DomainCpu
|
||||
from .cputune import DomainCputune
|
||||
from .features import DomainFeatures
|
||||
from .idmap import DomainIdmap
|
||||
from .memorybacking import DomainMemoryBacking
|
||||
from .memtune import DomainMemtune
|
||||
from .numatune import DomainNumatune
|
||||
from .os import DomainOs
|
||||
from .pm import DomainPm
|
||||
from .resource import DomainResource
|
||||
from .seclabel import DomainSeclabel
|
||||
from .sysinfo import DomainSysinfo
|
||||
from .xmlnsqemu import DomainXMLNSQemu
|
||||
|
||||
__all__ = [l for l in locals() if l.startswith("Domain")]
|
@ -5,7 +5,7 @@
|
||||
# This work is licensed under the GNU GPLv2.
|
||||
# See the COPYING file in the top-level directory.
|
||||
|
||||
from .xmlbuilder import XMLBuilder, XMLProperty
|
||||
from ..xmlbuilder import XMLBuilder, XMLProperty
|
||||
|
||||
|
||||
class DomainBlkiotune(XMLBuilder):
|
@ -5,7 +5,7 @@
|
||||
# This work is licensed under the GNU GPLv2.
|
||||
# See the COPYING file in the top-level directory.
|
||||
|
||||
from .xmlbuilder import XMLBuilder, XMLChildProperty, XMLProperty
|
||||
from ..xmlbuilder import XMLBuilder, XMLChildProperty, XMLProperty
|
||||
|
||||
|
||||
class _ClockTimer(XMLBuilder):
|
||||
@ -16,7 +16,7 @@ class _ClockTimer(XMLBuilder):
|
||||
tickpolicy = XMLProperty("./@tickpolicy")
|
||||
|
||||
|
||||
class Clock(XMLBuilder):
|
||||
class DomainClock(XMLBuilder):
|
||||
_XML_ROOT_NAME = "clock"
|
||||
|
||||
TIMER_NAMES = ["platform", "pit", "rtc", "hpet", "tsc", "kvmclock",
|
@ -5,7 +5,7 @@
|
||||
# This work is licensed under the GNU GPLv2.
|
||||
# See the COPYING file in the top-level directory.
|
||||
|
||||
from .xmlbuilder import XMLBuilder, XMLProperty, XMLChildProperty
|
||||
from ..xmlbuilder import XMLBuilder, XMLProperty, XMLChildProperty
|
||||
|
||||
|
||||
class _CPUCellSibling(XMLBuilder):
|
||||
@ -32,7 +32,7 @@ class _CPUCell(XMLBuilder):
|
||||
siblings = XMLChildProperty(_CPUCellSibling, relative_xpath="./distances")
|
||||
|
||||
|
||||
class CPUCache(XMLBuilder):
|
||||
class _CPUCache(XMLBuilder):
|
||||
"""
|
||||
Class for generating <cpu> child <cache> XML
|
||||
"""
|
||||
@ -44,7 +44,7 @@ class CPUCache(XMLBuilder):
|
||||
level = XMLProperty("./@level", is_int=True)
|
||||
|
||||
|
||||
class CPUFeature(XMLBuilder):
|
||||
class _CPUFeature(XMLBuilder):
|
||||
"""
|
||||
Class for generating <cpu> child <feature> XML
|
||||
"""
|
||||
@ -58,7 +58,7 @@ class CPUFeature(XMLBuilder):
|
||||
policy = XMLProperty("./@policy")
|
||||
|
||||
|
||||
class CPU(XMLBuilder):
|
||||
class DomainCpu(XMLBuilder):
|
||||
"""
|
||||
Class for generating <cpu> XML
|
||||
"""
|
||||
@ -107,10 +107,10 @@ class CPU(XMLBuilder):
|
||||
feature = self.features.add_new()
|
||||
feature.name = name
|
||||
feature.policy = policy
|
||||
features = XMLChildProperty(CPUFeature)
|
||||
features = XMLChildProperty(_CPUFeature)
|
||||
|
||||
cells = XMLChildProperty(_CPUCell, relative_xpath="./numa")
|
||||
cache = XMLChildProperty(CPUCache)
|
||||
cache = XMLChildProperty(_CPUCache)
|
||||
|
||||
def copy_host_cpu(self):
|
||||
"""
|
@ -3,7 +3,7 @@
|
||||
# This work is licensed under the GNU GPLv2.
|
||||
# See the COPYING file in the top-level directory.
|
||||
|
||||
from .xmlbuilder import XMLBuilder, XMLProperty, XMLChildProperty
|
||||
from ..xmlbuilder import XMLBuilder, XMLProperty, XMLChildProperty
|
||||
|
||||
|
||||
class _VCPUPin(XMLBuilder):
|
||||
@ -17,7 +17,7 @@ class _VCPUPin(XMLBuilder):
|
||||
cpuset = XMLProperty("./@cpuset")
|
||||
|
||||
|
||||
class CPUTune(XMLBuilder):
|
||||
class DomainCputune(XMLBuilder):
|
||||
"""
|
||||
Class for generating <cpu> XML
|
||||
"""
|
@ -5,7 +5,7 @@
|
||||
# This work is licensed under the GNU GPLv2.
|
||||
# See the COPYING file in the top-level directory.
|
||||
|
||||
from .xmlbuilder import XMLBuilder, XMLProperty
|
||||
from ..xmlbuilder import XMLBuilder, XMLProperty
|
||||
|
||||
|
||||
class DomainFeatures(XMLBuilder):
|
@ -5,10 +5,10 @@
|
||||
# This work is licensed under the GNU GPLv2.
|
||||
# See the COPYING file in the top-level directory.
|
||||
|
||||
from .xmlbuilder import XMLBuilder, XMLProperty
|
||||
from ..xmlbuilder import XMLBuilder, XMLProperty
|
||||
|
||||
|
||||
class IdMap(XMLBuilder):
|
||||
class DomainIdmap(XMLBuilder):
|
||||
"""
|
||||
Class for generating user namespace related XML
|
||||
"""
|
@ -5,10 +5,10 @@
|
||||
# This work is licensed under the GNU GPLv2.
|
||||
# See the COPYING file in the top-level directory.
|
||||
|
||||
from .xmlbuilder import XMLBuilder, XMLProperty
|
||||
from ..xmlbuilder import XMLBuilder, XMLProperty
|
||||
|
||||
|
||||
class DomainMemorybacking(XMLBuilder):
|
||||
class DomainMemoryBacking(XMLBuilder):
|
||||
"""
|
||||
Class for generating <memoryBacking> XML
|
||||
"""
|
@ -5,10 +5,10 @@
|
||||
# This work is licensed under the GNU GPLv2.
|
||||
# See the COPYING file in the top-level directory.
|
||||
|
||||
from .xmlbuilder import XMLBuilder, XMLProperty
|
||||
from ..xmlbuilder import XMLBuilder, XMLProperty
|
||||
|
||||
|
||||
class DomainMemorytune(XMLBuilder):
|
||||
class DomainMemtune(XMLBuilder):
|
||||
"""
|
||||
Class for generating <memtune> XML
|
||||
"""
|
@ -7,7 +7,7 @@
|
||||
|
||||
import re
|
||||
|
||||
from .xmlbuilder import XMLBuilder, XMLProperty
|
||||
from ..xmlbuilder import XMLBuilder, XMLProperty
|
||||
|
||||
|
||||
def get_phy_cpus(conn):
|
@ -5,7 +5,7 @@
|
||||
# This work is licensed under the GNU GPLv2.
|
||||
# See the COPYING file in the top-level directory.
|
||||
|
||||
from .xmlbuilder import XMLBuilder, XMLProperty, XMLChildProperty
|
||||
from ..xmlbuilder import XMLBuilder, XMLProperty, XMLChildProperty
|
||||
|
||||
|
||||
class _InitArg(XMLBuilder):
|
||||
@ -18,7 +18,7 @@ class _BootDevice(XMLBuilder):
|
||||
dev = XMLProperty("./@dev")
|
||||
|
||||
|
||||
class OSXML(XMLBuilder):
|
||||
class DomainOs(XMLBuilder):
|
||||
"""
|
||||
Class for generating boot device related XML
|
||||
"""
|
@ -5,10 +5,10 @@
|
||||
# This work is licensed under the GNU GPLv2.
|
||||
# See the COPYING file in the top-level directory.
|
||||
|
||||
from .xmlbuilder import XMLBuilder, XMLProperty
|
||||
from ..xmlbuilder import XMLBuilder, XMLProperty
|
||||
|
||||
|
||||
class PM(XMLBuilder):
|
||||
class DomainPm(XMLBuilder):
|
||||
_XML_ROOT_NAME = "pm"
|
||||
|
||||
suspend_to_mem = XMLProperty("./suspend-to-mem/@enabled", is_yesno=True)
|
@ -5,7 +5,7 @@
|
||||
# This work is licensed under the GNU GPLv2.
|
||||
# See the COPYING file in the top-level directory.
|
||||
|
||||
from .xmlbuilder import XMLBuilder, XMLProperty
|
||||
from ..xmlbuilder import XMLBuilder, XMLProperty
|
||||
|
||||
|
||||
class DomainResource(XMLBuilder):
|
@ -5,10 +5,10 @@
|
||||
# This work is licensed under the GNU GPLv2.
|
||||
# See the COPYING file in the top-level directory.
|
||||
|
||||
from .xmlbuilder import XMLBuilder, XMLProperty
|
||||
from ..xmlbuilder import XMLBuilder, XMLProperty
|
||||
|
||||
|
||||
class Seclabel(XMLBuilder):
|
||||
class DomainSeclabel(XMLBuilder):
|
||||
"""
|
||||
Class for generating <seclabel> XML
|
||||
"""
|
@ -1,21 +1,17 @@
|
||||
#
|
||||
# Copyright (C) 2016 Red Hat, Inc.
|
||||
# Copyright (C) 2016 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
# Charles Arnold <carnold suse com>
|
||||
#
|
||||
# This work is licensed under the GNU GPLv2.
|
||||
# See the COPYING file in the top-level directory.
|
||||
"""
|
||||
Classes for building and installing with libvirt <sysinfo> XML
|
||||
"""
|
||||
import datetime
|
||||
|
||||
from .xmlbuilder import XMLBuilder, XMLProperty
|
||||
from ..xmlbuilder import XMLBuilder, XMLProperty
|
||||
|
||||
|
||||
class SYSInfo(XMLBuilder):
|
||||
class DomainSysinfo(XMLBuilder):
|
||||
"""
|
||||
Top level class for <sysinfo type='smbios'> object XML
|
||||
Class for building and domain <sysinfo> XML
|
||||
"""
|
||||
|
||||
_XML_ROOT_NAME = "sysinfo"
|
@ -4,7 +4,7 @@
|
||||
# This work is licensed under the GNU GPLv2.
|
||||
# See the COPYING file in the top-level directory.
|
||||
|
||||
from .xmlbuilder import XMLBuilder, XMLChildProperty, XMLProperty
|
||||
from ..xmlbuilder import XMLBuilder, XMLChildProperty, XMLProperty
|
||||
|
||||
|
||||
class _XMLNSQemuArg(XMLBuilder):
|
||||
@ -20,7 +20,7 @@ class _XMLNSQemuEnv(XMLBuilder):
|
||||
value = XMLProperty("./@value")
|
||||
|
||||
|
||||
class XMLNSQemu(XMLBuilder):
|
||||
class DomainXMLNSQemu(XMLBuilder):
|
||||
"""
|
||||
Class for generating <qemu:commandline> XML
|
||||
"""
|
@ -16,28 +16,14 @@ from virtcli import CLIConfig
|
||||
|
||||
from . import util
|
||||
from . import support
|
||||
from .osdict import OSDB
|
||||
from .clock import Clock
|
||||
from .cpu import CPU
|
||||
from .cputune import CPUTune
|
||||
from .devices import (Device, DeviceChannel, DeviceConsole, DeviceController,
|
||||
DeviceDisk, DeviceInput, DeviceGraphics, DevicePanic, DeviceRedirdev,
|
||||
DeviceRng, DeviceSound, DeviceVideo)
|
||||
from .distroinstaller import DistroInstaller
|
||||
from .domainblkiotune import DomainBlkiotune
|
||||
from .domainfeatures import DomainFeatures
|
||||
from .domainmemorybacking import DomainMemorybacking
|
||||
from .domainmemorytune import DomainMemorytune
|
||||
from .domainnumatune import DomainNumatune
|
||||
from .domainresource import DomainResource
|
||||
from .domain import * # pylint: disable=wildcard-import
|
||||
from .domcapabilities import DomainCapabilities
|
||||
from .idmap import IdMap
|
||||
from .osxml import OSXML
|
||||
from .pm import PM
|
||||
from .seclabel import Seclabel
|
||||
from .sysinfo import SYSInfo
|
||||
from .osdict import OSDB
|
||||
from .xmlbuilder import XMLBuilder, XMLProperty, XMLChildProperty
|
||||
from .xmlnsqemu import XMLNSQemu
|
||||
|
||||
|
||||
class Guest(XMLBuilder):
|
||||
@ -186,22 +172,22 @@ class Guest(XMLBuilder):
|
||||
on_crash = XMLProperty("./on_crash")
|
||||
on_lockfailure = XMLProperty("./on_lockfailure")
|
||||
|
||||
seclabels = XMLChildProperty(Seclabel)
|
||||
os = XMLChildProperty(OSXML, is_single=True)
|
||||
seclabels = XMLChildProperty(DomainSeclabel)
|
||||
os = XMLChildProperty(DomainOs, is_single=True)
|
||||
features = XMLChildProperty(DomainFeatures, is_single=True)
|
||||
clock = XMLChildProperty(Clock, is_single=True)
|
||||
cpu = XMLChildProperty(CPU, is_single=True)
|
||||
cputune = XMLChildProperty(CPUTune, is_single=True)
|
||||
clock = XMLChildProperty(DomainClock, is_single=True)
|
||||
cpu = XMLChildProperty(DomainCpu, is_single=True)
|
||||
cputune = XMLChildProperty(DomainCputune, is_single=True)
|
||||
numatune = XMLChildProperty(DomainNumatune, is_single=True)
|
||||
pm = XMLChildProperty(PM, is_single=True)
|
||||
pm = XMLChildProperty(DomainPm, is_single=True)
|
||||
blkiotune = XMLChildProperty(DomainBlkiotune, is_single=True)
|
||||
memtune = XMLChildProperty(DomainMemorytune, is_single=True)
|
||||
memoryBacking = XMLChildProperty(DomainMemorybacking, is_single=True)
|
||||
idmap = XMLChildProperty(IdMap, is_single=True)
|
||||
memtune = XMLChildProperty(DomainMemtune, is_single=True)
|
||||
memoryBacking = XMLChildProperty(DomainMemoryBacking, is_single=True)
|
||||
idmap = XMLChildProperty(DomainIdmap, is_single=True)
|
||||
resource = XMLChildProperty(DomainResource, is_single=True)
|
||||
sysinfo = XMLChildProperty(SYSInfo, is_single=True)
|
||||
sysinfo = XMLChildProperty(DomainSysinfo, is_single=True)
|
||||
|
||||
xmlns_qemu = XMLChildProperty(XMLNSQemu, is_single=True)
|
||||
xmlns_qemu = XMLChildProperty(DomainXMLNSQemu, is_single=True)
|
||||
|
||||
|
||||
###############################
|
||||
|
@ -11,7 +11,7 @@ import os
|
||||
import logging
|
||||
|
||||
from .devices import DeviceDisk
|
||||
from .osxml import OSXML
|
||||
from .domain import DomainOs
|
||||
|
||||
|
||||
class Installer(object):
|
||||
@ -214,18 +214,18 @@ class ContainerInstaller(Installer):
|
||||
def _get_bootdev(self, isinstall, guest):
|
||||
ignore = isinstall
|
||||
ignore = guest
|
||||
return OSXML.BOOT_DEVICE_HARDDISK
|
||||
return DomainOs.BOOT_DEVICE_HARDDISK
|
||||
|
||||
|
||||
class PXEInstaller(Installer):
|
||||
def _get_bootdev(self, isinstall, guest):
|
||||
bootdev = OSXML.BOOT_DEVICE_NETWORK
|
||||
bootdev = DomainOs.BOOT_DEVICE_NETWORK
|
||||
|
||||
if (not isinstall and
|
||||
[d for d in guest.get_devices("disk") if
|
||||
d.device == d.DEVICE_DISK]):
|
||||
# If doing post-install boot and guest has an HD attached
|
||||
bootdev = OSXML.BOOT_DEVICE_HARDDISK
|
||||
bootdev = DomainOs.BOOT_DEVICE_HARDDISK
|
||||
|
||||
return bootdev
|
||||
|
||||
@ -237,15 +237,15 @@ class ImportInstaller(Installer):
|
||||
def _get_bootdev(self, isinstall, guest):
|
||||
disks = guest.get_devices("disk")
|
||||
if not disks:
|
||||
return OSXML.BOOT_DEVICE_HARDDISK
|
||||
return DomainOs.BOOT_DEVICE_HARDDISK
|
||||
return self._disk_to_bootdev(disks[0])
|
||||
|
||||
def _disk_to_bootdev(self, disk):
|
||||
if disk.device == DeviceDisk.DEVICE_DISK:
|
||||
return OSXML.BOOT_DEVICE_HARDDISK
|
||||
return DomainOs.BOOT_DEVICE_HARDDISK
|
||||
elif disk.device == DeviceDisk.DEVICE_CDROM:
|
||||
return OSXML.BOOT_DEVICE_CDROM
|
||||
return DomainOs.BOOT_DEVICE_CDROM
|
||||
elif disk.device == DeviceDisk.DEVICE_FLOPPY:
|
||||
return OSXML.BOOT_DEVICE_FLOPPY
|
||||
return DomainOs.BOOT_DEVICE_FLOPPY
|
||||
else:
|
||||
return OSXML.BOOT_DEVICE_HARDDISK
|
||||
return DomainOs.BOOT_DEVICE_HARDDISK
|
||||
|
Loading…
Reference in New Issue
Block a user