1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

Feature #1224: snapshot-create can be scheduled

This commit is contained in:
Carlos Martín 2013-02-21 14:53:04 +01:00
parent 51de89ff70
commit e3380cba7f
4 changed files with 26 additions and 7 deletions

View File

@ -299,7 +299,7 @@ class OneVMHelper < OpenNebulaHelper::OneHelper
end
column :"HYPERVISOR_ID", "", :left, :size=>15 do |d|
d["NAME"] if !d.nil?
d["HYPERVISOR_ID"] if !d.nil?
end
end.show([vm.to_hash['VM']['TEMPLATE']['SNAPSHOT']].flatten, {})

View File

@ -628,10 +628,14 @@ cmd=CommandParser::CmdParser.new(ARGV) do
EOT
command :"snapshot-create", snapshot_create_desc, [:range,:vmid_list],
[:name, nil] do
[:name, nil], :options => [OneVMHelper::SCHEDULE] do
helper.perform_actions(args[0],options,"snapshot created") do |o|
o.snapshot_create(args[1])
if (!options[:schedule].nil?)
helper.schedule_actions(args[0], options, @comm_name)
else
helper.perform_actions(args[0],options,"snapshot created") do |o|
o.snapshot_create(args[1])
end
end
end

View File

@ -254,14 +254,28 @@ int VirtualMachineActionsPoolXML::action(
try
{
client->call( client->get_endpoint(), // serverUrl
if (action == "snapshot-create")
{
client->call( client->get_endpoint(), // serverUrl
"one.vm.snapshotcreate", // methodName
"sis", // arguments format
&result, // resultP
client->get_oneauth().c_str(), // session
vid, // VM ID
string("").c_str() // snapshot name
);
}
else
{
client->call( client->get_endpoint(), // serverUrl
"one.vm.action", // methodName
"ssi", // arguments format
&result, // resultP
client->get_oneauth().c_str(), // session
action.c_str(), // action
vid // VM ID
);
);
}
}
catch (exception const& e)
{

View File

@ -312,7 +312,8 @@ int VirtualMachineXML::parse_action_name(string& action_st)
&& action_st != "reboot"
&& action_st != "reset"
&& action_st != "poweroff"
&& action_st != "finalize")
&& action_st != "finalize"
&& action_st != "snapshot-create")
{
return -1;
}