diff --git a/src/cli/one_helper/onevm_helper.rb b/src/cli/one_helper/onevm_helper.rb index b7e691b2bf..2fe432c165 100644 --- a/src/cli/one_helper/onevm_helper.rb +++ b/src/cli/one_helper/onevm_helper.rb @@ -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, {}) diff --git a/src/cli/onevm b/src/cli/onevm index bcce47cb62..31cdc1c581 100755 --- a/src/cli/onevm +++ b/src/cli/onevm @@ -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 diff --git a/src/scheduler/src/pool/VirtualMachinePoolXML.cc b/src/scheduler/src/pool/VirtualMachinePoolXML.cc index ec9ff9eb63..6479e30456 100644 --- a/src/scheduler/src/pool/VirtualMachinePoolXML.cc +++ b/src/scheduler/src/pool/VirtualMachinePoolXML.cc @@ -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) { diff --git a/src/scheduler/src/pool/VirtualMachineXML.cc b/src/scheduler/src/pool/VirtualMachineXML.cc index 2b0840b26b..6fe23e47af 100644 --- a/src/scheduler/src/pool/VirtualMachineXML.cc +++ b/src/scheduler/src/pool/VirtualMachineXML.cc @@ -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; }