Revision 83f08054 src/lcm/LifeCycleActions.cc

View differences:

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
    {

Also available in: Unified diff