1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-22 13:33:52 +03:00

B #6432: disk_resize: Safety check of disk pointer (#2877)

(cherry picked from commit 0a57636bf3)
This commit is contained in:
Pavel Czerný 2024-01-03 12:12:25 +01:00 committed by Ruben S. Montero
parent 5966e8d60d
commit 0949062589
No known key found for this signature in database
GPG Key ID: A0CEA6FA880A1D87

View File

@ -2319,13 +2319,6 @@ void LifeCycleManager::trigger_disk_resize_success(int vid)
if ( auto vm = vmpool->get(vid) )
{
VirtualMachineDisk * disk = vm->get_resize_disk();
if ( disk == nullptr )
{
return;
}
state = vm->get_lcm_state();
switch (state)
@ -2345,6 +2338,15 @@ void LifeCycleManager::trigger_disk_resize_success(int vid)
return;
}
VirtualMachineDisk * disk = vm->get_resize_disk();
if ( disk == nullptr )
{
vm->log("LCM", Log::ERROR,
"disk_resize_success, but the VM doesn't have a disk with resize operation in progress");
return;
}
disk->clear_resize(false);
is_persistent = disk->is_persistent();
@ -2403,8 +2405,6 @@ void LifeCycleManager::trigger_disk_resize_failure(int vid)
if ( auto vm = vmpool->get(vid) )
{
VirtualMachineDisk * disk = vm->get_resize_disk();
state = vm->get_lcm_state();
switch (state)
@ -2423,6 +2423,15 @@ void LifeCycleManager::trigger_disk_resize_failure(int vid)
return;
}
VirtualMachineDisk * disk = vm->get_resize_disk();
if ( disk == nullptr )
{
vm->log("LCM", Log::ERROR,
"disk_resize_failure, but the VM doesn't have a disk with resize operation in progress");
return;
}
vm_uid = vm->get_uid();
vm_gid = vm->get_gid();