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

B #5640: Fix NETRX and NETTX for accounting (#2417)

(cherry picked from commit 3beca2d9d3f3aeb7d81bb277cc5469af73fac337)
This commit is contained in:
Pavel Czerný 2022-12-12 09:28:46 +01:00 committed by Ruben S. Montero
parent 4cbd92bd6e
commit 60fb740d1e
No known key found for this signature in database
GPG Key ID: A0CEA6FA880A1D87
3 changed files with 15 additions and 0 deletions

View File

@ -701,6 +701,8 @@ public:
*/
void set_vm_info()
{
load_monitoring();
to_xml_extended(history->vm_info, 0);
};

View File

@ -1478,6 +1478,8 @@ int DispatchManager::detach(int vid, int disk_id, const RequestAttributes& ra,
vm->set_resched(false);
vm->set_vm_info();
close_cp_history(vmpool, vm.get(), VMActions::DISK_DETACH_ACTION, ra);
if ( vm->get_state() == VirtualMachine::ACTIVE &&
@ -1767,6 +1769,8 @@ int DispatchManager::attach_nic(int vid, VirtualMachineTemplate* tmpl,
action = VMActions::ALIAS_ATTACH_ACTION;
}
vm->set_vm_info();
close_cp_history(vmpool, vm.get(), action, ra);
if (vm->get_state() == VirtualMachine::ACTIVE)
@ -1855,6 +1859,8 @@ int DispatchManager::detach_nic(int vid, int nic_id, const RequestAttributes& ra
action = VMActions::ALIAS_DETACH_ACTION;
}
vm->set_vm_info();
close_cp_history(vmpool, vm.get(), action, ra);
bool cold_attach = false;
@ -2040,6 +2046,8 @@ int DispatchManager::disk_snapshot_revert(int vid, int did, int snap_id,
return -1;
}
vm->set_vm_info();
close_cp_history(vmpool, vm.get(), VMActions::DISK_SNAPSHOT_REVERT_ACTION, ra);
switch (state)

View File

@ -471,6 +471,11 @@ void InformationManager::_vm_state(unique_ptr<im_msg_t> msg)
vmpool->update(vm.get());
}
// Update monitoring date in history record
vm->set_vm_info();
vmpool->update_history(vm.get());
/* ------------------------------------------------------------------ */
/* Apply state changes */
/* ------------------------------------------------------------------ */