Adam Litke has uploaded a new change for review.
Change subject: [WIP] api: Define the VmJobs API ......................................................................
[WIP] api: Define the VmJobs API
As part of the work being done to enable live merge usecases (deleting snapshots while a VM is running), we need an API for ovirt-engine to monitor the state of ongoing libvirt Block Jobs. In the future we would also like to extend this API to support other use cases (eg. migration).
The libvirt API only reports about block jobs while they are active. Once finished (whether successfully or in error) the job ceases to exist. We will mirror the same behavior in vdsm to avoid issues related to persisting information and needing to clean it later.
Here is an example of how this API would be used by ovirt-engine:
1. The user initiates the removal of a VM snapshot. 2. ovirt-engine starts a blockCommit operation using an as yet unimplemented vdsm API. 3. ovirt-engine monitors the VmStats that are already being collected to gather progress information on the running live merge. 4. At some point the job will stop appearing in VmStats. 5. ovirt-engine will call an as yet unimplemented API to list the volume chain for the affected VM Disk. This information will tell ovirt-engine whether the operation succeeded or failed.
What's missing? This API does not provide a reliable way to report detailed error messages about the operation. This is because block jobs disappear as soon as they succeed or fail. To solve this problem on a best errort basis, vdsm can subscribe to libvirt events to receive block job error messages which can be relayed to engine in the same way that other errors are relayed. This would not be fool proof because if libvirt or vdsm is restarted, some events may be missed. In any case, the detailed error reporting is a separate issue that can be implemented by another patch.
Change-Id: I92d8afc2526ba0d2fe930a4227adc2b91f87ba8a Signed-off-by: Adam Litke alitke@redhat.com --- M vdsm/vm.py M vdsm_api/vdsmapi-schema.json 2 files changed, 102 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/33/24133/1
diff --git a/vdsm/vm.py b/vdsm/vm.py index 77f9683..c4220fd 100644 --- a/vdsm/vm.py +++ b/vdsm/vm.py @@ -2734,6 +2734,9 @@ stats["watchdogEvent"] = self._watchdogEvent return stats
+ def _getVmJobs(self): + return [] + def _getStatsInternal(self): # used by API.Vm.getStats
@@ -2818,6 +2821,7 @@ stats['clientIp'] = self.conf.get('clientIp', '') if 'pauseCode' in self.conf: stats['pauseCode'] = self.conf['pauseCode'] + stats['jobs'] = self._getVmJobs() try: stats.update(self.guestAgent.getGuestInfo()) except Exception: diff --git a/vdsm_api/vdsmapi-schema.json b/vdsm_api/vdsmapi-schema.json index 6d8c333..037b8be 100644 --- a/vdsm_api/vdsmapi-schema.json +++ b/vdsm_api/vdsmapi-schema.json @@ -5589,6 +5589,100 @@ 'data': {'time': 'float', 'action': 'WatchdogEventAction'}}
## +# @VmJobState: +# +# An enumeration of VmJob states. +# +# @unknown: The state is not known +# +# @normal: The job is running normally +# +# Since: 4.14.2 +## +{'enum': 'VmJobState', 'data': ['unknown', 'normal']} + +## +# @VmJobType: +# +# An enumeration of VmJob Types. +# +# @unknown: The job type is not known +# +# @block: A job related to a Vm block device +# +# Since: 4.14.2 +## +{'enum': 'VmJobType', 'data': ['unknown', 'block']} + +## +# @BlockJobType: +# +# An enumeration of VM Block Job Types. +# +# @copy: A block rebase operation in copy mode +# +# @rebase: A block rebase operation +# +# @commit: A block commit operation +# +# Since: 4.14.2 +## +{'enum': 'BlockJobType', 'data': ['copy', 'rebase', 'commit']} + +## +# @VmJobInfoBlock: +# +# Detailed information about a block job. +# +# @jobType: The VmJobType (always @block) +# +# @opType: The specific type of operation being performed +# +# @bandwidth: Indicates a bandwidth limit in MB/s +# +# @cur: A cursor value indicating the job's current position +# +# @end: A cursor value indicating the the end of the job +# +# @imgUUID: The UUID of the image that this job is working with +# +# Since: 4.14.2 +## +{'type': 'VmJobInfoBlock', + 'data': {'jobType': 'VmJobType', 'opType': 'BlockJobType', + 'bandwidth': 'uint', 'cur': 'uint', 'end': 'uint', + 'imgUUID': 'UUID'}} + +## +# @VmJobInfo: +# +# A discriminated record of job type-specific metadata. +# +# @jobType: The type of VmJob this metadata describes +# +# Since: 4.14.2 +## +{'type': 'VmJobInfo', + 'data': {'jobType': 'VmJobType'}, + 'union': ['VmJobInfoBlock']} + +## +# @VmJob: +# +# Information about an ongoing operation related to a VM. +# +# @state: The current state of the job. Note that as soon as jobs finish they +# will no longer be reported. This field is designed to report any +# conditions which may require further intervention. +# +# @info: Type-specific such as progress information +# +# Since: 4.14.2 +## +{'type': 'VmJob', + 'data': {'state': 'VmJobState', 'info': 'VmJobInfo'}} + +## # @RunningVmStats: # # Statistics for a running virtual machine. @@ -5656,6 +5750,8 @@ # @guestFQDN: Fully qualified domain name of the guest OS. (Reported # by the guest agent) # +# @jobs: #optional A list of active Vm Jobs +# # Since: 4.10.0 ## {'type': 'RunningVmStats', @@ -5674,7 +5770,8 @@ 'memoryStats': 'GuestMemoryStats', 'balloonInfo': 'BalloonInfo', 'disksUsage': ['GuestMountInfo'], 'netIfaces': ['GuestNetworkDeviceInfo'], - '*watchdogEvent': 'WatchdogEvent', 'guestFQDN': 'str'}} + '*watchdogEvent': 'WatchdogEvent', 'guestFQDN': 'str', + '*jobs': ['VmJob']}}
## # @VmStats:
oVirt Jenkins CI Server has posted comments on this change.
Change subject: [WIP] api: Define the VmJobs API ......................................................................
Patch Set 1:
Build Successful
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/6194/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/7087/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/6973/ : SUCCESS
oVirt Jenkins CI Server has posted comments on this change.
Change subject: [WIP] api: Define the VmJobs API ......................................................................
Patch Set 2:
Build Successful
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/6459/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/7243/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/7361/ : SUCCESS
oVirt Jenkins CI Server has posted comments on this change.
Change subject: [WIP] live merge support ......................................................................
Patch Set 3:
Build Failed
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/7422/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/6629/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/7531/ : SUCCESS
Adam Litke has posted comments on this change.
Change subject: [OLD][WIP] live merge support ......................................................................
Patch Set 4: Code-Review-1
This is an older version of live merge. Keeping here for reference only.
oVirt Jenkins CI Server has posted comments on this change.
Change subject: [OLD][WIP] live merge support ......................................................................
Patch Set 4:
Build Failed
http://jenkins.ovirt.org/job/vdsm_master_pep8_gerrit/8105/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit/8218/ : FAILURE
http://jenkins.ovirt.org/job/vdsm_master_unit_tests_gerrit_el/7315/ : SUCCESS
Adam Litke has abandoned this change.
Change subject: [OLD][WIP] live merge support ......................................................................
Abandoned
Way out of date initial implementation.
vdsm-patches@lists.fedorahosted.org