Change in vdsm[master]: migration: Enable lazy setting of incoming/outgoing limits
mbetak at redhat.com
mbetak at redhat.com
Tue Feb 9 15:16:15 UTC 2016
Martin Betak has uploaded a new change for review.
Change subject: migration: Enable lazy setting of incoming/outgoing limits
......................................................................
migration: Enable lazy setting of incoming/outgoing limits
Change-Id: I79ab97f15788e4024c94d051e4aade713d760acf
Signed-off-by: Martin Betak <mbetak at redhat.com>
---
M lib/api/vdsmapi-schema.json
M vdsm/API.py
M vdsm/virt/migration.py
3 files changed, 27 insertions(+), 3 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/05/53305/1
diff --git a/lib/api/vdsmapi-schema.json b/lib/api/vdsmapi-schema.json
index 69a6802..e188d5b 100644
--- a/lib/api/vdsmapi-schema.json
+++ b/lib/api/vdsmapi-schema.json
@@ -7852,6 +7852,12 @@
# @maxBandwidth: #optional maximal bandwidth used by the migration (MiB/s)
# (new in version 4.18.0)
#
+# @outgoingLimit: #optional maximum number of outgoing migrations
+# (new in version 4.18.0)
+#
+# @incomingLimit: #optional maximum number of incoming migrations
+# (new in version 4.18.0)
+#
# Since: 4.10.0
##
{'type': 'MigrateParams',
@@ -7860,7 +7866,8 @@
'*tunneled': 'bool', '*abortOnError': 'bool',
'consoleAddress': 'str', 'dstqemu': 'str',
'*compressed': 'bool', '*autoConverge': 'bool',
- '*maxBandwidth': 'int'}}
+ '*maxBandwidth': 'int', '*outgoingLimit': 'int',
+ '*incomingLimit': 'int'}}
##
# @VM.migrate:
diff --git a/vdsm/API.py b/vdsm/API.py
index d4a4b5e..c85b647 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -540,6 +540,8 @@
*compressed* - compress repeated pages during live migration
*autoConverge* - force convergence during live migration
*maxBandwidth* - max bandwidth used by this specific migration
+ *outgoingLimit* - max number of outgoing migrations
+ *incomingLimit* - max number of incoming migrations
"""
params['vmId'] = self._UUID
self.log.debug(params)
@@ -592,6 +594,10 @@
"""
self.log.debug('Migration create')
+ incomingLimit = params.get('incomingLimit')
+ if incomingLimit:
+ migration.incomingMigrations.set_bound(incomingLimit)
+
params['vmId'] = self._UUID
result = self.create(params, migration.spawn_vm)
if result['status']['code']:
diff --git a/vdsm/virt/migration.py b/vdsm/virt/migration.py
index 090124c..0ab8e7f 100644
--- a/vdsm/virt/migration.py
+++ b/vdsm/virt/migration.py
@@ -121,6 +121,8 @@
)
self._autoConverge = autoConverge
self._compressed = compressed
+ self._incomingLimit = kwargs.get('incomingLimit')
+ self._outgoingLimit = kwargs.get('outgoingLimit')
self.status = {
'status': {
'code': 0,
@@ -212,6 +214,8 @@
del self._machineParams[k]
if not self.hibernating:
self._machineParams['migrationDest'] = 'libvirt'
+ if self._incomingLimit:
+ self._machineParams['incomingLimit'] = self._incomingLimit
self._machineParams['_srcDomXML'] = self._vm._dom.XMLDesc(0)
def _prepareGuest(self):
@@ -319,7 +323,14 @@
'dstqemu': self._dstqemu,
}
+ def _update_outgoing_limit(self):
+ if self._outgoingLimit:
+ self.log.debug('Updating outgoing migration limit to %d',
+ self._outgoingLimit)
+ SourceThread.ongoingMigrations.set_bound(self._outgoingLimit)
+
def run(self):
+ self._update_outgoing_limit()
try:
startTime = time.time()
self._setupVdsConnection()
@@ -328,7 +339,7 @@
while not self._completed:
try:
- with SourceThread._ongoingMigrations:
+ with SourceThread.ongoingMigrations:
if self._migrationCanceledEvt:
self._raiseAbortError()
self.log.debug("migration semaphore acquired "
@@ -417,7 +428,7 @@
@staticmethod
def _is_retry_error(self, result):
return result['status']['code'] == \
- errCode['migrateLimit']['status']['code']
+ errCode['migrateLimit']['status']['code']
def _perform_migration(self, duri, muri):
if self._vm.hasSpice and self._vm.conf.get('clientIp'):
--
To view, visit https://gerrit.ovirt.org/53305
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I79ab97f15788e4024c94d051e4aade713d760acf
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Betak <mbetak at redhat.com>
More information about the vdsm-patches
mailing list