diff --git a/include/QuotaNetwork.h b/include/QuotaNetwork.h index 3ff0123cce..defb73e482 100644 --- a/include/QuotaNetwork.h +++ b/include/QuotaNetwork.h @@ -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(){}; diff --git a/include/QuotaVirtualMachine.h b/include/QuotaVirtualMachine.h index 75593db3d6..8b430e10ee 100644 --- a/include/QuotaVirtualMachine.h +++ b/include/QuotaVirtualMachine.h @@ -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 */ diff --git a/src/rm/RequestManagerAllocate.cc b/src/rm/RequestManagerAllocate.cc index 818ac476f8..009f4b5c81 100644 --- a/src/rm/RequestManagerAllocate.cc +++ b/src/rm/RequestManagerAllocate.cc @@ -274,12 +274,14 @@ int VirtualMachineAllocate::pool_allocate(xmlrpc_c::paramList const& paramList, VirtualMachineTemplate * ttmpl= static_cast(tmpl); VirtualMachinePool * vmpool = static_cast(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; diff --git a/src/um/QuotaVirtualMachine.cc b/src/um/QuotaVirtualMachine.cc index 8f125a19eb..deb07ea196 100644 --- a/src/um/QuotaVirtualMachine.cc +++ b/src/um/QuotaVirtualMachine.cc @@ -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; /* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */ diff --git a/src/um/User.cc b/src/um/User.cc index 3ca5abad5b..36d78f451e 100644 --- a/src/um/User.cc +++ b/src/um/User.cc @@ -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); diff --git a/src/vm/VirtualMachinePool.cc b/src/vm/VirtualMachinePool.cc index 7f7fa7d207..a36f153a24 100644 --- a/src/vm/VirtualMachinePool.cc +++ b/src/vm/VirtualMachinePool.cc @@ -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; }