1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-21 18:03:38 +03:00

feature #3801, bug #3775: Delete operation is now under the recover

interface for admin. New terminate operation can be used in any "final"
state for end-users.
This commit is contained in:
Ruben S. Montero 2016-05-02 18:34:42 +02:00
parent 4f545a9d4b
commit 058e23c37a
16 changed files with 442 additions and 425 deletions

View File

@ -138,13 +138,13 @@ public:
VirtualMachine * vm);
/**
* Shuts down a VM.
* Terminates a VM.
* @param vid VirtualMachine identification
* @param hard True to force the shutdown (cancel instead of shutdown)
* @return 0 on success, -1 if the VM does not exits or -2 if the VM is
* in a wrong a state
*/
int shutdown (
int terminate (
int vid,
bool hard,
string& error_str);
@ -225,23 +225,50 @@ public:
/**
* Ends a VM life cycle inside ONE.
* @param vid VirtualMachine identification
* @return 0 on success, -1 if the VM does not exits or -2 if the VM is
* in a wrong a state
* @param vm VirtualMachine object
* @return 0 on success, the VM mutex is unlocked
*/
int finalize(
int vid,
string& error_str);
int delete_vm(VirtualMachine * vm, string& error_str);
/**
* VM ID interface
*/
int delete_vm(int vid, string& error_str)
{
VirtualMachine * vm;
vm = vmpool->get(vid, true);
if ( vm == 0 )
{
error_str = "Virtual machine does not exist";
return -1;
}
return delete_vm(vm, error_str);
}
/**
* Moves a VM to PENDING state preserving any resource (i.e. leases) and id
* @param vid VirtualMachine identification
* @return 0 on success, -1 if the VM does not exits or -2 if the VM is
* in a wrong a state
* @param vm VirtualMachine object
* @return 0 on success
*/
int resubmit(
int vid,
string& error_str);
int delete_recreate(VirtualMachine * vm, string& error_str);
/**
* Recover the last operation on the VM
* @param vm VirtualMachine object
* @param success if the operation is assumed to succeed or not
* @return 0 on success
*/
int recover(VirtualMachine * vm, bool success, string& error_str);
/**
* Retry the last operation on the VM
* @param vm VirtualMachine object
* @return 0 on success
*/
int retry(VirtualMachine * vm, string& error_str);
/**
* Reboots a VM preserving any resource and RUNNING state
@ -413,6 +440,7 @@ public:
int snap_id,
string& error_str);
private:
/**
* Thread id for the Dispatch Manager
@ -470,11 +498,9 @@ private:
void * arg);
/**
* Called from finalize(). Releases the images and networks acquired by this
* vm, and unlocks it.
* @param vm the VM
* Frees the resources associated to a VM: disks, ip addresses and Quotas
*/
void finalize_cleanup(VirtualMachine * vm);
void free_vm_resources(VirtualMachine * vm);
//--------------------------------------------------------------------------
// DM Actions associated with a VM state transition

View File

@ -40,8 +40,8 @@ public:
NONE_ACTION = 0,
MIGRATE_ACTION = 1,
LIVE_MIGRATE_ACTION = 2,
SHUTDOWN_ACTION = 3,
SHUTDOWN_HARD_ACTION = 4,
//SHUTDOWN_ACTION = 3,
//SHUTDOWN_HARD_ACTION = 4,
UNDEPLOY_ACTION = 5,
UNDEPLOY_HARD_ACTION = 6,
HOLD_ACTION = 7,
@ -49,7 +49,7 @@ public:
STOP_ACTION = 9,
SUSPEND_ACTION = 10,
RESUME_ACTION = 11,
BOOT_ACTION = 12,
//BOOT_ACTION = 12,
DELETE_ACTION = 13,
DELETE_RECREATE_ACTION = 14,
REBOOT_ACTION = 15,
@ -63,7 +63,9 @@ public:
NIC_ATTACH_ACTION = 23,
NIC_DETACH_ACTION = 24,
DISK_SNAPSHOT_CREATE_ACTION = 25,
DISK_SNAPSHOT_DELETE_ACTION = 26
DISK_SNAPSHOT_DELETE_ACTION = 26,
TERMINATE_ACTION = 27,
TERMINATE_HARD_ACTION = 28
};
static string action_to_str(VMAction action)
@ -78,11 +80,11 @@ public:
case LIVE_MIGRATE_ACTION:
st = "live-migrate";
break;
case SHUTDOWN_ACTION:
st = "shutdown";
case TERMINATE_ACTION:
st = "terminate";
break;
case SHUTDOWN_HARD_ACTION:
st = "shutdown-hard";
case TERMINATE_HARD_ACTION:
st = "terminate-hard";
break;
case UNDEPLOY_ACTION:
st = "undeploy";
@ -148,7 +150,6 @@ public:
st = "snap-delete";
break;
case NONE_ACTION:
case BOOT_ACTION:
st = "none";
break;
}
@ -166,13 +167,13 @@ public:
{
action = LIVE_MIGRATE_ACTION;
}
else if (st == "shutdown")
else if (st == "terminate")
{
action = SHUTDOWN_ACTION;
action = TERMINATE_ACTION;
}
else if (st == "shutdown-hard")
else if (st == "terminate-hard")
{
action = SHUTDOWN_HARD_ACTION;
action = TERMINATE_HARD_ACTION;
}
else if (st == "undeploy")
{
@ -258,7 +259,7 @@ public:
{
action = DISK_SNAPSHOT_DELETE_ACTION;
}
else //BOOT_ACTION and others
else
{
action = NONE_ACTION;
return -1;

View File

@ -55,16 +55,16 @@ public:
{
SAVE_SUCCESS, /**< Sent by the VMM when a save action succeeds */
SAVE_FAILURE, /**< Sent by the VMM when a save action fails */
DEPLOY_SUCCESS, /**< Sent by the VMM when a deploy/restore/migrate action succeeds */
DEPLOY_FAILURE, /**< Sent by the VMM when a deploy/restore/migrate action fails */
DEPLOY_SUCCESS, /**< Sent by the VMM deploy/restore/migrate succeeds*/
DEPLOY_FAILURE, /**< Sent by the VMM deploy/restore/migrate fails */
SHUTDOWN_SUCCESS, /**< Sent by the VMM when a shutdown action succeeds*/
SHUTDOWN_FAILURE, /**< Sent by the VMM when a shutdown action fails */
CANCEL_SUCCESS, /**< Sent by the VMM when a cancel action succeeds */
CANCEL_FAILURE, /**< Sent by the VMM when a cancel action fails */
MONITOR_SUSPEND, /**< Sent by the VMM when a VM is paused while active */
MONITOR_SUSPEND, /**< Sent by the VMM when a VM is paused in active */
MONITOR_DONE, /**< Sent by the VMM when a Host cannot be monitored*/
MONITOR_POWEROFF, /**< Sent by the VMM when a VM is not found */
MONITOR_POWERON, /**< Sent by the VMM when a VM is found again */
MONITOR_POWEROFF, /**< Sent by the VMM when a VM is not found */
MONITOR_POWERON, /**< Sent by the VMM when a VM is found again */
PROLOG_SUCCESS, /**< Sent by the TM when the prolog phase succeeds */
PROLOG_FAILURE, /**< Sent by the TM when the prolog phase fails */
EPILOG_SUCCESS, /**< Sent by the TM when the epilog phase succeeds */
@ -73,10 +73,10 @@ public:
ATTACH_FAILURE, /**< Sent by the VMM when an attach action fails */
DETACH_SUCCESS, /**< Sent by the VMM when a detach action succeeds */
DETACH_FAILURE, /**< Sent by the VMM when a detach action fails */
ATTACH_NIC_SUCCESS,/**< Sent by the VMM when an attach nic action succeeds */
ATTACH_NIC_FAILURE,/**< Sent by the VMM when an attach nic action fails */
DETACH_NIC_SUCCESS,/**< Sent by the VMM when a detach nic action succeeds */
DETACH_NIC_FAILURE,/**< Sent by the VMM when a detach nic action fails */
ATTACH_NIC_SUCCESS,/**< Sent by the VMM when attach nic action succeeds*/
ATTACH_NIC_FAILURE,/**< Sent by the VMM when attach nic action fails */
DETACH_NIC_SUCCESS,/**< Sent by the VMM when detach nic action succeeds*/
DETACH_NIC_FAILURE,/**< Sent by the VMM when detach nic action fails */
CLEANUP_SUCCESS, /**< Sent by the VMM when a cleanup action succeeds */
CLEANUP_FAILURE, /**< Sent by the VMM when a cleanup action fails */
SAVEAS_SUCCESS, /**< Sent by the VMM when saveas succeeds */
@ -87,8 +87,8 @@ public:
SNAPSHOT_REVERT_FAILURE, /**< Sent by the VMM on snap. revert failure */
SNAPSHOT_DELETE_SUCCESS, /**< Sent by the VMM on snap. revert success */
SNAPSHOT_DELETE_FAILURE, /**< Sent by the VMM on snap. revert failure */
DISK_SNAPSHOT_SUCCESS, /**<Sent by TM when a snap. succeeds */
DISK_SNAPSHOT_FAILURE, /**<Sent by TM when a snap. fails */
DISK_SNAPSHOT_SUCCESS, /**< Sent by TM when a snap. succeeds */
DISK_SNAPSHOT_FAILURE, /**< Sent by TM when a snap. fails */
DEPLOY, /**< Sent by the DM to deploy a VM on a host */
SUSPEND, /**< Sent by the DM to suspend an running VM */
RESTORE, /**< Sent by the DM to restore a suspended VM */
@ -103,11 +103,11 @@ public:
POWEROFF_HARD, /**< Sent by the DM to power off hard a running VM */
RESTART, /**< Sent by the DM to restart a deployed VM */
DELETE, /**< Sent by the DM to delete a VM */
CLEAN, /**< Sent by the DM to cleanup a VM for resubmission*/
DELETE_RECREATE, /**< Sent by the DM to cleanup a VM for resubmission*/
FINALIZE,
UPDATESG, /**< Sent by RM/VMM to trigger the secgroup update */
DISK_LOCK_SUCCESS, /**< Sent by IM when an image moves from locked to ready */
DISK_LOCK_FAILURE, /**< Sent by IM when an image moves from locked to error */
DISK_LOCK_SUCCESS,/**< Sent by IM, image moves from locked to ready */
DISK_LOCK_FAILURE,/**< Sent by IM, image moves from locked to error */
};
/**
@ -339,17 +339,9 @@ private:
void delete_action(int vid);
void clean_action(int vid);
void delete_recreate_action(int vid);
void timer_action();
void recover_lcm_state(VirtualMachine * vm, bool success);
void recover_state(VirtualMachine * vm, bool success);
void retry_lcm_state(VirtualMachine * vm);
void retry_state(VirtualMachine * vm);
};
#endif /*LIFE_CYCLE_MANAGER_H_*/

View File

@ -51,6 +51,7 @@ public:
PROLOG_RESUME,
PROLOG_ATTACH,
EPILOG,
EPILOG_LOCAL,
EPILOG_STOP,
EPILOG_DELETE,
EPILOG_DELETE_PREVIOUS,
@ -145,12 +146,14 @@ public:
* Inserts a transfer command in the xfs stream
*
* @param vm The VM
* @param host where the operation will be performed fe or host
* @param disk Disk to transfer
* @param disk_index Disk index
* @param xfr Stream where the transfer command will be written
*/
void epilog_transfer_command(
VirtualMachine * vm,
const string& host,
const VectorAttribute * disk,
ostream& xfr);
/**
@ -294,7 +297,7 @@ private:
/**
* This function starts the epilog sequence
*/
void epilog_action(int vid);
void epilog_action(bool local, int vid);
/**
* This function starts the epilog_stop sequence

View File

@ -375,8 +375,8 @@ IM_MAD = [
# for imported vms. The available actions are:
# migrate
# live-migrate
# shutdown
# shutdown-hard
# terminate
# terminate-hard
# undeploy
# undeploy-hard
# hold
@ -421,7 +421,7 @@ VM_MAD = [
ARGUMENTS = "-t 15 -r 0 kvm",
DEFAULT = "vmm_exec/vmm_exec_kvm.conf",
TYPE = "kvm",
IMPORTED_VMS_ACTIONS = "shutdown, shutdown-hard, hold, release, suspend,
IMPORTED_VMS_ACTIONS = "terminate, terminate-hard, hold, release, suspend,
resume, delete, reboot, reboot-hard, resched, unresched, disk-attach,
disk-detach, nic-attach, nic-detach, snap-create, snap-delete"
]
@ -444,7 +444,7 @@ VM_MAD = [
# ARGUMENTS = "-p -t 15 -r 0 vcenter -s sh",
# DEFAULT = "vmm_exec/vmm_exec_vcenter.conf",
# TYPE = "xml",
# IMPORTED_VMS_ACTIONS = "shutdown, shutdown-hard, hold, release, suspend,
# IMPORTED_VMS_ACTIONS = "terminate, terminate-hard, hold, release, suspend,
# resume, delete, reboot, reboot-hard, resched, unresched, poweroff,
# poweroff-hard, disk-attach, disk-detach, nic-attach, nic-detach,
# snap-create, snap-delete"
@ -462,7 +462,7 @@ VM_MAD = [
# EXECUTABLE = "one_vmm_sh",
# ARGUMENTS = "-t 15 -r 0 ec2",
# TYPE = "xml",
# IMPORTED_VMS_ACTIONS = "shutdown, shutdown-hard, hold, release, suspend,
# IMPORTED_VMS_ACTIONS = "terminate, terminate-hard, hold, release, suspend,
# resume, delete, reboot, reboot-hard, resched, unresched, poweroff,
# poweroff-hard, disk-attach, disk-detach, nic-attach, nic-detach,
# snap-create, snap-delete"
@ -480,7 +480,7 @@ VM_MAD = [
# EXECUTABLE = "one_vmm_sh",
# ARGUMENTS = "-t 15 -r 0 az",
# TYPE = "xml",
# IMPORTED_VMS_ACTIONS = "shutdown, shutdown-hard, hold, release, suspend,
# IMPORTED_VMS_ACTIONS = "terminate, terminate-hard, hold, release, suspend,
# resume, delete, reboot, reboot-hard, resched, unresched, poweroff,
# poweroff-hard, disk-attach, disk-detach, nic-attach, nic-detach,
# snap-create, snap-delete"

View File

@ -104,6 +104,18 @@ cmd=CommandParser::CmdParser.new(ARGV) do
:description => "Recover a VM by retrying the last failed action"
}
DELETE={
:name => "delete",
:large => "--delete",
:description => "No recover action possible, delete the VM"
}
RECREATE={
:name => "recreate",
:large => "--recreate",
:description => "No recover action possible, delete and recreate the VM"
}
INTERACTIVE={
:name => "interactive",
:large => "--interactive",
@ -262,31 +274,6 @@ cmd=CommandParser::CmdParser.new(ARGV) do
end
end
delete_desc = <<-EOT.unindent
Deletes the given VM. Using --recreate resubmits the VM.
Resubmits the VM to PENDING state. This is intended for VMs stuck in a
transient state. To re-deploy a fresh copy of the same VM, create a
Template and instantiate it, see 'onetemplate instantiate'
States: ANY
EOT
command :delete, delete_desc, [:range, :vmid_list],
:options => [OneVMHelper::SCHEDULE, OneVMHelper::RECREATE] do
command_name="delete"
command_name<<"-recreate" if options[:recreate]
if (!options[:schedule].nil?)
helper.schedule_actions(args[0], options, command_name)
else
helper.perform_actions(args[0],options,"deleted") do |vm|
vm.delete(options[:recreate]==true)
end
end
end
hold_desc = <<-EOT.unindent
Sets the given VM on hold. A VM on hold is not scheduled until it is
released. It can be, however, deployed manually; see 'onevm deploy'
@ -361,25 +348,25 @@ cmd=CommandParser::CmdParser.new(ARGV) do
end
end
shutdown_desc = <<-EOT.unindent
Shuts down the given VM. The VM life cycle will end.
terminate_desc = <<-EOT.unindent
Terminates the given VM. The VM life cycle will end.
With --hard it unplugs the VM.
States: RUNNING, UNKNOWN (with --hard)
States: valid if no operation is being performed on the VM
EOT
command :shutdown, shutdown_desc, [:range,:vmid_list],
command :terminate, terminate_desc, [:range,:vmid_list],
:options => [OneVMHelper::SCHEDULE, OneVMHelper::HARD] do
command_name='shutdown'
command_name='terminate'
command_name<<'-hard' if options[:hard]
if (!options[:schedule].nil?)
helper.schedule_actions(args[0], options, command_name)
else
helper.perform_actions(args[0],options,"shutting down") do |vm|
vm.shutdown(options[:hard]==true)
helper.perform_actions(args[0],options,"terminated") do |vm|
vm.terminate(options[:hard]==true)
end
end
end
@ -553,9 +540,9 @@ cmd=CommandParser::CmdParser.new(ARGV) do
recover_desc = <<-EOT.unindent
Recovers a stuck VM that is waiting for a driver operation. The recovery
may be done by failing, succeeding or retrying the current operation. YOU NEED
TO MANUALLY CHECK THE VM STATUS ON THE HOST, to decide if the operation
was successful or not, or if it can be retried.
may be done by failing, succeeding or retrying the current operation.
YOU NEED TO MANUALLY CHECK THE VM STATUS ON THE HOST, to decide if the
operation was successful or not, or if it can be retried.
Example: A VM is stuck in "migrate" because of a hardware failure. You
need to check if the VM is running in the new host or not to recover
@ -563,21 +550,29 @@ cmd=CommandParser::CmdParser.new(ARGV) do
States for success/failure recovers: Any ACTIVE state.
States for a retry recover: Any *FAILURE state
States for delete: Any
States for delete-recreate: Any but STOP/UNDEPLOYED
EOT
command :recover, recover_desc, [:range,:vmid_list],
:options => [SUCCESS, FAILURE, RETRY, INTERACTIVE] do
:options => [SUCCESS, FAILURE, RETRY, INTERACTIVE, DELETE, RECREATE] do
if !options[:success].nil?
result = 1
elsif !options[:failure].nil?
result = 0
elsif !options[:retry].nil?
result = 2
elsif !options[:delete].nil?
result = 3
elsif !options[:recreate].nil?
result = 4
else
STDERR.puts "Need to specify the result of the pending action."
STDERR.puts "\t--success recover the VM by succeeding the missing action."
STDERR.puts "\t--failure recover the VM by failing the missing action."
STDERR.puts "\t--retry recover the VM by retrying the last failed action."
STDERR.puts "\t--delete no recover possible, delete the VM."
STDERR.puts "\t--recreate no recover possible, delete and recreate the VM."
exit -1
end
@ -994,13 +989,6 @@ cmd=CommandParser::CmdParser.new(ARGV) do
# Deprecated commands
deprecated_command(:attachdisk, 'disk-attach')
deprecated_command(:detachdisk, 'disk-detach')
deprecated_command(:'disk-snapshot', 'disk-saveas')
deprecated_command(:livemigrate, 'migrate --live')
deprecated_command(:cancel, 'shutdown --hard')
deprecated_command(:reset, 'reboot --hard')
deprecated_command(:restart, 'recover --retry')
deprecated_command(:boot, 'recover --retry')
deprecated_command(:resubmit, 'delete --recreate')
deprecated_command(:shutdown, 'terminate')
deprecated_command(:delete, 'recover')
end

View File

@ -221,11 +221,42 @@ error:
/* ************************************************************************** */
/* ************************************************************************** */
int DispatchManager::shutdown (
void DispatchManager::free_vm_resources(VirtualMachine * vm)
{
Template * tmpl;
int uid;
int gid;
vm->release_network_leases();
vm->release_disk_images();
vm->set_exit_time(time(0));
vm->set_state(VirtualMachine::LCM_INIT);
vm->set_state(VirtualMachine::DONE);
vmpool->update(vm);
uid = vm->get_uid();
gid = vm->get_gid();
tmpl = vm->clone_template();
vm->unlock();
Quotas::vm_del(uid, gid, tmpl);
delete tmpl;
}
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
int DispatchManager::terminate(
int vid,
bool hard,
string& error_str)
{
int rc = 0;
ostringstream oss;
VirtualMachine * vm = vmpool->get(vid,true);
@ -235,44 +266,62 @@ int DispatchManager::shutdown (
return -1;
}
oss << "Shutting down VM " << vid;
oss << "Terminating VM " << vid;
NebulaLog::log("DiM",Log::DEBUG,oss);
if (vm->get_state() == VirtualMachine::POWEROFF ||
vm->get_state() == VirtualMachine::SUSPENDED ||
(vm->get_state() == VirtualMachine::ACTIVE &&
(vm->get_lcm_state() == VirtualMachine::RUNNING ||
vm->get_lcm_state() == VirtualMachine::UNKNOWN)))
switch (vm->get_state())
{
if (hard)
{
lcm->trigger(LifeCycleManager::CANCEL,vid);
}
else
{
lcm->trigger(LifeCycleManager::SHUTDOWN,vid);
}
}
else
{
goto error;
//Hard has no effect, VM is not RUNNING
case VirtualMachine::SUSPENDED:
case VirtualMachine::POWEROFF:
case VirtualMachine::STOPPED:
case VirtualMachine::UNDEPLOYED:
lcm->trigger(LifeCycleManager::SHUTDOWN, vid);
vm->unlock();
break;
case VirtualMachine::INIT:
case VirtualMachine::PENDING:
case VirtualMachine::HOLD:
case VirtualMachine::CLONING:
case VirtualMachine::CLONING_FAILURE:
free_vm_resources(vm);
break;
case VirtualMachine::DONE:
vm->unlock();
break;
case VirtualMachine::ACTIVE:
switch (vm->get_lcm_state())
{
case VirtualMachine::RUNNING:
case VirtualMachine::UNKNOWN:
if (hard)
{
lcm->trigger(LifeCycleManager::CANCEL,vid);
}
else
{
lcm->trigger(LifeCycleManager::SHUTDOWN,vid);
}
break;
default:
oss.str("");
oss << "Could not terminate VM " << vid << ", wrong state.";
NebulaLog::log("DiM",Log::ERROR,oss);
error_str = oss.str();
rc = -2;
break;
}
vm->unlock();
break;
}
vm->unlock();
return 0;
error:
oss.str("");
oss << "Could not shutdown VM " << vid << ", wrong state.";
NebulaLog::log("DiM",Log::ERROR,oss);
oss.str("");
oss << "This action is not available for state " << vm->state_str();
error_str = oss.str();
vm->unlock();
return -2;
return rc;
}
/* -------------------------------------------------------------------------- */
@ -745,72 +794,92 @@ error:
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
void DispatchManager::finalize_cleanup(VirtualMachine * vm)
int DispatchManager::recover(VirtualMachine * vm, bool success, string& error)
{
Template * tmpl;
int rc = 0;
int uid;
int gid;
switch (vm->get_state())
{
case VirtualMachine::CLONING_FAILURE:
if (success)
{
lcm->trigger(LifeCycleManager::DISK_LOCK_SUCCESS,vm->get_oid());
}
else
{
lcm->trigger(LifeCycleManager::DISK_LOCK_FAILURE,vm->get_oid());
}
break;
vm->release_network_leases();
vm->release_disk_images();
case VirtualMachine::ACTIVE:
lcm->recover(vm, success);
break;
vm->set_exit_time(time(0));
vm->set_state(VirtualMachine::LCM_INIT);
vm->set_state(VirtualMachine::DONE);
vmpool->update(vm);
uid = vm->get_uid();
gid = vm->get_gid();
tmpl = vm->clone_template();
default:
rc = -1;
error = "Cannot recover VM operation";
break;
}
vm->unlock();
Quotas::vm_del(uid, gid, tmpl);
delete tmpl;
return rc;
}
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
int DispatchManager::finalize(
int vid,
string& error_str)
int DispatchManager::retry(VirtualMachine * vm, string& error)
{
int rc = 0;
switch (vm->get_state())
{
case VirtualMachine::ACTIVE:
lcm->retry(vm);
break;
default:
rc = -1;
error = "The VM operation cannot be retried";
break;
}
vm->unlock();
return rc;
}
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
int DispatchManager::delete_vm(VirtualMachine * vm, string& error)
{
VirtualMachine * vm;
Host * host;
ostringstream oss;
int cpu, mem, disk;
vector<VectorAttribute *> pci;
VirtualMachine::VmState state;
bool is_public_host = false;
int host_id = -1;
vm = vmpool->get(vid,true);
if ( vm == 0 )
{
return -1;
}
if(vm->hasHistory())
{
host_id = vm->get_hid();
}
vm->unlock();
int vid = vm->get_oid();
if(host_id != -1)
{
host = hpool->get(host_id,true);
Host * host = hpool->get(host_id,true);
if ( host == 0 )
{
oss << "Error getting host " << host_id;
error_str = oss.str();
error = oss.str();
vm->unlock();
return -1;
}
@ -820,46 +889,41 @@ int DispatchManager::finalize(
host->unlock();
}
vm = vmpool->get(vid,true);
state = vm->get_state();
oss << "Finalizing VM " << vid;
oss << "Deleting VM " << vm->get_oid();
NebulaLog::log("DiM",Log::DEBUG,oss);
switch (state)
switch (vm->get_state())
{
case VirtualMachine::SUSPENDED:
case VirtualMachine::POWEROFF:
int cpu, mem, disk;
vm->get_requirements(cpu, mem, disk, pci);
hpool->del_capacity(vm->get_hid(),vm->get_oid(),cpu,mem,disk,pci);
hpool->del_capacity(vm->get_hid(), vid, cpu, mem, disk, pci);
if (is_public_host)
{
vmm->trigger(VirtualMachineManager::CLEANUP,vid);
vmm->trigger(VirtualMachineManager::CLEANUP, vid);
}
else
{
tm->trigger(TransferManager::EPILOG_DELETE,vid);
tm->trigger(TransferManager::EPILOG_DELETE, vid);
}
finalize_cleanup(vm);
free_vm_resources(vm);
break;
case VirtualMachine::STOPPED:
case VirtualMachine::UNDEPLOYED:
if (is_public_host)
{
vmm->trigger(VirtualMachineManager::CLEANUP,vid);
vmm->trigger(VirtualMachineManager::CLEANUP, vid);
}
else
{
tm->trigger(TransferManager::EPILOG_DELETE,vid);
tm->trigger(TransferManager::EPILOG_DELETE, vid);
}
finalize_cleanup(vm);
free_vm_resources(vm);
break;
case VirtualMachine::INIT:
@ -867,11 +931,11 @@ int DispatchManager::finalize(
case VirtualMachine::HOLD:
case VirtualMachine::CLONING:
case VirtualMachine::CLONING_FAILURE:
finalize_cleanup(vm);
free_vm_resources(vm);
break;
case VirtualMachine::ACTIVE:
lcm->trigger(LifeCycleManager::DELETE,vid);
lcm->trigger(LifeCycleManager::DELETE, vid);
vm->unlock();
break;
@ -886,38 +950,29 @@ int DispatchManager::finalize(
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
int DispatchManager::resubmit(
int vid,
string& error_str)
int DispatchManager::delete_recreate(VirtualMachine * vm, string& error)
{
VirtualMachine * vm;
ostringstream oss;
int rc = 0;
ostringstream oss;
int rc = 0;
Template * vm_quotas = 0;
map<int, Template *> ds_quotas;
int vm_uid, vm_gid;
vm = vmpool->get(vid,true);
if ( vm == 0 )
{
return -1;
}
switch (vm->get_state())
{
case VirtualMachine::POWEROFF:
error_str = "Cannot delete-recreate a powered off VM. Resume it first";
NebulaLog::log("DiM",Log::ERROR,error_str);
rc = -2;
error = "Cannot delete-recreate a powered off VM. Resume it first";
NebulaLog::log("DiM", Log::ERROR, error);
rc = -1;
break;
case VirtualMachine::SUSPENDED:
error_str = "Cannot delete-recreate a suspended VM. Resume it first";
NebulaLog::log("DiM",Log::ERROR,error_str);
rc = -2;
error = "Cannot delete-recreate a suspended VM. Resume it first";
NebulaLog::log("DiM", Log::ERROR, error);
rc = -1;
break;
case VirtualMachine::INIT:
@ -947,13 +1002,13 @@ int DispatchManager::resubmit(
break;
case VirtualMachine::ACTIVE: //Cleanup VM resources before PENDING
lcm->trigger(LifeCycleManager::CLEAN, vid);
lcm->trigger(LifeCycleManager::DELETE_RECREATE, vm->get_oid());
break;
case VirtualMachine::DONE:
error_str = "Cannot delete-recreate a VM already in DONE state";
NebulaLog::log("DiM",Log::ERROR,error_str);
rc = -2;
error = "Cannot delete-recreate a VM already in DONE state";
NebulaLog::log("DiM", Log::ERROR, error);
rc = -1;
break;
}

View File

@ -438,7 +438,8 @@ int ImagePool::acquire_disk(int vm_id,
(*snap)->set_disk_id(disk_id);
}
if (img->get_state() == Image::LOCKED_USED || img->get_state() == Image::LOCKED_USED_PERS)
if ( img->get_state() == Image::LOCKED_USED ||
img->get_state() == Image::LOCKED_USED_PERS )
{
disk->replace("CLONING", "YES");
}

View File

@ -387,7 +387,7 @@ void LifeCycleManager::shutdown_action(int vid, bool hard)
if (hard)
{
vm->set_action(History::SHUTDOWN_HARD_ACTION);
vm->set_action(History::TERMINATE_HARD_ACTION);
//----------------------------------------------------
@ -395,7 +395,7 @@ void LifeCycleManager::shutdown_action(int vid, bool hard)
}
else
{
vm->set_action(History::SHUTDOWN_ACTION);
vm->set_action(History::TERMINATE_ACTION);
//----------------------------------------------------
@ -410,16 +410,12 @@ void LifeCycleManager::shutdown_action(int vid, bool hard)
else if (vm->get_state() == VirtualMachine::SUSPENDED ||
vm->get_state() == VirtualMachine::POWEROFF)
{
//----------------------------------------------------
// Bypass SHUTDOWN
//----------------------------------------------------
vm->set_state(VirtualMachine::ACTIVE);
vm->set_state(VirtualMachine::EPILOG);
vmpool->update(vm);
vm->set_action(History::SHUTDOWN_ACTION);
vm->set_action(History::TERMINATE_ACTION);
vm->set_epilog_stime(time(0));
@ -427,7 +423,25 @@ void LifeCycleManager::shutdown_action(int vid, bool hard)
//----------------------------------------------------
tm->trigger(TransferManager::EPILOG,vid);
tm->trigger(TransferManager::EPILOG, vid);
}
else if (vm->get_state() == VirtualMachine::STOPPED ||
vm->get_state() == VirtualMachine::UNDEPLOYED)
{
vm->set_state(VirtualMachine::ACTIVE);
vm->set_state(VirtualMachine::EPILOG);
vmpool->update(vm);
vm->set_action(History::TERMINATE_ACTION);
vm->set_epilog_stime(time(0));
vmpool->update_history(vm);
//----------------------------------------------------
tm->trigger(TransferManager::EPILOG_LOCAL, vid);
}
else
{
@ -738,7 +752,7 @@ void LifeCycleManager::delete_action(int vid)
if ( image_id != -1 )
{
Image* image = ipool->get(image_id, true);
Image * image = ipool->get(image_id, true);
if ( image != 0 )
{
@ -754,7 +768,7 @@ void LifeCycleManager::delete_action(int vid)
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
void LifeCycleManager::clean_action(int vid)
void LifeCycleManager::delete_recreate_action(int vid)
{
Template * vm_quotas = 0;
map<int, Template *> ds_quotas;
@ -832,16 +846,17 @@ void LifeCycleManager::clean_action(int vid)
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
void LifeCycleManager::clean_up_vm(VirtualMachine * vm, bool dispose, int& image_id)
void LifeCycleManager::clean_up_vm(VirtualMachine * vm, bool dispose,
int& image_id)
{
int cpu, mem, disk;
int cpu, mem, disk;
unsigned int port;
vector<VectorAttribute *> pci;
time_t the_time = time(0);
VirtualMachine::LcmState state = vm->get_lcm_state();
int vid = vm->get_oid();
int vid = vm->get_oid();
if (dispose)
{
@ -1076,21 +1091,6 @@ void LifeCycleManager::clean_up_vm(VirtualMachine * vm, bool dispose, int& imag
/* -------------------------------------------------------------------------- */
void LifeCycleManager::recover(VirtualMachine * vm, bool success)
{
if (vm->get_state() == VirtualMachine::ACTIVE)
{
recover_lcm_state(vm, success);
}
else
{
recover_state(vm, success);
}
}
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
void LifeCycleManager::recover_lcm_state(VirtualMachine * vm, bool success)
{
LifeCycleManager::Actions lcm_action = LifeCycleManager::FINALIZE;
@ -1307,52 +1307,7 @@ void LifeCycleManager::recover_lcm_state(VirtualMachine * vm, bool success)
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
void LifeCycleManager::recover_state(VirtualMachine * vm, bool success)
{
LifeCycleManager::Actions lcm_action = LifeCycleManager::FINALIZE;
switch (vm->get_state())
{
case VirtualMachine::CLONING_FAILURE:
if (success)
{
lcm_action = LifeCycleManager::DISK_LOCK_SUCCESS;
}
else
{
lcm_action = LifeCycleManager::DISK_LOCK_FAILURE;
}
break;
default:
break;
}
if (lcm_action != LifeCycleManager::FINALIZE)
{
trigger(lcm_action, vm->get_oid());
}
}
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
void LifeCycleManager::retry(VirtualMachine * vm)
{
if (vm->get_state() == VirtualMachine::ACTIVE)
{
retry_lcm_state(vm);
}
else
{
retry_state(vm);
}
}
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
void LifeCycleManager::retry_lcm_state(VirtualMachine * vm)
{
int vid = vm->get_oid();
@ -1494,13 +1449,13 @@ void LifeCycleManager::retry_lcm_state(VirtualMachine * vm)
case VirtualMachine::SHUTDOWN:
case VirtualMachine::SHUTDOWN_POWEROFF:
case VirtualMachine::SHUTDOWN_UNDEPLOY:
if (vm->get_action() == History::SHUTDOWN_HARD_ACTION)
if (vm->get_action() == History::TERMINATE_ACTION)
{
vmm->trigger(VirtualMachineManager::CANCEL,vid);
vmm->trigger(VirtualMachineManager::SHUTDOWN,vid);
}
else
{
vmm->trigger(VirtualMachineManager::SHUTDOWN,vid);
vmm->trigger(VirtualMachineManager::CNCEL,vid);
}
break;
@ -1566,17 +1521,6 @@ void LifeCycleManager::retry_lcm_state(VirtualMachine * vm)
return;
}
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
void LifeCycleManager::retry_state(VirtualMachine * vm)
{
if (vm->get_state() == VirtualMachine::CLONING_FAILURE)
{
trigger(LifeCycleManager::DISK_LOCK_SUCCESS, vm->get_oid());
}
}
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */

View File

@ -281,8 +281,8 @@ void LifeCycleManager::trigger(Actions action, int _vid)
aname = "DELETE";
break;
case CLEAN:
aname = "CLEAN";
case DELETE_RECREATE:
aname = "DELETE_RECREATE";
break;
case FINALIZE:
@ -526,9 +526,9 @@ void LifeCycleManager::do_action(const string &action, void * arg)
{
delete_action(vid);
}
else if (action == "CLEAN")
else if (action == "DELETE_RECREATE")
{
clean_action(vid);
delete_recreate_action(vid);
}
else if (action == "POWEROFF")
{

View File

@ -207,7 +207,7 @@ module OpenNebula
undeploy undeploy-hard hold release stop suspend resume boot delete
delete-recreate reboot reboot-hard resched unresched poweroff
poweroff-hard disk-attach disk-detach nic-attach nic-detach
snap-create snap-delete}
snap-create snap-delete terminate terminate-hard}
EXTERNAL_IP_ATTRS = [
'GUEST_IP',
@ -342,10 +342,12 @@ module OpenNebula
end
# Shutdowns an already deployed VM
def shutdown(hard=false)
action(hard ? 'shutdown-hard' : 'shutdown')
def terminate(hard=false)
action(hard ? 'terminate-hard' : 'terminate')
end
alias_method :shutdown, :terminate
# Shuts down an already deployed VM, saving its state in the system DS
def undeploy(hard=false)
action(hard ? 'undeploy-hard' : 'undeploy')
@ -361,16 +363,6 @@ module OpenNebula
action(hard ? 'reboot-hard' : 'reboot')
end
# @deprecated use {#reboot}
def reset
reboot(true)
end
# @deprecated use {#shutdown}
def cancel
shutdown(true)
end
# Sets a VM to hold state, scheduler will not deploy it
def hold
action('hold')
@ -436,25 +428,6 @@ module OpenNebula
return call(VM_METHODS[:detachnic], @pe_id, nic_id)
end
# Deletes a VM from the pool
def delete(recreate=false)
if recreate
action('delete-recreate')
else
action('delete')
end
end
# @deprecated use {#delete} instead
def finalize(recreate=false)
delete(recreate)
end
# @deprecated use {#delete} instead
def resubmit
action('delete-recreate')
end
# Sets the re-scheduling flag for the VM
def resched
action('resched')
@ -665,8 +638,8 @@ module OpenNebula
# Recovers an ACTIVE VM
#
# @param result [Integer] Recover with failure (0), success (1) or
# retry (2)
# @param result [Integer] Recover with failure (0), success (1),
# retry (2), delete (3), delete-recreate (4)
# @param result [info] Additional information needed to recover the VM
# @return [nil, OpenNebula::Error] nil in case of success, Error
# otherwise
@ -674,6 +647,15 @@ module OpenNebula
return call(VM_METHODS[:recover], @pe_id, result)
end
# Deletes a VM from the pool
def delete(recreate=false)
if recreate
recover(4)
else
recover(3)
end
end
# Changes the attributes of a VM in power off, failure and undeploy
# states
# @param new_conf, string describing the new attributes. Each attribute

View File

@ -495,22 +495,14 @@ void VirtualMachineAction::request_execute(xmlrpc_c::paramList const& paramList,
VirtualMachine * vm;
// Compatibility with 3.8
if (action_st == "cancel")
// Compatibility with 4.x
if (action_st == "shutdown-hard" || action_st == "delete" )
{
action_st = "shutdown-hard";
action_st = "terminate-hard";
}
else if (action_st == "finalize")
else if (action_st == "shutdown")
{
action_st = "delete";
}
else if (action_st == "resubmit")
{
action_st = "delete-recreate";
}
else if (action_st == "reset")
{
action_st = "reboot-hard";
action_st = "terminate";
}
History::action_from_str(action_st, action);
@ -532,7 +524,9 @@ void VirtualMachineAction::request_execute(xmlrpc_c::paramList const& paramList,
if (vm->is_imported() && !vm->is_imported_action_supported(action))
{
att.resp_msg = "Action \"" + action_st + "\" is not supported for imported VMs";
att.resp_msg = "Action \"" + action_st + "\" is not supported for "
"imported VMs";
failure_response(ACTION, att);
vm->unlock();
@ -543,10 +537,9 @@ void VirtualMachineAction::request_execute(xmlrpc_c::paramList const& paramList,
{
bool failure = true;
// Delete operation is allowed for orphan virtual router VMs.
if (action == History::DELETE_ACTION ||
action == History::SHUTDOWN_ACTION ||
action == History::SHUTDOWN_HARD_ACTION)
// Terminate operation is allowed for orphan virtual router VMs.
if ( action == History::TERMINATE_ACTION ||
action == History::TERMINATE_HARD_ACTION )
{
VirtualRouterPool* vrpool = Nebula::instance().get_vrouterpool();
failure = (vrpool->get(vm->get_vrouter_id(), false) != 0);
@ -554,8 +547,9 @@ void VirtualMachineAction::request_execute(xmlrpc_c::paramList const& paramList,
if (failure)
{
att.resp_msg = "Action \""+action_st+"\" is not supported for "
att.resp_msg = "Action \"" + action_st + "\" is not supported for "
"virtual router VMs";
failure_response(ACTION, att);
vm->unlock();
@ -567,8 +561,11 @@ void VirtualMachineAction::request_execute(xmlrpc_c::paramList const& paramList,
switch (action)
{
case History::SHUTDOWN_ACTION:
rc = dm->shutdown(id, false, error);
case History::TERMINATE_ACTION:
rc = dm->terminate(id, false, error);
break;
case History::TERMINATE_HARD_ACTION:
rc = dm->terminate(id, true, error);
break;
case History::HOLD_ACTION:
rc = dm->hold(id, error);
@ -579,33 +576,24 @@ void VirtualMachineAction::request_execute(xmlrpc_c::paramList const& paramList,
case History::STOP_ACTION:
rc = dm->stop(id, error);
break;
case History::SHUTDOWN_HARD_ACTION:
rc = dm->shutdown(id, true, error);
break;
case History::SUSPEND_ACTION:
rc = dm->suspend(id, error);
break;
case History::RESUME_ACTION:
rc = dm->resume(id, error);
break;
case History::DELETE_ACTION:
rc = dm->finalize(id, error);
break;
case History::DELETE_RECREATE_ACTION:
rc = dm->resubmit(id, error);
break;
case History::REBOOT_ACTION:
rc = dm->reboot(id, false, error);
break;
case History::REBOOT_HARD_ACTION:
rc = dm->reboot(id, true, error);
break;
case History::RESCHED_ACTION:
rc = dm->resched(id, true, error);
break;
case History::UNRESCHED_ACTION:
rc = dm->resched(id, false, error);
break;
case History::REBOOT_HARD_ACTION:
rc = dm->reboot(id, true, error);
break;
case History::POWEROFF_ACTION:
rc = dm->poweroff(id, false, error);
break;
@ -628,25 +616,29 @@ void VirtualMachineAction::request_execute(xmlrpc_c::paramList const& paramList,
case 0:
success_response(id, att);
break;
case -1:
att.resp_id = id;
failure_response(NO_EXISTS, att);
break;
case -2:
oss << "Error performing action \"" << action_st << "\" on "
<< object_name(auth_object) << " [" << id << "]. " << error;
att.resp_msg = oss.str();
oss << "Error performing action \"" << action_st << "\": " << error;
att.resp_msg = oss.str();
failure_response(ACTION, att);
break;
case -3:
oss << "Virtual machine action \"" << action_st << "\" is not supported";
att.resp_msg = oss.str();
oss << "Action \"" << action_st << "\" is not supported";
att.resp_msg = oss.str();
failure_response(ACTION, att);
break;
default:
att.resp_msg = "Internal error. Action result not defined";
failure_response(INTERNAL, att);
}
@ -2460,41 +2452,45 @@ void VirtualMachineRecover::request_execute(
int id = xmlrpc_c::value_int(paramList.getInt(1));
int op = xmlrpc_c::value_int(paramList.getInt(2));
VirtualMachine * vm;
int rc;
string error;
Nebula& nd = Nebula::instance();
LifeCycleManager* lcm = nd.get_lcm();
DispatchManager * dm = Nebula::instance().get_dm();
if ( vm_authorization(id, 0, 0, att, 0, 0, 0, auth_op) == false )
{
return;
}
if ((vm = get_vm(id, att)) == 0)
{
return;
}
VirtualMachine * vm=(static_cast<VirtualMachinePool *>(pool))->get(id,true);
if(vm->get_state() != VirtualMachine::ACTIVE &&
vm->get_state() != VirtualMachine::CLONING_FAILURE)
if (vm == 0)
{
att.resp_msg = "Recover action is not available for state " + vm->state_str();
failure_response(ACTION, att);
vm->unlock();
att.resp_id = id;
failure_response(NO_EXISTS, att);
return;
}
switch (op)
{
case 0:
lcm->recover(vm, false);
case 0: //recover-failure
rc = dm->recover(vm, false, error);
break;
case 1:
lcm->recover(vm, true);
case 1: //recover-success
rc = dm->recover(vm, true, error);
break;
case 2:
lcm->retry(vm);
case 2: //retry
rc = dm->retry(vm, error);
break;
case 3: //delete
rc = dm->delete_vm(vm, error);
break;
case 4: //delete-recreate
rc = dm->delete_recreate(vm, error);
break;
default:
@ -2505,9 +2501,17 @@ void VirtualMachineRecover::request_execute(
return;
}
success_response(id, att);
vm->unlock();
if ( rc == 0 )
{
success_response(id, att);
}
else
{
att.resp_msg = error;
failure_response(ACTION, att);
}
return;
}

View File

@ -136,7 +136,7 @@ void VirtualRouterInstantiate::request_execute(
for (vmid = vms.begin(); vmid != vms.end(); vmid++)
{
dm->finalize(*vmid, att.resp_msg);
dm->delete_vm(*vmid, att.resp_msg);
}
return;

View File

@ -285,7 +285,22 @@ void TransferManager::do_action(const string &action, void * arg)
}
else
{
epilog_action(vid);
epilog_action(false, vid);
}
}
else if (action == "EPILOG_LOCAL")
{
if (host_is_cloud)
{
(nd.get_lcm())->trigger(LifeCycleManager::EPILOG_SUCCESS,vid);
}
else if (vm_no_history)
{
(nd.get_lcm())->trigger(LifeCycleManager::EPILOG_FAILURE,vid);
}
else
{
epilog_action(true, vid);
}
}
else if (action == "EPILOG_STOP")
@ -1216,19 +1231,16 @@ error_common:
void TransferManager::epilog_transfer_command(
VirtualMachine * vm,
const string& host,
const VectorAttribute * disk,
ostream& xfr)
{
int disk_id;
string save = disk->vector_value("SAVE");
string save = disk->vector_value("SAVE");
disk->vector_value("DISK_ID", disk_id);
transform(save.begin(),save.end(),save.begin(),(int(*)(int))toupper);
if ( save == "YES" )
if ( one_util::toupper(save) == "YES" )
{
string source = disk->vector_value("SOURCE");
string tm_mad = disk->vector_value("TM_MAD");
@ -1249,8 +1261,7 @@ void TransferManager::epilog_transfer_command(
//MVDS tm_mad hostname:remote_system_dir/disk.0 <fe:SOURCE|SOURCE> vmid dsid
xfr << "MVDS "
<< tm_mad << " "
<< vm->get_hostname() << ":"
<< vm->get_system_dir() << "/disk." << disk_id << " "
<< host << ":" << vm->get_system_dir() << "/disk." << disk_id << " "
<< source << " "
<< vm->get_oid() << " "
<< ds_id
@ -1279,8 +1290,7 @@ void TransferManager::epilog_transfer_command(
//DELETE tm_mad hostname:remote_system_dir/disk.i vmid ds_id
xfr << "DELETE "
<< tm_mad << " "
<< vm->get_hostname() << ":"
<< vm->get_system_dir() << "/disk." << disk_id << " "
<< host << ":" << vm->get_system_dir() << "/disk." << disk_id << " "
<< vm->get_oid() << " "
<< ds_id_i
<< endl;
@ -1291,13 +1301,15 @@ void TransferManager::epilog_transfer_command(
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
void TransferManager::epilog_action(int vid)
void TransferManager::epilog_action(bool local, int vid)
{
ofstream xfr;
ostringstream os;
ofstream xfr;
ostringstream os;
string xfr_name;
string vm_tm_mad;
string error_str;
string host;
VirtualMachine * vm;
Nebula& nd = Nebula::instance();
@ -1338,6 +1350,15 @@ void TransferManager::epilog_action(int vid)
goto error_file;
}
if (local)
{
host = nd.get_nebula_hostname();
}
else
{
host = vm->get_hostname();
}
// -------------------------------------------------------------------------
// copy back VM image (DISK with SAVE="yes")
// -------------------------------------------------------------------------
@ -1345,13 +1366,13 @@ void TransferManager::epilog_action(int vid)
for (int i=0; i < num; i++)
{
epilog_transfer_command(vm, disk[i], xfr);
epilog_transfer_command(vm, host, disk[i], xfr);
}
//DELETE vm_tm_mad hostname:remote_system_dir vmid ds_id
xfr << "DELETE "
<< vm_tm_mad << " "
<< vm->get_hostname() << ":" << vm->get_system_dir() << " "
<< host << ":" << vm->get_system_dir() << " "
<< vm->get_oid() << " "
<< vm->get_ds_id() << endl;
@ -1922,7 +1943,7 @@ void TransferManager::epilog_detach_action(int vid)
goto error_disk;
}
epilog_transfer_command(vm, disk, xfr);
epilog_transfer_command(vm, vm->get_hostname(), disk, xfr);
xfr.close();

View File

@ -1765,7 +1765,7 @@ void VirtualMachineManager::attach_action(
os.str("");
tm->epilog_transfer_command(vm, disk, os);
tm->epilog_transfer_command(vm, vm->get_hostname(), disk, os);
epilog_cmd = os.str();
@ -1853,7 +1853,8 @@ void VirtualMachineManager::detach_action(
const VectorAttribute * disk;
int disk_id;
Nebula& nd = Nebula::instance();
Nebula& nd = Nebula::instance();
TransferManager * tm = nd.get_tm();
// Get the VM from the pool
vm = vmpool->get(vid,true);
@ -1888,7 +1889,7 @@ void VirtualMachineManager::detach_action(
disk->vector_value("DISK_ID", disk_id);
Nebula::instance().get_tm()->epilog_transfer_command(vm, disk, os);
tm->epilog_transfer_command(vm, vm->get_hostname(), disk, os);
epilog_cmd = os.str();

View File

@ -25,7 +25,6 @@ static const History::VMAction action[12] = {
History::HOLD_ACTION,
History::RELEASE_ACTION,
History::RESUME_ACTION,
History::BOOT_ACTION,
History::REBOOT_ACTION,
History::REBOOT_HARD_ACTION,
History::RESCHED_ACTION,
@ -159,7 +158,7 @@ int VirtualRouter::drop(SqlDB * db)
int VirtualRouter::shutdown_vms()
{
DispatchManager* dm = Nebula::instance().get_dm();
DispatchManager * dm = Nebula::instance().get_dm();
set<int> _vms;
set<int>::iterator it;
@ -172,7 +171,7 @@ int VirtualRouter::shutdown_vms()
for (it = _vms.begin(); it != _vms.end(); it++)
{
rc = dm->shutdown(*it, true, error);
rc = dm->terminate(*it, true, error);
if (rc != 0)
{
@ -180,7 +179,7 @@ int VirtualRouter::shutdown_vms()
if (rc == -2)
{
dm->finalize(*it, error);
dm->delete_vm(*it, error);
}
}
}