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

B #6320: Fix history for VM disk actions (#2806)

This commit is contained in:
Pavel Czerný 2023-11-28 11:08:57 +01:00 committed by GitHub
parent f94e225a6c
commit 9cf5f85db8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 9 deletions

View File

@ -721,14 +721,12 @@ public:
};
/**
* Sets end time of a VM. It also sets the vm_info when the record is closed
* Sets end time of a VM
* @param _etime time when the VM finished
*/
void set_etime(time_t _etime)
{
history->etime = _etime;
to_xml_extended(history->vm_info, 0, false);
};
/**
@ -740,15 +738,12 @@ public:
}
/**
* Sets end time of a VM in the previous Host. It also sets the vm_info
* when the record is closed
* Sets end time of a VM in the previous Host
* @param _etime time when the VM finished
*/
void set_previous_etime(time_t _etime)
{
previous_history->etime = _etime;
to_xml_extended(previous_history->vm_info, 0, false);
};
/**

View File

@ -1995,6 +1995,10 @@ void LifeCycleManager::trigger_disk_snapshot_success(int vid)
is_persistent = disk->is_persistent();
target = disk->get_tm_target();
vm->set_vm_info();
vmpool->update_history(vm.get());
vmpool->update(vm.get());
}
else
@ -2138,6 +2142,11 @@ void LifeCycleManager::trigger_disk_snapshot_failure(int vid)
is_persistent = disk->is_persistent();
target = disk->get_tm_target();
// Update the history record
vm->set_vm_info();
vmpool->update_history(vm.get());
vmpool->update(vm.get());
}
else
@ -2406,12 +2415,12 @@ void LifeCycleManager::trigger_disk_resize_failure(int vid)
[[fallthrough]];
case VirtualMachine::DISK_RESIZE_POWEROFF:
case VirtualMachine::DISK_RESIZE_UNDEPLOYED:
vm->log("LCM", Log::INFO, "VM disk resize operation completed.");
vm->log("LCM", Log::INFO, "VM disk resize operation failed.");
break;
default:
vm->log("LCM",Log::ERROR,"disk_resize_success, VM in a wrong state");
vm->log("LCM",Log::ERROR,"disk_resize_failure, VM in a wrong state");
return;
}
@ -2424,6 +2433,10 @@ void LifeCycleManager::trigger_disk_resize_failure(int vid)
disk->clear_resize(true);
vm->set_vm_info();
vmpool->update_history(vm.get());
vmpool->update(vm.get());
}
else

View File

@ -1008,6 +1008,10 @@ void VirtualMachinePool::delete_attach_disk(std::unique_ptr<VirtualMachine> vm)
gid = vm->get_gid();
oid = vm->get_oid();
vm->set_vm_info();
vm->update_history(db);
update(vm.get());
if ( disk == nullptr )