[PATCH 01 of 11] Fix multiple disks

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

 



# HG changeset patch
# User john.levon@xxxxxxx
# Date 1215470367 25200
# Node ID c75d57437b7b219443580f6e9d6736d27d76ebcf
# Parent  a2be1263c2f5d3f346cfc3501682073fce2e8966
Fix multiple disks

Fix handling of multiple disks.

Signed-off-by: John Levon <john.levon@xxxxxxx>

diff --git a/virtconv/parsers/virtimage.py b/virtconv/parsers/virtimage.py
--- a/virtconv/parsers/virtimage.py
+++ b/virtconv/parsers/virtimage.py
@@ -117,12 +117,12 @@ class virtimage_parser(vmconfig.parser):
 
             # FIXME: needs updating for later Xen enhancements; need to
             # implement capabilities checking for max disks etc.
-            pv_disks.append("""<drive disk="%s" target="xvd%s" />""" %
+            pv_disks.append("""<drive disk="%s" target="xvd%s" />\n""" %
                 (path, ascii_letters[number % 26]))
-            hvm_disks.append("""<drive disk="%s" target="hd%s" />""" %
+            hvm_disks.append("""<drive disk="%s" target="hd%s" />\n""" %
                 (path, ascii_letters[number % 26]))
             storage_disks.append(
-                """<disk file="%s" use="system" format="raw"/>""" % path)
+                """<disk file="%s" use="system" format="raw"/>\n""" % path)
 
         if vm.type == vmconfig.VM_TYPE_PV:
             boot_template = pv_boot_template
diff --git a/virtconv/parsers/vmx.py b/virtconv/parsers/vmx.py
--- a/virtconv/parsers/vmx.py
+++ b/virtconv/parsers/vmx.py
@@ -60,6 +60,7 @@ class vmx_parser(vmconfig.parser):
                 lines.append(line)
     
         config = {}
+        disks = []
 
         # split out all remaining entries of key = value form
         for (line_nr, line) in enumerate(lines):
@@ -69,6 +70,9 @@ class vmx_parser(vmconfig.parser):
                 value = after_eq.replace('"',"")
                 value = value.strip()
                 config[key] = value
+                # FIXME: this should probably be a lot smarter.
+                if value.endswith(".vmdk"):
+                    disks += [ value ]
             except:
                 raise Exception("Syntax error at line %d: %s" %
                     (line_nr + 1, line.strip()))
@@ -80,10 +84,6 @@ class vmx_parser(vmconfig.parser):
         vm.memory = config.get("memsize")
         vm.description = config.get("annotation")
         vm.nr_vcpus = config.get("numvcpus")
-
-        # FIXME: this should probably be a lot smarter. I don't think
-        # this even gets disk numbering right.
-        disks = [ d for d in config.values() if d.endswith(".vmdk") ]
 
         for (number, path) in enumerate(disks):
             vm.disks += [ vmconfig.disk(path, number, vmconfig.DISK_TYPE_VMDK) ]

_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/et-mgmt-tools

[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