Revision ae32c481

View differences:

include/VirtualMachine.h
96 96
        HOTPLUG_SAVEAS           = 26,
97 97
        HOTPLUG_SAVEAS_POWEROFF  = 27,
98 98
        HOTPLUG_SAVEAS_SUSPENDED = 28,
99
        UNDEPLOYING         = 29,
99
        SHUTDOWN_UNDEPLOY   = 29,
100 100
        EPILOG_UNDEPLOY     = 30,
101 101
        PROLOG_UNDEPLOY     = 31
102 102
    };
src/lcm/LifeCycleActions.cc
360 360
        VirtualMachineManager * vmm = nd.get_vmm();
361 361

  
362 362
        //----------------------------------------------------
363
        //             UNDEPLOYING STATE
363
        //             SHUTDOWN_UNDEPLOY STATE
364 364
        //----------------------------------------------------
365 365

  
366
        vm->set_state(VirtualMachine::UNDEPLOYING);
366
        vm->set_state(VirtualMachine::SHUTDOWN_UNDEPLOY);
367 367

  
368 368
        vm->set_resched(false);
369 369

  
370 370
        vmpool->update(vm);
371 371

  
372
        vm->log("LCM",Log::INFO,"New VM state is UNDEPLOYING");
372
        vm->log("LCM",Log::INFO,"New VM state is SHUTDOWN_UNDEPLOY");
373 373

  
374 374
        //----------------------------------------------------
375 375

  
src/lcm/LifeCycleStates.cc
514 514

  
515 515
        dm->trigger(DispatchManager::POWEROFF_SUCCESS,vid);
516 516
    }
517
    else if (vm->get_lcm_state() == VirtualMachine::UNDEPLOYING)
517
    else if (vm->get_lcm_state() == VirtualMachine::SHUTDOWN_UNDEPLOY)
518 518
    {
519 519
        //----------------------------------------------------
520 520
        //            EPILOG_UNDEPLOY STATE
......
567 567

  
568 568
    if ( vm->get_lcm_state() == VirtualMachine::SHUTDOWN ||
569 569
         vm->get_lcm_state() == VirtualMachine::SHUTDOWN_POWEROFF ||
570
         vm->get_lcm_state() == VirtualMachine::UNDEPLOYING )
570
         vm->get_lcm_state() == VirtualMachine::SHUTDOWN_UNDEPLOY )
571 571
    {
572 572
        //----------------------------------------------------
573 573
        //    RUNNING STATE FROM SHUTDOWN
......
959 959

  
960 960
        tm->trigger(TransferManager::EPILOG,vid);
961 961
    }
962
    else if (vm->get_lcm_state() == VirtualMachine::UNDEPLOYING)
962
    else if (vm->get_lcm_state() == VirtualMachine::SHUTDOWN_UNDEPLOY)
963 963
    {
964 964
        //----------------------------------------------------
965 965
        //            EPILOG_UNDEPLOY STATE
......
1011 1011
    }
1012 1012

  
1013 1013
    if ( vm->get_lcm_state() == VirtualMachine::CANCEL ||
1014
         vm->get_lcm_state() == VirtualMachine::UNDEPLOYING )
1014
         vm->get_lcm_state() == VirtualMachine::SHUTDOWN_UNDEPLOY )
1015 1015
    {
1016 1016
        //----------------------------------------------------
1017 1017
        //    RUNNING STATE FROM CANCEL
src/oca/java/src/org/opennebula/client/vm/VirtualMachine.java
58 58
        "SUSPENDED",
59 59
        "DONE",
60 60
        "FAILED",
61
        "POWEROFF" };
61
        "POWEROFF",
62
        "UNDEPLOYED" };
62 63

  
63 64
    private static final String[] SHORT_VM_STATES =
64 65
    {
......
70 71
        "susp",
71 72
        "done",
72 73
        "fail",
73
        "poff" };
74
        "poff",
75
        "unde" };
74 76

  
75 77
    private static final String[] LCM_STATE =
76 78
    {
......
102 104
        "HOTPLUG_NIC",
103 105
        "HOTPLUG_SAVEAS",
104 106
        "HOTPLUG_SAVEAS_POWEROFF",
105
        "HOTPLUG_SAVEAS_SUSPENDED" };
107
        "HOTPLUG_SAVEAS_SUSPENDED",
108
        "SHUTDOWN_UNDEPLOY",
109
        "EPILOG_UNDEPLOY",
110
        "PROLOG_UNDEPLOY" };
106 111

  
107 112
    private static final String[] SHORT_LCM_STATES =
108 113
    {
......
501 506
     * <li>{@link VirtualMachine#poweroff()}</li>
502 507
     * <li>{@link VirtualMachine#resched()}</li>
503 508
     * <li>{@link VirtualMachine#unresched()}</li>
509
     * <li>{@link VirtualMachine#undeploy(boolean)}</li>
504 510
     * </ul>
505 511
     *
506 512
     * @param action The action name to be performed, can be:<br/>
507 513
     * "shutdown", "hold", "release", "stop", "shutdown-hard", "suspend",
508 514
     * "resume", "boot", "destroy", "destroy-recreate", "reboot", "resched",
509
     * "unresched", "reboot-hard", "poweroff"
515
     * "unresched", "reboot-hard", "poweroff", "undeploy", "undeploy-hard"
510 516
     * @return If an error occurs the error message contains the reason.
511 517
     */
512 518
    protected OneResponse action(String action)
......
833 839
    }
834 840

  
835 841
    /**
842
     * Undeploy a running VM, it preserve its resources and disk modifications.
843
     * @param hard True to perform a hard (no acpi) shutdown, false for a
844
     * graceful shutdown
845
     * @return If an error occurs the error message contains the reason.
846
     */
847
    public OneResponse undeploy(boolean hard)
848
    {
849
        String actionSt = hard ? "undeploy-hard" : "undeploy";
850

  
851
        return action(actionSt);
852
    }
853

  
854
    /**
836 855
     * Powers off a running VM.
837 856
     * @return If an error occurs the error message contains the reason.
838 857
     */
src/oca/ruby/opennebula/virtual_machine.rb
54 54
            SHUTDOWN CANCEL FAILURE CLEANUP_RESUBMIT UNKNOWN HOTPLUG SHUTDOWN_POWEROFF
55 55
            BOOT_UNKNOWN BOOT_POWEROFF BOOT_SUSPENDED BOOT_STOPPED CLEANUP_DELETE
56 56
            HOTPLUG_SNAPSHOT HOTPLUG_NIC HOTPLUG_SAVEAS HOTPLUG_SAVEAS_POWEROFF
57
            HOTPLUG_SAVEAS_SUSPENDED UNDEPLOYING EPILOG_UNDEPLOY PROLOG_UNDEPLOY}
57
            HOTPLUG_SAVEAS_SUSPENDED SHUTDOWN_UNDEPLOY EPILOG_UNDEPLOY PROLOG_UNDEPLOY}
58 58

  
59 59
        SHORT_VM_STATES={
60 60
            "INIT"      => "init",
......
66 66
            "DONE"      => "done",
67 67
            "FAILED"    => "fail",
68 68
            "POWEROFF"  => "poff",
69
            "UNDEPLOYING"  => "unde"
69
            "UNDEPLOYED"=> "unde"
70 70
        }
71 71

  
72 72
        SHORT_LCM_STATES={
......
98 98
            "HOTPLUG_SAVEAS"           => "hotp",
99 99
            "HOTPLUG_SAVEAS_POWEROFF"  => "hotp",
100 100
            "HOTPLUG_SAVEAS_SUSPENDED" => "hotp",
101
            "UNDEPLOYING"       => "unde",
101
            "SHUTDOWN_UNDEPLOY" => "shut",
102 102
            "EPILOG_UNDEPLOY"   => "epil",
103 103
            "PROLOG_UNDEPLOY"   => "prol"
104 104
        }
src/vmm/VirtualMachineManager.cc
901 901
    os.str("");
902 902
    os << "cancel_action, error getting driver " << vm->get_vmm_mad();
903 903

  
904
error_common:
905
    if ( vm->get_lcm_state() == VirtualMachine::CANCEL ||
906
         vm->get_lcm_state() == VirtualMachine::UNDEPLOYING ) //not in DELETE
907
    {
908
        Nebula              &ne = Nebula::instance();
909
        LifeCycleManager *  lcm = ne.get_lcm();
904
error_common://LifeCycleManager::cancel_failure_action will check state
905
    Nebula              &ne = Nebula::instance();
906
    LifeCycleManager *  lcm = ne.get_lcm();
910 907

  
911
        lcm->trigger(LifeCycleManager::CANCEL_FAILURE, vid);
912
    }
908
    lcm->trigger(LifeCycleManager::CANCEL_FAILURE, vid);
913 909

  
914 910
    vm->log("VMM", Log::ERROR, os);
915 911
    vm->unlock();

Also available in: Unified diff