On Mon, 2015-10-26 at 16:08 -0200, dhbarboza82(a)gmail.com wrote:
From: Daniel Henrique Barboza <dhbarboza82(a)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(a)gmail.com>
---
src/wok/plugins/kimchi/API.json | 17
+++++++++++++++++
src/wok/plugins/kimchi/docs/API.md | 4 ++++
src/wok/plugins/kimchi/i18n.py | 7 +++++++
src/wok/plugins/kimchi/ui/js/src/kimchi.api.js | 13 +++++++++++++
4 files changed, 41 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 a9333b5..e9fb35e 100644
--- a/src/wok/plugins/kimchi/docs/API.md
+++ b/src/wok/plugins/kimchi/docs/API.md
@@ -180,6 +180,10 @@ 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.
Would be nice break the line at the 80 collumm :-P
+ * 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..e67f6f0 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 vm to the remote host %(host)s the
user %(user)s must have password-less login to the remote host."),
All messages are not using the term "vm" (or "VM"), but "Virtual
Machine". Would be nice keep the pattern.
+ "KCHVM0057E": _("Can not migrate vm %(name)s when
its in
%(state)s state."),
+ "KCHVM0058E": _("Failed Migrate vm %(name)s due error:
%(err)s"),
I guess it should be "Failed to migrate".
+ "KCHVM0059E": _("User name of the remote server
must be a
string"),
+ "KCHVM0060E": _("Migrate remote_host must be a string"),
Is this message correct?
+
"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 6ffa0df..58693f5 100644
--- a/src/wok/plugins/kimchi/ui/js/src/kimchi.api.js
+++ b/src/wok/plugins/kimchi/ui/js/src/kimchi.api.js
@@ -1007,6 +1007,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',