Hello Dan Kenigsberg, Francesco Romani,
I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/31045
to review the following change.
Change subject: Live Merge: Add liveMerge capability to vdsCaps
......................................................................
Live Merge: Add liveMerge capability to vdsCaps
It is desirable for engine to know up front if a host can support live
merge so the UI can either enable or disable the 'Delete' snapshot
command based on presence of the feature.
Change-Id: Iac66c679166b5687ed3940e517fe6827fe10e258
Signed-off-by: Adam Litke <[email protected]>
Reviewed-on: http://gerrit.ovirt.org/28998
Reviewed-by: Francesco Romani <[email protected]>
Reviewed-by: Dan Kenigsberg <[email protected]>
---
M vdsm/caps.py
M vdsm/rpc/vdsmapi-schema.json
M vdsm/virt/vm.py
3 files changed, 40 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/45/31045/1
diff --git a/vdsm/caps.py b/vdsm/caps.py
index 607dcde..0993939 100644
--- a/vdsm/caps.py
+++ b/vdsm/caps.py
@@ -247,6 +247,30 @@
@utils.memoized
+def getLiveMergeSupport():
+ """
+ Determine if libvirt provides the necessary features to enable live merge.
+ We check for the existence of several libvirt flags to serve as indicators:
+
+ VIR_DOMAIN_BLOCK_COMMIT_RELATIVE indicates that libvirt can maintain
+ relative backing file path names when rewriting a backing chain.
+
+ VIR_DOMAIN_EVENT_ID_BLOCK_JOB_2 indicates that libvirt can pass a drive
+ name (ie. vda) rather than a path to the block job event callback.
+
+ VIR_DOMAIN_BLOCK_COMMIT_ACTIVE indicates that libvirt supports merging the
+ active layer using the virDomainBlockCommit API.
+ """
+ for flag in ('VIR_DOMAIN_BLOCK_COMMIT_RELATIVE',
+ 'VIR_DOMAIN_EVENT_ID_BLOCK_JOB_2',
+ 'VIR_DOMAIN_BLOCK_COMMIT_ACTIVE'):
+ if not hasattr(libvirt, flag):
+ logging.debug("libvirt is missing '%s': live merge disabled", flag)
+ return False
+ return True
+
+
[email protected]
def getNumaTopology():
capabilities = _getCapsXMLStr()
caps = minidom.parseString(capabilities)
@@ -622,6 +646,7 @@
liveSnapSupported = _getLiveSnapshotSupport(targetArch)
if liveSnapSupported is not None:
caps['liveSnapshot'] = str(liveSnapSupported).lower()
+ caps['liveMerge'] = str(getLiveMergeSupport()).lower()
caps['kdumpStatus'] = _getKdumpStatus()
return caps
diff --git a/vdsm/rpc/vdsmapi-schema.json b/vdsm/rpc/vdsmapi-schema.json
index c301912..0f667fc 100644
--- a/vdsm/rpc/vdsmapi-schema.json
+++ b/vdsm/rpc/vdsmapi-schema.json
@@ -1155,6 +1155,11 @@
# @kdumpStatus: The current status of kdump configuration for the host:
# enabled (1), disabled(0), unknown(-1)
# (new in version 4.15.0)
+#
+# @liveMerge: #optional Indicates if live merge is supported on this
+# host.
+# (new in version 4.15.0)
+#
# Since: 4.15.0
#
# Notes: Since ovirt-engine cannot parse software versions in 'x.y.z' format,
@@ -1179,7 +1184,7 @@
'numaNodeDistance': 'NumaNodeDistanceMap',
'autoNumaBalancing': 'AutoNumaBalancingStatus',
'selinux': 'SELinuxStatus', '*liveSnapshot': 'bool',
- 'kdumpStatus': 'int'}}
+ 'kdumpStatus': 'int', '*liveMerge': 'bool'}}
##
# @Host.getCapabilities:
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index 30a5679..48f0a56 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -5517,6 +5517,10 @@
return jobs
def merge(self, driveSpec, baseVolUUID, topVolUUID, bandwidth, jobUUID):
+ if not caps.getLiveMergeSupport():
+ self.log.error("Live merge is not supported on this host")
+ return errCode['mergeErr']
+
bandwidth = int(bandwidth)
if jobUUID is None:
jobUUID = str(uuid.uuid4())
@@ -5557,6 +5561,11 @@
return errCode['mergeErr']
baseSize = int(res['info']['apparentsize'])
+ # Indicate that we expect libvirt to maintain the relative paths of
+ # backing files. This is necessary to ensure that a volume chain is
+ # visible from any host even if the mountpoint is different.
+ flags = libvirt.VIR_DOMAIN_BLOCK_COMMIT_RELATIVE
+
try:
self.trackBlockJob(jobUUID, drive, baseVolUUID, topVolUUID,
'commit')
--
To view, visit http://gerrit.ovirt.org/31045
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iac66c679166b5687ed3940e517fe6827fe10e258
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Adam Litke <[email protected]>
Gerrit-Reviewer: Dan Kenigsberg <[email protected]>
Gerrit-Reviewer: Francesco Romani <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches