mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-25 02:50:08 +03:00
M #-: Update Java bindings (#2386)
This commit is contained in:
parent
bf5a9193a0
commit
ff1f296ed1
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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
|
||||
// =================================
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user