[Kimchi-devel] [PATCH V2] Fix hardcoded storage bus assignment in vmstorage
Rodrigo Trujillo
rodrigo.trujillo at linux.vnet.ibm.com
Thu Apr 3 20:43:00 UTC 2014
There is an error when a user tries to change the midia path in "Manage
Midia" at Guest tab. If the midia was created with SCSI bus, Kimchi is
going to try replace it by IDE bus, causing the following error:
No device with bus 'ide' and target 'sdc'
Bus IDE was hardcoded. This patch retrieves the original midia bus and
pass the value as parameter in order to create the right XML.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo at linux.vnet.ibm.com>
---
src/kimchi/model/vmstorages.py | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/kimchi/model/vmstorages.py b/src/kimchi/model/vmstorages.py
index c1c90ce..8c57318 100644
--- a/src/kimchi/model/vmstorages.py
+++ b/src/kimchi/model/vmstorages.py
@@ -55,7 +55,8 @@ def _get_storage_xml(params):
source.set(DEV_TYPE_SRC_ATTR_MAP[src_type], params.get('path'))
disk.append(source)
- disk.append(E.target(dev=params.get('dev'), bus='ide'))
+ dev_bus = params.get('bus', 'ide')
+ disk.append(E.target(dev=params.get('dev'), bus=dev_bus))
return ET.tostring(disk)
@@ -164,6 +165,7 @@ class VMStorageModel(object):
raise NotFoundError("KCHCDROM0007E", {'dev_name': dev_name,
'vm_name': vm_name})
path = ""
+ dev_bus = 'ide'
try:
source = disk.source
if source is not None:
@@ -175,12 +177,15 @@ class VMStorageModel(object):
host.attrib['port'] + source.attrib['name'])
else:
path = source.attrib[DEV_TYPE_SRC_ATTR_MAP[src_type]]
+ # Retrieve storage bus type
+ dev_bus = disk.target.attrib['bus']
except:
pass
dev_type = disk.attrib['device']
return {'dev': dev_name,
'type': dev_type,
- 'path': path}
+ 'path': path,
+ 'bus': dev_bus}
def delete(self, vm_name, dev_name):
# Get storage device xml
--
1.8.5.3
More information about the Kimchi-devel
mailing list