mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-23 22:50:09 +03:00
Feature #3782: Add image snapshots to java api
This commit is contained in:
parent
c795f055a0
commit
d728d0f9d5
@ -39,6 +39,9 @@ public class Image extends PoolElement
|
||||
private static final String CHTYPE = METHOD_PREFIX + "chtype";
|
||||
private static final String CLONE = METHOD_PREFIX + "clone";
|
||||
private static final String RENAME = METHOD_PREFIX + "rename";
|
||||
private static final String SNAPSHOTDELETE = METHOD_PREFIX + "snapshotdelete";
|
||||
private static final String SNAPSHOTREVERT = METHOD_PREFIX + "snapshotrevert";
|
||||
private static final String SNAPSHOTFLATTEN = METHOD_PREFIX + "snapshotflatten";
|
||||
|
||||
private static final String[] IMAGE_STATES =
|
||||
{"INIT", "READY", "USED", "DISABLED", "LOCKED",
|
||||
@ -282,6 +285,43 @@ public class Image extends PoolElement
|
||||
return client.call(RENAME, id, name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes Image from snapshot
|
||||
*
|
||||
* @param client XML-RPC Client.
|
||||
* @param id The Image id of the target Image.
|
||||
* @param snapId ID of the snapshot to delete
|
||||
* @return If an error occurs the error message contains the reason.
|
||||
*/
|
||||
public static OneResponse snapshotDelete(Client client, int id, int snapId)
|
||||
{
|
||||
return client.call(SNAPSHOTDELETE, id, snapId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverts Image state to a previous snapshot
|
||||
* @param client XML-RPC Client.
|
||||
* @param id The Image id of the target Image.
|
||||
* @param snapId ID of the snapshot to revert to
|
||||
* @return If an error occurs the error message contains the reason.
|
||||
*/
|
||||
public static OneResponse snapshotRevert(Client client, int id, int snapId)
|
||||
{
|
||||
return client.call(SNAPSHOTREVERT, id, snapId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Flattens an image snapshot
|
||||
* @param client XML-RPC Client.
|
||||
* @param id The Image id of the target Image.
|
||||
* @param snapId ID of the snapshot to flatten
|
||||
* @return If an error occurs the error message contains the reason.
|
||||
*/
|
||||
public static OneResponse snapshotFlatten(Client client, int id, int snapId)
|
||||
{
|
||||
return client.call(SNAPSHOTFLATTEN, id, snapId);
|
||||
}
|
||||
|
||||
// =================================
|
||||
// Instanced object XML-RPC methods
|
||||
// =================================
|
||||
@ -550,6 +590,37 @@ public class Image extends PoolElement
|
||||
return rename(client, id, name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes Image from snapshot
|
||||
*
|
||||
* @param snapId ID of the snapshot to delete
|
||||
* @return If an error occurs the error message contains the reason.
|
||||
*/
|
||||
public OneResponse snapshotDelete(int snapId)
|
||||
{
|
||||
return snapshotDelete(client, id, snapId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverts Image state to a previous snapshot
|
||||
* @param snapId ID of the snapshot to revert to
|
||||
* @return If an error occurs the error message contains the reason.
|
||||
*/
|
||||
public OneResponse snapshotRevert(int snapId)
|
||||
{
|
||||
return snapshotRevert(client, id, snapId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Flattens an image snapshot
|
||||
* @param snapId ID of the snapshot to flatten
|
||||
* @return If an error occurs the error message contains the reason.
|
||||
*/
|
||||
public OneResponse snapshotFlatten(int snapId)
|
||||
{
|
||||
return snapshotFlatten(client, id, snapId);
|
||||
}
|
||||
|
||||
// =================================
|
||||
// Helpers
|
||||
// =================================
|
||||
|
@ -228,7 +228,7 @@ module OpenNebula
|
||||
|
||||
# Deletes Image from snapshot
|
||||
#
|
||||
# @param snap_id [Integet] ID of the snapshot to delete
|
||||
# @param snap_id [Integer] ID of the snapshot to delete
|
||||
#
|
||||
# @return [nil, OpenNebula::Error] nil in case of success or Error
|
||||
def snapshot_delete(snap_id)
|
||||
@ -237,7 +237,7 @@ module OpenNebula
|
||||
|
||||
# Reverts Image state to a previous snapshot
|
||||
#
|
||||
# @param snap_id [Integet] ID of the snapshot to delete
|
||||
# @param snap_id [Integer] ID of the snapshot to revert to
|
||||
#
|
||||
# @return [nil, OpenNebula::Error] nil in case of success or Error
|
||||
def snapshot_revert(snap_id)
|
||||
@ -246,7 +246,7 @@ module OpenNebula
|
||||
|
||||
# Flattens an image snapshot
|
||||
#
|
||||
# @param snap_id [Integet] ID of the snapshot to flatten
|
||||
# @param snap_id [Integer] ID of the snapshot to flatten
|
||||
#
|
||||
# @return [nil, OpenNebula::Error] nil in case of success or Error
|
||||
def snapshot_flatten(snap_id)
|
||||
|
Loading…
x
Reference in New Issue
Block a user