osdict: Clean up 'default' handling usage

- Unify looking up osdict values
- Have Guest.py pass in its defaults, not encoding them in osdict
- Explicitly specify every device parameter that osdict handles, rather
    than have some psuedo magic dictionary format to handle it
This commit is contained in:
Cole Robinson 2013-08-11 15:29:31 -04:00
parent f220e6778c
commit 81ce0a1085
5 changed files with 228 additions and 249 deletions

View File

@ -0,0 +1,50 @@
<domain type="kvm">
<name>TestGuest</name>
<uuid>12345678-1234-1234-1234-123456789012</uuid>
<memory>409600</memory>
<currentMemory>204800</currentMemory>
<vcpu>5</vcpu>
<os>
<type arch="i686">hvm</type>
<boot dev="hd"/>
</os>
<features>
<acpi/>
<apic/>
</features>
<clock offset="utc"/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/lib/xen/bin/qemu-dm</emulator>
<disk type="file" device="floppy">
<driver name="qemu" type="qcow2"/>
<source file="/dev/default-pool/testvol1.img"/>
<target dev="fda" bus="fdc"/>
</disk>
<disk type="file" device="disk">
<driver name="qemu" type="raw"/>
<source file="/tmp/test.img"/>
<target dev="vda" bus="virtio"/>
</disk>
<disk type="block" device="disk">
<driver name="qemu" type="raw"/>
<source dev="/dev/loop0"/>
<target dev="vdb" bus="virtio"/>
</disk>
<disk type="block" device="cdrom">
<target dev="hdc" bus="ide"/>
<readonly/>
</disk>
<interface type="network">
<source network="default"/>
<mac address="22:22:33:44:55:66"/>
<model type="virtio"/>
</interface>
<input type="tablet" bus="usb"/>
<graphics type="sdl" display=":3.4" xauth="/tmp/.Xauthority"/>
<console type="pty"/>
<sound model="ac97"/>
</devices>
</domain>

View File

@ -17,7 +17,7 @@
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/lib/xen/bin/qemu-dm</emulator>
<emulator>/usr/libexec/qemu-kvm</emulator>
<disk type="file" device="floppy">
<driver name="qemu" type="qcow2" cache="none"/>
<source file="/dev/default-pool/testvol1.img"/>
@ -45,5 +45,6 @@
<input type="tablet" bus="usb"/>
<graphics type="sdl" display=":3.4" xauth="/tmp/.Xauthority"/>
<console type="pty"/>
<sound model="ich6"/>
</devices>
</domain>

View File

@ -296,7 +296,8 @@ class TestXMLConfig(unittest.TestCase):
Make sure device defaults are properly changed if we change OS
distro/variant mid process
"""
utils.set_conn(_plainkvm)
conn = utils.open_plainkvm(connver=12005)
utils.set_conn(conn)
i = utils.make_distro_installer()
g = utils.get_basic_fullyvirt_guest("kvm", installer=i)
@ -307,21 +308,27 @@ class TestXMLConfig(unittest.TestCase):
g.add_device(utils.get_filedisk())
g.add_device(utils.get_blkdisk())
g.add_device(utils.get_virtual_network())
g.add_device(VirtualAudio(g.conn))
# Call get_xml_config sets first round of defaults w/o os_variant set
g.get_install_xml(do_install)
g.os_variant = "fedora11"
self._compare(g, "install-f11", do_install)
self._compare(g, "install-f11-norheldefaults", do_install)
try:
virtinst.enable_rhel_defaults = True
origemu = g.emulator
g.emulator = "/usr/libexec/qemu-kvm"
g.conn._support_cache = {}
self._compare(g, "install-f11-rheldefaults", do_install)
g.emulator = origemu
g.conn._support_cache = {}
finally:
virtinst.enable_rhel_defaults = False
# Verify main guest wasn't polluted
self._compare(g, "install-f11", do_install)
self._compare(g, "install-f11-norheldefaults", do_install)
def testInstallFVImport(self):
i = utils.make_import_installer()

View File

@ -340,6 +340,7 @@ class Guest(XMLBuilder):
self._devices = [dev.copy() for dev in self._devices]
self.features = self.features.copy()
self.os = self.os.copy()
support.set_rhel6(self._is_rhel6())
except:
self._finish_get_xml(data)
raise
@ -347,6 +348,7 @@ class Guest(XMLBuilder):
def _finish_get_xml(self, data):
self._devices, self.features, self.os = data
support.set_rhel6(False)
def get_install_xml(self, *args, **kwargs):
data = self._prepare_get_xml()
@ -404,7 +406,7 @@ class Guest(XMLBuilder):
if not self.installer.has_install_phase():
return False
return self._lookup_osdict_key("cont")
return self._lookup_osdict_key("three_stage_install", False)
##########################
@ -624,7 +626,7 @@ class Guest(XMLBuilder):
return
if self.clock.offset is None:
self.clock.offset = self._lookup_osdict_key("clock")
self.clock.offset = self._lookup_osdict_key("clock", "utc")
def _set_emulator_defaults(self):
if self.os.is_xenpv():
@ -654,9 +656,9 @@ class Guest(XMLBuilder):
return
if self.features["acpi"] == "default":
self.features["acpi"] = self._lookup_osdict_key("acpi")
self.features["acpi"] = self._lookup_osdict_key("acpi", True)
if self.features["apic"] == "default":
self.features["apic"] = self._lookup_osdict_key("apic")
self.features["apic"] = self._lookup_osdict_key("apic", True)
if self.features["pae"] == "default":
self.features["pae"] = self.conn.caps.support_pae()
@ -673,7 +675,7 @@ class Guest(XMLBuilder):
self.add_device(ctrl)
def _set_disk_defaults(self):
os_disk_bus = self._lookup_device_param("disk", "bus")
os_disk_bus = self._lookup_osdict_key("diskbus", None)
def set_disk_bus(d):
if d.device == d.DEVICE_FLOPPY:
@ -710,7 +712,7 @@ class Guest(XMLBuilder):
used_targets.append(disk.generate_target(used_targets))
def _set_net_defaults(self):
net_model = self._lookup_device_param("interface", "model")
net_model = self._lookup_osdict_key("netmodel", None)
if not self.os.is_hvm():
net_model = None
@ -719,8 +721,8 @@ class Guest(XMLBuilder):
net.model = net_model
def _set_input_defaults(self):
input_type = self._lookup_device_param("input", "type")
input_bus = self._lookup_device_param("input", "bus")
input_type = self._lookup_osdict_key("inputtype", "mouse")
input_bus = self._lookup_osdict_key("inputbus", "ps2")
if self.os.is_xenpv():
input_type = virtinst.VirtualInputDevice.TYPE_MOUSE
input_bus = virtinst.VirtualInputDevice.BUS_XEN
@ -732,10 +734,18 @@ class Guest(XMLBuilder):
inp.bus = input_bus
def _set_sound_defaults(self):
sound_model = self._lookup_device_param("sound", "model")
if self.conn.check_conn_hv_support(
support.SUPPORT_CONN_HV_SOUND_ICH6, self.type):
default = "ich6"
elif self.conn.check_conn_hv_support(
support.SUPPORT_CONN_HV_SOUND_AC97, self.type):
default = "ac97"
else:
default = "es1370"
for sound in self.get_devices("sound"):
if sound.model == sound.MODEL_DEFAULT:
sound.model = sound_model
sound.model = default
def _set_video_defaults(self):
# QXL device (only if we use spice) - safe even if guest is VGA only
@ -746,7 +756,7 @@ class Guest(XMLBuilder):
if has_spice():
video_model = "qxl"
else:
video_model = self._lookup_device_param("video", "model")
video_model = self._lookup_osdict_key("videomodel", "cirrus")
for video in self.get_devices("video"):
if video.model == video.MODEL_DEFAULT:
@ -777,23 +787,10 @@ class Guest(XMLBuilder):
return (self.type in ["qemu", "kvm"] and
emulator.startswith("/usr/libexec/qemu"))
def _lookup_osdict_key(self, key):
def _lookup_osdict_key(self, key, default):
"""
Use self.os_variant to find key in OSTYPES
@returns: dict value, or None if os_type/variant wasn't set
"""
return osdict.lookup_osdict_key(self.conn, self.type,
self.os_variant, key)
def _lookup_device_param(self, device_key, param):
"""
Check the OS dictionary for the prefered device setting for passed
device type and param (bus, model, etc.)
"""
try:
support.set_rhel6(self._is_rhel6())
return osdict.lookup_device_param(self.conn, self.type,
self.os_variant,
device_key, param)
finally:
support.set_rhel6(False)
self.os_variant, key, default)

View File

@ -20,103 +20,39 @@
# MA 02110-1301 USA.
from virtinst import support
from virtinst import VirtualDevice
HV_ALL = "all"
# Default values for OS_TYPES keys. Can be overwritten at os_type or
# variant level
NET = VirtualDevice.VIRTUAL_DEV_NET
DISK = VirtualDevice.VIRTUAL_DEV_DISK
INPUT = VirtualDevice.VIRTUAL_DEV_INPUT
SOUND = VirtualDevice.VIRTUAL_DEV_AUDIO
VIDEO = VirtualDevice.VIRTUAL_DEV_VIDEO
VIRTIO_DISK = {
"bus" : [
(support.SUPPORT_CONN_HV_VIRTIO, "virtio"),
]
}
VIRTIO_NET = {
"model" : [
(support.SUPPORT_CONN_HV_VIRTIO, "virtio"),
]
}
USB_TABLET = {
"type" : [
(HV_ALL, "tablet"),
],
"bus" : [
(HV_ALL, "usb"),
]
}
VGA_VIDEO = {
"model": [
(HV_ALL, "vga"),
]
}
VMVGA_VIDEO = {
"model": [
(HV_ALL, "vmvga"),
]
}
DEFAULTS = {
"acpi": True,
"apic": True,
"clock": "utc",
"cont": False,
"distro": None,
"label": None,
"supported": False,
"devices" : {
# "devname" : {"attribute" : [(["applicable", "hv-type", list"],
# "recommended value for hv-types"),]},
INPUT : {
"type" : [
(HV_ALL, "mouse")
],
"bus" : [
(HV_ALL, "ps2")
],
},
DISK : {
"bus" : [
(HV_ALL, None)
],
},
NET : {
"model": [
(HV_ALL, None)
],
},
SOUND : {
"model": [
(support.SUPPORT_CONN_HV_SOUND_ICH6, "ich6"),
(support.SUPPORT_CONN_HV_SOUND_AC97, "ac97"),
(HV_ALL, "es1370"),
]
},
VIDEO : {
"model": [
(HV_ALL, "cirrus"),
]
},
}
}
_SENTINEL = -1234
OS_TYPES = {}
class _SupportCheck(object):
"""
Class for encapsulating complex support checks.
Example: Fedora 18 supports virtio disks, but we only want to
use virtio if the HV supports it. So this is initialized like:
_SupportCheck(support.SUPPORT_CONN_HV_VIRTIO, "virtio")
And that object should be passed to the diskbus value of _OSVariant.
"""
def __init__(self, key, val):
self._checks = []
self.add_check(key, val)
def add_check(self, key, val):
self._checks.append((key, val))
def check(self, conn, hv_type):
for (support_key, value) in self._checks:
if conn.check_conn_hv_support(support_key, hv_type):
return value
return _SENTINEL
_DISK_BUS_VIRTIO = _SupportCheck(support.SUPPORT_CONN_HV_VIRTIO, "virtio")
_NET_MODEL_VIRTIO = _SupportCheck(support.SUPPORT_CONN_HV_VIRTIO, "virtio")
_ACPI_OLD_XEN = _SupportCheck(support.SUPPORT_CONN_HV_SKIP_DEFAULT_ACPI, False)
_allvariants = {}
@ -191,124 +127,111 @@ def list_os(list_types=False, typename=None,
return _sort(sortmap, **kwargs)
def parse_key_entry(conn, hv_type, key_entry, defaults):
ret = None
found = False
if type(key_entry) == list:
# List of tuples with (support -> value) mappings
for tup in key_entry:
support_key = tup[0]
value = tup[1]
# HV_ALL means don't check for support, just return the value
if support_key != HV_ALL:
support_ret = conn.check_conn_hv_support(support_key, hv_type)
if support_ret is not True:
continue
found = True
ret = value
break
def lookup_osdict_key(conn, hv_type, variant, key, default):
if variant is not None:
val = getattr(_allvariants[variant], key)
if isinstance(val, _SupportCheck):
val = val.check(conn, hv_type)
else:
found = True
ret = key_entry
if not found and defaults:
ret = parse_key_entry(conn, hv_type, defaults, None)
return ret
def lookup_osdict_key(conn, hv_type, var, key):
defaults = DEFAULTS[key]
dictval = defaults
if var is not None:
vardict = _allvariants[var].to_dict()
if key in vardict:
dictval = vardict[key]
return parse_key_entry(conn, hv_type, dictval, defaults)
def lookup_device_param(conn, hv_type, var, device_key, param):
os_devs = lookup_osdict_key(conn, hv_type, var, "devices")
defaults = DEFAULTS["devices"]
for devs in [os_devs, defaults]:
if device_key not in devs:
continue
return parse_key_entry(conn, hv_type, devs[device_key][param],
defaults.get(param))
raise RuntimeError(_("Invalid dictionary entry for device '%s %s'" %
(device_key, param)))
val = _SENTINEL
if val == _SENTINEL:
val = default
return val
class _OSVariant(object):
"""
Object tracking guest OS specific configuration bits.
@name: name of the object. This must be lowercase. This becomes part of
the virt-install command line API so we cannot remove any existing
name (we could probably add aliases though)
@label: Pretty printed label. This is used in the virt-manager UI.
We can tweak this.
@is_type: virt-install historically had a distinction between an
os 'type' (windows, linux, etc), and an os 'variant' (fedora18,
winxp, etc). Back in 2009 we actually required the user to
specify --os-type if specifying an --os-variant even though we
could figure it out easily. This distinction isn't needed any
more, though it's still baked into the virt-manager UI where
it is still pretty useful, so we fake it here. New types should
not be added often.
@parent: Name of a pre-created variant that we want to extend. So
fedoraFOO would have parent fedoraFOO-1. It's used for inheiriting
values.
@sortby: A different key to use for sorting the distro list. By default
it's 'name', so this doesn't need to be specified.
@distro: This is a distro class. It's wired up in urlfetcher to give
us a shortcut when detecting OS type from a URL.
@supported: If this distro is supported by it's owning organization,
like is it still receiving updates. We use this to limit the
distros we show in virt-manager by default, so old distros aren't
squeezing out current ones.
@three_stage_install: If True, this VM has a 3 stage install, AKA windows.
The rest of the parameters are about setting device/guest defaults
based on the OS. They should be self explanatory. See guest.py for
their usage.
"""
def __init__(self, name, label, is_type=False,
sortby=None, parent=_SENTINEL,
distro=_SENTINEL, cont=_SENTINEL, supported=_SENTINEL,
devices=_SENTINEL, acpi=_SENTINEL,
apic=_SENTINEL, clock=_SENTINEL):
if parent == _SENTINEL:
distro=_SENTINEL, supported=_SENTINEL,
three_stage_install=_SENTINEL,
acpi=_SENTINEL, apic=_SENTINEL, clock=_SENTINEL,
netmodel=_SENTINEL, diskbus=_SENTINEL,
inputtype=_SENTINEL, inputbus=_SENTINEL,
videomodel=_SENTINEL):
if is_type:
if parent != _SENTINEL:
raise RuntimeError("OS types must not specify parent")
parent = None
elif parent == _SENTINEL:
raise RuntimeError("Must specify explicit parent")
elif parent is None:
if not is_type:
raise RuntimeError("Only OS types can have parent=None")
else:
parent = _allvariants[parent]
def _get_default(name, val, default):
def _get_default(name, val, default=_SENTINEL):
if val == _SENTINEL:
if parent:
return getattr(parent, name)
return default
if not parent:
return default
return getattr(parent, name)
return val
self.name = name.lower()
if name != name.lower():
raise RuntimeError("OS dictionary wants lowercase name, not "
"'%s'" % name)
self.name = name
self.label = label
self.sortby = sortby
self.is_type = bool(is_type)
self.typename = _get_default("typename", _SENTINEL, self.name)
self.typename = _get_default("typename",
self.is_type and self.name or _SENTINEL)
# 'types' should rarely be altered, this check will make
# doubly sure that a new type isn't accidentally added
_approved_types = ["linux", "windows", "unix",
"solaris", "other"]
if self.typename not in _approved_types:
raise RuntimeError("type '%s' for variant '%s' not in list "
"of approved distro types %s" %
(self.typename, self.name, _approved_types))
self.distro = _get_default("distro", distro, None)
self.supported = bool(_get_default("supported", supported, False))
self.cont = bool(_get_default("cont", cont, False))
self.supported = _get_default("supported", supported, False)
self.three_stage_install = _get_default("three_stage_install",
three_stage_install)
self.devices = _get_default("devices", devices, None)
self.acpi = _get_default("acpi", acpi, None)
self.apic = _get_default("apic", apic, None)
self.clock = _get_default("clock", clock, None)
self.acpi = _get_default("acpi", acpi)
self.apic = _get_default("apic", apic)
self.clock = _get_default("clock", clock)
def to_dict(self):
ret = {}
allparams = ["label", "distro", "sortby", "supported",
"cont", "devices", "apic", "acpi", "clock"]
canfalse = ["apic", "acpi"]
for param in allparams:
val = getattr(self, param)
if param in canfalse and val is False:
pass
elif not val:
continue
ret[param] = val
return ret
# 'types' should rarely be altered, this check will make
# doubly sure that a new type isn't accidentally added
_approved_types = ["linux", "windows", "unix", "solaris", "other"]
self.netmodel = _get_default("netmodel", netmodel)
self.videomodel = _get_default("videomodel", videomodel)
self.diskbus = _get_default("diskbus", diskbus)
self.inputtype = _get_default("inputtype", inputtype)
self.inputbus = _get_default("inputbus", inputbus)
def _add_type(*args, **kwargs):
@ -317,18 +240,21 @@ def _add_type(*args, **kwargs):
_allvariants[_t.name] = _t
def _add_var(*args, **kwargs):
v = _OSVariant(*args, **kwargs)
_allvariants[v.name] = v
_add_type("linux", "Linux", parent=None)
_add_type("linux", "Linux")
_add_var("rhel2.1", "Red Hat Enterprise Linux 2.1", distro="rhel", parent="linux")
_add_var("rhel3", "Red Hat Enterprise Linux 3", parent="rhel2.1")
_add_var("rhel4", "Red Hat Enterprise Linux 4", supported=True, parent="rhel3")
_add_var("rhel5", "Red Hat Enterprise Linux 5", supported=False, parent="rhel4")
_add_var("rhel5.4", "Red Hat Enterprise Linux 5.4 or later", supported=True, devices={DISK: VIRTIO_DISK, NET: VIRTIO_NET}, parent="rhel5")
_add_var("rhel6", "Red Hat Enterprise Linux 6", devices={DISK: VIRTIO_DISK, NET: VIRTIO_NET, INPUT: USB_TABLET}, parent="rhel5.4")
_add_var("rhel5.4", "Red Hat Enterprise Linux 5.4 or later", supported=True, diskbus=_DISK_BUS_VIRTIO, netmodel=_NET_MODEL_VIRTIO, parent="rhel5")
_add_var("rhel6", "Red Hat Enterprise Linux 6", diskbus=_DISK_BUS_VIRTIO, netmodel=_NET_MODEL_VIRTIO, inputtype="tablet", inputbus="usb", parent="rhel5.4")
_add_var("rhel7", "Red Hat Enterprise Linux 7", supported=False, parent="rhel6")
_add_var("fedora5", "Fedora Core 5", sortby="fedora05", distro="fedora", parent="linux")
@ -337,9 +263,9 @@ _add_var("fedora7", "Fedora 7", sortby="fedora07", parent="fedora6")
_add_var("fedora8", "Fedora 8", sortby="fedora08", parent="fedora7")
# Apparently F9 has selinux errors when installing with virtio:
# https: //bugzilla.redhat.com/show_bug.cgi?id=470386
_add_var("fedora9", "Fedora 9", sortby="fedora09", devices={NET: VIRTIO_NET}, parent="fedora8")
_add_var("fedora10", "Fedora 10", devices={DISK: VIRTIO_DISK, NET: VIRTIO_NET}, parent="fedora9")
_add_var("fedora11", "Fedora 11", devices={DISK: VIRTIO_DISK, NET: VIRTIO_NET, INPUT: USB_TABLET}, parent="fedora10")
_add_var("fedora9", "Fedora 9", sortby="fedora09", netmodel=_NET_MODEL_VIRTIO, parent="fedora8")
_add_var("fedora10", "Fedora 10", diskbus=_DISK_BUS_VIRTIO, netmodel=_NET_MODEL_VIRTIO, parent="fedora9")
_add_var("fedora11", "Fedora 11", diskbus=_DISK_BUS_VIRTIO, netmodel=_NET_MODEL_VIRTIO, inputtype="tablet", inputbus="usb", parent="fedora10")
_add_var("fedora12", "Fedora 12", parent="fedora11")
_add_var("fedora13", "Fedora 13", parent="fedora12")
_add_var("fedora14", "Fedora 14", parent="fedora13")
@ -349,30 +275,30 @@ _add_var("fedora17", "Fedora 17", supported=True, parent="fedora16")
_add_var("fedora18", "Fedora 18", parent="fedora17")
_add_var("fedora19", "Fedora 19", parent="fedora18")
_add_var("opensuse11", "openSuse 11", distro="suse", supported=True, devices={DISK: VIRTIO_DISK, NET: VIRTIO_NET}, parent="linux")
_add_var("opensuse11", "openSuse 11", distro="suse", supported=True, diskbus=_DISK_BUS_VIRTIO, netmodel=_NET_MODEL_VIRTIO, parent="linux")
_add_var("opensuse12", "openSuse 12", parent="opensuse11")
_add_var("sles10", "Suse Linux Enterprise Server", distro="suse", supported=True, parent="linux")
_add_var("sles11", "Suse Linux Enterprise Server 11", supported=True, devices={DISK: VIRTIO_DISK, NET: VIRTIO_NET}, parent="sles10")
_add_var("sles11", "Suse Linux Enterprise Server 11", supported=True, diskbus=_DISK_BUS_VIRTIO, netmodel=_NET_MODEL_VIRTIO, parent="sles10")
_add_var("mandriva2009", "Mandriva Linux 2009 and earlier", distro="mandriva", parent="linux")
_add_var("mandriva2010", "Mandriva Linux 2010 and later", devices={DISK: VIRTIO_DISK, NET: VIRTIO_NET}, parent="mandriva2009")
_add_var("mandriva2010", "Mandriva Linux 2010 and later", diskbus=_DISK_BUS_VIRTIO, netmodel=_NET_MODEL_VIRTIO, parent="mandriva2009")
_add_var("mes5", "Mandriva Enterprise Server 5.0", distro="mandriva", parent="linux")
_add_var("mes5.1", "Mandriva Enterprise Server 5.1 and later", supported=True, devices={DISK: VIRTIO_DISK, NET: VIRTIO_NET}, parent="mes5")
_add_var("mes5.1", "Mandriva Enterprise Server 5.1 and later", supported=True, diskbus=_DISK_BUS_VIRTIO, netmodel=_NET_MODEL_VIRTIO, parent="mes5")
_add_var("mageia1", "Mageia 1 and later", distro="mageia", supported=True, devices={DISK: VIRTIO_DISK, NET: VIRTIO_NET, INPUT: USB_TABLET}, parent="linux")
_add_var("mageia1", "Mageia 1 and later", distro="mageia", supported=True, diskbus=_DISK_BUS_VIRTIO, netmodel=_NET_MODEL_VIRTIO, inputtype="tablet", inputbus="usb", parent="linux")
_add_var("altlinux", "ALT Linux", distro="altlinux", supported=True, devices={DISK: VIRTIO_DISK, NET: VIRTIO_NET, INPUT: USB_TABLET}, parent="linux")
_add_var("altlinux", "ALT Linux", distro="altlinux", supported=True, diskbus=_DISK_BUS_VIRTIO, netmodel=_NET_MODEL_VIRTIO, inputtype="tablet", inputbus="usb", parent="linux")
_add_var("debianetch", "Debian Etch", distro="debian", sortby="debian4", parent="linux")
_add_var("debianlenny", "Debian Lenny", sortby="debian5", supported=True, devices={DISK: VIRTIO_DISK, NET: VIRTIO_NET}, parent="debianetch")
_add_var("debiansqueeze", "Debian Squeeze", sortby="debian6", devices={DISK: VIRTIO_DISK, NET: VIRTIO_NET, INPUT: USB_TABLET}, parent="debianlenny")
_add_var("debianlenny", "Debian Lenny", sortby="debian5", supported=True, diskbus=_DISK_BUS_VIRTIO, netmodel=_NET_MODEL_VIRTIO, parent="debianetch")
_add_var("debiansqueeze", "Debian Squeeze", sortby="debian6", diskbus=_DISK_BUS_VIRTIO, netmodel=_NET_MODEL_VIRTIO, inputtype="tablet", inputbus="usb", parent="debianlenny")
_add_var("debianwheezy", "Debian Wheezy", sortby="debian7", parent="debiansqueeze")
_add_var("ubuntuhardy", "Ubuntu 8.04 LTS (Hardy Heron)", distro="ubuntu", devices={NET: VIRTIO_NET}, parent="linux")
_add_var("ubuntuhardy", "Ubuntu 8.04 LTS (Hardy Heron)", distro="ubuntu", netmodel=_NET_MODEL_VIRTIO, parent="linux")
_add_var("ubuntuintrepid", "Ubuntu 8.10 (Intrepid Ibex)", parent="ubuntuhardy")
_add_var("ubuntujaunty", "Ubuntu 9.04 (Jaunty Jackalope)", devices={DISK: VIRTIO_DISK, NET: VIRTIO_NET}, parent="ubuntuintrepid")
_add_var("ubuntujaunty", "Ubuntu 9.04 (Jaunty Jackalope)", diskbus=_DISK_BUS_VIRTIO, netmodel=_NET_MODEL_VIRTIO, parent="ubuntuintrepid")
_add_var("ubuntukarmic", "Ubuntu 9.10 (Karmic Koala)", parent="ubuntujaunty")
_add_var("ubuntulucid", "Ubuntu 10.04 LTS (Lucid Lynx)", supported=True, parent="ubuntukarmic")
_add_var("ubuntumaverick", "Ubuntu 10.10 (Maverick Meerkat)", supported=False, parent="ubuntulucid")
@ -380,18 +306,17 @@ _add_var("ubuntunatty", "Ubuntu 11.04 (Natty Narwhal)", parent="ubuntumaverick")
_add_var("ubuntuoneiric", "Ubuntu 11.10 (Oneiric Ocelot)", parent="ubuntunatty")
_add_var("ubuntuprecise", "Ubuntu 12.04 LTS (Precise Pangolin)", supported=True, parent="ubuntuoneiric")
_add_var("ubuntuquantal", "Ubuntu 12.10 (Quantal Quetzal)", parent="ubuntuprecise")
_add_var("ubunturaring", "Ubuntu 13.04 (Raring Ringtail)", devices={DISK: VIRTIO_DISK, NET: VIRTIO_NET, VIDEO: VMVGA_VIDEO}, parent="ubuntuquantal")
_add_var("ubunturaring", "Ubuntu 13.04 (Raring Ringtail)", diskbus=_DISK_BUS_VIRTIO, netmodel=_NET_MODEL_VIRTIO, videomodel="vmvga", parent="ubuntuquantal")
_add_var("ubuntusaucy", "Ubuntu 13.10 (Saucy Salamander)", parent="ubunturaring")
_add_var("generic24", "Generic 2.4.x kernel", parent="linux")
_add_var("generic26", "Generic 2.6.x kernel", parent="generic24")
_add_var("virtio26", "Generic 2.6.25 or later kernel with virtio", sortby="genericvirtio26", devices={DISK: VIRTIO_DISK, NET: VIRTIO_NET}, parent="generic26")
_add_var("virtio26", "Generic 2.6.25 or later kernel with virtio", sortby="genericvirtio26", diskbus=_DISK_BUS_VIRTIO, netmodel=_NET_MODEL_VIRTIO, parent="generic26")
_add_type("windows", "Windows", clock="localtime", cont=True, devices={INPUT: USB_TABLET, VIDEO: VGA_VIDEO}, parent=None)
_add_var("win2k", "Microsoft Windows 2000", sortby="mswin4", acpi=[(support.SUPPORT_CONN_HV_SKIP_DEFAULT_ACPI, False)], apic=[(support.SUPPORT_CONN_HV_SKIP_DEFAULT_ACPI, False)], parent="windows")
_add_var("winxp", "Microsoft Windows XP", sortby="mswin5", supported=True, acpi=[(support.SUPPORT_CONN_HV_SKIP_DEFAULT_ACPI, False)], apic=[(support.SUPPORT_CONN_HV_SKIP_DEFAULT_ACPI, False)], parent="windows")
_add_type("windows", "Windows", clock="localtime", three_stage_install=True, inputtype="tablet", inputbus="usb", videomodel="vga")
_add_var("win2k", "Microsoft Windows 2000", sortby="mswin4", acpi=_ACPI_OLD_XEN, apic=_ACPI_OLD_XEN, parent="windows")
_add_var("winxp", "Microsoft Windows XP", sortby="mswin5", supported=True, acpi=_ACPI_OLD_XEN, apic=_ACPI_OLD_XEN, parent="windows")
_add_var("winxp64", "Microsoft Windows XP (x86_64)", supported=True, sortby="mswin564", parent="windows")
_add_var("win2k3", "Microsoft Windows Server 2003", supported=True, sortby="mswinserv2003", parent="windows")
_add_var("win2k8", "Microsoft Windows Server 2008", supported=True, sortby="mswinserv2008", parent="windows")
@ -399,26 +324,25 @@ _add_var("vista", "Microsoft Windows Vista", supported=True, sortby="mswin6", pa
_add_var("win7", "Microsoft Windows 7", supported=True, sortby="mswin7", parent="windows")
_add_type("solaris", "Solaris", clock="localtime", parent=None)
_add_type("solaris", "Solaris", clock="localtime")
_add_var("solaris9", "Sun Solaris 9", parent="solaris")
_add_var("solaris10", "Sun Solaris 10", devices={INPUT: USB_TABLET}, parent="solaris")
_add_var("opensolaris", "Sun OpenSolaris", devices={INPUT: USB_TABLET}, parent="solaris")
_add_var("solaris10", "Sun Solaris 10", inputtype="tablet", inputbus="usb", parent="solaris")
_add_var("opensolaris", "Sun OpenSolaris", inputtype="tablet", inputbus="usb", parent="solaris")
_add_type("unix", "UNIX", parent=None)
_add_type("unix", "UNIX")
# http: //www.nabble.com/Re%3A-Qemu%3A-bridging-on-FreeBSD-7.0-STABLE-p15919603.html
_add_var("freebsd6", "FreeBSD 6.x", devices={NET: {"model": [(HV_ALL, "ne2k_pci")]}}, parent="unix")
_add_var("freebsd6", "FreeBSD 6.x", netmodel="ne2k_pci", parent="unix")
_add_var("freebsd7", "FreeBSD 7.x", parent="freebsd6")
_add_var("freebsd8", "FreeBSD 8.x", supported=True, devices={NET: {"model": [(HV_ALL, "e1000")]}}, parent="freebsd7")
_add_var("freebsd8", "FreeBSD 8.x", supported=True, netmodel="e1000", parent="freebsd7")
_add_var("freebsd9", "FreeBSD 9.x", parent="freebsd8")
_add_var("freebsd10", "FreeBSD 10.x", supported=False, devices={DISK: VIRTIO_DISK, NET: VIRTIO_NET}, parent="freebsd9")
_add_var("freebsd10", "FreeBSD 10.x", supported=False, diskbus=_DISK_BUS_VIRTIO, netmodel=_NET_MODEL_VIRTIO, parent="freebsd9")
# http: //calamari.reverse-dns.net: 980/cgi-bin/moin.cgi/OpenbsdOnQemu
# https: //www.redhat.com/archives/et-mgmt-tools/2008-June/msg00018.html
_add_var("openbsd4", "OpenBSD 4.x", devices={NET: {"model": [(HV_ALL, "pcnet")]}}, parent="unix")
_add_var("openbsd4", "OpenBSD 4.x", netmodel="pcnet", parent="unix")
_add_type("other", "Other", parent=None)
_add_type("other", "Other")
_add_var("msdos", "MS-DOS", acpi=False, apic=False, parent="other")
_add_var("netware4", "Novell Netware 4", parent="other")
_add_var("netware5", "Novell Netware 5", parent="other")