mirror of
https://github.com/OpenNebula/one.git
synced 2025-08-22 09:49:26 +03:00
feature #1685: Clean network in CLEANUP. Adds cleanup_action to VMM. Make use of new action in LCM
This commit is contained in:
@ -54,6 +54,7 @@ public:
|
|||||||
EPILOG_DELETE,
|
EPILOG_DELETE,
|
||||||
EPILOG_DELETE_PREVIOUS,
|
EPILOG_DELETE_PREVIOUS,
|
||||||
EPILOG_DELETE_STOP,
|
EPILOG_DELETE_STOP,
|
||||||
|
EPILOG_DELETE_BOTH,
|
||||||
CHECKPOINT,
|
CHECKPOINT,
|
||||||
DRIVER_CANCEL,
|
DRIVER_CANCEL,
|
||||||
FINALIZE
|
FINALIZE
|
||||||
@ -138,6 +139,20 @@ public:
|
|||||||
VirtualMachine * vm,
|
VirtualMachine * vm,
|
||||||
ostream& xfr);
|
ostream& xfr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function generates the the epilog_delete sequence for current,
|
||||||
|
* front-end and previous hosts.
|
||||||
|
* @param vm pointer to VM, locked
|
||||||
|
* @param xfr stream to write the commands
|
||||||
|
* @param local true to delete the front-end
|
||||||
|
* @param previous true to delete the previous host
|
||||||
|
*
|
||||||
|
* @return 0 on success
|
||||||
|
*/
|
||||||
|
int epilog_delete_commands(VirtualMachine *vm,
|
||||||
|
ostream& xfr,
|
||||||
|
bool local,
|
||||||
|
bool previous);
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* Thread id for the Transfer Manager
|
* Thread id for the Transfer Manager
|
||||||
@ -247,7 +262,8 @@ private:
|
|||||||
void epilog_stop_action(int vid);
|
void epilog_stop_action(int vid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function starts the epilog_delete sequence
|
* This function starts the epilog_delete sequence in the current host
|
||||||
|
* @param vid the Virtual Machine ID
|
||||||
*/
|
*/
|
||||||
void epilog_delete_action(int vid)
|
void epilog_delete_action(int vid)
|
||||||
{
|
{
|
||||||
@ -256,6 +272,8 @@ private:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This function starts the epilog_delete_stop sequence on the local host
|
* This function starts the epilog_delete_stop sequence on the local host
|
||||||
|
* i.e. the front-end (the VM is not running)
|
||||||
|
* @param vid the Virtual Machine ID
|
||||||
*/
|
*/
|
||||||
void epilog_delete_stop_action(int vid)
|
void epilog_delete_stop_action(int vid)
|
||||||
{
|
{
|
||||||
@ -263,21 +281,22 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function starts the epilog_delete sequence
|
* This function starts the epilog_delete sequence on the previous host
|
||||||
|
* @param vid the Virtual Machine ID
|
||||||
*/
|
*/
|
||||||
void epilog_delete_action(bool local, int vid);
|
void epilog_delete_previous_action(int vid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function starts the epilog_delete sequence on the current and
|
||||||
|
* previous hosts
|
||||||
|
* @param vid the Virtual Machine ID
|
||||||
|
*/
|
||||||
|
void epilog_delete_both_action(int vid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function starts the epilog_delete sequence
|
* This function starts the epilog_delete sequence
|
||||||
*/
|
*/
|
||||||
int epilog_delete_commands(VirtualMachine *vm,
|
void epilog_delete_action(bool local, int vid);
|
||||||
ostream& xfr,
|
|
||||||
bool local,
|
|
||||||
bool previous);
|
|
||||||
/**
|
|
||||||
* This function starts the epilog_delete sequence on the previous host
|
|
||||||
*/
|
|
||||||
void epilog_delete_previous_action(int vid);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function starts the epilog sequence
|
* This function starts the epilog sequence
|
||||||
|
@ -49,6 +49,8 @@ public:
|
|||||||
SHUTDOWN,
|
SHUTDOWN,
|
||||||
CANCEL,
|
CANCEL,
|
||||||
CANCEL_PREVIOUS,
|
CANCEL_PREVIOUS,
|
||||||
|
CLEANUP,
|
||||||
|
CLEANUP_BOTH,
|
||||||
MIGRATE,
|
MIGRATE,
|
||||||
RESTORE,
|
RESTORE,
|
||||||
REBOOT,
|
REBOOT,
|
||||||
@ -257,6 +259,13 @@ private:
|
|||||||
void cancel_previous_action(
|
void cancel_previous_action(
|
||||||
int vid);
|
int vid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cleanups a host (cancel VM + delete disk images).
|
||||||
|
* @param vid the id of the VM.
|
||||||
|
*/
|
||||||
|
void cleanup_action(
|
||||||
|
int vid, bool cancel_previous);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function to migrate (live) a VM (MIGRATE action).
|
* Function to migrate (live) a VM (MIGRATE action).
|
||||||
* @param vid the id of the VM.
|
* @param vid the id of the VM.
|
||||||
|
@ -30,7 +30,7 @@ using namespace std;
|
|||||||
* VirtualMachineManagerDriver provides a base class to implement VM Manager
|
* VirtualMachineManagerDriver provides a base class to implement VM Manager
|
||||||
* Drivers. This class implements the protocol and recover functions
|
* Drivers. This class implements the protocol and recover functions
|
||||||
* from the Mad interface. Classes derived from the VirtualMachineManagerDriver
|
* from the Mad interface. Classes derived from the VirtualMachineManagerDriver
|
||||||
* must implement the deployment function to generate specific VM
|
* must implement the deployment function to generate specific VM
|
||||||
* deployment information for the unerlying MAD.
|
* deployment information for the unerlying MAD.
|
||||||
*/
|
*/
|
||||||
class VirtualMachineManagerDriver : public Mad
|
class VirtualMachineManagerDriver : public Mad
|
||||||
@ -53,7 +53,7 @@ public:
|
|||||||
string& message);
|
string& message);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: What do we need here? just poll the active VMs to recover
|
* TODO: What do we need here? just poll the active VMs to recover
|
||||||
* connections? Or an specific recover action from the MAD?
|
* connections? Or an specific recover action from the MAD?
|
||||||
*/
|
*/
|
||||||
void recover();
|
void recover();
|
||||||
@ -67,25 +67,25 @@ public:
|
|||||||
virtual int deployment_description(
|
virtual int deployment_description(
|
||||||
const VirtualMachine * vm,
|
const VirtualMachine * vm,
|
||||||
const string& file_name) const = 0;
|
const string& file_name) const = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* Gets a configuration attr from driver configuration file (single
|
* Gets a configuration attr from driver configuration file (single
|
||||||
* version)
|
* version)
|
||||||
* @param name of config attribute
|
* @param name of config attribute
|
||||||
* @param value of the attribute
|
* @param value of the attribute
|
||||||
*/
|
*/
|
||||||
void get_default(
|
void get_default(
|
||||||
const char * name,
|
const char * name,
|
||||||
string& value) const
|
string& value) const
|
||||||
{
|
{
|
||||||
string sn = name;
|
string sn = name;
|
||||||
|
|
||||||
driver_conf.get(sn,value);
|
driver_conf.get(sn,value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a configuration attr from driver configuration file (vector
|
* Gets a configuration attr from driver configuration file (vector
|
||||||
* version)
|
* version)
|
||||||
* @param name of config vector attribute for the domain
|
* @param name of config vector attribute for the domain
|
||||||
* @param vname of the attribute
|
* @param vname of the attribute
|
||||||
@ -95,20 +95,20 @@ protected:
|
|||||||
const char * name,
|
const char * name,
|
||||||
const char * vname,
|
const char * vname,
|
||||||
string& value) const;
|
string& value) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* Configuration file for the driver
|
* Configuration file for the driver
|
||||||
*/
|
*/
|
||||||
Template driver_conf;
|
Template driver_conf;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pointer to the Virtual Machine Pool, to access VMs
|
* Pointer to the Virtual Machine Pool, to access VMs
|
||||||
*/
|
*/
|
||||||
VirtualMachinePool * vmpool;
|
VirtualMachinePool * vmpool;
|
||||||
|
|
||||||
friend class VirtualMachineManager;
|
friend class VirtualMachineManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends a deploy request to the MAD: "DEPLOY ID XML_DRV_MSG"
|
* Sends a deploy request to the MAD: "DEPLOY ID XML_DRV_MSG"
|
||||||
* @param oid the virtual machine id.
|
* @param oid the virtual machine id.
|
||||||
@ -169,6 +169,18 @@ private:
|
|||||||
write_drv("CANCEL", oid, drv_msg);
|
write_drv("CANCEL", oid, drv_msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends a cleanup request to the MAD: "CLEANUP ID XML_DRV_MSG"
|
||||||
|
* @param oid the virtual machine id.
|
||||||
|
* @param drv_msg xml data for the mad operation
|
||||||
|
*/
|
||||||
|
void cleanup (
|
||||||
|
const int oid,
|
||||||
|
const string& drv_msg) const
|
||||||
|
{
|
||||||
|
write_drv("CLEANUP", oid, drv_msg);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends a checkpoint request to the MAD: "CHECKPOINT ID XML_DRV_MSG"
|
* Sends a checkpoint request to the MAD: "CHECKPOINT ID XML_DRV_MSG"
|
||||||
* @param oid the virtual machine id.
|
* @param oid the virtual machine id.
|
||||||
@ -263,7 +275,7 @@ private:
|
|||||||
ostringstream os;
|
ostringstream os;
|
||||||
|
|
||||||
os << aname << " " << oid << " " << msg << endl;
|
os << aname << " " << oid << " " << msg << endl;
|
||||||
|
|
||||||
write(os);
|
write(os);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -683,9 +683,7 @@ void LifeCycleManager::clean_up_vm(VirtualMachine * vm)
|
|||||||
vmpool->update_history(vm);
|
vmpool->update_history(vm);
|
||||||
|
|
||||||
vmm->trigger(VirtualMachineManager::DRIVER_CANCEL,vid);
|
vmm->trigger(VirtualMachineManager::DRIVER_CANCEL,vid);
|
||||||
vmm->trigger(VirtualMachineManager::CANCEL,vid);
|
vmm->trigger(VirtualMachineManager::CLEANUP,vid);
|
||||||
|
|
||||||
tm->trigger(TransferManager::EPILOG_DELETE,vid);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VirtualMachine::MIGRATE:
|
case VirtualMachine::MIGRATE:
|
||||||
@ -701,11 +699,7 @@ void LifeCycleManager::clean_up_vm(VirtualMachine * vm)
|
|||||||
hpool->del_capacity(vm->get_previous_hid(), vm->get_oid(), cpu, mem, disk);
|
hpool->del_capacity(vm->get_previous_hid(), vm->get_oid(), cpu, mem, disk);
|
||||||
|
|
||||||
vmm->trigger(VirtualMachineManager::DRIVER_CANCEL,vid);
|
vmm->trigger(VirtualMachineManager::DRIVER_CANCEL,vid);
|
||||||
|
vmm->trigger(VirtualMachineManager::CLEANUP_BOTH,vid);
|
||||||
vmm->trigger(VirtualMachineManager::CANCEL,vid);
|
|
||||||
vmm->trigger(VirtualMachineManager::CANCEL_PREVIOUS,vid);
|
|
||||||
|
|
||||||
tm->trigger(TransferManager::EPILOG_DELETE,vid);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VirtualMachine::SAVE_STOP:
|
case VirtualMachine::SAVE_STOP:
|
||||||
@ -714,9 +708,7 @@ void LifeCycleManager::clean_up_vm(VirtualMachine * vm)
|
|||||||
vmpool->update_history(vm);
|
vmpool->update_history(vm);
|
||||||
|
|
||||||
vmm->trigger(VirtualMachineManager::DRIVER_CANCEL,vid);
|
vmm->trigger(VirtualMachineManager::DRIVER_CANCEL,vid);
|
||||||
vmm->trigger(VirtualMachineManager::CANCEL,vid);
|
vmm->trigger(VirtualMachineManager::CLEANUP,vid);
|
||||||
|
|
||||||
tm->trigger(TransferManager::EPILOG_DELETE,vid);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VirtualMachine::SAVE_MIGRATE:
|
case VirtualMachine::SAVE_MIGRATE:
|
||||||
@ -742,8 +734,7 @@ void LifeCycleManager::clean_up_vm(VirtualMachine * vm)
|
|||||||
vmpool->update_history(vm);
|
vmpool->update_history(vm);
|
||||||
|
|
||||||
tm->trigger(TransferManager::DRIVER_CANCEL,vid);
|
tm->trigger(TransferManager::DRIVER_CANCEL,vid);
|
||||||
tm->trigger(TransferManager::EPILOG_DELETE,vid);
|
tm->trigger(TransferManager::EPILOG_DELETE_BOTH,vid);
|
||||||
tm->trigger(TransferManager::EPILOG_DELETE_PREVIOUS,vid);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VirtualMachine::EPILOG_STOP:
|
case VirtualMachine::EPILOG_STOP:
|
||||||
|
@ -115,6 +115,10 @@ void TransferManager::trigger(Actions action, int _vid)
|
|||||||
aname = "EPILOG_DELETE_PREVIOUS";
|
aname = "EPILOG_DELETE_PREVIOUS";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case EPILOG_DELETE_BOTH:
|
||||||
|
aname = "EPILOG_DELETE_BOTH";
|
||||||
|
break;
|
||||||
|
|
||||||
case CHECKPOINT:
|
case CHECKPOINT:
|
||||||
aname = "CHECKPOINT";
|
aname = "CHECKPOINT";
|
||||||
break;
|
break;
|
||||||
@ -183,6 +187,10 @@ void TransferManager::do_action(const string &action, void * arg)
|
|||||||
{
|
{
|
||||||
epilog_delete_previous_action(vid);
|
epilog_delete_previous_action(vid);
|
||||||
}
|
}
|
||||||
|
else if (action == "EPILOG_DELETE_BOTH")
|
||||||
|
{
|
||||||
|
epilog_delete_both_action(vid);
|
||||||
|
}
|
||||||
else if (action == "CHECKPOINT")
|
else if (action == "CHECKPOINT")
|
||||||
{
|
{
|
||||||
checkpoint_action(vid);
|
checkpoint_action(vid);
|
||||||
@ -1394,8 +1402,7 @@ error_driver:
|
|||||||
|
|
||||||
error_file:
|
error_file:
|
||||||
os << "epilog_delete, could not open file: " << xfr_name;
|
os << "epilog_delete, could not open file: " << xfr_name;
|
||||||
os << ". You may need to manually clean " << vm->get_hostname()
|
os << ". You may need to manually clean the host (current)";
|
||||||
<< ":" << vm->get_remote_system_dir();
|
|
||||||
goto error_common;
|
goto error_common;
|
||||||
|
|
||||||
error_common:
|
error_common:
|
||||||
@ -1468,8 +1475,81 @@ error_driver:
|
|||||||
|
|
||||||
error_file:
|
error_file:
|
||||||
os << "epilog_delete_previous, could not open file: " << xfr_name;
|
os << "epilog_delete_previous, could not open file: " << xfr_name;
|
||||||
os << ". You may need to manually clean " << vm->get_previous_hostname()
|
os << ". You may need to manually clean the host (previous)";
|
||||||
<< ":" << vm->get_remote_system_dir();
|
goto error_common;
|
||||||
|
|
||||||
|
error_common:
|
||||||
|
vm->log("TM", Log::ERROR, os);
|
||||||
|
(nd.get_lcm())->trigger(LifeCycleManager::EPILOG_FAILURE, vid);
|
||||||
|
|
||||||
|
vm->unlock();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void TransferManager::epilog_delete_both_action(int vid)
|
||||||
|
{
|
||||||
|
ostringstream os;
|
||||||
|
|
||||||
|
ofstream xfr;
|
||||||
|
string xfr_name;
|
||||||
|
|
||||||
|
VirtualMachine * vm;
|
||||||
|
Nebula& nd = Nebula::instance();
|
||||||
|
|
||||||
|
const TransferManagerDriver * tm_md;
|
||||||
|
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
// Setup & Transfer script
|
||||||
|
// ------------------------------------------------------------------------
|
||||||
|
vm = vmpool->get(vid,true);
|
||||||
|
|
||||||
|
if (vm == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
tm_md = get();
|
||||||
|
|
||||||
|
if (tm_md == 0)
|
||||||
|
{
|
||||||
|
goto error_driver;
|
||||||
|
}
|
||||||
|
|
||||||
|
xfr_name = vm->get_transfer_file() + ".delete_both";
|
||||||
|
xfr.open(xfr_name.c_str(),ios::out | ios::trunc);
|
||||||
|
|
||||||
|
if (xfr.fail() == true)
|
||||||
|
{
|
||||||
|
goto error_file;
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = epilog_delete_commands(vm, xfr, false, false); //current
|
||||||
|
rc = epilog_delete_commands(vm, xfr, false, true); //previous
|
||||||
|
|
||||||
|
if ( rc != 0 )
|
||||||
|
{
|
||||||
|
goto error_common;
|
||||||
|
}
|
||||||
|
|
||||||
|
xfr.close();
|
||||||
|
|
||||||
|
tm_md->transfer(vid, xfr_name);
|
||||||
|
|
||||||
|
vm->unlock();
|
||||||
|
return;
|
||||||
|
|
||||||
|
error_driver:
|
||||||
|
os << "epilog_delete_both, error getting TM driver.";
|
||||||
|
goto error_common;
|
||||||
|
|
||||||
|
error_file:
|
||||||
|
os << "epilog_delete_both, could not open file: " << xfr_name;
|
||||||
|
os << ". You may need to manually clean hosts (previous & current)";
|
||||||
goto error_common;
|
goto error_common;
|
||||||
|
|
||||||
error_common:
|
error_common:
|
||||||
|
@ -146,6 +146,14 @@ void VirtualMachineManager::trigger(Actions action, int _vid)
|
|||||||
aname = "CANCEL_PREVIOUS";
|
aname = "CANCEL_PREVIOUS";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case CLEANUP:
|
||||||
|
aname = "CLEANUP";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CLEANUP_BOTH:
|
||||||
|
aname = "CLEANUP_BOTH";
|
||||||
|
break;
|
||||||
|
|
||||||
case MIGRATE:
|
case MIGRATE:
|
||||||
aname = "MIGRATE";
|
aname = "MIGRATE";
|
||||||
break;
|
break;
|
||||||
@ -234,6 +242,14 @@ void VirtualMachineManager::do_action(const string &action, void * arg)
|
|||||||
{
|
{
|
||||||
cancel_previous_action(vid);
|
cancel_previous_action(vid);
|
||||||
}
|
}
|
||||||
|
else if (action == "CLEANUP")
|
||||||
|
{
|
||||||
|
cleanup_action(vid, false);
|
||||||
|
}
|
||||||
|
else if (action == "CLEANUP_BOTH")
|
||||||
|
{
|
||||||
|
cleanup_action(vid, true);
|
||||||
|
}
|
||||||
else if (action == "MIGRATE")
|
else if (action == "MIGRATE")
|
||||||
{
|
{
|
||||||
migrate_action(vid);
|
migrate_action(vid);
|
||||||
@ -925,6 +941,106 @@ error_common:
|
|||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
void VirtualMachineManager::cleanup_action(
|
||||||
|
int vid, bool cancel_previous)
|
||||||
|
{
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
VirtualMachine * vm;
|
||||||
|
ostringstream os;
|
||||||
|
|
||||||
|
string vm_tmpl;
|
||||||
|
string * drv_msg;
|
||||||
|
|
||||||
|
string m_hostname = "";
|
||||||
|
string m_net_drv = "";
|
||||||
|
|
||||||
|
const VirtualMachineManagerDriver * vmd;
|
||||||
|
|
||||||
|
Nebula& nd = Nebula::instance();
|
||||||
|
|
||||||
|
// Get the VM from the pool
|
||||||
|
vm = vmpool->get(vid,true);
|
||||||
|
|
||||||
|
if (vm == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!vm->hasHistory())
|
||||||
|
{
|
||||||
|
goto error_history;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the driver for this VM
|
||||||
|
vmd = get(vm->get_vmm_mad());
|
||||||
|
|
||||||
|
if ( vmd == 0 )
|
||||||
|
{
|
||||||
|
goto error_driver;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( cancel_previous && vm->hasPreviousHistory() )
|
||||||
|
{
|
||||||
|
m_hostname = vm->get_previous_hostname();
|
||||||
|
m_net_drv = vm->get_previous_vnm_mad();
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = nd.get_tm()->epilog_delete_commands(vm, os, false, false);
|
||||||
|
|
||||||
|
if ( rc != 0 )
|
||||||
|
{
|
||||||
|
goto error_common;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Invoke driver method
|
||||||
|
drv_msg = format_message(
|
||||||
|
vm->get_hostname(),
|
||||||
|
vm->get_vnm_mad(),
|
||||||
|
m_hostname,
|
||||||
|
m_net_drv,
|
||||||
|
vm->get_deploy_id(),
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
os.str(),
|
||||||
|
"",
|
||||||
|
vm->to_xml(vm_tmpl));
|
||||||
|
|
||||||
|
vmd->cleanup(vid, *drv_msg);
|
||||||
|
|
||||||
|
delete drv_msg;
|
||||||
|
|
||||||
|
vm->unlock();
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
error_history:
|
||||||
|
os.str("");
|
||||||
|
os << "cleanup_action, VM has no history";
|
||||||
|
goto error_common;
|
||||||
|
|
||||||
|
error_driver:
|
||||||
|
os.str("");
|
||||||
|
os << "cleanup_action, error getting driver " << vm->get_vmm_mad();
|
||||||
|
|
||||||
|
error_common:
|
||||||
|
if ( vm->get_lcm_state() == VirtualMachine::CLEANUP)
|
||||||
|
{
|
||||||
|
Nebula &ne = Nebula::instance();
|
||||||
|
LifeCycleManager * lcm = ne.get_lcm();
|
||||||
|
|
||||||
|
//TODO
|
||||||
|
//lcm->trigger(LifeCycleManager::CLEANUP_FAILURE, vid);
|
||||||
|
}
|
||||||
|
|
||||||
|
vm->unlock();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void VirtualMachineManager::migrate_action(
|
void VirtualMachineManager::migrate_action(
|
||||||
int vid)
|
int vid)
|
||||||
{
|
{
|
||||||
@ -1366,7 +1482,7 @@ void VirtualMachineManager::attach_action(
|
|||||||
vm_tm_mad = vm->get_tm_mad();
|
vm_tm_mad = vm->get_tm_mad();
|
||||||
opennebula_hostname = nd.get_nebula_hostname();
|
opennebula_hostname = nd.get_nebula_hostname();
|
||||||
|
|
||||||
rc = Nebula::instance().get_tm()->prolog_transfer_command(
|
rc = nd.get_tm()->prolog_transfer_command(
|
||||||
vm,
|
vm,
|
||||||
disk,
|
disk,
|
||||||
vm_tm_mad,
|
vm_tm_mad,
|
||||||
|
@ -627,18 +627,33 @@ class ExecDriver < VirtualMachineDriver
|
|||||||
:action => :cancel,
|
:action => :cancel,
|
||||||
:parameters => [:deploy_id, :host],
|
:parameters => [:deploy_id, :host],
|
||||||
:no_fail => true
|
:no_fail => true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
:driver => :vnm,
|
||||||
|
:action => :clean,
|
||||||
|
:no_fail => true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
# Cancel the VM at the previous host (in case of migration)
|
# Cancel the VM at the previous host (in case of migration)
|
||||||
steps <<
|
if !mhost.empty?
|
||||||
|
steps <<
|
||||||
{
|
{
|
||||||
:driver => :vmm,
|
:driver => :vmm,
|
||||||
:action => :cancel,
|
:action => :cancel,
|
||||||
:parameters => [:deploy_id, :dest_host],
|
:parameters => [:deploy_id, :dest_host],
|
||||||
:destination => true,
|
:destination => true,
|
||||||
:no_fail => true
|
:no_fail => true
|
||||||
} if !mhost.empty?
|
}
|
||||||
|
|
||||||
|
steps <<
|
||||||
|
{
|
||||||
|
:driver => :vnm,
|
||||||
|
:action => :clean,
|
||||||
|
:destination => true,
|
||||||
|
:no_fail => true
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
# Cleans VM disk images and directory
|
# Cleans VM disk images and directory
|
||||||
tm_command.each_line { |tc|
|
tm_command.each_line { |tc|
|
||||||
|
Reference in New Issue
Block a user