Subject: virt-manager : add support for architecture type "s390x".
From: Kevin Zhao kevinzs@linux.vnet.ibm.com Mon Jul 13 07:35:24 2015 -0400
Date: Tue Jul 14 12:45:32 2015 -0400:
Git: 8dbe96fc01c1b563a3720fd9292bca1fcb97f326
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)
diff --git a/tests/capabilities-xml/kvm-s390x.xml b/tests/capabilities-xml/kvm-s390x.xml
new file mode 100644
index 0000000..039c2e0
--- /dev/null
+++ b/tests/capabilities-xml/kvm-s390x.xml
@@ -0,0 +1,73 @@
+
+
+
+ b88e553c-5920-4aa8-bb09-cc0ab8e6e0c2
+
+ s390x
+ host
+
+
+
+
+
+
+
+
+
+
+
+ tcp
+ rdma
+
+
+
+
+
+ 2878860
+
+
+
+
+
+
+ |
+
+
+
+ selinux
+ 0
+ system_u:system_r:svirt_t:s0
+ system_u:system_r:svirt_tcg_t:s0
+
+
+ dac
+ 0
+ +107:+107
+ +107:+107
+
+
+
+
+ hvm
+
+ 64
+ /usr/bin/qemu-system-s390x
+ s390
+ s390-ccw
+
+ /usr/bin/qemu-system-s390x
+
+
+ /usr/bin/qemu-system-s390x
+ s390
+ s390-ccw
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/cli-test-xml/compare/virt-install-s390x-cdrom.xml b/tests/cli-test-xml/compare/virt-install-s390x-cdrom.xml
new file mode 100644
index 0000000..4d7b9c1
--- /dev/null
+++ b/tests/cli-test-xml/compare/virt-install-s390x-cdrom.xml
@@ -0,0 +1,43 @@
+
+ foobar
+ 00000000-1111-2222-3333-444444444444
+ 65536
+ 65536
+ 1
+
+ hvm
+ /kernel.img
+ /initrd.img
+
+
+
+
+
+
+ destroy
+ restart
+ restart
+
+ /usr/bin/qemu-system-s390x
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/clitest.py b/tests/clitest.py
index 2e5df3b..fb63191 100644
--- a/tests/clitest.py
+++ b/tests/clitest.py
@@ -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
diff --git a/tests/utils.py b/tests/utils.py
index 811016c..fe99155 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -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"
diff --git a/virtManager/create.py b/virtManager/create.py
index 8401a7a..1005398 100644
--- a/virtManager/create.py
+++ b/virtManager/create.py
@@ -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:
diff --git a/virtinst/capabilities.py b/virtinst/capabilities.py
index bed8596..5823da2 100644
--- a/virtinst/capabilities.py
+++ b/virtinst/capabilities.py
@@ -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
diff --git a/virtinst/devicedisk.py b/virtinst/devicedisk.py
index 6ca76e5..679b0cd 100644
--- a/virtinst/devicedisk.py
+++ b/virtinst/devicedisk.py
@@ -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
diff --git a/virtinst/guest.py b/virtinst/guest.py
index bf4b70b..c958068 100644
--- a/virtinst/guest.py
+++ b/virtinst/guest.py
@@ -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"
diff --git a/virtinst/osxml.py b/virtinst/osxml.py
index 77771bd..f195f19 100644
--- a/virtinst/osxml.py
+++ b/virtinst/osxml.py
@@ -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",