virt-manager : add support for architecture type "s390x".

For architecture "s390x",the disk and the network device are base
on "virtio" bus.The cdrom is based on "scsi".So set the default
cdrom bus as "scsi",the default bus as "virtio".Also the default
machine type is set to "s390-ccw-virtio" as it is the only supported
in "s390x".Also add a test cast of virt-install by cdrom in s390x.

(crobinso: Tweak test suite and minor formatting stuff)
This commit is contained in:
Kevin Zhao 2015-07-13 07:35:24 -04:00 committed by Cole Robinson
parent 612123563e
commit 8dbe96fc01
9 changed files with 136 additions and 2 deletions

View File

@ -0,0 +1,73 @@
<capabilities>
<host>
<uuid>b88e553c-5920-4aa8-bb09-cc0ab8e6e0c2</uuid>
<cpu>
<arch>s390x</arch>
<model>host</model>
<topology sockets="2" cores="2" threads="1"/>
<pages unit="KiB" size="4"/>
<pages unit="KiB" size="1024"/>
</cpu>
<power_management>
<suspend_disk/>
<suspend_hybrid/>
</power_management>
<migration_features>
<live/>
<uri_transports>
<uri_transport>tcp</uri_transport>
<uri_transport>rdma</uri_transport>
</uri_transports>
</migration_features>
<topology>
<cells num="1">
<cell id="0">
<memory unit="KiB">2878860</memory>
<cpus num="4">
<cpu id="0" socket_id="0" core_id="0" siblings="0"/>
<cpu id="1" socket_id="0" core_id="1" siblings="1"/>
<cpu id="2" socket_id="1" core_id="0" siblings="2"/>
<cpu id="3" socket_id="1" core_id="1" siblings="3"/>
</cpus>
</cell>
</cells>
</topology>
<secmodel>
<model>selinux</model>
<doi>0</doi>
<baselabel type="kvm">system_u:system_r:svirt_t:s0</baselabel>
<baselabel type="qemu">system_u:system_r:svirt_tcg_t:s0</baselabel>
</secmodel>
<secmodel>
<model>dac</model>
<doi>0</doi>
<baselabel type="kvm">+107:+107</baselabel>
<baselabel type="qemu">+107:+107</baselabel>
</secmodel>
</host>
<guest>
<os_type>hvm</os_type>
<arch name="s390x">
<wordsize>64</wordsize>
<emulator>/usr/bin/qemu-system-s390x</emulator>
<machine canonical="s390-virtio" maxCpus="255">s390</machine>
<machine canonical="s390-ccw-virtio" maxCpus="255">s390-ccw</machine>
<domain type="qemu">
<emulator>/usr/bin/qemu-system-s390x</emulator>
</domain>
<domain type="kvm">
<emulator>/usr/bin/qemu-system-s390x</emulator>
<machine canonical="s390-virtio" maxCpus="255">s390</machine>
<machine canonical="s390-ccw-virtio" maxCpus="255">s390-ccw</machine>
</domain>
</arch>
<features>
<cpuselection/>
<deviceboot/>
<disksnapshot default="on" toggle="no"/>
</features>
</guest>
</capabilities>

View File

@ -0,0 +1,43 @@
<domain type="kvm">
<name>foobar</name>
<uuid>00000000-1111-2222-3333-444444444444</uuid>
<memory>65536</memory>
<currentMemory>65536</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch="s390x" machine="s390-ccw-virtio">hvm</type>
<kernel>/kernel.img</kernel>
<initrd>/initrd.img</initrd>
</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/bin/qemu-system-s390x</emulator>
<disk type="file" device="disk">
<driver name="qemu" type="qcow2"/>
<source file="/dev/default-pool/testvol1.img"/>
<target dev="vda" bus="virtio"/>
</disk>
<disk type="file" device="cdrom">
<driver name="qemu"/>
<source file="/tmp/__virtinst_cli_exist1.img"/>
<target dev="sda" bus="scsi"/>
<readonly/>
</disk>
<interface type="bridge">
<source bridge="eth0"/>
<mac address="00:11:22:33:44:55"/>
</interface>
<console type="pty"/>
<channel type="unix">
<source mode="bind"/>
<target type="virtio" name="org.qemu.guest_agent.0"/>
</channel>
</devices>
</domain>

View File

@ -76,6 +76,7 @@ test_files = {
'URI-KVM-ARMV7L' : utils.uri_kvm_armv7l,
'URI-KVM-AARCH64' : utils.uri_kvm_aarch64,
'URI-KVM-PPC64LE' : utils.uri_kvm_ppc64le,
'URI-KVM-S390X' : utils.uri_kvm_s390x,
'URI-XEN': utils.uri_xen,
'URI-LXC': utils.uri_lxc,
@ -694,6 +695,9 @@ c.add_compare("--arch ppc64 --machine pseries --boot network --disk %(EXISTIMG1)
c.add_compare("--arch ppc64 --boot network --disk %(EXISTIMG1)s --os-variant fedora20 --network none", "ppc64-machdefault-f20")
c.add_compare("--connect %(URI-KVM-PPC64LE)s --import --disk %(EXISTIMG1)s --os-variant fedora20", "ppc64le-kvm-import")
# s390x tests
c.add_compare("--arch s390x --machine s390-ccw-virtio --connect %(URI-KVM-S390X)s --boot kernel=/kernel.img,initrd=/initrd.img --disk %(EXISTIMG1)s --disk %(EXISTIMG3)s,device=cdrom --os-variant fedora21", "s390x-cdrom")
c.add_compare("--disk none --location %(EXISTIMG3)s --nonetworks", "location-iso") # Using --location iso mounting
c.add_compare("--disk %(EXISTIMG1)s --pxe --os-variant rhel6.4", "kvm-rhel6") # RHEL6 defaults
c.add_compare("--disk %(EXISTIMG1)s --pxe --os-variant rhel7.0", "kvm-rhel7") # RHEL7 defaults

View File

@ -46,6 +46,7 @@ uri_kvm = (_uri_kvm_domcaps + _capsprefix + "kvm-x86_64.xml")
uri_kvm_armv7l = (_uri_kvm_domcaps + _capsprefix + "kvm-armv7l.xml")
uri_kvm_aarch64 = (_uri_kvm_domcaps + _capsprefix + "kvm-aarch64.xml")
uri_kvm_ppc64le = (_uri_kvm_domcaps + _capsprefix + "kvm-ppc64le.xml")
uri_kvm_s390x = (_uri_kvm_domcaps + _capsprefix + "kvm-s390x.xml")
uri_xen = uri_test + _capsprefix + "xen-rhel5.4.xml,xen"
uri_lxc = uri_test + _capsprefix + "lxc.xml,lxc"

View File

@ -409,7 +409,7 @@ class vmmCreate(vmmGObjectUI):
can_remote_url = self.conn.get_backend().support_remote_url_install()
installable_arch = (self.capsinfo.arch in
["i686", "x86_64", "ppc64", "ppc64le", "ia64"])
["i686", "x86_64", "ppc64", "ppc64le", "ia64", "s390x"])
if self.capsinfo.arch == "aarch64":
try:
@ -676,7 +676,8 @@ class vmmCreate(vmmGObjectUI):
archs.remove("i686")
archs.sort()
prios = ["x86_64", "i686", "aarch64", "armv7l", "ppc64", "ppc64le"]
prios = ["x86_64", "i686", "aarch64", "armv7l", "ppc64", "ppc64le",
"s390x"]
if self.conn.caps.host.cpu.arch not in prios:
prios = []
else:

View File

@ -323,6 +323,10 @@ class _CapsInfo(object):
if "vexpress-a15" in self.machines:
return "vexpress-a15"
if self.arch in ["s390x"]:
if "s390-ccw-virtio" in self.machines:
return "s390-ccw-virtio"
return None

View File

@ -897,6 +897,9 @@ class VirtualDisk(VirtualDevice):
if self.is_cdrom():
self.read_only = True
if self.is_cdrom() and guest.os.is_s390x():
self.bus = "scsi"
if (guest.os.is_xenpv() and
self.type == VirtualDisk.TYPE_FILE and
self.driver_name is None and

View File

@ -987,6 +987,8 @@ class Guest(XMLBuilder):
d.bus = "sd"
elif self.os.is_q35():
d.bus = "sata"
elif self.os.is_s390x():
d.bus = "virtio"
else:
d.bus = "ide"

View File

@ -71,6 +71,9 @@ class OSXML(XMLBuilder):
def is_pseries(self):
return self.is_ppc64() and self.machine == "pseries"
def is_s390x(self):
return self.arch == "s390x"
_XML_ROOT_NAME = "os"
_XML_PROP_ORDER = ["arch", "os_type", "loader", "loader_ro", "loader_type",
"nvram", "nvram_template", "kernel", "initrd",