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

feature #204: Drop method now in the base class PoolSQL

This commit is contained in:
Carlos Martin and Ruben S. Montero 2010-04-05 23:34:09 +02:00 committed by Ruben S. Montero
parent 7d16e4b0c8
commit 36d27746ba
4 changed files with 25 additions and 30 deletions

View File

@ -72,16 +72,7 @@ public:
*/
int update(Host * host)
{
return host->update(db);
};
/** Drops a host from the DB, the host mutex MUST BE locked
* @param host pointer to Host
*/
int drop(Host * host)
{
return host->drop(db);
return host->update(db);
};
/**

View File

@ -106,6 +106,18 @@ public:
return rc;
};
/**
* Drops the object's data in the data base. The object mutex SHOULD be
* locked.
* @param objsql a pointer to the object
* @return 0 on success.
*/
virtual int drop(
PoolObjectSQL * objsql)
{
return objsql->drop(db);
};
/**
* Removes all the elements from the pool
*/

View File

@ -106,7 +106,7 @@ public:
*/
int drop(User * user)
{
int rc = user->drop(db);
int rc = PoolSQL::drop(user);
if ( rc == 0)
{

View File

@ -32,7 +32,7 @@ class VirtualNetworkPool : public PoolSQL
{
public:
VirtualNetworkPool(SqliteDB * db,
VirtualNetworkPool(SqliteDB * db,
const string& str_mac_prefix,
int default_size);
@ -43,7 +43,7 @@ public:
* @param uid user identifier
* @param stemplate a string describing the VN
* @param oid the id assigned to the VM (output)
* @return 0 on success, -1 error inserting in DB,-2 error parsing
* @return 0 on success, -1 error inserting in DB,-2 error parsing
* the template, -3 wrong attributes in template
*/
int allocate (
@ -64,7 +64,7 @@ public:
{
return static_cast<VirtualNetwork *>(PoolSQL::get(oid,lock));
};
/**
* Function to get a VN from the pool using the network name
* If the object is not in memory it is loaded from the DB
@ -79,9 +79,9 @@ public:
//--------------------------------------------------------------------------
// Virtual Network DB access functions
//--------------------------------------------------------------------------
/**
* Updates the template of a VN, adding a new attribute (replacing it if
* Updates the template of a VN, adding a new attribute (replacing it if
* already defined), the VN's mutex SHOULD be locked
* @param vn pointer to the virtual network object
* @param name of the new attribute
@ -103,15 +103,7 @@ public:
{
VirtualNetwork::bootstrap(_db);
};
/** Drops a VN from the cache & DB, the VN mutex MUST BE locked
* @param vn pointer to VN
*/
int drop(VirtualNetwork * vn)
{
return vn->drop(db);
};
/**
* Dumps the HOST pool in XML format. A filter can be also added to the
* query
@ -138,12 +130,12 @@ private:
* Holds the system-wide MAC prefix
*/
unsigned int mac_prefix;
/**
* Default size for Virtual Networks
*/
unsigned int default_size;
unsigned int default_size;
/**
* Factory method to produce VN objects
* @return a pointer to the new VN
@ -152,7 +144,7 @@ private:
{
return new VirtualNetwork(mac_prefix, default_size);
};
};
#endif /*VIRTUAL_NETWORK_POOL_H_*/