[python-virtinst/f13/master] virt-install: Fix post install check from erroring (bz 628721) virt-install: Don't lowercase kernel

Cole Robinson crobinso at fedoraproject.org
Tue Mar 29 21:39:58 UTC 2011


commit 9b2c31fafb5c92dd47abcfcebc3f73a64ad47f1e
Author: Cole Robinson <crobinso at redhat.com>
Date:   Tue Mar 29 17:40:59 2011 -0400

    virt-install: Fix post install check from erroring (bz 628721)
    virt-install: Don't lowercase kernel args (bz 646029)
    virt-install: Fix installing to iscsi volume (bz 647241)
    virt-install: Fix setting default keymap (bz 636907)
    virt-install: Add ubuntu 10.10 os option (bz 642441)
    virt-install: Fix locale error if paging --help (bz 655328)

 virtinst-fix-default-keymap.patch |   74 ++++++++++++++++++++++
 virtinst-fix-post-check.patch     |   14 ++++
 virtinst-help-pager.patch         |   24 +++++++
 virtinst-iscsi-format-fix.patch   |  126 +++++++++++++++++++++++++++++++++++++
 virtinst-lower-kernel-args.patch  |   21 ++++++
 virtinst-ubuntu-1010.patch        |   25 +++++++
 6 files changed, 284 insertions(+), 0 deletions(-)
---
diff --git a/virtinst-fix-default-keymap.patch b/virtinst-fix-default-keymap.patch
new file mode 100644
index 0000000..d9b010a
--- /dev/null
+++ b/virtinst-fix-default-keymap.patch
@@ -0,0 +1,74 @@
+diff -rup virtinst-0.500.4/virtinst/cli.py new/virtinst/cli.py
+--- virtinst-0.500.4/virtinst/cli.py	2011-03-29 17:28:44.519612002 -0400
++++ new/virtinst/cli.py	2011-03-29 17:27:49.611612002 -0400
+@@ -769,11 +769,13 @@ def get_graphics(vnc, vncport, vnclisten
+         guest.add_device(VirtualVideoDevice(conn=guest.conn))
+ 
+     if sdl is not None:
+-        guest.graphics_dev = VirtualGraphics(type=VirtualGraphics.TYPE_SDL)
++        guest.graphics_dev = VirtualGraphics(conn=guest.conn,
++                                             type=VirtualGraphics.TYPE_SDL)
+         return
+ 
+     if vnc is not None:
+-        guest.graphics_dev = VirtualGraphics(type=VirtualGraphics.TYPE_VNC)
++        guest.graphics_dev = VirtualGraphics(conn=guest.conn,
++                                             type=VirtualGraphics.TYPE_VNC)
+         if vncport:
+             guest.graphics_dev.port = vncport
+         if vnclisten:
+diff -rup virtinst-0.500.4/virtinst/VirtualGraphics.py new/virtinst/VirtualGraphics.py
+--- virtinst-0.500.4/virtinst/VirtualGraphics.py	2010-08-23 15:24:44.000000000 -0400
++++ new/virtinst/VirtualGraphics.py	2011-03-29 17:28:27.291611998 -0400
+@@ -33,9 +33,11 @@ class VirtualGraphics(VirtualDevice.Virt
+     TYPE_VNC = "vnc"
+ 
+     KEYMAP_LOCAL = "local"
++    KEYMAP_DEFAULT = "default"
++    _special_keymaps = [KEYMAP_LOCAL, KEYMAP_DEFAULT]
+ 
+     def __init__(self, type=TYPE_VNC, port=-1, listen=None, passwd=None,
+-                 keymap=None, conn=None):
++                 keymap=KEYMAP_DEFAULT, conn=None):
+ 
+         VirtualDevice.VirtualDevice.__init__(self, conn=conn)
+ 
+@@ -66,19 +68,23 @@ class VirtualGraphics(VirtualDevice.Virt
+     type = property(get_type)
+ 
+     def get_keymap(self):
++        if self._keymap == self.KEYMAP_DEFAULT:
++            return self._default_keymap()
++        if self._keymap == self.KEYMAP_LOCAL:
++            return _util.default_keymap()
+         return self._keymap
+     def set_keymap(self, val):
+-        if not val:
+-            val = self._default_keymap()
+-
++        # At this point, 'None' is a valid value
+         if val == None:
+-            # At this point, 'None' is a valid value
++            self._keymap = None
++            return
++
++        if val in self._special_keymaps:
+             self._keymap = val
+             return
+ 
+-        if type(val) != type("string"):
++        if type(val) is not str:
+             raise ValueError, _("Keymap must be a string")
+-
+         if val.lower() == self.KEYMAP_LOCAL:
+             val = _util.default_keymap()
+         elif len(val) > 16:
+@@ -145,7 +151,7 @@ class VirtualGraphics(VirtualDevice.Virt
+         listenxml = ""
+         passwdxml = ""
+         if self.keymap:
+-            keymapxml = " keymap='%s'" % self._keymap
++            keymapxml = " keymap='%s'" % self.keymap
+         if self.listen:
+             listenxml = " listen='%s'" % self._listen
+         if self.passwd:
diff --git a/virtinst-fix-post-check.patch b/virtinst-fix-post-check.patch
new file mode 100644
index 0000000..a798f36
--- /dev/null
+++ b/virtinst-fix-post-check.patch
@@ -0,0 +1,14 @@
+diff -rup virtinst-0.500.4/virtinst/Installer.py new/virtinst/Installer.py
+--- virtinst-0.500.4/virtinst/Installer.py	2010-08-23 16:05:33.000000000 -0400
++++ new/virtinst/Installer.py	2010-12-09 15:08:43.924740000 -0500
+@@ -343,8 +343,8 @@ class Installer(object):
+             return True
+ 
+         if (disk.driver_type and
+-            disk.driver_type not in [disk.DRIVER_TYPE_AIO,
+-                                     disk.DRIVER_TYPE_QEMU]):
++            disk.driver_type not in [disk.DRIVER_TAP_RAW,
++                                     disk.DRIVER_QEMU_RAW]):
+             # Might be a non-raw format
+             return True
+ 
diff --git a/virtinst-help-pager.patch b/virtinst-help-pager.patch
new file mode 100644
index 0000000..5f10555
--- /dev/null
+++ b/virtinst-help-pager.patch
@@ -0,0 +1,24 @@
+commit de041b97d2017447e4142e1230dcac48abd270bd
+Author: Cole Robinson <crobinso at redhat.com>
+Date:   Mon Nov 22 11:18:55 2010 -0500
+
+    virt-install: Fix locale error if piped to pager
+    
+    Not really sure what's going on, and I can only reproduce if commenting
+    the setlocale call in setupGettext, but there is a bz about it:
+    
+    https://bugzilla.redhat.com/show_bug.cgi?id=655328
+
+diff --git a/virtinst/cli.py b/virtinst/cli.py
+index 8ed6534..352a05b 100644
+--- a/virtinst/cli.py
++++ b/virtinst/cli.py
+@@ -75,6 +75,8 @@ class VirtOptionParser(OptionParser):
+         encoding = getattr(f, "encoding", None)
+         if not encoding:
+             (dummy, encoding) = locale.getlocale()
++        if not encoding:
++            encoding = "UTF-8"
+         return encoding
+ 
+     def print_help(self, file=None):
diff --git a/virtinst-iscsi-format-fix.patch b/virtinst-iscsi-format-fix.patch
new file mode 100644
index 0000000..09437c3
--- /dev/null
+++ b/virtinst-iscsi-format-fix.patch
@@ -0,0 +1,126 @@
+commit 4781df175c61917dc3db56c97e3f173eaf840d19
+Author: Cole Robinson <crobinso at redhat.com>
+Date:   Wed Nov 17 15:36:51 2010 -0500
+
+    VirtualDisk: Fix detecting format of existing block devices (bz 647241)
+
+diff --git a/tests/testdriver.xml b/tests/testdriver.xml
+index 458ada7..83ef22a 100644
+--- a/tests/testdriver.xml
++++ b/tests/testdriver.xml
+@@ -304,6 +304,41 @@
+   </volume>
+ </pool>
+ 
++<pool type='iscsi'>
++  <name>iscsi-pool</name>
++  <uuid>abcdead9-388a-cdfe-461a-b8907f6e5aaa</uuid>
++  <capacity>107374182400</capacity>
++  <allocation>0</allocation>
++  <available>107374182400</available>
++  <source>
++    <host name="iscsi.example.com"/>
++    <device path="demo-target"/>
++    <auth type='chap' login='foobar' passwd='frobbar'/>
++  </source>
++  <target>
++    <path>/iscsi-pool</path>
++    <permissions>
++      <mode>0700</mode>
++      <owner>10736</owner>
++      <group>10736</group>
++    </permissions>
++  </target>
++
++  <volume>
++    <name>diskvol1</name>
++    <capacity>1000000</capacity>
++    <allocation>50000</allocation>
++    <target>
++      <format type='unknown'/>
++      <permissions>
++        <mode>0700</mode>
++        <owner>10736</owner>
++        <group>10736</group>
++      </permissions>
++    </target>
++  </volume>
++</pool>
++
+ <pool type='dir'>
+   <name>full-pool</name>
+   <uuid>35bb2ad9-388a-cdfe-461a-b8907f6e5555</uuid>
+diff --git a/tests/xmlconfig-xml/misc-qemu-driver-type.xml b/tests/xmlconfig-xml/misc-qemu-driver-type.xml
+index 14ca346..e1c8ba7 100644
+--- a/tests/xmlconfig-xml/misc-qemu-driver-type.xml
++++ b/tests/xmlconfig-xml/misc-qemu-driver-type.xml
+@@ -23,6 +23,11 @@
+       <source file='/tmp/test.img'/>
+       <target dev='hda' bus='ide'/>
+     </disk>
++    <disk type='block' device='disk'>
++      <driver name='qemu' type='raw'/>
++      <source dev='/iscsi-pool/diskvol1'/>
++      <target dev='hdb' bus='ide'/>
++    </disk>
+     <disk type='block' device='cdrom'>
+       <driver name='qemu'/>
+       <source dev='/dev/loop0'/>
+diff --git a/tests/xmlconfig.py b/tests/xmlconfig.py
+index 076dfc3..33e0347 100644
+--- a/tests/xmlconfig.py
++++ b/tests/xmlconfig.py
+@@ -108,8 +108,8 @@ def get_filedisk(path = None):
+         path = "/tmp/test.img"
+     return VirtualDisk(path, size=.0001, conn=conn)
+ 
+-def get_blkdisk():
+-    return VirtualDisk("/dev/loop0", conn=conn)
++def get_blkdisk(path="/dev/loop0"):
++    return VirtualDisk(path, conn=conn)
+ 
+ def get_virtual_network():
+     dev = virtinst.VirtualNetworkInterface()
+@@ -522,6 +522,7 @@ class TestXMLConfig(unittest.TestCase):
+ 
+         g = get_basic_fullyvirt_guest()
+         g.disks.append(get_filedisk())
++        g.disks.append(get_blkdisk("/iscsi-pool/diskvol1"))
+         fargs = (g, "misc-qemu-driver-type", True)
+         self.conn_function_wrappers(g, fargs, conn_uri=qemu_uri)
+ 
+diff --git a/virtinst/VirtualDisk.py b/virtinst/VirtualDisk.py
+index 4f9857f..e11e03e 100644
+--- a/virtinst/VirtualDisk.py
++++ b/virtinst/VirtualDisk.py
+@@ -58,14 +58,17 @@ def _vdisk_clone(path, clone):
+     except OSError:
+         return False
+ 
+-def _qemu_sanitize_drvtype(phystype, fmt):
++def _qemu_sanitize_drvtype(phystype, fmt, manual_format=False):
+     """
+     Sanitize libvirt storage volume format to a valid qemu driver type
+     """
+     raw_list = [ "iso" ]
+ 
+-    if phystype == VirtualDisk.TYPE_BLOCK and not fmt:
+-        return VirtualDisk.DRIVER_QEMU_RAW
++    if phystype == VirtualDisk.TYPE_BLOCK:
++        if not fmt:
++            return VirtualDisk.DRIVER_QEMU_RAW
++        if fmt and not manual_format:
++            return VirtualDisk.DRIVER_QEMU_RAW
+ 
+     if fmt in raw_list:
+         return VirtualDisk.DRIVER_QEMU_RAW
+@@ -956,7 +959,8 @@ class VirtualDisk(VirtualDevice):
+ 
+         if self.format:
+             if drvname == self.DRIVER_QEMU:
+-                drvtype = _qemu_sanitize_drvtype(self.type, self.format)
++                drvtype = _qemu_sanitize_drvtype(self.type, self.format,
++                                                 manual_format=True)
+ 
+         elif self.vol_object:
+             fmt = _util.get_xml_path(self.vol_object.XMLDesc(0),
diff --git a/virtinst-lower-kernel-args.patch b/virtinst-lower-kernel-args.patch
new file mode 100644
index 0000000..cdd0e07
--- /dev/null
+++ b/virtinst-lower-kernel-args.patch
@@ -0,0 +1,21 @@
+commit c8f813b2b267a930021c9b948078475910fd80ec
+Author: Cole Robinson <crobinso at redhat.com>
+Date:   Wed Nov 17 14:52:09 2010 -0500
+
+    cli: Don't erroneously lower() --boot values (and others) (bz 646029)
+    
+    This was a misguided attempt at making parameter parsing more friendly.
+
+diff --git a/virtinst/cli.py b/virtinst/cli.py
+index 62e09d7..9852425 100644
+--- a/virtinst/cli.py
++++ b/virtinst/cli.py
+@@ -618,7 +618,7 @@ def parse_optstr_tuples(optstr):
+         opt_val = None
+         if opt.count("="):
+             opt_type, opt_val = opt.split("=", 1)
+-            optlist.append((opt_type.lower(), opt_val.lower()))
++            optlist.append((opt_type.lower(), opt_val))
+         else:
+             optlist.append((opt.lower(), None))
+ 
diff --git a/virtinst-ubuntu-1010.patch b/virtinst-ubuntu-1010.patch
new file mode 100644
index 0000000..46aea0a
--- /dev/null
+++ b/virtinst-ubuntu-1010.patch
@@ -0,0 +1,25 @@
+commit a8c7fb4a66c5aacfeb628796d66d75d5deae2ed9
+Author: Cole Robinson <crobinso at redhat.com>
+Date:   Wed Nov 17 15:42:16 2010 -0500
+
+    osdict: Add Ubuntu 10.10 (bz 642441)
+
+diff --git a/virtinst/osdict.py b/virtinst/osdict.py
+index 92776fd..371d6e4 100644
+--- a/virtinst/osdict.py
++++ b/virtinst/osdict.py
+@@ -336,6 +336,14 @@ OS_TYPES = {
+                             DISK : VIRTIO_DISK,
+                             NET  : VIRTIO_NET,
+                         }},
++        "ubuntumaverick": {
++            "label": "Ubuntu 10.10 (Maverick Meerkat)",
++            "distro": "ubuntu",
++            "devices" : {
++                DISK : VIRTIO_DISK,
++                NET  : VIRTIO_NET,
++                INPUT: USB_TABLET,
++            }},
+         "generic24": { "label": "Generic 2.4.x kernel" },
+         "generic26": { "label": "Generic 2.6.x kernel" },
+         "virtio26": { "sortby": "genericvirtio26",


More information about the scm-commits mailing list