<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=gbk">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <pre style="color: rgb(0, 0, 0); font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">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</pre>
    <div class="moz-forward-container"><br>
      <br>
      -------- 转发的消息 --------
      <table class="moz-email-headers-table" border="0" cellpadding="0"
        cellspacing="0">
        <tbody>
          <tr>
            <th align="RIGHT" nowrap="nowrap" valign="BASELINE">主题: </th>
            <td>[PATCH] virt-manager : add support for architecture type
              "s390x"</td>
          </tr>
          <tr>
            <th align="RIGHT" nowrap="nowrap" valign="BASELINE">日期: </th>
            <td>Wed, 8 Jul 2015 03:45:14 -0400</td>
          </tr>
          <tr>
            <th align="RIGHT" nowrap="nowrap" valign="BASELINE">发件人: </th>
            <td>Kevin Zhao <a class="moz-txt-link-rfc2396E" href="mailto:kevinzs@linux.vnet.ibm.com"><kevinzs@linux.vnet.ibm.com></a></td>
          </tr>
          <tr>
            <th align="RIGHT" nowrap="nowrap" valign="BASELINE">收件人: </th>
            <td><a class="moz-txt-link-abbreviated" href="mailto:virt-tools-list@redhat.com">virt-tools-list@redhat.com</a></td>
          </tr>
          <tr>
            <th align="RIGHT" nowrap="nowrap" valign="BASELINE">抄送: </th>
            <td>Kevin Zhao <a class="moz-txt-link-rfc2396E" href="mailto:kevinzs@linux.vnet.ibm.com"><kevinzs@linux.vnet.ibm.com></a></td>
          </tr>
        </tbody>
      </table>
      <br>
      <br>
      <pre>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 <a class="moz-txt-link-rfc2396E" href="mailto:kevinzs@linux.vnet.ibm.com"><kevinzs@linux.vnet.ibm.com></a>
---
 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

</pre>
      <br>
    </div>
    <br>
  </body>
</html>