
From: Daniel Henrique Barboza <dhbarboza82@gmail.com> This patch adds messages in i18n to support the live migration backend, which is defined by a new API defined in API.json and docs/API.md. Signed-off-by: Daniel Henrique Barboza <dhbarboza82@gmail.com> --- src/wok/plugins/kimchi/API.json | 17 +++++++++++++++++ src/wok/plugins/kimchi/docs/API.md | 5 +++++ src/wok/plugins/kimchi/i18n.py | 7 +++++++ src/wok/plugins/kimchi/ui/js/src/kimchi.api.js | 13 +++++++++++++ 4 files changed, 42 insertions(+) diff --git a/src/wok/plugins/kimchi/API.json b/src/wok/plugins/kimchi/API.json index c43fa36..de68d70 100644 --- a/src/wok/plugins/kimchi/API.json +++ b/src/wok/plugins/kimchi/API.json @@ -309,6 +309,23 @@ }, "additionalProperties": false }, + "vm_migrate": { + "type": "object", + "properties": { + "remote_host": { + "description": "IP address or hostname of the remote server", + "type": "string", + "minLength": 1, + "error": "KCHVM0060E" + }, + "user": { + "description": "User of the remote server", + "type": "string", + "minLength": 1, + "error": "KCHVM0059E" + } + } + }, "networks_create": { "type": "object", "error": "KCHNET0016E", diff --git a/src/wok/plugins/kimchi/docs/API.md b/src/wok/plugins/kimchi/docs/API.md index eb3905f..52368b7 100644 --- a/src/wok/plugins/kimchi/docs/API.md +++ b/src/wok/plugins/kimchi/docs/API.md @@ -182,6 +182,11 @@ server. * resume: Resume a suspended domain. The process is restarted from the state where it was frozen by calling "suspend". +* migrate: Migrate a virtual machine to a remote server, only support live +mode without block migration. + * remote_host: IP address or hostname of the remote server. + * user: User to log on at the remote server. + ### Sub-resource: Virtual Machine Screenshot **URI:** /plugins/kimchi/vms/*:name*/screenshot diff --git a/src/wok/plugins/kimchi/i18n.py b/src/wok/plugins/kimchi/i18n.py index f9a2ca1..42a5e16 100644 --- a/src/wok/plugins/kimchi/i18n.py +++ b/src/wok/plugins/kimchi/i18n.py @@ -109,6 +109,13 @@ messages = { "KCHVM0050E": _("Cannot shutdown %(name)s. Virtual machine is shut off."), "KCHVM0051E": _("Cannot reset %(name)s. Virtual machine is already shut off."), + "KCHVM0055E": _("Migrate to localhost %(host)s is not allowed."), + "KCHVM0056E": _("To migrate a virtual machine to the remote host %(host)s the user %(user)s must have password-less login to the remote host."), + "KCHVM0057E": _("Can not migrate virtual machine %(name)s when its in %(state)s state."), + "KCHVM0058E": _("Failed to migrate virtual machine %(name)s due error: %(err)s"), + "KCHVM0059E": _("User name of the remote server must be a string."), + "KCHVM0060E": _("Destination host of the migration must be a string."), + "KCHVMHDEV0001E": _("VM %(vmid)s does not contain directly assigned host device %(dev_name)s."), "KCHVMHDEV0002E": _("The host device %(dev_name)s is not allowed to directly assign to VM."), "KCHVMHDEV0003E": _("No IOMMU groups found. Host PCI pass through needs IOMMU group to function correctly. " diff --git a/src/wok/plugins/kimchi/ui/js/src/kimchi.api.js b/src/wok/plugins/kimchi/ui/js/src/kimchi.api.js index c55b252..b1acdb9 100644 --- a/src/wok/plugins/kimchi/ui/js/src/kimchi.api.js +++ b/src/wok/plugins/kimchi/ui/js/src/kimchi.api.js @@ -1018,6 +1018,19 @@ var kimchi = { }); }, + migrateGuest: function(vm, suc, err) { + wok.requestJSON({ + url : 'plugins/kimchi/vms/' + encodeURIComponent(vm) + "/migrate", + type : 'POST', + contentType : 'application/json', + dataType : 'json', + success : suc, + error : err ? err : function(data) { + wok.message.error(data.responseJSON.reason); + } + }); + }, + listSnapshots : function(vm, suc, err) { wok.requestJSON({ url : 'plugins/kimchi/vms/' + encodeURIComponent(vm) + '/snapshots', -- 2.4.3