File xenpv-libvirtxml.patch of Package open-ovf

Index: open-ovf-0.1/py/ovf/OvfLibvirt.py
===================================================================
--- open-ovf-0.1.orig/py/ovf/OvfLibvirt.py
+++ open-ovf-0.1/py/ovf/OvfLibvirt.py
@@ -1135,20 +1135,22 @@ def getOvfDisks(virtualHardware, dir, re
                 raise ValueError(hostResource)
 
             #target bus
-            parentId = int(ovfDisk['rasd:Parent'])
-            for presource in rasd:
-                if presource['name'] == 'Item':
-                    instId = int(presource['rasd:InstanceID'])
-                    if instId == parentId:
-                        parentType = presource['rasd:ResourceType']
-                        break
-
-            if(parentType == '5'):
-                bus = 'ide'
-            elif(parentType == '6'):
-                bus = 'scsi'
-            else:
-                raise ValueError
+            bus = None
+            if ovfDisk.has_key('rasd:Parent'):
+                parentId = int(ovfDisk['rasd:Parent'])
+                for presource in rasd:
+                    if presource['name'] == 'Item':
+                        instId = int(presource['rasd:InstanceID'])
+                        if instId == parentId:
+                            parentType = presource['rasd:ResourceType']
+                            break
+
+                        if(parentType == '5'):
+                            bus = 'ide'
+                        elif(parentType == '6'):
+                            bus = 'scsi'
+                        else:
+                            raise ValueError
 
             #default not read-only
             ro = False
@@ -1157,15 +1159,18 @@ def getOvfDisks(virtualHardware, dir, re
             if(device == 'cdrom'):
                 ro = True
                 dev = 'hdc'
+            if ovfDisk.has_key('rasd:Address'):
+                dev = ovfDisk['rasd:Address']
             else:
                 dev = logicalNames.pop(0)
 
             libvirtDisk = dict(diskType='file',
                                diskDevice=device,
                                sourceFile=source,
-                               targetBus=bus,
                                targetDev=dev,
                                readonly=ro)
+            if bus:
+                libvirtDisk['targetBus'] = bus
 
             disks += (libvirtDisk,)
 
openSUSE Build Service is sponsored by