1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-22 18:50:08 +03:00

Bug #3876: Trigger cancel on other states than active if host is hybrid

This commit is contained in:
Tino Vazquez 2015-08-20 23:05:04 +02:00
parent a1853dd987
commit f22ca784b3
2 changed files with 37 additions and 5 deletions

View File

@ -768,11 +768,18 @@ int DispatchManager::finalize(
string& error_str)
{
VirtualMachine * vm;
Host * host;
ostringstream oss;
VirtualMachine::VmState state;
bool is_public_host;
vm = vmpool->get(vid,true);
vm = vmpool->get(vid,true);
host = hpool->get(vm->get_hid(),true);
is_public_host = host->is_public_cloud();
host->unlock();
if ( vm == 0 )
{
@ -793,13 +800,29 @@ int DispatchManager::finalize(
vm->get_requirements(cpu,mem,disk);
hpool->del_capacity(vm->get_hid(), vm->get_oid(), cpu, mem, disk);
tm->trigger(TransferManager::EPILOG_DELETE,vid);
if (is_public_host)
{
vmm->trigger(VirtualMachineManager::CLEANUP,vid);
}
else
{
tm->trigger(TransferManager::EPILOG_DELETE,vid);
}
finalize_cleanup(vm);
break;
case VirtualMachine::STOPPED:
case VirtualMachine::UNDEPLOYED:
tm->trigger(TransferManager::EPILOG_DELETE_STOP,vid);
if (is_public_host)
{
vmm->trigger(VirtualMachineManager::CLEANUP,vid);
}
else
{
tm->trigger(TransferManager::EPILOG_DELETE,vid);
}
finalize_cleanup(vm);
break;

View File

@ -232,14 +232,23 @@ class VIClient
# @return [Hash] in the form
# {dc_name [String] => ClusterComputeResources Names [Array - String]}
########################################################################
def hierarchy
def hierarchy(one_client=nil)
vc_hosts = {}
datacenters = get_entities(@root, 'Datacenter')
hpool = OpenNebula::HostPool.new((one_client||@one))
rc = hpool.info
datacenters.each { |dc|
ccrs = get_entities(dc.hostFolder, 'ClusterComputeResource')
vc_hosts[dc.name] = ccrs.collect { |c| c.name }
vc_hosts[dc.name] = []
ccrs.each { |c|
puts c.name
if !hpool["HOST[NAME=\"c.name\"]"]
vc_hosts[dc.name] << c.name
end
}
}
return vc_hosts