Shahar Havivi has uploaded a new change for review.

Change subject: v2v: add volume size to disk info
......................................................................

v2v: add volume size to disk info

Added size in bytes for each disk size.
The size is needed by oVirt Engine for volume creation when import will
take place.

Change-Id: Ic7e9ba73514292cc2bb4a025d286e2c732e88a75
Signed-off-by: Shahar Havivi <[email protected]>
---
M vdsm/rpc/vdsmapi-schema.json
M vdsm/v2v.py
2 files changed, 8 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/63/36263/1

diff --git a/vdsm/rpc/vdsmapi-schema.json b/vdsm/rpc/vdsmapi-schema.json
index beb4f77..871b3be 100644
--- a/vdsm/rpc/vdsmapi-schema.json
+++ b/vdsm/rpc/vdsmapi-schema.json
@@ -3619,10 +3619,12 @@
 #
 # @alias:    #optional device path (file path)
 #
+# @truesize: #optional device size in bytes
+#
 # Since: 4.17.0
 ##
 {'type': 'ExternalDiskInfo',
- 'data': {'*dev': 'str', '*alias': 'str'}}
+ 'data': {'*dev': 'str', '*alias': 'str', '*truesize': 'str'}}
 
 ##
 # @ExternalNetworkInfo:
diff --git a/vdsm/v2v.py b/vdsm/v2v.py
index 53694b5..a918cf3 100644
--- a/vdsm/v2v.py
+++ b/vdsm/v2v.py
@@ -49,7 +49,7 @@
                 logging.error('error parsing domain xml, msg: %s  xml: %s',
                               e.message, vm.XMLDesc(0))
                 continue
-            _add_disks(root, params)
+            _add_disks(root, params, conn)
             _add_networks(root, params)
             ret.append(params)
         return ret
@@ -99,7 +99,7 @@
         params['arch'] = e.get('arch')
 
 
-def _add_disks(root, params):
+def _add_disks(root, params, conn):
     params['disks'] = []
     disks = root.findall('.//disk[@type="file"]')
     for disk in disks:
@@ -110,6 +110,9 @@
         source = disk.find('./source/[@file]')
         if source is not None:
             d['alias'] = source.get('file')
+            vol = conn.storageVolLookupByPath(source.get('file'))
+            if vol is not None and vol.info() is not None:
+                d['truesize'] = str(vol.info()[1])
         params['disks'].append(d)
 
 


-- 
To view, visit http://gerrit.ovirt.org/36263
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic7e9ba73514292cc2bb4a025d286e2c732e88a75
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Shahar Havivi <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to