mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-22 22:03:39 +03:00
Bug #1306: Use the System DS id to generate the VM system dir
This commit is contained in:
parent
fd28ff9d9f
commit
1327f28fab
@ -47,6 +47,7 @@ public:
|
||||
const string& vmm,
|
||||
const string& vnm,
|
||||
const string& tmm,
|
||||
int ds_id,
|
||||
const string& vm_info);
|
||||
|
||||
~History(){};
|
||||
@ -92,6 +93,8 @@ private:
|
||||
string vnm_mad_name;
|
||||
string tm_mad_name;
|
||||
|
||||
int ds_id;
|
||||
|
||||
time_t stime;
|
||||
time_t etime;
|
||||
|
||||
|
@ -57,7 +57,8 @@ protected:
|
||||
AuthRequest::Operation op);
|
||||
|
||||
int get_host_information(int hid, string& name, string& vmm, string& vnm,
|
||||
string& tm, RequestAttributes& att, PoolObjectAuth& host_perms);
|
||||
string& tm, int& ds_id, RequestAttributes& att,
|
||||
PoolObjectAuth& host_perms);
|
||||
|
||||
int add_history(VirtualMachine * vm,
|
||||
int hid,
|
||||
@ -65,6 +66,7 @@ protected:
|
||||
const string& vmm_mad,
|
||||
const string& vnm_mad,
|
||||
const string& tm_mad,
|
||||
int ds_id,
|
||||
RequestAttributes& att);
|
||||
|
||||
VirtualMachine * get_vm(int id, RequestAttributes& att);
|
||||
|
@ -243,7 +243,8 @@ public:
|
||||
const string& hostname,
|
||||
const string& vmm_mad,
|
||||
const string& vnm_mad,
|
||||
const string& tm_mad);
|
||||
const string& tm_mad,
|
||||
int ds_id);
|
||||
|
||||
/**
|
||||
* Duplicates the last history record. Only the host related fields are
|
||||
|
@ -100,6 +100,7 @@ int RequestManagerVirtualMachine::get_host_information(int hid,
|
||||
string& vmm,
|
||||
string& vnm,
|
||||
string& tm,
|
||||
int& ds_id,
|
||||
RequestAttributes& att,
|
||||
PoolObjectAuth& host_perms)
|
||||
{
|
||||
@ -111,7 +112,6 @@ int RequestManagerVirtualMachine::get_host_information(int hid,
|
||||
Datastore * ds;
|
||||
|
||||
int cluster_id;
|
||||
int ds_id;
|
||||
|
||||
host = hpool->get(hid,true);
|
||||
|
||||
@ -213,6 +213,7 @@ int RequestManagerVirtualMachine::add_history(VirtualMachine * vm,
|
||||
const string& vmm_mad,
|
||||
const string& vnm_mad,
|
||||
const string& tm_mad,
|
||||
int ds_id,
|
||||
RequestAttributes& att)
|
||||
{
|
||||
string vmdir;
|
||||
@ -220,7 +221,7 @@ int RequestManagerVirtualMachine::add_history(VirtualMachine * vm,
|
||||
|
||||
VirtualMachinePool * vmpool = static_cast<VirtualMachinePool *>(pool);
|
||||
|
||||
vm->add_history(hid,hostname,vmm_mad,vnm_mad,tm_mad);
|
||||
vm->add_history(hid,hostname,vmm_mad,vnm_mad,tm_mad,ds_id);
|
||||
|
||||
rc = vmpool->update_history(vm);
|
||||
|
||||
@ -366,13 +367,15 @@ void VirtualMachineDeploy::request_execute(xmlrpc_c::paramList const& paramList,
|
||||
string vmm_mad;
|
||||
string vnm_mad;
|
||||
string tm_mad;
|
||||
int ds_id;
|
||||
|
||||
int id = xmlrpc_c::value_int(paramList.getInt(1));
|
||||
int hid = xmlrpc_c::value_int(paramList.getInt(2));
|
||||
|
||||
bool auth = false;
|
||||
|
||||
if (get_host_information(hid,hostname,vmm_mad,vnm_mad,tm_mad,att, host_perms) != 0)
|
||||
if (get_host_information(
|
||||
hid,hostname,vmm_mad,vnm_mad,tm_mad, ds_id, att, host_perms) != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -399,7 +402,7 @@ void VirtualMachineDeploy::request_execute(xmlrpc_c::paramList const& paramList,
|
||||
return;
|
||||
}
|
||||
|
||||
if ( add_history(vm,hid,hostname,vmm_mad,vnm_mad,tm_mad,att) != 0)
|
||||
if ( add_history(vm,hid,hostname,vmm_mad,vnm_mad,tm_mad,ds_id,att) != 0)
|
||||
{
|
||||
vm->unlock();
|
||||
return;
|
||||
@ -428,6 +431,7 @@ void VirtualMachineMigrate::request_execute(xmlrpc_c::paramList const& paramList
|
||||
string vmm_mad;
|
||||
string vnm_mad;
|
||||
string tm_mad;
|
||||
int ds_id;
|
||||
|
||||
int id = xmlrpc_c::value_int(paramList.getInt(1));
|
||||
int hid = xmlrpc_c::value_int(paramList.getInt(2));
|
||||
@ -435,7 +439,8 @@ void VirtualMachineMigrate::request_execute(xmlrpc_c::paramList const& paramList
|
||||
|
||||
bool auth = false;
|
||||
|
||||
if (get_host_information(hid,hostname,vmm_mad,vnm_mad,tm_mad,att, host_perms) != 0)
|
||||
if (get_host_information(
|
||||
hid,hostname,vmm_mad,vnm_mad,tm_mad,ds_id, att, host_perms) != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -464,7 +469,7 @@ void VirtualMachineMigrate::request_execute(xmlrpc_c::paramList const& paramList
|
||||
return;
|
||||
}
|
||||
|
||||
if ( add_history(vm,hid,hostname,vmm_mad,vnm_mad,tm_mad,att) != 0)
|
||||
if ( add_history(vm,hid,hostname,vmm_mad,vnm_mad,tm_mad,ds_id,att) != 0)
|
||||
{
|
||||
vm->unlock();
|
||||
return;
|
||||
|
@ -45,6 +45,7 @@ History::History(
|
||||
vmm_mad_name(""),
|
||||
vnm_mad_name(""),
|
||||
tm_mad_name(""),
|
||||
ds_id(0),
|
||||
stime(0),
|
||||
etime(0),
|
||||
prolog_stime(0),
|
||||
@ -66,6 +67,7 @@ History::History(
|
||||
const string& _vmm,
|
||||
const string& _vnm,
|
||||
const string& _tmm,
|
||||
int _ds_id,
|
||||
const string& _vm_info):
|
||||
oid(_oid),
|
||||
seq(_seq),
|
||||
@ -74,6 +76,7 @@ History::History(
|
||||
vmm_mad_name(_vmm),
|
||||
vnm_mad_name(_vnm),
|
||||
tm_mad_name(_tmm),
|
||||
ds_id(_ds_id),
|
||||
stime(0),
|
||||
etime(0),
|
||||
prolog_stime(0),
|
||||
@ -126,7 +129,7 @@ void History::non_persistent_data()
|
||||
os.str("");
|
||||
|
||||
nd.get_configuration_attribute("DATASTORE_LOCATION", ds_location);
|
||||
os << ds_location << "/" << DatastorePool::SYSTEM_DS_ID << "/" << oid;
|
||||
os << ds_location << "/" << ds_id << "/" << oid;
|
||||
|
||||
vm_rhome = os.str();
|
||||
|
||||
@ -296,6 +299,7 @@ string& History::to_xml(string& xml, bool database) const
|
||||
"<VMMMAD>" << vmm_mad_name << "</VMMMAD>"<<
|
||||
"<VNMMAD>" << vnm_mad_name << "</VNMMAD>"<<
|
||||
"<TMMAD>" << tm_mad_name << "</TMMAD>" <<
|
||||
"<DS_ID>" << ds_id << "</DS_ID>" <<
|
||||
"<PSTIME>" << prolog_stime << "</PSTIME>"<<
|
||||
"<PETIME>" << prolog_etime << "</PETIME>"<<
|
||||
"<RSTIME>" << running_stime << "</RSTIME>"<<
|
||||
@ -334,7 +338,8 @@ int History::rebuild_attributes()
|
||||
xpath(vnm_mad_name , "/HISTORY/VNMMAD", "dummy");
|
||||
|
||||
// TODO: add TMMAD element in onedb migrator
|
||||
rc += xpath(tm_mad_name , "/HISTORY/TMMAD", "not_found");
|
||||
rc += xpath(tm_mad_name , "/HISTORY/TMMAD", "not_found");
|
||||
rc += xpath(ds_id , "/HISTORY/DS_ID", 0);
|
||||
|
||||
rc += xpath(prolog_stime , "/HISTORY/PSTIME", 0);
|
||||
rc += xpath(prolog_etime , "/HISTORY/PETIME", 0);
|
||||
|
@ -827,7 +827,8 @@ void VirtualMachine::add_history(
|
||||
const string& hostname,
|
||||
const string& vmm_mad,
|
||||
const string& vnm_mad,
|
||||
const string& tm_mad)
|
||||
const string& tm_mad,
|
||||
int ds_id)
|
||||
{
|
||||
ostringstream os;
|
||||
int seq;
|
||||
@ -853,6 +854,7 @@ void VirtualMachine::add_history(
|
||||
vmm_mad,
|
||||
vnm_mad,
|
||||
tm_mad,
|
||||
ds_id,
|
||||
vm_xml);
|
||||
|
||||
history_records.push_back(history);
|
||||
@ -880,6 +882,7 @@ void VirtualMachine::cp_history()
|
||||
history->vmm_mad_name,
|
||||
history->vnm_mad_name,
|
||||
history->tm_mad_name,
|
||||
history->ds_id,
|
||||
vm_xml);
|
||||
|
||||
previous_history = history;
|
||||
@ -910,6 +913,7 @@ void VirtualMachine::cp_previous_history()
|
||||
previous_history->vmm_mad_name,
|
||||
previous_history->vnm_mad_name,
|
||||
previous_history->tm_mad_name,
|
||||
previous_history->ds_id,
|
||||
vm_xml);
|
||||
|
||||
previous_history = history;
|
||||
@ -1984,7 +1988,7 @@ string VirtualMachine::get_remote_system_dir() const
|
||||
Nebula& nd = Nebula::instance();
|
||||
|
||||
nd.get_configuration_attribute("DATASTORE_LOCATION", ds_location);
|
||||
oss << ds_location << "/" << DatastorePool::SYSTEM_DS_ID << "/" << oid;
|
||||
oss << ds_location << "/" << history->ds_id << "/" << oid;
|
||||
|
||||
return oss.str();
|
||||
}
|
||||
@ -1997,7 +2001,7 @@ string VirtualMachine::get_system_dir() const
|
||||
ostringstream oss;
|
||||
Nebula& nd = Nebula::instance();
|
||||
|
||||
oss << nd.get_ds_location() << DatastorePool::SYSTEM_DS_ID << "/"<< oid;
|
||||
oss << nd.get_ds_location() << history->ds_id << "/"<< oid;
|
||||
|
||||
return oss.str();
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user