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

System attributes, Group and User quotas are local tables needs to be bootstraped locally

This commit is contained in:
Ruben S. Montero 2014-03-08 02:44:53 +01:00
parent f949691cef
commit dbe21675fa
4 changed files with 50 additions and 32 deletions

View File

@ -177,15 +177,9 @@ private:
*/
static int bootstrap(SqlDB * db)
{
int rc;
ostringstream oss_group(Group::db_bootstrap);
ostringstream oss_quota(GroupQuotas::db_bootstrap);
rc = db->exec(oss_group);
rc += db->exec(oss_quota);
return rc;
return db->exec(oss_group);
};
/**

View File

@ -159,14 +159,16 @@ public:
virtual ~GroupQuotas(){};
// *************************************************************************
// DataBase implementation
// *************************************************************************
/**
* Bootstraps the database table for group quotas
* @return 0 on success
*/
static int bootstrap(SqlDB * db)
{
ostringstream oss_quota(GroupQuotas::db_bootstrap);
static const char * db_names;
static const char * db_bootstrap;
static const char * db_table;
static const char * db_oid_column;
return db->exec(oss_quota);
};
protected:
@ -184,6 +186,18 @@ protected:
{
return db_oid_column;
};
private:
friend class GroupPool;
// *************************************************************************
// DataBase implementation
// *************************************************************************
static const char * db_names;
static const char * db_bootstrap;
static const char * db_table;
static const char * db_oid_column;
};
/* -------------------------------------------------------------------------- */
@ -198,14 +212,16 @@ public:
"/QUOTAS/IMAGE_QUOTA",
"/QUOTAS/VM_QUOTA"){};
// *************************************************************************
// DataBase implementation
// *************************************************************************
/**
* Bootstraps the database table for user quotas
* @return 0 on success
*/
static int bootstrap(SqlDB * db)
{
ostringstream oss_quota(UserQuotas::db_bootstrap);
static const char * db_names;
static const char * db_bootstrap;
static const char * db_table;
static const char * db_oid_column;
return db->exec(oss_quota);
};
protected:
@ -223,6 +239,18 @@ protected:
{
return db_oid_column;
};
private:
friend class UserPool;
// *************************************************************************
// DataBase implementation
// *************************************************************************
static const char * db_names;
static const char * db_bootstrap;
static const char * db_table;
static const char * db_oid_column;
};
#endif /*QUOTAS_SQL_H_*/

View File

@ -317,15 +317,9 @@ private:
*/
static int bootstrap(SqlDB * db)
{
int rc;
ostringstream oss_user(User::db_bootstrap);
ostringstream oss_quota(UserQuotas::db_bootstrap);
rc = db->exec(oss_user);
rc += db->exec(oss_quota);
return rc;
return db->exec(oss_user);
};
/**

View File

@ -330,12 +330,18 @@ void Nebula::start(bool bootstrap_only)
rc += DatastorePool::bootstrap(db);
rc += ClusterPool::bootstrap(db);
rc += DocumentPool::bootstrap(db);
rc += UserQuotas::bootstrap(db);
rc += GroupQuotas::bootstrap(db);
// Create the system tables only if bootstrap went well
if (rc == 0)
{
rc += system_db->local_bootstrap();
}
// Insert default system attributes
rc += default_user_quota.insert();
rc += default_group_quota.insert();
}
if (shared_bootstrap)
@ -353,10 +359,6 @@ void Nebula::start(bool bootstrap_only)
{
rc += system_db->shared_bootstrap();
}
// Insert default system attributes
rc += default_user_quota.insert();
rc += default_group_quota.insert();
}
if ( rc != 0 )