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

feature #1112: Makes system datastore access safer

This commit is contained in:
Ruben S. Montero 2012-02-26 21:52:10 +01:00
parent 5363c4ff05
commit 37e25141de
2 changed files with 22 additions and 4 deletions

View File

@ -217,10 +217,16 @@ public:
string get_system_ds_path()
{
Datastore * ds;
string system_ds_path;
string system_ds_path = "";
ds = dspool->get(DatastorePool::SYSTEM_DS_ID, true);
if ( ds == 0 )
{
NebulaLog::log("DaS", Log::ERROR, "Can not get system datastore");
return system_ds_path;
}
system_ds_path = ds->get_base_path();
ds->unlock();
@ -235,10 +241,16 @@ public:
string get_system_ds_tm_mad()
{
Datastore * ds;
string tm_mad;
string tm_mad = "";
ds = dspool->get(DatastorePool::SYSTEM_DS_ID, true);
if ( ds == 0 )
{
NebulaLog::log("DaS", Log::ERROR, "Can not get system datastore");
return tm_mad;
}
tm_mad = ds->get_tm_mad();
ds->unlock();
@ -253,16 +265,23 @@ public:
string get_system_ds_name()
{
Datastore * ds;
string name;
string name = "";
ds = dspool->get(DatastorePool::SYSTEM_DS_ID, true);
if ( ds == 0 )
{
NebulaLog::log("DaS", Log::ERROR, "Can not get system datastore");
return name;
}
name = ds->get_name();
ds->unlock();
return name;
};
/**
* Returns the path of the log file for a VM, depending where OpenNebula is
* installed,

View File

@ -91,7 +91,6 @@ void History::non_persistent_data()
{
ostringstream os;
string vm_lhome;
string vm_rhome;
Nebula& nd = Nebula::instance();
// ----------- Local Locations ------------