1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-11 04:58:16 +03:00

Feature #3782: Rename disk snapshot tag to name

This commit is contained in:
Carlos Martín 2015-07-09 13:13:07 +02:00
parent fe2e96abd2
commit 27e3ac289f
17 changed files with 41 additions and 41 deletions

View File

@ -368,7 +368,7 @@ public:
*
* @param vid VirtualMachine identification
* @param did DISK identification
* @param tag Description for the new snapshot
* @param name Description for the new snapshot
* @param snap_id Will contain the new snapshot ID
* @param error_str Error reason, if any
*
@ -377,7 +377,7 @@ public:
int disk_snapshot_create(
int vid,
int did,
const string& tag,
const string& name,
int& snap_id,
string& error_str);

View File

@ -37,7 +37,7 @@ class VectorAttribute;
* <ACTIVE>: the current snapshot in use by the VM. 0 for the original DISK
* <SNAPSHOT>
* <ID>
* <TAG>: Description
* <NAME>: Description
* <DATE>: the snapshot was taken
* <PARENT>: backing for this snapshot, -1 for the original image
* <CHILDREN>: comma separated list of children snapshots
@ -75,11 +75,11 @@ public:
/**
* Creates a new (empty) snapshot of the active disk
* @param tag description of this snapshot (optional)
* @param name description of this snapshot (optional)
* @param size_mb of the snapshot (virtual size)
* @return id of the new snapshot
*/
int create_snapshot(const string& tag, unsigned int size_mb);
int create_snapshot(const string& name, unsigned int size_mb);
/**
* Check if an snapshot can be deleted (no children, no active)
@ -179,7 +179,7 @@ public:
* @param id of the snapshot
* @return size or 0 if not found
*/
unsigned int get_snapshot_size(int id) const;
unsigned int get_snapshot_size(int id) const;
/**
* Get Attribute from the given snapshot

View File

@ -1533,11 +1533,11 @@ public:
/**
* Creates a new snapshot of the given disk
* @param disk_id of the disk
* @param tag a description for this snapshot
* @param name a description for this snapshot
* @param error if any
* @return the id of the new snapshot or -1 if error
*/
int new_disk_snapshot(int disk_id, const string& tag, string& error);
int new_disk_snapshot(int disk_id, const string& name, string& error);
/**
* Sets the snap_id as active, the VM will boot from it next time

View File

@ -339,15 +339,15 @@ class OneImageHelper < OpenNebulaHelper::OneHelper
d["CHILDREN"]
end
column :TAG, "Snapshot Tag", :left, :size=>45 do |d|
d["TAG"]
column :NAME, "Snapshot Name", :left, :size=>45 do |d|
d["NAME"]
end
column :DATE, "Snapshot creation date", :size=>15 do |d|
OpenNebulaHelper.time_to_str(d["DATE"])
end
default :AC, :ID, :PARENT, :DATE, :CHILDREN, :TAG
default :AC, :ID, :PARENT, :DATE, :CHILDREN, :NAME
end
# Convert snapshot data to an array

View File

@ -988,15 +988,15 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
"#{monitor_size}/#{size}"
end
column :TAG, "Snapshot Tag", :left, :size=>26 do |d|
d["TAG"]
column :NAME, "Snapshot Name", :left, :size=>26 do |d|
d["NAME"]
end
column :DATE, "Snapshot creation date", :size=>10 do |d|
OpenNebulaHelper.time_to_str(d["DATE"])
end
default :AC, :ID, :DISK, :PARENT, :DATE, :CHILDREN, :SIZE, :TAG
default :AC, :ID, :DISK, :PARENT, :DATE, :CHILDREN, :SIZE, :NAME
end
# Convert snapshot data to an array

View File

@ -816,7 +816,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
EOT
command :"disk-snapshot-create", disk_snapshot_create_desc,
:vmid, :diskid, :tag do
:vmid, :diskid, :name do
helper.perform_action(args[0],options,"disk snapshot created") do |o|
o.disk_snapshot_create(args[1].to_i, args[2])
end

View File

@ -1615,7 +1615,7 @@ int DispatchManager::detach_nic(
int DispatchManager::disk_snapshot_create(
int vid,
int did,
const string& tag,
const string& name,
int& snap_id,
string& error_str)
{
@ -1652,7 +1652,7 @@ int DispatchManager::disk_snapshot_create(
return -1;
}
snap_id = vm->new_disk_snapshot(did, tag, error_str);
snap_id = vm->new_disk_snapshot(did, name, error_str);
if (snap_id == -1)
{

View File

@ -518,13 +518,13 @@ public class VirtualMachine extends PoolElement{
* @param client XML-RPC Client.
* @param id The VM id of the target VM.
* @param diskId Id of the disk
* @param tag description for the snapshot
* @param name description for the snapshot
* @return New snapshot Id, or the error message
*/
public static OneResponse diskSnapshotCreate(Client client, int id,
int diskId, String tag)
int diskId, String name)
{
return client.call(DISKSNAPSHOTCREATE, id, diskId, tag);
return client.call(DISKSNAPSHOTCREATE, id, diskId, name);
}
/**
@ -956,12 +956,12 @@ public class VirtualMachine extends PoolElement{
* Takes a new snapshot of a disk
*
* @param diskId Id of the disk
* @param tag description for the snapshot
* @param name description for the snapshot
* @return New snapshot Id, or the error message
*/
public OneResponse diskSnapshotCreate(int diskId, String tag)
public OneResponse diskSnapshotCreate(int diskId, String name)
{
return diskSnapshotCreate(client, id, diskId, tag);
return diskSnapshotCreate(client, id, diskId, name);
}
/**

View File

@ -615,11 +615,11 @@ module OpenNebula
# Takes a new snapshot of a disk
#
# @param disk_id [Integer] Id of the disk
# @param tag [String] description for the snapshot
# @param name [String] description for the snapshot
#
# @return [Integer, OpenNebula::Error] The new snapshot ID or error
def disk_snapshot_create(disk_id, tag)
return call(VM_METHODS[:disksnapshotcreate], @pe_id, disk_id, tag)
def disk_snapshot_create(disk_id, name)
return call(VM_METHODS[:disksnapshotcreate], @pe_id, disk_id, name)
end
# Reverts disk state to a previously taken snapshot

View File

@ -2356,9 +2356,9 @@ void VirtualMachineDiskSnapshotCreate::request_execute(
int snap_id;
string error_str;
int id = xmlrpc_c::value_int(paramList.getInt(1));
int did = xmlrpc_c::value_int(paramList.getInt(2));
string tag = xmlrpc_c::value_string(paramList.getString(3));
int id = xmlrpc_c::value_int(paramList.getInt(1));
int did = xmlrpc_c::value_int(paramList.getInt(2));
string name = xmlrpc_c::value_string(paramList.getString(3));
if ( vm_authorization(id, 0, 0, att, 0, 0, auth_op) == false )
{
@ -2430,7 +2430,7 @@ void VirtualMachineDiskSnapshotCreate::request_execute(
// ------------------------------------------------------------------------
// Do the snapshot
// ------------------------------------------------------------------------
rc = dm->disk_snapshot_create(id, did, tag, snap_id, error_str);
rc = dm->disk_snapshot_create(id, did, name, snap_id, error_str);
if ( rc != 0 )
{

View File

@ -127,7 +127,7 @@ module OpenNebulaJSON
end
def disk_snapshot_create(params=Hash.new)
super(params['disk_id'].to_i, params['tag'])
super(params['disk_id'].to_i, params['snapshot_name'])
end
def disk_snapshot_revert(params=Hash.new)

View File

@ -184,7 +184,7 @@ define(function(require){
}
html += Humanize.prettyTime(snapshot.DATE) + SPACE +
(snapshot.TAG ? snapshot.TAG + SPACE : '');
(snapshot.NAME ? snapshot.NAME + SPACE : '');
html += '</div>';

View File

@ -54,7 +54,7 @@ define(function(require) {
var snapshot_name = $('#snapshot_name', this).val();
var obj = {
"disk_id" : that.diskId,
"tag": snapshot_name
"snapshot_name": snapshot_name
};
Sunstone.runAction('VM.disk_snapshot_create', that.element.ID, obj);

View File

@ -18,7 +18,7 @@
</div>
<div class="row">
<div class="large-12 columns">
<label for="snapshot_name">{{tr "Tag"}}:</label>
<label for="snapshot_name">{{tr "Name"}}:</label>
<input type="text" name="snapshot_name" id="snapshot_name" />
</div>
</div>

View File

@ -441,7 +441,7 @@ define(function(require) {
}
html += Humanize.prettyTime(snapshot.DATE) + SPACE +
(snapshot.TAG ? snapshot.TAG + SPACE : '');
(snapshot.NAME ? snapshot.NAME + SPACE : '');
if (Config.isTabActionEnabled("vms-tab", "VM.disk_saveas") &&
StateActions.enabledStateAction("VM.disk_saveas", that.element.STATE, that.element.LCM_STATE)) {

View File

@ -122,13 +122,13 @@ void Snapshots::init()
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
int Snapshots::create_snapshot(const string& tag, unsigned int size_mb)
int Snapshots::create_snapshot(const string& name, unsigned int size_mb)
{
VectorAttribute * snapshot = new VectorAttribute("SNAPSHOT");
if (!tag.empty())
if (!name.empty())
{
snapshot->replace("TAG", tag);
snapshot->replace("NAME", name);
}
snapshot->replace("SIZE", size_mb);

View File

@ -4209,7 +4209,7 @@ int VirtualMachine::get_snapshot_disk(int& ds_id, string& tm_mad,
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
int VirtualMachine::new_disk_snapshot(int did, const string& tag, string& error)
int VirtualMachine::new_disk_snapshot(int did, const string& name, string& error)
{
map<int, Snapshots *>::iterator it;
unsigned int size_mb, snap_size;
@ -4243,7 +4243,7 @@ int VirtualMachine::new_disk_snapshot(int did, const string& tag, string& error)
{
Snapshots * snap = new Snapshots(did);
snap_id = snap->create_snapshot(tag, size_mb);
snap_id = snap->create_snapshot(name, size_mb);
snap_size = size_mb;
if (snap_id != -1)
@ -4257,7 +4257,7 @@ int VirtualMachine::new_disk_snapshot(int did, const string& tag, string& error)
}
else
{
snap_id = it->second->create_snapshot(tag, size_mb);
snap_id = it->second->create_snapshot(name, size_mb);
snap_size = it->second->get_total_size();
}