On 2014年08月26日 12:51, Rodrigo Trujillo wrote:
When a guest has an ISCSI volume attached as disk, backend is not
returning path correctly, it return a blank field. This patch fixes
this problem, returning the path = <iscsi pool> - <volume unit>.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)linux.vnet.ibm.com>
---
src/kimchi/vmdisks.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/kimchi/vmdisks.py b/src/kimchi/vmdisks.py
index 6012ada..6835172 100644
--- a/src/kimchi/vmdisks.py
+++ b/src/kimchi/vmdisks.py
@@ -53,6 +53,9 @@ def get_vm_disk(dom, dev_name):
path = (source.attrib['protocol'] + '://' +
host.attrib['name'] + ':' +
host.attrib['port'] + source.attrib['name'])
+ # ISCSI, Fibre Channel
+ elif src_type == 'volume':
+ path = source.attrib['pool'] + ' - ' +
source.attrib['volume']
else:
path = source.attrib[DEV_TYPE_SRC_ATTR_MAP[src_type]]
# Retrieve storage bus type
If a disk is attached from path : POST
/vms/vm-name/storages,
we just support 3 types of src_type: block, file, and network (as you
can see in vmstorages.py _check_path())
So do you mean if you attached a disk at create time of vm?
If I attach iscsi volume to vm as 'block' src_type in runtime
and the attached disk in vm xml will be like:
<disk type='block' device='disk'>
<driver name='qemu' type='raw'/>
<source
dev='/dev/disk/by-id/scsi-14945540000000000a9317b0c790140de31c9bfc43cd66411'/>
<target dev='vdb' bus='virtio'/>
<alias name='virtio-disk1'/>
<address type='pci' domain='0x0000' bus='0x00'
slot='0x07' function='0x0'/>
</disk>
So the path of iscsi volume is:
<source
dev='/dev/disk/by-id/scsi-14945540000000000a9317b0c790140de31c9bfc43cd66411'/>
which you can read from the volume xml.
virsh # vol-list --pool iscsi-1
Name Path
-----------------------------------------
unit:0:0:0
/dev/disk/by-id/scsi-14945540000000000a9317b0c790140de31c9bfc43cd66411
I think you can report path using this value.