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 0cac8109e0..de94f27b0a 100644 --- a/src/oca/java/src/org/opennebula/client/image/Image.java +++ b/src/oca/java/src/org/opennebula/client/image/Image.java @@ -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 // ================================= diff --git a/src/oca/ruby/opennebula/image.rb b/src/oca/ruby/opennebula/image.rb index 3940989487..68673dcb8d 100644 --- a/src/oca/ruby/opennebula/image.rb +++ b/src/oca/ruby/opennebula/image.rb @@ -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)