Revision 83f08054

View differences:

include/VirtualMachine.h
806 806
    };
807 807

  
808 808
    /**
809
     *  Sets end time of VM prolog state in the previous host.
810
     *    @param _etime time when the running state finished
811
     */
812
    void set_previous_prolog_etime(time_t _etime)
813
    {
814
        previous_history->prolog_etime=_etime;
815
    };
816

  
817
    /**
818 809
     *  Sets start time of VM epilog.
819 810
     *    @param _stime time when the epilog started
820 811
     */
share/doc/states/states-complete.dot
167 167
    prolog          -> failure [style="dotted"];
168 168

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

  
172 172
    prolog_resume   -> stopped [style="dotted"];
173 173
    prolog_undeploy -> undeployed [style="dotted"];
src/dm/DispatchManagerActions.cc
107 107
    vmpool->update(vm);
108 108

  
109 109
    vm->set_stime(the_time);
110
    
110

  
111 111
    vm->set_prolog_stime(the_time);
112 112
    vm->set_prolog_etime(the_time);
113 113

  
......
145 145

  
146 146
    if (vm->get_state()     == VirtualMachine::ACTIVE &&
147 147
        (vm->get_lcm_state() == VirtualMachine::RUNNING ||
148
         vm->get_lcm_state() == VirtualMachine::UNKNOWN ||
149
         vm->get_lcm_state() == VirtualMachine::PROLOG_MIGRATE_FAILURE) )
148
         vm->get_lcm_state() == VirtualMachine::UNKNOWN ) )
150 149
    {
151 150
        Nebula&             nd  = Nebula::instance();
152 151
        LifeCycleManager *  lcm = nd.get_lcm();
......
691 690
         vm->get_lcm_state() == VirtualMachine::BOOT_UNDEPLOY ||
692 691
         vm->get_lcm_state() == VirtualMachine::BOOT_MIGRATE ||
693 692
         vm->get_lcm_state() == VirtualMachine::BOOT_FAILURE ||
694
         vm->get_lcm_state() == VirtualMachine::BOOT_MIGRATE_FAILURE ))
693
         vm->get_lcm_state() == VirtualMachine::BOOT_MIGRATE_FAILURE ||
694
         vm->get_lcm_state() == VirtualMachine::PROLOG_MIGRATE_FAILURE))
695 695
    {
696 696
        Nebula&             nd  = Nebula::instance();
697 697
        LifeCycleManager *  lcm = nd.get_lcm();
src/lcm/LifeCycleActions.cc
267 267

  
268 268
        vmm->trigger(VirtualMachineManager::SAVE,vid);
269 269
    }
270
    else if (vm->get_state() == VirtualMachine::ACTIVE &&
271
             vm->get_lcm_state() == VirtualMachine::PROLOG_MIGRATE_FAILURE)
272
    {
273
        //----------------------------------------------------
274
        //   Bypass SAVE_MIGRATE
275
        //----------------------------------------------------
276

  
277
        Nebula& nd = Nebula::instance();
278
        TransferManager * tm = nd.get_tm();
279

  
280
        int    cpu, mem, disk;
281
        time_t the_time = time(0);
282

  
283
        vm->set_resched(false);
284

  
285
        vm->set_state(VirtualMachine::PROLOG_MIGRATE);
286

  
287
        vm->delete_snapshots();
288

  
289
        map<string, string> empty;
290

  
291
        vm->update_info(0, 0, -1, -1, empty);
292

  
293
        vmpool->update(vm);
294

  
295
        vm->set_stime(the_time);
296

  
297
        vm->set_previous_action(History::MIGRATE_ACTION);
298

  
299
        vm->set_previous_prolog_etime(the_time);
300

  
301
        vm->set_previous_etime(the_time);
302

  
303
        vm->set_previous_vm_info();
304

  
305
        vm->set_previous_reason(History::USER);
306

  
307
        vmpool->update_previous_history(vm);
308

  
309
        vmpool->update_history(vm);
310

  
311
        vm->get_requirements(cpu,mem,disk);
312

  
313
        hpool->add_capacity(vm->get_hid(), vm->get_oid(), cpu, mem, disk);
314

  
315
        hpool->del_capacity(vm->get_previous_hid(), vm->get_oid(), cpu, mem, disk);
316

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

  
319
        //----------------------------------------------------
320

  
321
        tm->trigger(TransferManager::PROLOG_MIGR,vid);
322
    }
323 270
    else if (vm->get_state()     == VirtualMachine::ACTIVE &&
324 271
             vm->get_lcm_state() == VirtualMachine::UNKNOWN)
325 272
    {
......
762 709
         vm->get_lcm_state() == VirtualMachine::BOOT_UNDEPLOY ||
763 710
         vm->get_lcm_state() == VirtualMachine::BOOT_MIGRATE ||
764 711
         vm->get_lcm_state() == VirtualMachine::BOOT_MIGRATE_FAILURE ||
765
         vm->get_lcm_state() == VirtualMachine::BOOT_FAILURE))
712
         vm->get_lcm_state() == VirtualMachine::BOOT_FAILURE ||
713
         vm->get_lcm_state() == VirtualMachine::PROLOG_MIGRATE_FAILURE))
766 714
       ||vm->get_state() == VirtualMachine::POWEROFF)
767 715
    {
768
        Nebula&                 nd = Nebula::instance();
716
        Nebula& nd  = Nebula::instance();
717

  
769 718
        VirtualMachineManager * vmm = nd.get_vmm();
770 719

  
771 720
        VirtualMachineManager::Actions action;
......
832 781
                default:
833 782
                    break;
834 783
            }
784

  
785
            vmm->trigger(action,vid);
835 786
        }
836
        else // if ( vm->get_state() == VirtualMachine::POWEROFF )
787
        else if ( vm->get_state() == VirtualMachine::POWEROFF )
837 788
        {
838 789
            time_t the_time = time(0);
839 790

  
840 791
            vm->set_state(VirtualMachine::ACTIVE); // Only needed by poweroff
792

  
841 793
            vm->set_state(VirtualMachine::BOOT_POWEROFF);
842 794

  
843 795
            vm->cp_history();
......
853 805
            vmpool->update_history(vm);
854 806

  
855 807
            vm->log("LCM", Log::INFO, "New VM state is BOOT_POWEROFF");
808

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

  
858
        vmm->trigger(action,vid);
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
        }
859 823
    }
860 824
    else
861 825
    {
src/lcm/LifeCycleStates.cc
731 731
    {
732 732
        vm->set_state(VirtualMachine::BOOT_UNDEPLOY);
733 733
    }
734
    else if ( lcm_state == VirtualMachine::PROLOG_MIGRATE ||
735
              lcm_state == VirtualMachine::PROLOG_MIGRATE_FAILURE )
734
    else if ( lcm_state == VirtualMachine::PROLOG_MIGRATE )
736 735
    {
737 736
        vm->set_state(VirtualMachine::BOOT_MIGRATE);
738 737
    }
......
790 789
    else if ( state == VirtualMachine::PROLOG_MIGRATE )
791 790
    {
792 791
        vm->set_state(VirtualMachine::PROLOG_MIGRATE_FAILURE);
792

  
793 793
        vmpool->update(vm);
794 794

  
795 795
        vm->log("LCM", Log::INFO, "New VM state is PROLOG_MIGRATE_FAILURE");

Also available in: Unified diff