mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-26 06:50:09 +03:00
feature #1288: Fix some bugs in quota rollback
This commit is contained in:
parent
4420b1d81b
commit
7e7dcf6eac
@ -35,9 +35,9 @@ class QuotaNetwork : public Quota
|
||||
public:
|
||||
|
||||
QuotaNetwork():Quota("NETWORK_QUOTA",
|
||||
"NETWORK",
|
||||
NET_METRICS,
|
||||
NUM_NET_METRICS)
|
||||
"NETWORK",
|
||||
NET_METRICS,
|
||||
NUM_NET_METRICS)
|
||||
{};
|
||||
|
||||
~QuotaNetwork(){};
|
||||
|
@ -38,9 +38,9 @@ class QuotaVirtualMachine : public Quota
|
||||
public:
|
||||
|
||||
QuotaVirtualMachine():Quota("VM_QUOTA",
|
||||
"VM",
|
||||
VM_METRICS,
|
||||
NUM_VM_METRICS)
|
||||
"VM",
|
||||
VM_METRICS,
|
||||
NUM_VM_METRICS)
|
||||
{};
|
||||
|
||||
~QuotaVirtualMachine(){};
|
||||
@ -61,7 +61,7 @@ public:
|
||||
void del(Template* tmpl);
|
||||
|
||||
/**
|
||||
* Gets a quota identified by its ID.
|
||||
* Gets a quota, overrides base to not to use ID.
|
||||
* @param id of the quota
|
||||
* @return a pointer to the quota or 0 if not found
|
||||
*/
|
||||
|
@ -274,12 +274,14 @@ int VirtualMachineAllocate::pool_allocate(xmlrpc_c::paramList const& paramList,
|
||||
VirtualMachineTemplate * ttmpl= static_cast<VirtualMachineTemplate *>(tmpl);
|
||||
VirtualMachinePool * vmpool = static_cast<VirtualMachinePool *>(pool);
|
||||
|
||||
Template tmpl_back(*tmpl);
|
||||
|
||||
int rc = vmpool->allocate(att.uid, att.gid, att.uname, att.gname, ttmpl, &id,
|
||||
error_str, false);
|
||||
|
||||
if ( rc != 0 )
|
||||
if ( rc < 0 )
|
||||
{
|
||||
quota_rollback(tmpl, att);
|
||||
quota_rollback(&tmpl_back, att);
|
||||
}
|
||||
|
||||
return rc;
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
const char * QuotaVirtualMachine::VM_METRICS[] = {"VMS", "CPU", "MEMORY"};
|
||||
|
||||
const int QuotaVirtualMachine::NUM_VM_METRICS = 2;
|
||||
const int QuotaVirtualMachine::NUM_VM_METRICS = 3;
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
@ -227,7 +227,7 @@ int User::from_xml(const string& xml)
|
||||
|
||||
if (!content.empty())
|
||||
{
|
||||
rc += network_quota.from_xml_node(content[0]);
|
||||
rc += vm_quota.from_xml_node(content[0]);
|
||||
}
|
||||
|
||||
ObjectXML::free_nodes(content);
|
||||
|
@ -221,7 +221,7 @@ int VirtualMachinePool::allocate (
|
||||
// Insert the Object in the pool
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
*oid = PoolSQL::allocate(vm,error_str);
|
||||
*oid = PoolSQL::allocate(vm, error_str);
|
||||
|
||||
return *oid;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user