From ea8afc435b5dd32e65e1d677976f91af40f48b07 Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Fri, 8 Mar 2013 14:26:03 +0100 Subject: [PATCH 1/2] feature #1791: Add new states to JAVA bindings, and Sunstone --- share/doc/xsd/acct.xsd | 5 ++++- share/doc/xsd/vm.xsd | 5 ++++- .../opennebula/client/vm/VirtualMachine.java | 21 +++++++++++++------ src/ozones/Server/public/js/ozones.js | 5 ++++- src/sunstone/public/js/opennebula.js | 5 ++++- src/sunstone/public/js/plugins/vms-tab.js | 3 +-- 6 files changed, 32 insertions(+), 12 deletions(-) diff --git a/share/doc/xsd/acct.xsd b/share/doc/xsd/acct.xsd index 7234640862..f7c7d29381 100644 --- a/share/doc/xsd/acct.xsd +++ b/share/doc/xsd/acct.xsd @@ -108,7 +108,10 @@ BOOT_STOPPED = 22, CLEANUP_DELETE = 23, HOTPLUG_SNAPSHOT = 24, - HOTPLUG_NIC = 25 + HOTPLUG_NIC = 25, + HOTPLUG_SAVEAS = 26, + HOTPLUG_SAVEAS_POWEROFF = 27, + HOTPLUG_SAVEAS_SUSPENDED = 28 --> diff --git a/share/doc/xsd/vm.xsd b/share/doc/xsd/vm.xsd index 08a73a8f44..fa5babf322 100644 --- a/share/doc/xsd/vm.xsd +++ b/share/doc/xsd/vm.xsd @@ -70,7 +70,10 @@ BOOT_STOPPED = 22, CLEANUP_DELETE = 23, HOTPLUG_SNAPSHOT = 24, - HOTPLUG_NIC = 25 + HOTPLUG_NIC = 25, + HOTPLUG_SAVEAS = 26, + HOTPLUG_SAVEAS_POWEROFF = 27, + HOTPLUG_SAVEAS_SUSPENDED = 28 --> diff --git a/src/oca/java/src/org/opennebula/client/vm/VirtualMachine.java b/src/oca/java/src/org/opennebula/client/vm/VirtualMachine.java index 7a9949e525..c8322af13b 100644 --- a/src/oca/java/src/org/opennebula/client/vm/VirtualMachine.java +++ b/src/oca/java/src/org/opennebula/client/vm/VirtualMachine.java @@ -96,7 +96,10 @@ public class VirtualMachine extends PoolElement{ "BOOT_STOPPED", "CLEANUP_DELETE", "HOTPLUG_SNAPSHOT", - "HOTPLUG_NIC" }; + "HOTPLUG_NIC", + "HOTPLUG_SAVEAS", + "HOTPLUG_SAVEAS_POWEROFF", + "HOTPLUG_SAVEAS_SUSPENDED" }; private static final String[] SHORT_LCM_STATES = { @@ -124,7 +127,11 @@ public class VirtualMachine extends PoolElement{ "boot", "boot", "clea", - "snap" }; + "snap", + "hotp", + "hotp", + "hotp", + "hotp" }; /** * Creates a new VM representation. @@ -468,9 +475,9 @@ public class VirtualMachine extends PoolElement{ * @param imageName Name of the new Image that will be created. * @return If an error occurs the error message contains the reason. */ - public OneResponse savedisk(int diskId, String imageName) + public OneResponse savedisk(int diskId, String imageName, boolean hot = false) { - return savedisk(diskId, imageName, ""); + return savedisk(diskId, imageName, "", hot); } /** @@ -481,11 +488,13 @@ public class VirtualMachine extends PoolElement{ * @param imageName Name of the new Image that will be created. * @param imageType Type of the new image. Set to empty string to use * the default type + * @param hot do not defer saveas operation * @return If an error occurs the error message contains the reason. */ - public OneResponse savedisk(int diskId, String imageName, String imageType) + public OneResponse savedisk(int diskId, String imageName, String imageType, + boolean hot) { - return client.call(SAVEDISK, id ,diskId, imageName, imageType); + return client.call(SAVEDISK, id ,diskId, imageName, imageType, hot); } /** diff --git a/src/ozones/Server/public/js/ozones.js b/src/ozones/Server/public/js/ozones.js index ab47b88fc4..e8661caccd 100644 --- a/src/ozones/Server/public/js/ozones.js +++ b/src/ozones/Server/public/js/ozones.js @@ -104,7 +104,10 @@ var oZones = { "BOOT_STOPPED", "CLEANUP_DELETE", "HOTPLUG_SNAPSHOT", - "HOTPLUG_NIC"][value]); + "HOTPLUG_NIC", + "HOTPLUG_SAVEAS", + "HOTPLUG_SAVEAS_POWEROFF", + "HOTPLUG_SAVEAS_SUSPENDED"][value]); break; case "IMAGE": case "image": diff --git a/src/sunstone/public/js/opennebula.js b/src/sunstone/public/js/opennebula.js index 4008cee7a1..a512a2bf32 100644 --- a/src/sunstone/public/js/opennebula.js +++ b/src/sunstone/public/js/opennebula.js @@ -112,7 +112,10 @@ var OpenNebula = { "BOOT_STOPPED", "CLEANUP_DELETE", "HOTPLUG_SNAPSHOT", - "HOTPLUG_NIC"][value]); + "HOTPLUG_NIC", + "HOTPLUG_SAVEAS", + "HOTPLUG_SAVEAS_POWEROFF", + "HOTPLUG_SAVEAS_SUSPENDED"][value]); break; case "IMAGE": case "image": diff --git a/src/sunstone/public/js/plugins/vms-tab.js b/src/sunstone/public/js/plugins/vms-tab.js index a2654070cc..0aa73874ab 100644 --- a/src/sunstone/public/js/plugins/vms-tab.js +++ b/src/sunstone/public/js/plugins/vms-tab.js @@ -49,8 +49,7 @@ var vm_graphs = [ } ]; - -var VNCstates=["RUNNING","SHUTDOWN","SHUTDOWN_POWEROFF","UNKNOWN","HOTPLUG","CANCEL","MIGRATE", "HOTPLUG_SNAPSHOT", "HOTPLUG_NIC"]; +var VNCstates=["RUNNING","SHUTDOWN","SHUTDOWN_POWEROFF","UNKNOWN","HOTPLUG","CANCEL","MIGRATE", "HOTPLUG_SNAPSHOT", "HOTPLUG_NIC", "HOTPLUG_SAVEAS", "HOTPLUG_SAVEAS_POWEROFF", "HOTPLUG_SAVEAS_SUSPENDED"]; //Permanent storage for last value of aggregated network usage //Used to calculate bandwidth From 8f3fdaf943d1093622a421ffafacb9cee2790d71 Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Fri, 8 Mar 2013 14:37:03 +0100 Subject: [PATCH 2/2] bug #1799: Remove NAME from template in VMTemplate and Document classes --- src/document/Document.cc | 6 +++--- src/vm_template/VMTemplate.cc | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/document/Document.cc b/src/document/Document.cc index b6481e9010..4343d694e5 100644 --- a/src/document/Document.cc +++ b/src/document/Document.cc @@ -79,7 +79,7 @@ int Document::insert(SqlDB *db, string& error_str) // Check default attributes // --------------------------------------------------------------------- - get_template_attribute("NAME", name); + erase_template_attribute("NAME", name); if ( name.empty() == true ) { @@ -199,8 +199,8 @@ string& Document::to_xml(string& xml) const << "" << oid << "" << "" << uid << "" << "" << gid << "" - << "" << uname << "" - << "" << gname << "" + << "" << uname << "" + << "" << gname << "" << "" << name << "" << "" << type << "" << perms_to_xml(perm_str) diff --git a/src/vm_template/VMTemplate.cc b/src/vm_template/VMTemplate.cc index af638437fd..822885c0ad 100644 --- a/src/vm_template/VMTemplate.cc +++ b/src/vm_template/VMTemplate.cc @@ -81,7 +81,7 @@ int VMTemplate::insert(SqlDB *db, string& error_str) // Check default attributes // --------------------------------------------------------------------- - get_template_attribute("NAME", name); + erase_template_attribute("NAME", name); if ( name.empty() == true ) {