diff --git a/include/VMActions.h b/include/VMActions.h index caf78e8d9a..ec56c492e5 100644 --- a/include/VMActions.h +++ b/include/VMActions.h @@ -79,8 +79,7 @@ public: POFF_MIGRATE_ACTION = 48, // "one.vm.migrate" POFF_HARD_MIGRATE_ACTION = 49, // "one.vm.migrate" BACKUP_ACTION = 50, // "one.vm.backup" - NIC_UPDATE_ACTION = 51, // "one.vm.updatenic" - NIC_RECOVER_ACTION = 52 // "one.vm.recovernic" + NIC_UPDATE_ACTION = 51 // "one.vm.updatenic" }; static std::string action_to_str(Action action); diff --git a/src/oca/java/src/org/opennebula/client/image/Image.java b/src/oca/java/src/org/opennebula/client/image/Image.java index f46f0d4b13..73e180cc67 100644 --- a/src/oca/java/src/org/opennebula/client/image/Image.java +++ b/src/oca/java/src/org/opennebula/client/image/Image.java @@ -152,11 +152,12 @@ public class Image extends PoolElement * * @param client XML-RPC Client. * @param id The image id of the target image we want to delete. + * @param force Ignore errors * @return A encapsulated response. */ - public static OneResponse delete(Client client, int id) + public static OneResponse delete(Client client, int id, boolean force) { - return client.call(DELETE, id); + return client.call(DELETE, id, force); } /** @@ -404,11 +405,12 @@ public class Image extends PoolElement /** * Deletes the image from OpenNebula. * + * @param force Ignore errors * @return A encapsulated response. */ - public OneResponse delete() + public OneResponse delete(boolean force) { - return delete(client, id); + return delete(client, id, force); } /** 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 ef998fcc88..e31c0b8765 100644 --- a/src/oca/java/src/org/opennebula/client/vm/VirtualMachine.java +++ b/src/oca/java/src/org/opennebula/client/vm/VirtualMachine.java @@ -62,6 +62,7 @@ public class VirtualMachine extends PoolElement{ private static final String UNLOCK = METHOD_PREFIX + "unlock"; private static final String ATTACHSG = METHOD_PREFIX + "attachsg"; private static final String DETACHSG = METHOD_PREFIX + "detachsg"; + private static final String BACKUP = METHOD_PREFIX + "backup"; private static final String[] VM_STATES = { @@ -165,7 +166,9 @@ public class VirtualMachine extends PoolElement{ "HOTPLUG_NIC_POWEROFF", "HOTPLUG_RESIZE", "HOTPLUG_SAVEAS_UNDEPLOYED", - "HOTPLUG_SAVEAS_STOPPED" + "HOTPLUG_SAVEAS_STOPPED", + "BACKUP", + "BACKUP_POWEROFF" }; private static final String[] SHORT_LCM_STATES = @@ -238,7 +241,9 @@ public class VirtualMachine extends PoolElement{ "hotp", // HOTPLUG_NIC_POWEROFF "hotp", // HOTPLUG_RESIZE "hotp", // HOTPLUG_SAVEAS_UNDEPLOYED - "hotp" // HOTPLUG_SAVEAS_STOPPED + "hotp", // HOTPLUG_SAVEAS_STOPPED + "back", // BACKUP + "back" // BACKUP_POWEROFF }; /** @@ -773,6 +778,21 @@ public class VirtualMachine extends PoolElement{ return client.call(DETACHSG, id, nicid, sgid); } + /** + * Backup Virtual Machine + * + * @param client XML-RPC Client. + * @param id The Virtual Machine ID (vid) of the target instance. + * @param ds_id Id of the datastore to save the backup + * @param reset Reset incremental backup, do full backup + * @return If an error occurs the error message contains the reason. + */ + public static OneResponse backup(Client client, int id, int ds_id, + boolean reset) + { + return client.call(BACKUP, id, ds_id, reset); + } + // ================================= // Instanced object XML-RPC methods // ================================= @@ -1343,6 +1363,18 @@ public class VirtualMachine extends PoolElement{ return sgDetach(client, id, nicid, sgid); } + /** + * Backup VM + * + * @param ds_id Id of the datastore to save the backup + * @param reset Reset incremental backup, do full backup + * @return If an error occurs the error message contains the reason. + */ + public OneResponse backup(int ds_id, boolean reset) + { + return backup(client, id, ds_id, reset); + } + // ================================= // Helpers // ================================= diff --git a/src/oca/ruby/opennebula/virtual_machine.rb b/src/oca/ruby/opennebula/virtual_machine.rb index cffec60913..33a233c295 100644 --- a/src/oca/ruby/opennebula/virtual_machine.rb +++ b/src/oca/ruby/opennebula/virtual_machine.rb @@ -58,8 +58,7 @@ module OpenNebula :attachsg => "vm.attachsg", :detachsg => "vm.detachsg", :backup => "vm.backup", - :updatenic => "vm.updatenic", - :recovernic => "vm.recovernic" + :updatenic => "vm.updatenic" } VM_STATE=%w{INIT PENDING HOLD ACTIVE STOPPED SUSPENDED DONE FAILED diff --git a/src/vm/VMActions.cc b/src/vm/VMActions.cc index f471107751..a82036ff6f 100644 --- a/src/vm/VMActions.cc +++ b/src/vm/VMActions.cc @@ -369,9 +369,6 @@ string VMActions::action_to_str(Action action) case NIC_UPDATE_ACTION: st = "nic-update"; break; - case NIC_RECOVER_ACTION: - st = "nic-recover"; - break; } return st; @@ -563,10 +560,6 @@ int VMActions::action_from_str(const string& st, Action& action) { action = NIC_UPDATE_ACTION; } - else if ( st == "nic-recover") - { - action = NIC_RECOVER_ACTION; - } else { action = NONE_ACTION;