Change in vdsm[master]: migration added migrateChangeParams verb
tjelinek at redhat.com
tjelinek at redhat.com
Fri Oct 2 10:20:08 UTC 2015
Tomas Jelinek has uploaded a new change for review.
Change subject: migration added migrateChangeParams verb
......................................................................
migration added migrateChangeParams verb
Currently it contains only the bandwidth but it will be used also for
convergenceSchedule in future.
Feature-Page: http://www.ovirt.org/Features/Migration_Enhancements
Change-Id: I52219c0e1f7d619dd30441dd4c70bd401f91e56d
Signed-off-by: Tomas Jelinek <tjelinek at redhat.com>
---
M vdsm/API.py
M vdsm/rpc/bindingxmlrpc.py
M vdsm/rpc/vdsmapi-schema.json
M vdsm/virt/migration.py
M vdsm/virt/vm.py
5 files changed, 60 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/34/46934/1
diff --git a/vdsm/API.py b/vdsm/API.py
index e3b9241..ffca8d3 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -551,6 +551,19 @@
params['mode'] = 'remote'
return v.migrate(params)
+ def migrateChangeParams(self, params):
+ """
+ Change parameters of an ongoing migration
+
+ :param params: a dictionary containing:
+ *maxBandwidth* - new max bandwidth
+ """
+ try:
+ v = self._cif.vmContainer[self._UUID]
+ except KeyError:
+ return errCode['noVM']
+ return v.migrateChangeParams(params)
+
def migrateCancel(self):
"""
Cancel a currently outgoing migration process.
diff --git a/vdsm/rpc/bindingxmlrpc.py b/vdsm/rpc/bindingxmlrpc.py
index 4c69b32..68e03cd 100644
--- a/vdsm/rpc/bindingxmlrpc.py
+++ b/vdsm/rpc/bindingxmlrpc.py
@@ -453,6 +453,10 @@
vm = API.VM(vmId)
return vm.migrateCancel()
+ def vmMigrateChangeParams(self, vmId, params):
+ vm = API.VM(vmId)
+ return vm.migrateChangeParams(params)
+
def vmHotplugDisk(self, params):
vm = API.VM(params['vmId'])
return vm.hotplugDisk(params)
@@ -1067,6 +1071,7 @@
(self.vmMigrate, 'migrate'),
(self.vmGetMigrationStatus, 'migrateStatus'),
(self.vmMigrationCancel, 'migrateCancel'),
+ (self.vmMigrateChangeParams, 'vmMigrateChangeParams'),
(self.getCapabilities, 'getVdsCapabilities'),
(self.getHardwareInfo, 'getVdsHardwareInfo'),
(self.diskGetAlignment, 'getDiskAlignment'),
diff --git a/vdsm/rpc/vdsmapi-schema.json b/vdsm/rpc/vdsmapi-schema.json
index 7eaf04d..3bd87a8 100644
--- a/vdsm/rpc/vdsmapi-schema.json
+++ b/vdsm/rpc/vdsmapi-schema.json
@@ -7752,6 +7752,32 @@
'data': {'vmID': 'UUID'}}
##
+# @MigrateChangeParamsParams:
+#
+# Parameters for @VM.migrateChangeParams
+#
+# @maxBandwidth: #optional the new bandwidth
+#
+# Since: TODO
+##
+{'type': 'MigrateChangeParamsParams',
+ 'data': {'*maxBandwidth': 'int'}}
+
+##
+# @VM.migrateChangeParams:
+#
+# Change parameters of an ongoing migration
+#
+# @vmID: The UUID of the VM
+#
+# @params: The new parameters
+#
+# Since: TODO
+##
+{'command': {'class': 'VM', 'name': 'migrateChangeParams'},
+ 'data': {'vmID': 'UUID', 'params': 'MigrateChangeParamsParams'}}
+
+##
# @MigrationCreateState:
#
# Reports the state of a VM creation on the destination host.
diff --git a/vdsm/virt/migration.py b/vdsm/virt/migration.py
index 32caccb..14ce93e 100644
--- a/vdsm/virt/migration.py
+++ b/vdsm/virt/migration.py
@@ -404,6 +404,17 @@
else:
self._raiseAbortError()
+ def migrateChangeParams(self, params):
+ if 'maxBandwidth' in params:
+ self._set_max_bandwidth(params['maxBandwidth'])
+
+ def _set_max_bandwidth(self, bandwidth):
+ self._vm.log.debug('setting migration max bandwidth to %d', bandwidth)
+ self._maxBandwidth = int(bandwidth)
+ self._vm._dom.migrateSetMaxSpeed(int(bandwidth))
+ self._vm.log.debug('bandwidth set successfully')
+
+
def stop(self):
# if its locks we are before the migrateToURI3()
# call so no need to abortJob()
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py
index b8ec3d4..26eedc3 100644
--- a/vdsm/virt/vm.py
+++ b/vdsm/virt/vm.py
@@ -1546,6 +1546,11 @@
finally:
self._guestCpuLock.release()
+ def migrateChangeParams(self, params):
+ # TODO check if the self._acquireCpuLockWithTimeout() is needed here
+ self._migrationSourceThread.migrateChangeParams(params)
+ return {'status': doneCode}
+
def _customDevices(self):
"""
Get all devices that have custom properties
--
To view, visit https://gerrit.ovirt.org/46934
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I52219c0e1f7d619dd30441dd4c70bd401f91e56d
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Tomas Jelinek <tjelinek at redhat.com>
More information about the vdsm-patches
mailing list