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(a)linux.vnet.ibm.com>
---
src/kimchi/model/vmstorages.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/kimchi/model/vmstorages.py b/src/kimchi/model/vmstorages.py
index c1c90ce..3b5f99e 100644
--- a/src/kimchi/model/vmstorages.py
+++ b/src/kimchi/model/vmstorages.py
@@ -55,7 +55,7 @@ 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'))
+ disk.append(E.target(dev=params.get('dev'), bus=params.get('bus',
'ide')))
return ET.tostring(disk)
@@ -164,6 +164,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 +176,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