[virt-tools-list] Fwd: [PATCH] virt-manager : add support for architecture type "s390x"

Kevin Zhao kevinzs at linux.vnet.ibm.com
Thu Jul 9 05:20:21 UTC 2015


Hi Cole,
	I  really appreciate for your advice.I will recheck the code ,add the test case and send the patch again.
	Thanks very much!

Best Regards,
Kevin

On 07/08/2015 03:45 AM, Kevin Zhao wrote:
> For architecture "s390x",the disk and the network device are based
> 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".
>
> Signed-off-by: Kevin Zhao <kevinzs linux vnet ibm com>
> ---
>  virtManager/create.py    | 4 ++--
>  virtinst/capabilities.py | 4 ++++
>  virtinst/devicedisk.py   | 3 +++
>  virtinst/guest.py        | 2 ++
>  virtinst/osxml.py        | 3 +++
>  5 files changed, 14 insertions(+), 2 deletions(-)
>

Changes look fine, but there's some style issues:

$ python setup.py pylint
running pylint
************* Module virtinst.osxml
C: 73, 0: Trailing whitespace (trailing-whitespace)
************* Module virtinst.devicedisk
C:899, 0: Trailing whitespace (trailing-whitespace)
W:901, 0: Bad indentation. Found 16 spaces, expected 12 (bad-indentation)

Also, please add a test case that hits all these changes. Check
tests/clitest.py and add a virt-install --cdrom test. Maybe grep for ppc64 to
find an example. HACKING has some more details about using the test suite

Thanks,
Cole



-------- 转发的消息 --------
主题: 	[PATCH] virt-manager : add support for architecture type "s390x"
日期: 	Wed, 8 Jul 2015 03:45:14 -0400
发件人: 	Kevin Zhao <kevinzs at linux.vnet.ibm.com>
收件人: 	virt-tools-list at redhat.com
抄送: 	Kevin Zhao <kevinzs at linux.vnet.ibm.com>



For architecture "s390x",the disk and the network device are based
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".

Signed-off-by: Kevin Zhao <kevinzs at linux.vnet.ibm.com>
---
  virtManager/create.py    | 4 ++--
  virtinst/capabilities.py | 4 ++++
  virtinst/devicedisk.py   | 3 +++
  virtinst/guest.py        | 2 ++
  virtinst/osxml.py        | 3 +++
  5 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/virtManager/create.py b/virtManager/create.py
index 8401a7a..013a089 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,7 @@ 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..d2b3443 100644
--- a/virtinst/devicedisk.py
+++ b/virtinst/devicedisk.py
@@ -896,6 +896,9 @@ class VirtualDisk(VirtualDevice):
      def set_defaults(self, guest):
          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
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..7ba20e4 100644
--- a/virtinst/osxml.py
+++ b/virtinst/osxml.py
@@ -70,6 +70,9 @@ class OSXML(XMLBuilder):
          return self.arch == "ppc64" or self.arch == "ppc64le"
      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",
-- 
1.8.3.1



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20150709/62d4eb06/attachment.htm>


More information about the virt-tools-list mailing list