Revision dd3edff6

View differences:

include/LifeCycleManager.h
275 275

  
276 276
    void restart_action(int vid);
277 277

  
278
    void retry_action(int vid);
279

  
278 280
    void delete_action(int vid);
279 281

  
280 282
    void clean_action(int vid);
share/doc/states/states-complete.dot
124 124
    boot_unknown    -> boot_unknown [label="boot"];
125 125
    boot_unknown    -> running [style="dashed"];
126 126

  
127
    boot_failure         -> boot [label="boot"];
128
    boot_migrate_failure -> boot_migrate [label="boot"];
127
    boot_failure         -> boot [label="recover"];
128
    boot_migrate_failure -> boot_migrate [label="recover"];
129 129

  
130 130
#   reboot
131 131
    running     -> running [label="reboot"];
......
167 167
    prolog          -> failure [style="dotted"];
168 168

  
169 169
    prolog_migrate          -> prolog_migrate_failure [style="dotted"];
170
    prolog_migrate_failure  -> prolog_migrate [label="boot"];
170
    prolog_migrate_failure  -> prolog_migrate [label="recover"];
171 171

  
172 172
    prolog_resume   -> stopped [style="dotted"];
173 173
    prolog_undeploy -> undeployed [style="dotted"];
src/cli/onevm
459 459
    boot_desc = <<-EOT.unindent
460 460
        Boots the given VM.
461 461

  
462
        States: UNKNOWN, BOOT OR FAIL
462
        States: UNKNOWN, BOOT
463 463
    EOT
464 464

  
465 465
    command :boot, boot_desc, [:range,:vmid_list],
src/dm/DispatchManagerActions.cc
688 688
         vm->get_lcm_state() == VirtualMachine::BOOT_SUSPENDED ||
689 689
         vm->get_lcm_state() == VirtualMachine::BOOT_STOPPED ||
690 690
         vm->get_lcm_state() == VirtualMachine::BOOT_UNDEPLOY ||
691
         vm->get_lcm_state() == VirtualMachine::BOOT_MIGRATE ||
692
         vm->get_lcm_state() == VirtualMachine::BOOT_FAILURE ||
693
         vm->get_lcm_state() == VirtualMachine::BOOT_MIGRATE_FAILURE ||
694
         vm->get_lcm_state() == VirtualMachine::PROLOG_MIGRATE_FAILURE))
691
         vm->get_lcm_state() == VirtualMachine::BOOT_MIGRATE ))
695 692
    {
696 693
        Nebula&             nd  = Nebula::instance();
697 694
        LifeCycleManager *  lcm = nd.get_lcm();
src/lcm/LifeCycleActions.cc
688 688
/* -------------------------------------------------------------------------- */
689 689
/* -------------------------------------------------------------------------- */
690 690

  
691
void LifeCycleManager::retry_action(int vid)
692
{
693
    Nebula& nd  = Nebula::instance();
694

  
695
    TransferManager *       tm  = nd.get_tm();
696
    VirtualMachineManager * vmm = nd.get_vmm();
697

  
698
    VirtualMachine * vm;
699

  
700
    vm = vmpool->get(vid,true);
701

  
702
    if ( vm == 0 )
703
    {
704
        return;
705
    }
706

  
707
    if ( vm->get_state() != VirtualMachine::ACTIVE )
708
    {
709
        vm->unlock();
710
        return;
711
    }
712

  
713
    VirtualMachine::LcmState state = vm->get_lcm_state();
714

  
715
    switch (state)
716
    {
717
        case VirtualMachine::BOOT_FAILURE:
718
            vm->set_state(VirtualMachine::BOOT);
719

  
720
            vmpool->update(vm);
721

  
722
            vm->log("LCM", Log::INFO, "New VM state is BOOT");
723

  
724
            vmm->trigger(VirtualMachineManager::DEPLOY, vid);
725
            break;
726

  
727
        case VirtualMachine::BOOT_MIGRATE_FAILURE:
728
            vm->set_state(VirtualMachine::BOOT_MIGRATE);
729

  
730
            vmpool->update(vm);
731

  
732
            vm->log("LCM", Log::INFO, "New VM state is BOOT_MIGRATE");
733

  
734
            vmm->trigger(VirtualMachineManager::RESTORE, vid);
735
            break;
736

  
737
        case VirtualMachine::PROLOG_MIGRATE_FAILURE:
738
            vm->set_state(VirtualMachine::PROLOG_MIGRATE);
739

  
740
            vmpool->update(vm);
741

  
742
            vm->log("LCM", Log::INFO, "New VM state is PROLOG_MIGRATE");
743

  
744
            tm->trigger(TransferManager::PROLOG_MIGR, vid);
745
            break;
746

  
747
        case VirtualMachine::LCM_INIT:
748
        case VirtualMachine::BOOT:
749
        case VirtualMachine::BOOT_MIGRATE:
750
        case VirtualMachine::BOOT_POWEROFF:
751
        case VirtualMachine::BOOT_SUSPENDED:
752
        case VirtualMachine::BOOT_STOPPED:
753
        case VirtualMachine::BOOT_UNDEPLOY:
754
        case VirtualMachine::BOOT_UNKNOWN:
755
        case VirtualMachine::CANCEL:
756
        case VirtualMachine::CLEANUP_RESUBMIT:
757
        case VirtualMachine::CLEANUP_DELETE:
758
        case VirtualMachine::EPILOG:
759
        case VirtualMachine::EPILOG_STOP:
760
        case VirtualMachine::EPILOG_UNDEPLOY:
761
        case VirtualMachine::FAILURE:
762
        case VirtualMachine::HOTPLUG:
763
        case VirtualMachine::HOTPLUG_NIC:
764
        case VirtualMachine::HOTPLUG_SNAPSHOT:
765
        case VirtualMachine::HOTPLUG_SAVEAS:
766
        case VirtualMachine::HOTPLUG_SAVEAS_POWEROFF:
767
        case VirtualMachine::HOTPLUG_SAVEAS_SUSPENDED:
768
        case VirtualMachine::HOTPLUG_PROLOG_POWEROFF:
769
        case VirtualMachine::HOTPLUG_EPILOG_POWEROFF:
770
        case VirtualMachine::PROLOG:
771
        case VirtualMachine::PROLOG_MIGRATE:
772
        case VirtualMachine::PROLOG_RESUME:
773
        case VirtualMachine::PROLOG_UNDEPLOY:
774
        case VirtualMachine::MIGRATE:
775
        case VirtualMachine::RUNNING:
776
        case VirtualMachine::SAVE_STOP:
777
        case VirtualMachine::SAVE_SUSPEND:
778
        case VirtualMachine::SAVE_MIGRATE:
779
        case VirtualMachine::SHUTDOWN:
780
        case VirtualMachine::SHUTDOWN_POWEROFF:
781
        case VirtualMachine::SHUTDOWN_UNDEPLOY:
782
        case VirtualMachine::UNKNOWN:
783
            break;
784
    }
785

  
786
    vm->unlock();
787

  
788
    return;
789
}
790

  
791
/* -------------------------------------------------------------------------- */
792
/* -------------------------------------------------------------------------- */
793

  
691 794
void  LifeCycleManager::restart_action(int vid)
692 795
{
693 796
    VirtualMachine *    vm;
......
699 802
        return;
700 803
    }
701 804

  
702
    if ((vm->get_state() == VirtualMachine::ACTIVE &&
703
        (vm->get_lcm_state() == VirtualMachine::UNKNOWN ||
704
         vm->get_lcm_state() == VirtualMachine::BOOT ||
705
         vm->get_lcm_state() == VirtualMachine::BOOT_UNKNOWN ||
706
         vm->get_lcm_state() == VirtualMachine::BOOT_POWEROFF ||
707
         vm->get_lcm_state() == VirtualMachine::BOOT_SUSPENDED ||
708
         vm->get_lcm_state() == VirtualMachine::BOOT_STOPPED ||
709
         vm->get_lcm_state() == VirtualMachine::BOOT_UNDEPLOY ||
710
         vm->get_lcm_state() == VirtualMachine::BOOT_MIGRATE ||
711
         vm->get_lcm_state() == VirtualMachine::BOOT_MIGRATE_FAILURE ||
712
         vm->get_lcm_state() == VirtualMachine::BOOT_FAILURE ||
713
         vm->get_lcm_state() == VirtualMachine::PROLOG_MIGRATE_FAILURE))
714
       ||vm->get_state() == VirtualMachine::POWEROFF)
805
    VirtualMachine::LcmState lstate = vm->get_lcm_state();
806
    VirtualMachine::VmState  vstate = vm->get_state();
807

  
808
    if (vstate == VirtualMachine::POWEROFF || ( vstate == VirtualMachine::ACTIVE &&
809
        (lstate == VirtualMachine::UNKNOWN        || lstate == VirtualMachine::BOOT ||
810
         lstate == VirtualMachine::BOOT_UNKNOWN   || lstate == VirtualMachine::BOOT_POWEROFF ||
811
         lstate == VirtualMachine::BOOT_SUSPENDED || lstate == VirtualMachine::BOOT_STOPPED ||
812
         lstate == VirtualMachine::BOOT_UNDEPLOY  || lstate == VirtualMachine::BOOT_MIGRATE)))
715 813
    {
716 814
        Nebula& nd  = Nebula::instance();
717 815

  
......
723 821
        //       RE-START THE VM IN THE SAME HOST
724 822
        //----------------------------------------------------
725 823

  
726
        if (vm->get_state() == VirtualMachine::ACTIVE)
824
        if (vstate == VirtualMachine::ACTIVE)
727 825
        {
728
            switch (vm->get_lcm_state()) {
826
            switch (lstate) {
729 827
                case VirtualMachine::BOOT:
730 828
                case VirtualMachine::BOOT_UNKNOWN:
731 829
                case VirtualMachine::BOOT_POWEROFF:
732 830
                    action = VirtualMachineManager::DEPLOY;
733 831

  
734 832
                    vm->log("LCM", Log::INFO, "Sending BOOT command to VM again");
735

  
736 833
                    break;
737 834

  
738 835
                case VirtualMachine::BOOT_SUSPENDED:
......
742 839
                    action = VirtualMachineManager::RESTORE;
743 840

  
744 841
                    vm->log("LCM", Log::INFO, "Sending RESTORE command to VM again");
745

  
746 842
                    break;
747 843

  
748 844
                case VirtualMachine::UNKNOWN:
......
753 849
                    vmpool->update(vm);
754 850

  
755 851
                    vm->log("LCM", Log::INFO, "New VM state is BOOT_UNKNOWN");
756

  
757
                    break;
758

  
759
                case VirtualMachine::BOOT_FAILURE:
760
                    action = VirtualMachineManager::DEPLOY;
761

  
762
                    vm->set_state(VirtualMachine::BOOT);
763

  
764
                    vmpool->update(vm);
765

  
766
                    vm->log("LCM", Log::INFO, "New VM state is BOOT");
767

  
768
                    break;
769

  
770
                case VirtualMachine::BOOT_MIGRATE_FAILURE:
771
                    action = VirtualMachineManager::RESTORE;
772

  
773
                    vm->set_state(VirtualMachine::BOOT_MIGRATE);
774

  
775
                    vmpool->update(vm);
776

  
777
                    vm->log("LCM", Log::INFO, "New VM state is BOOT_MIGRATE");
778

  
779 852
                    break;
780 853

  
781 854
                default:
......
808 881

  
809 882
            vmm->trigger(VirtualMachineManager::DEPLOY, vid);
810 883
        }
811
        else if ( vm->get_state() == VirtualMachine::PROLOG_MIGRATE_FAILURE )
812
        {
813
            TransferManager * tm  = nd.get_tm();
814

  
815
            vm->set_state(VirtualMachine::PROLOG_MIGRATE);
816

  
817
            vmpool->update(vm);
818

  
819
            vm->log("LCM", Log::INFO, "New VM state is PROLOG_MIGRATE");
820

  
821
            tm->trigger(TransferManager::PROLOG_MIGR, vid);
822
        }
823 884
    }
824 885
    else
825 886
    {
......
1040 1101
        case VirtualMachine::UNKNOWN:
1041 1102
        case VirtualMachine::SHUTDOWN:
1042 1103
        case VirtualMachine::SHUTDOWN_POWEROFF:
1104
        case VirtualMachine::SHUTDOWN_UNDEPLOY:
1043 1105
        case VirtualMachine::CANCEL:
1044 1106
        case VirtualMachine::HOTPLUG_SNAPSHOT:
1045 1107
            vm->set_running_etime(the_time);
src/lcm/LifeCycleStates.cc
309 309
              vm->get_lcm_state() == VirtualMachine::BOOT_SUSPENDED||
310 310
              vm->get_lcm_state() == VirtualMachine::BOOT_STOPPED ||
311 311
              vm->get_lcm_state() == VirtualMachine::BOOT_UNDEPLOY ||
312
              vm->get_lcm_state() == VirtualMachine::BOOT_MIGRATE ||
313
              vm->get_lcm_state() == VirtualMachine::BOOT_MIGRATE_FAILURE ||
314
              vm->get_lcm_state() == VirtualMachine::BOOT_FAILURE )
312
              vm->get_lcm_state() == VirtualMachine::BOOT_MIGRATE )
315 313
    {
316 314
        vm->set_state(VirtualMachine::RUNNING);
317 315

  
......
403 401

  
404 402
        vmm->trigger(VirtualMachineManager::POLL,vid);
405 403
    }
406
    else if (vm->get_lcm_state() == VirtualMachine::BOOT ||
407
             vm->get_lcm_state() == VirtualMachine::BOOT_FAILURE)
404
    else if (vm->get_lcm_state() == VirtualMachine::BOOT)
408 405
    {
409 406
        vm->set_state(VirtualMachine::BOOT_FAILURE);
410 407

  
......
412 409

  
413 410
        vm->log("LCM", Log::INFO, "Fail to boot VM. New VM state is BOOT_FAILURE");
414 411
    }
415
    else if (vm->get_lcm_state() == VirtualMachine::BOOT_MIGRATE ||
416
             vm->get_lcm_state() == VirtualMachine::BOOT_MIGRATE_FAILURE )
412
    else if (vm->get_lcm_state() == VirtualMachine::BOOT_MIGRATE)
417 413
    {
418 414
        vm->set_state(VirtualMachine::BOOT_MIGRATE_FAILURE);
419 415

  

Also available in: Unified diff