mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 17:57:34 +03:00
qemu ARM support: wire up virtio, fix a bunch of defaults
This has some fallout on non-x86 tests which were wrong to begin with. There's still some missing bits but this is the jist of it.
This commit is contained in:
parent
8c6149d3f3
commit
e52f6050fa
37
tests/cli-test-xml/compare/arm-vexpress-f19.xml
Normal file
37
tests/cli-test-xml/compare/arm-vexpress-f19.xml
Normal file
@ -0,0 +1,37 @@
|
||||
<domain type="qemu">
|
||||
<name>foobar</name>
|
||||
<uuid>00000000-1111-2222-3333-444444444444</uuid>
|
||||
<memory>65536</memory>
|
||||
<currentMemory>65536</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<os>
|
||||
<type arch="armv7l" machine="vexpress-a15">hvm</type>
|
||||
<kernel>/f19-arm.kernel</kernel>
|
||||
<initrd>/f19-arm.initrd</initrd>
|
||||
<cmdline>console=ttyAMA0 rw root=/dev/vda3</cmdline>
|
||||
<dtb>/f19-arm.dtb</dtb>
|
||||
</os>
|
||||
<features>
|
||||
<acpi/>
|
||||
<apic/>
|
||||
<pae/>
|
||||
</features>
|
||||
<clock offset="utc"/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
<on_crash>restart</on_crash>
|
||||
<devices>
|
||||
<emulator>/usr/bin/qemu-system-arm</emulator>
|
||||
<disk type="file" device="disk">
|
||||
<driver name="qemu"/>
|
||||
<source file="/tmp/__virtinst_cli_exist1.img"/>
|
||||
<target dev="vda" bus="virtio"/>
|
||||
</disk>
|
||||
<interface type="network">
|
||||
<source network="default"/>
|
||||
<mac address="00:11:22:33:44:55"/>
|
||||
<model type="virtio"/>
|
||||
</interface>
|
||||
<console type="pty"/>
|
||||
</devices>
|
||||
</domain>
|
36
tests/cli-test-xml/compare/arm-vexpress-plain.xml
Normal file
36
tests/cli-test-xml/compare/arm-vexpress-plain.xml
Normal file
@ -0,0 +1,36 @@
|
||||
<domain type="qemu">
|
||||
<name>foobar</name>
|
||||
<uuid>00000000-1111-2222-3333-444444444444</uuid>
|
||||
<memory>65536</memory>
|
||||
<currentMemory>65536</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<os>
|
||||
<type arch="armv7l" machine="vexpress-a9">hvm</type>
|
||||
<kernel>/f19-arm.kernel</kernel>
|
||||
<initrd>/f19-arm.initrd</initrd>
|
||||
<cmdline>console=ttyAMA0 rw root=/dev/mmcblk0p3</cmdline>
|
||||
<dtb>/f19-arm.dtb</dtb>
|
||||
</os>
|
||||
<features>
|
||||
<acpi/>
|
||||
<apic/>
|
||||
<pae/>
|
||||
</features>
|
||||
<clock offset="utc"/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
<on_crash>restart</on_crash>
|
||||
<devices>
|
||||
<emulator>/usr/bin/qemu-system-arm</emulator>
|
||||
<disk type="file" device="disk">
|
||||
<driver name="qemu"/>
|
||||
<source file="/tmp/__virtinst_cli_exist1.img"/>
|
||||
<target dev="sda" bus="sd"/>
|
||||
</disk>
|
||||
<interface type="network">
|
||||
<source network="default"/>
|
||||
<mac address="00:11:22:33:44:55"/>
|
||||
</interface>
|
||||
<console type="pty"/>
|
||||
</devices>
|
||||
</domain>
|
@ -23,7 +23,6 @@
|
||||
<source network="default"/>
|
||||
<mac address="00:11:22:33:44:55"/>
|
||||
</interface>
|
||||
<input type="tablet" bus="usb"/>
|
||||
<graphics type="sdl" display=":3.4" xauth="/tmp/.Xauthority"/>
|
||||
<console type="pty"/>
|
||||
<video>
|
||||
|
@ -21,7 +21,6 @@
|
||||
<source network="default"/>
|
||||
<mac address="00:11:22:33:44:55"/>
|
||||
</interface>
|
||||
<input type="mouse" bus="xen"/>
|
||||
<graphics type="vnc" port="-1" keymap="en-us"/>
|
||||
<video>
|
||||
<model type="cirrus"/>
|
||||
|
@ -29,7 +29,6 @@
|
||||
<source network="default"/>
|
||||
<mac address="00:11:22:33:44:55"/>
|
||||
</interface>
|
||||
<input type="mouse" bus="ps2"/>
|
||||
<graphics type="vnc" port="-1" keymap="en-us"/>
|
||||
<console type="pty"/>
|
||||
<video>
|
||||
@ -66,7 +65,6 @@
|
||||
<source network="default"/>
|
||||
<mac address="00:11:22:33:44:55"/>
|
||||
</interface>
|
||||
<input type="mouse" bus="ps2"/>
|
||||
<graphics type="vnc" port="-1" keymap="en-us"/>
|
||||
<console type="pty"/>
|
||||
<video>
|
||||
|
@ -26,7 +26,6 @@
|
||||
<source network="default"/>
|
||||
<mac address="00:11:22:33:44:55"/>
|
||||
</interface>
|
||||
<input type="mouse" bus="xen"/>
|
||||
<graphics type="vnc" port="-1" keymap="en-us"/>
|
||||
<video>
|
||||
<model type="cirrus"/>
|
||||
@ -56,7 +55,6 @@
|
||||
<source network="default"/>
|
||||
<mac address="00:11:22:33:44:55"/>
|
||||
</interface>
|
||||
<input type="mouse" bus="xen"/>
|
||||
<graphics type="vnc" port="-1" keymap="en-us"/>
|
||||
<video>
|
||||
<model type="cirrus"/>
|
||||
|
@ -130,6 +130,8 @@ class Command(object):
|
||||
"""
|
||||
Instance of a single cli command to test
|
||||
"""
|
||||
SKIP = -123
|
||||
|
||||
def __init__(self, cmd):
|
||||
self.cmdstr = cmd % test_files
|
||||
self.check_success = True
|
||||
@ -142,17 +144,21 @@ class Command(object):
|
||||
def _launch_command(self):
|
||||
logging.debug(self.cmdstr)
|
||||
|
||||
uri = None
|
||||
conn = None
|
||||
app = self.argv[0]
|
||||
conn = None
|
||||
|
||||
for idx in reversed(range(len(self.argv))):
|
||||
if self.argv[idx] == "--connect":
|
||||
uri = self.argv[idx + 1]
|
||||
conn = virtinst.cli.getConnection(self.argv[idx + 1])
|
||||
break
|
||||
|
||||
if uri:
|
||||
conn = open_conn(uri)
|
||||
if not conn and "virt-convert" not in app:
|
||||
raise RuntimeError("couldn't parse URI from command %s" %
|
||||
self.argv)
|
||||
|
||||
skipmsg = self._skip_msg(conn)
|
||||
if skipmsg is not None:
|
||||
return (self.SKIP, skipmsg)
|
||||
|
||||
oldstdout = sys.stdout
|
||||
oldstderr = sys.stderr
|
||||
@ -199,19 +205,24 @@ class Command(object):
|
||||
except Exception, e:
|
||||
return (-1, "".join(traceback.format_exc()) + str(e))
|
||||
|
||||
def skip_msg(self):
|
||||
def _skip_msg(self, conn):
|
||||
if self.support_check is None:
|
||||
return
|
||||
if _defaultconn.check_conn_support(self.support_check):
|
||||
if conn is None:
|
||||
raise RuntimeError("support_check is not None, but conn is None")
|
||||
if conn.check_conn_support(self.support_check):
|
||||
return
|
||||
return "skipped"
|
||||
|
||||
def run(self):
|
||||
def run(self, tests):
|
||||
filename = self.compare_file
|
||||
err = None
|
||||
|
||||
try:
|
||||
code, output = self._get_output()
|
||||
if code == self.SKIP:
|
||||
tests.skipTest(output)
|
||||
return
|
||||
|
||||
if bool(code) == self.check_success:
|
||||
raise AssertionError(
|
||||
@ -231,7 +242,8 @@ class Command(object):
|
||||
except AssertionError, e:
|
||||
err = self.cmdstr + "\n" + str(e)
|
||||
|
||||
return err
|
||||
if err:
|
||||
tests.fail(err)
|
||||
|
||||
|
||||
class PromptCheck(object):
|
||||
@ -446,6 +458,8 @@ c.add_compare("--os-variant fedora14 --nodisks --boot cdrom --virt-type qemu --c
|
||||
c.add_compare("--os-variant fedora14 --nodisks --boot network --nographics --arch i686", "qemu-32-on-64") # 32 on 64
|
||||
c.add_compare("--os-variant fedora14 --nodisks --boot fd --graphics spice --machine pc", "kvm-machine") # kvm machine type 'pc'
|
||||
c.add_compare("--os-variant fedora14 --nodisks --boot fd --graphics sdl --arch sparc --machine SS-20", "qemu-sparc") # exotic arch + machine type
|
||||
c.add_compare("--arch armv7l --machine vexpress-a9 --boot kernel=/f19-arm.kernel,initrd=/f19-arm.initrd,dtb=/f19-arm.dtb,kernel_args=\"console=ttyAMA0 rw root=/dev/mmcblk0p3\" --disk %(EXISTIMG1)s --nographics", "arm-vexpress-plain", support_check=support.SUPPORT_CONN_DISK_SD)
|
||||
c.add_compare("--arch armv7l --machine vexpress-a15 --boot kernel=/f19-arm.kernel,initrd=/f19-arm.initrd,dtb=/f19-arm.dtb,kernel_args=\"console=ttyAMA0 rw root=/dev/vda3\" --disk %(EXISTIMG1)s --nographics --os-variant fedora19", "arm-vexpress-f19", support_check=support.SUPPORT_CONN_VIRTIO_MMIO)
|
||||
c.add_valid("--cdrom %(EXISTIMG2)s --file %(EXISTIMG1)s --os-variant win2k3 --wait 0 --sound") # HVM windows install with disk
|
||||
c.add_valid("--os-variant fedora14 --file %(EXISTIMG1)s --location %(TREEDIR)s --extra-args console=ttyS0 --sound") # F14 Directory tree URL install with extra-args
|
||||
c.add_invalid("--nodisks --boot network --machine foobar") # Unknown machine type
|
||||
@ -821,14 +835,6 @@ promptlist.append(p7)
|
||||
# Test runner functions #
|
||||
#########################
|
||||
|
||||
|
||||
def open_conn(uri):
|
||||
#if uri not in _conns:
|
||||
# _conns[uri] = virtinst.cli.getConnection(uri)
|
||||
#return _conns[uri]
|
||||
return virtinst.cli.getConnection(uri)
|
||||
|
||||
|
||||
newidx = 0
|
||||
curtest = 0
|
||||
old_bridge = virtinst.util.default_bridge
|
||||
@ -880,13 +886,7 @@ class CLITests(unittest.TestCase):
|
||||
|
||||
def maketest(cmd):
|
||||
def cmdtemplate(self, _cmdobj):
|
||||
skipmsg = _cmdobj.skip_msg()
|
||||
if skipmsg:
|
||||
self.skipTest(skipmsg)
|
||||
|
||||
err = _cmdobj.run()
|
||||
if err:
|
||||
self.fail(err)
|
||||
_cmdobj.run(self)
|
||||
return lambda s: cmdtemplate(s, cmd)
|
||||
|
||||
_cmdlist = promptlist
|
||||
|
@ -545,6 +545,8 @@ class vmmAddHardware(vmmGObjectUI):
|
||||
if self.vm.get_hv_type() in ["qemu", "kvm", "test"]:
|
||||
add_dev("sata", virtinst.VirtualDisk.DEVICE_DISK,
|
||||
_("SATA disk"))
|
||||
add_dev("sd", virtinst.VirtualDisk.DEVICE_DISK,
|
||||
_("SD disk"))
|
||||
add_dev("virtio", virtinst.VirtualDisk.DEVICE_DISK,
|
||||
_("Virtio disk"))
|
||||
add_dev("virtio", virtinst.VirtualDisk.DEVICE_LUN,
|
||||
|
@ -1411,17 +1411,6 @@ class vmmCreate(vmmGObjectUI):
|
||||
gdev.type = gtype
|
||||
return gdev
|
||||
|
||||
def get_video_device(self, guest):
|
||||
if guest.os.is_container():
|
||||
return
|
||||
return virtinst.VirtualVideoDevice(guest.conn)
|
||||
|
||||
def get_sound_device(self, guest):
|
||||
if (not self.config.get_new_vm_sound() or
|
||||
guest.os.is_container()):
|
||||
return
|
||||
return virtinst.VirtualAudio(guest.conn)
|
||||
|
||||
def build_guest(self, installer, name):
|
||||
guest = self.conn.caps.build_virtinst_guest(self.conn.get_backend(),
|
||||
self.capsguest,
|
||||
@ -1438,16 +1427,16 @@ class vmmCreate(vmmGObjectUI):
|
||||
|
||||
# Set up default devices
|
||||
try:
|
||||
devs = []
|
||||
devs.append(self.get_graphics_device(guest))
|
||||
devs.append(self.get_video_device(guest))
|
||||
devs.append(self.get_sound_device(guest))
|
||||
for dev in devs:
|
||||
if dev:
|
||||
guest.add_device(dev)
|
||||
gdev = self.get_graphics_device(guest)
|
||||
if gdev:
|
||||
guest.add_device(gdev)
|
||||
|
||||
guest.add_default_video_device()
|
||||
guest.add_default_input_device()
|
||||
guest.add_default_console_device()
|
||||
if self.config.get_new_vm_sound():
|
||||
guest.add_default_sound_device()
|
||||
|
||||
except Exception, e:
|
||||
self.err.show_err(_("Error setting up default devices:") + str(e))
|
||||
return None
|
||||
|
@ -146,7 +146,7 @@ PAGE_DYNAMIC_OFFSET = 2
|
||||
|
||||
|
||||
def prettyify_disk_bus(bus):
|
||||
if bus in ["ide", "sata", "scsi", "usb"]:
|
||||
if bus in ["ide", "sata", "scsi", "usb", "sd"]:
|
||||
return bus.upper()
|
||||
|
||||
if bus in ["xen"]:
|
||||
|
@ -559,8 +559,17 @@ class Guest(XMLBuilder):
|
||||
def add_default_input_device(self):
|
||||
if self.os.is_container():
|
||||
return
|
||||
if not self.os.is_x86():
|
||||
return
|
||||
self.add_device(virtinst.VirtualInputDevice(self.conn))
|
||||
|
||||
def add_default_sound_device(self):
|
||||
if not self.os.is_hvm():
|
||||
return
|
||||
if not self.os.is_x86():
|
||||
return
|
||||
self.add_device(virtinst.VirtualAudio(self.conn))
|
||||
|
||||
def add_default_console_device(self):
|
||||
if self.os.is_xenpv():
|
||||
return
|
||||
@ -568,6 +577,11 @@ class Guest(XMLBuilder):
|
||||
dev.type = dev.TYPE_PTY
|
||||
self.add_device(dev)
|
||||
|
||||
def add_default_video_device(self):
|
||||
if self.os.is_container():
|
||||
return
|
||||
self.add_device(virtinst.VirtualVideoDevice(self.conn))
|
||||
|
||||
def _set_transient_device_defaults(self, install):
|
||||
def do_remove_media(d):
|
||||
# Keep cdrom around, but with no media attached,
|
||||
@ -684,13 +698,20 @@ class Guest(XMLBuilder):
|
||||
self.add_device(ctrl)
|
||||
|
||||
def _can_virtio(self, key):
|
||||
if not self.os.is_x86():
|
||||
return False
|
||||
if not self.conn.is_qemu():
|
||||
return False
|
||||
if not self._lookup_osdict_key(key, False):
|
||||
return False
|
||||
return True
|
||||
|
||||
if self.os.is_x86():
|
||||
return True
|
||||
if (self.os.is_arm_vexpress() and
|
||||
self.os.dtb and
|
||||
self._lookup_osdict_key("virtiommio", False) and
|
||||
self.conn.check_conn_support(support.SUPPORT_CONN_VIRTIO_MMIO)):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
def _set_disk_defaults(self):
|
||||
os_disk_bus = self._lookup_osdict_key("diskbus", None)
|
||||
@ -712,6 +733,8 @@ class Guest(XMLBuilder):
|
||||
d.bus = os_disk_bus
|
||||
elif self.os.is_pseries():
|
||||
d.bus = "scsi"
|
||||
elif self.os.is_arm():
|
||||
d.bus = "sd"
|
||||
else:
|
||||
d.bus = "ide"
|
||||
|
||||
|
@ -136,6 +136,8 @@ class _OSVariant(object):
|
||||
This corresponds with the SUPPORT_CONN_HV_SKIP_DEFAULT_ACPI check
|
||||
@virtionet: If True, this OS supports virtionet out of the box
|
||||
@virtiodisk: If True, this OS supports virtiodisk out of the box
|
||||
@virtiommio: If True, this OS supports virtio-mmio out of the box,
|
||||
which provides virtio for certain ARM configurations
|
||||
|
||||
The rest of the parameters are about setting device/guest defaults
|
||||
based on the OS. They should be self explanatory. See guest.py for
|
||||
@ -149,7 +151,8 @@ class _OSVariant(object):
|
||||
netmodel=_SENTINEL, diskbus=_SENTINEL,
|
||||
inputtype=_SENTINEL, inputbus=_SENTINEL,
|
||||
videomodel=_SENTINEL, virtionet=_SENTINEL,
|
||||
virtiodisk=_SENTINEL, xen_disable_acpi=_SENTINEL):
|
||||
virtiodisk=_SENTINEL, virtiommio=_SENTINEL,
|
||||
xen_disable_acpi=_SENTINEL):
|
||||
if is_type:
|
||||
if parent != _SENTINEL:
|
||||
raise RuntimeError("OS types must not specify parent")
|
||||
@ -206,6 +209,7 @@ class _OSVariant(object):
|
||||
xen_disable_acpi)
|
||||
self.virtiodisk = _get_default("virtiodisk", virtiodisk)
|
||||
self.virtionet = _get_default("virtionet", virtionet)
|
||||
self.virtiommio = _get_default("virtiommio", virtiommio)
|
||||
|
||||
|
||||
def _add_type(*args, **kwargs):
|
||||
@ -233,7 +237,7 @@ _add_var("fedora6", "Fedora Core 6", sortby="fedora06", parent="fedora5")
|
||||
_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
|
||||
# https://bugzilla.redhat.com/show_bug.cgi?id=470386
|
||||
_add_var("fedora9", "Fedora 9", sortby="fedora09", virtionet=True, parent="fedora8")
|
||||
_add_var("fedora10", "Fedora 10", virtiodisk=True, parent="fedora9")
|
||||
_add_var("fedora11", "Fedora 11", inputtype="tablet", inputbus="usb", parent="fedora10")
|
||||
@ -244,7 +248,7 @@ _add_var("fedora15", "Fedora 15", parent="fedora14")
|
||||
_add_var("fedora16", "Fedora 16", parent="fedora15")
|
||||
_add_var("fedora17", "Fedora 17", parent="fedora16")
|
||||
_add_var("fedora18", "Fedora 18", supported=True, parent="fedora17")
|
||||
_add_var("fedora19", "Fedora 19", parent="fedora18")
|
||||
_add_var("fedora19", "Fedora 19", virtiommio=True, parent="fedora18")
|
||||
_add_var("fedora20", "Fedora 20", parent="fedora19")
|
||||
|
||||
_add_var("opensuse11", "openSuse 11", distro="suse", supported=True, virtiodisk=True, virtionet=True, parent="linux")
|
||||
|
@ -79,6 +79,8 @@ class OSXML(XMLBuilder):
|
||||
return self.arch == "x86_64" or self.arch == "i686"
|
||||
def is_arm(self):
|
||||
return self.arch == "armv7l"
|
||||
def is_arm_vexpress(self):
|
||||
return self.is_arm() and str(self.machine).startswith("vexpress-")
|
||||
def is_ppc64(self):
|
||||
return self.arch == "ppc64"
|
||||
def is_pseries(self):
|
||||
|
@ -320,6 +320,9 @@ SUPPORT_CONN_LISTALLSTORAGEPOOLS = _make(
|
||||
args=())
|
||||
SUPPORT_CONN_LISTALLINTERFACES = _make(function="virConnect.listAllInterfaces",
|
||||
args=())
|
||||
SUPPORT_CONN_VIRTIO_MMIO = _make(version=1001002,
|
||||
drv_version=[("qemu", 1006000)])
|
||||
SUPPORT_CONN_DISK_SD = _make(version=1001002)
|
||||
|
||||
|
||||
# Domain checks
|
||||
|
Loading…
x
Reference in New Issue
Block a user