Adam Litke has uploaded a new change for review. Change subject: LiveMerge: Add liveMerge capability to vdsCaps ......................................................................
LiveMerge: 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 <ali...@redhat.com> --- M vdsm/caps.py M vdsm/rpc/vdsmapi-schema.json M vdsm/virt/vm.py 3 files changed, 32 insertions(+), 7 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/98/28998/1 diff --git a/vdsm/caps.py b/vdsm/caps.py index 68851c9..e8c4844 100644 --- a/vdsm/caps.py +++ b/vdsm/caps.py @@ -246,6 +246,26 @@ @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. + """ + for flag in ('VIR_DOMAIN_BLOCK_COMMIT_RELATIVE', + 'VIR_DOMAIN_EVENT_ID_BLOCK_JOB_2'): + if not hasattr(libvirt, flag): + logging.debug("libvirt is missing '%s': live merge disabled", flag) + return False + return True + + +@utils.memoized def getNumaTopology(): capabilities = _getCapsXMLStr() caps = minidom.parseString(capabilities) @@ -609,6 +629,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 2ccf963..486a7cb 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 abdd9b0..216d2a7 100644 --- a/vdsm/virt/vm.py +++ b/vdsm/virt/vm.py @@ -5476,6 +5476,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()) @@ -5519,12 +5523,7 @@ # 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. - try: - flags = libvirt.VIR_DOMAIN_BLOCK_COMMIT_RELATIVE - except AttributeError: - self.log.error("Libvirt missing VIR_DOMAIN_BLOCK_COMMIT_RELATIVE. " - "Unable to perform live merge.") - return errCode['mergeErr'] + flags = libvirt.VIR_DOMAIN_BLOCK_COMMIT_RELATIVE if topVolUUID == drive.volumeID: # Pass a flag to libvirt to indicate that we expect a two phase -- To view, visit http://gerrit.ovirt.org/28998 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iac66c679166b5687ed3940e517fe6827fe10e258 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Adam Litke <ali...@redhat.com> _______________________________________________ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches