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

Feature #1797: The action to wake up a poweroff VM is now 'resume'

This commit is contained in:
Carlos Martín 2013-04-04 16:07:10 +02:00
parent 2cca4c5676
commit e53d97a5ad
4 changed files with 18 additions and 12 deletions

View File

@ -91,6 +91,9 @@ digraph OpenNebula {
suspended -> boot_suspended [label="resume"];
boot_suspended -> running [style="dashed"];
poweroff -> boot_poweroff [label="resume"];
boot_poweroff -> running [style="dashed"];
# destroy
ANY -> done [label="destroy"];
@ -101,10 +104,7 @@ digraph OpenNebula {
boot -> boot [label="boot"];
boot_suspended -> boot_suspended [label="boot"];
boot_stopped -> boot_stopped [label="boot"];
poweroff -> boot_poweroff [label="boot"];
boot_poweroff -> boot_poweroff [label="boot"];
boot_poweroff -> running [style="dashed"];
unknown -> boot_unknown [label="boot"];
boot_unknown -> boot_unknown [label="boot"];

View File

@ -69,6 +69,7 @@ digraph OpenNebula {
# resume
stopped -> pending [label="resume"];
suspended -> boot [label="resume"];
poweroff -> boot [label="resume"];
# delete
ANY -> done [label="destroy"];
@ -76,7 +77,6 @@ digraph OpenNebula {
# restart
unknown -> boot [label="boot"];
boot -> boot [label="boot"];
poweroff -> boot [label="boot"];
# reboot
running -> running [label="reboot"];

View File

@ -344,7 +344,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
poweroff_desc = <<-EOT.unindent
Powers off the given VM. The VM will remain in the poweroff state, and
can be powered on with the 'onevm boot' command.
can be powered on with the 'onevm resume' command.
States: RUNNING
EOT
@ -432,7 +432,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
boot_desc = <<-EOT.unindent
Boots the given VM.
States: UNKNOWN, BOOT, POWEROFF
States: UNKNOWN, BOOT
EOT
command :boot, boot_desc, [:range,:vmid_list],
@ -487,7 +487,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
resume_desc = <<-EOT.unindent
Resumes the execution of the a saved VM
States: STOPPED, SUSPENDED
States: STOPPED, SUSPENDED, UNDEPLOYED, POWEROFF
EOT
command :resume, resume_desc, [:range,:vmid_list],

View File

@ -572,12 +572,19 @@ int DispatchManager::resume(
Nebula& nd = Nebula::instance();
LifeCycleManager * lcm = nd.get_lcm();
vmpool->update(vm);
vm->log("DiM", Log::INFO, "New VM state is ACTIVE.");
lcm->trigger(LifeCycleManager::RESTORE,vid);
}
else if (vm->get_state() == VirtualMachine::POWEROFF)
{
Nebula& nd = Nebula::instance();
LifeCycleManager * lcm = nd.get_lcm();
vm->log("DiM", Log::INFO, "New VM state is ACTIVE.");
lcm->trigger(LifeCycleManager::RESTART,vid);
}
else
{
goto error;
@ -614,14 +621,13 @@ int DispatchManager::restart(int vid)
oss << "Restarting VM " << vid;
NebulaLog::log("DiM",Log::DEBUG,oss);
if ((vm->get_state() == VirtualMachine::ACTIVE &&
if (vm->get_state() == VirtualMachine::ACTIVE &&
(vm->get_lcm_state() == VirtualMachine::UNKNOWN ||
vm->get_lcm_state() == VirtualMachine::BOOT ||
vm->get_lcm_state() == VirtualMachine::BOOT_UNKNOWN ||
vm->get_lcm_state() == VirtualMachine::BOOT_POWEROFF ||
vm->get_lcm_state() == VirtualMachine::BOOT_SUSPENDED ||
vm->get_lcm_state() == VirtualMachine::BOOT_STOPPED))
|| vm->get_state() == VirtualMachine::POWEROFF )
{
Nebula& nd = Nebula::instance();
LifeCycleManager * lcm = nd.get_lcm();
@ -914,7 +920,7 @@ int DispatchManager::resubmit(int vid)
{
case VirtualMachine::POWEROFF:
NebulaLog::log("DiM",Log::ERROR,
"Cannot resubmit a powered off VM. Restart it first");
"Cannot resubmit a powered off VM. Resume it first");
rc = -2;
break;