mirror of
https://github.com/OpenNebula/one.git
synced 2026-12-03 13:46:09 +09:00
M #-: Fix SIGSEV on resize failure
This commit is contained in:
1 file changed
+13
-14
+13
-14
@@ -2430,11 +2430,12 @@ void LifeCycleManager::trigger_resize_failure(int vid)
|
||||
{
|
||||
trigger([this, vid] {
|
||||
Template deltas;
|
||||
HostShareCapacity sr, sr_orig;
|
||||
int vm_uid, vm_gid, hid;
|
||||
int vm_uid, vm_gid;
|
||||
|
||||
if ( auto vm = vmpool->get(vid) )
|
||||
{
|
||||
HostShareCapacity sr, sr_orig;
|
||||
|
||||
VirtualMachine::LcmState state = vm->get_lcm_state();
|
||||
|
||||
if (state == VirtualMachine::HOTPLUG_RESIZE)
|
||||
@@ -2450,8 +2451,6 @@ void LifeCycleManager::trigger_resize_failure(int vid)
|
||||
return;
|
||||
}
|
||||
|
||||
hid = vm->get_hid();
|
||||
|
||||
vm->get_capacity(sr);
|
||||
|
||||
auto vattr = vm->get_template_attribute("RESIZE");
|
||||
@@ -2491,22 +2490,22 @@ void LifeCycleManager::trigger_resize_failure(int vid)
|
||||
vm->reset_resize();
|
||||
|
||||
vmpool->update(vm.get());
|
||||
|
||||
// Revert host capacity
|
||||
if (auto host = hpool->get(vm->get_hid()))
|
||||
{
|
||||
host->del_capacity(sr);
|
||||
|
||||
host->add_capacity(sr_orig);
|
||||
|
||||
hpool->update(host.get());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Revert host capacity
|
||||
if (auto host = hpool->get(hid))
|
||||
{
|
||||
host->del_capacity(sr);
|
||||
|
||||
host->add_capacity(sr_orig);
|
||||
|
||||
hpool->update(host.get());
|
||||
}
|
||||
|
||||
// Quota rollback
|
||||
Quotas::quota_del(Quotas::VM, vm_uid, vm_gid, &deltas);
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user