[et-mgmt-tools] [PATCH] Check the number of vbd for PV

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I create a patch to check the number of vbd for PV domain.

In HVM domain, the virt-install command checks the number of vbd to
avoid mis-input.  During HVM domain installation, user cannot specify
4vbd using the virt-install command.  However, in PV domain, the
virt-install command does not check the number of vbd.  During PV
domain installation, user can specify more than 16vbd and the
following error message is displayed.

   xend.err 'Invalid configuration invalid character: code 208'

I think there are two problems.  One is that this error message should
be more plain.  The other is that the virt-install command should
check the vbd number in PV domain installation.


Thanks,
Shigeki Sakamoto.


===========================================================
diff -r 31a333a9a5ba virtinst/FullVirtGuest.py
--- a/virtinst/FullVirtGuest.py Tue Apr 17 10:45:06 2007 -0400
+++ b/virtinst/FullVirtGuest.py Thu Apr 19 14:18:41 2007 +0900
@@ -281,3 +281,23 @@ class FullVirtGuest(Guest.XenGuest):
         # This should always work, because it'll lookup a config file
         # for inactive guest, or get the still running install..
         return self.conn.lookupByName(self.name)
+
+    def _get_disk_xml(self, install = True):
+        """Get the disk config in the libvirt XML format"""
+        ret = ""
+        count = 0
+        for d in self.disks:
+            if d.transient and not install:
+                continue
+            if count > 4:
+                raise ValueError, "Can't use more than 4 disks on HVM guest"
+            if d.device == Guest.VirtualDisk.DEVICE_CDROM and count != 2:
+                disknode = "%(disknode)s%(dev)c" % { "disknode": self.disknode, "dev": ord('a') + 2 }
+            else:
+               if count == 2 and d.device != Guest.VirtualDisk.DEVICE_CDROM:
+                   # skip "hdc"
+                   count += 1
+               disknode = "%(disknode)s%(dev)c" % { "disknode": self.disknode, "dev": ord('a') + count }
+            ret += d.get_xml_config(disknode)
+            count += 1
+        return ret
diff -r 31a333a9a5ba virtinst/Guest.py
--- a/virtinst/Guest.py Tue Apr 17 10:45:06 2007 -0400
+++ b/virtinst/Guest.py Thu Apr 19 14:05:25 2007 +0900
@@ -557,26 +557,6 @@ class Guest(object):
         for nic in self.nics:
             nic.setup(self.conn)

-    def _get_disk_xml(self, install = True):
-        """Get the disk config in the libvirt XML format"""
-        ret = ""
-        count = 0
-        for d in self.disks:
-            if d.transient and not install:
-                continue
-            if count > 4 and self.disknode == "hd":
-                raise ValueError, "Can't use more than 4 disks on HVM guest"
-            if d.device == VirtualDisk.DEVICE_CDROM and count != 2:
-                disknode = "%(disknode)s%(dev)c" % { "disknode": self.disknode, "dev": ord('a') + 2 }
-            else:
-               if count == 2 and d.device != VirtualDisk.DEVICE_CDROM and self.disknode == "hd":
-                   # skip "hdc"
-                   count += 1
-               disknode = "%(disknode)s%(dev)c" % { "disknode": self.disknode, "dev": ord('a') + count }
-            ret += d.get_xml_config(disknode)
-            count += 1
-        return ret
-
     def _get_network_xml(self, install = True):
         """Get the network config in the libvirt XML format"""
         ret = ""
diff -r 31a333a9a5ba virtinst/ParaVirtGuest.py
--- a/virtinst/ParaVirtGuest.py Tue Apr 17 10:45:06 2007 -0400
+++ b/virtinst/ParaVirtGuest.py Thu Apr 19 14:06:32 2007 +0900
@@ -78,3 +78,16 @@ class ParaVirtGuest(Guest.XenGuest):
             self.disks.append(Guest.VirtualDisk(self.location, readOnly=True, transient=True))

         return tmpfiles
+
+    def _get_disk_xml(self, install = True):
+        """Get the disk config in the libvirt XML format"""
+        ret = ""
+        count = 0
+        for d in self.disks:
+            if d.transient and not install:
+                continue
+            if count > 15:
+                raise ValueError, "Can't use more than 16 disks on PV guest"
+            ret += d.get_xml_config("%(disknode)s%(dev)c" % { "disknode": self.disknode, "dev": ord('a') + count })
+            count += 1
+        return ret


[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux