diff --git a/include/History.h b/include/History.h
index ea7fe12345..f689196740 100644
--- a/include/History.h
+++ b/include/History.h
@@ -277,7 +277,6 @@ public:
int cid,
const string& vmm,
const string& tmm,
- const string& ds_location,
int ds_id,
const string& vm_info);
@@ -324,7 +323,6 @@ private:
string vmm_mad_name;
string tm_mad_name;
- string ds_location;
int ds_id;
time_t stime;
@@ -357,7 +355,7 @@ private:
// Remote paths
string checkpoint_file;
string rdeployment_file;
- string rsystem_dir;
+ string system_dir;
/**
* Writes the history record in the DB
diff --git a/include/VirtualMachine.h b/include/VirtualMachine.h
index 94865a9953..988e128584 100644
--- a/include/VirtualMachine.h
+++ b/include/VirtualMachine.h
@@ -499,32 +499,26 @@ public:
// ------------------------------------------------------------------------
/**
* Returns the remote VM directory. The VM remote dir is in the form:
- * $DATASTORE_LOCATION/$SYSTEM_DS_ID/$VM_ID. The remote system_dir stores
+ * $DATASTORE_LOCATION/$SYSTEM_DS_ID/$VM_ID. The system_dir stores
* disks for a running VM in the target host.
* @return the remote system directory for the VM
*/
- const string& get_remote_system_dir() const
+ const string& get_system_dir() const
{
- return history->rsystem_dir;
+ return history->system_dir;
}
/**
- * Returns the remote VM directory for the previous host.
+ * Returns the remote VM directory for the previous host. It maybe different
+ * if a system ds migration
* The hasPreviousHistory() function MUST be called before this one.
* @return the remote system directory for the VM
*/
- const string & get_previous_remote_system_dir() const
+ const string & get_previous_system_dir() const
{
- return previous_history->rsystem_dir;
+ return previous_history->system_dir;
};
- /**
- * Returns the local VM directory. The VM local dir is in the form:
- * $SYSTEM_DS_BASE_PATH/$VM_ID. Temporary stores VM disks.
- * @return the system directory for the VM
- */
- string get_system_dir() const;
-
// ------------------------------------------------------------------------
// History
// ------------------------------------------------------------------------
diff --git a/share/doc/xsd/acct.xsd b/share/doc/xsd/acct.xsd
index a9cec4afda..6266d561d9 100644
--- a/share/doc/xsd/acct.xsd
+++ b/share/doc/xsd/acct.xsd
@@ -20,9 +20,8 @@
-
-
-
+
+
diff --git a/share/doc/xsd/vm.xsd b/share/doc/xsd/vm.xsd
index 38b21397d8..d451fc393b 100644
--- a/share/doc/xsd/vm.xsd
+++ b/share/doc/xsd/vm.xsd
@@ -150,9 +150,8 @@
-
-
-
+
+
diff --git a/src/sunstone/public/app/opennebula/vm.js b/src/sunstone/public/app/opennebula/vm.js
index 6083b2cead..99cdb78703 100644
--- a/src/sunstone/public/app/opennebula/vm.js
+++ b/src/sunstone/public/app/opennebula/vm.js
@@ -602,7 +602,7 @@ define(function(require) {
function isNICGraphsSupported(element) {
var history = retrieveLastHistoryRecord(element)
if (history) {
- return $.inArray(history.VMMMAD, ['vcenter', 'az', 'sl']) == -1;
+ return $.inArray(history.VM_MAD, ['vcenter', 'az', 'sl']) == -1;
} else {
return false;
}
@@ -611,7 +611,7 @@ define(function(require) {
function isNICAttachSupported(element) {
var history = retrieveLastHistoryRecord(element)
if (history) {
- return $.inArray(history.VMMMAD, ['ec2', 'az', 'sl']) == -1;
+ return $.inArray(history.VM_MAD, ['ec2', 'az', 'sl']) == -1;
} else {
return false;
}
diff --git a/src/tm/TransferManager.cc b/src/tm/TransferManager.cc
index 344458bed5..7461a51bb7 100644
--- a/src/tm/TransferManager.cc
+++ b/src/tm/TransferManager.cc
@@ -457,7 +457,7 @@ int TransferManager::prolog_transfer_command(
<< vm_tm_mad << " "
<< size << " "
<< vm->get_hostname() << ":"
- << vm->get_remote_system_dir() << "/disk." << disk_id << " "
+ << vm->get_system_dir() << "/disk." << disk_id << " "
<< vm->get_oid() << " "
<< vm->get_ds_id()
<< endl;
@@ -488,7 +488,7 @@ int TransferManager::prolog_transfer_command(
<< size << " "
<< format << " "
<< vm->get_hostname() << ":"
- << vm->get_remote_system_dir() << "/disk." << disk_id << " "
+ << vm->get_system_dir() << "/disk." << disk_id << " "
<< vm->get_oid() << " "
<< vm->get_ds_id()
<< endl;
@@ -539,7 +539,7 @@ int TransferManager::prolog_transfer_command(
}
xfr << vm->get_hostname() << ":"
- << vm->get_remote_system_dir() << "/disk." << disk_id << " "
+ << vm->get_system_dir() << "/disk." << disk_id << " "
<< vm->get_oid() << " "
<< ds_id
<< endl;
@@ -591,7 +591,7 @@ static string prolog_os_transfer_commands(
transform(name.begin(), name.end(), name.begin(), (int(*)(int))tolower);
- base_dst << vm->get_remote_system_dir() << "/" << name;
+ base_dst << vm->get_system_dir() << "/" << name;
xfr << "CLONE " << tm_mad << " "
<< opennebula_hostname << ":" << source << " "
@@ -634,7 +634,7 @@ int TransferManager::prolog_context_command(
}
xfr << vm->get_hostname() << ":"
- << vm->get_remote_system_dir() << "/disk." << disk_id << " "
+ << vm->get_system_dir() << "/disk." << disk_id << " "
<< vm->get_oid() << " "
<< vm->get_ds_id()
<< endl;
@@ -901,9 +901,9 @@ void TransferManager::prolog_migr_action(int vid)
xfr << "MV "
<< tm_mad << " "
<< vm->get_previous_hostname() << ":"
- << vm->get_previous_remote_system_dir() << "/disk." << disk_id << " "
+ << vm->get_previous_system_dir() << "/disk." << disk_id << " "
<< vm->get_hostname() << ":"
- << vm->get_remote_system_dir() << "/disk." << disk_id << " "
+ << vm->get_system_dir() << "/disk." << disk_id << " "
<< vm->get_oid() << " "
<< ds_id << endl;
}
@@ -912,9 +912,9 @@ void TransferManager::prolog_migr_action(int vid)
xfr << "MV "
<< vm_tm_mad << " "
<< vm->get_previous_hostname() << ":"
- << vm->get_previous_remote_system_dir() << " "
+ << vm->get_previous_system_dir() << " "
<< vm->get_hostname() << ":"
- << vm->get_remote_system_dir() << " "
+ << vm->get_system_dir() << " "
<< vm->get_oid() << " "
<< vm->get_ds_id() << endl;
@@ -1052,7 +1052,7 @@ void TransferManager::prolog_resume_action(int vid)
<< nd.get_nebula_hostname() << ":"
<< vm->get_system_dir() << "/disk." << disk_id << " "
<< vm->get_hostname() << ":"
- << vm->get_remote_system_dir() << "/disk." << disk_id << " "
+ << vm->get_system_dir() << "/disk." << disk_id << " "
<< vm->get_oid() << " "
<< ds_id << endl;
}
@@ -1061,7 +1061,7 @@ void TransferManager::prolog_resume_action(int vid)
xfr << "MV "
<< vm_tm_mad << " "
<< nd.get_nebula_hostname() << ":"<< vm->get_system_dir() << " "
- << vm->get_hostname() << ":" << vm->get_remote_system_dir()<< " "
+ << vm->get_hostname() << ":" << vm->get_system_dir()<< " "
<< vm->get_oid() << " "
<< vm->get_ds_id() << endl;
@@ -1250,7 +1250,7 @@ void TransferManager::epilog_transfer_command(
xfr << "MVDS "
<< tm_mad << " "
<< vm->get_hostname() << ":"
- << vm->get_remote_system_dir() << "/disk." << disk_id << " "
+ << vm->get_system_dir() << "/disk." << disk_id << " "
<< source << " "
<< vm->get_oid() << " "
<< ds_id
@@ -1280,7 +1280,7 @@ void TransferManager::epilog_transfer_command(
xfr << "DELETE "
<< tm_mad << " "
<< vm->get_hostname() << ":"
- << vm->get_remote_system_dir() << "/disk." << disk_id << " "
+ << vm->get_system_dir() << "/disk." << disk_id << " "
<< vm->get_oid() << " "
<< ds_id_i
<< endl;
@@ -1351,7 +1351,7 @@ void TransferManager::epilog_action(int vid)
//DELETE vm_tm_mad hostname:remote_system_dir vmid ds_id
xfr << "DELETE "
<< vm_tm_mad << " "
- << vm->get_hostname() << ":" << vm->get_remote_system_dir() << " "
+ << vm->get_hostname() << ":" << vm->get_system_dir() << " "
<< vm->get_oid() << " "
<< vm->get_ds_id() << endl;
@@ -1468,7 +1468,7 @@ void TransferManager::epilog_stop_action(int vid)
xfr << "MV "
<< tm_mad << " "
<< vm->get_hostname() << ":"
- << vm->get_remote_system_dir() << "/disk." << disk_id << " "
+ << vm->get_system_dir() << "/disk." << disk_id << " "
<< nd.get_nebula_hostname() << ":"
<< vm->get_system_dir() << "/disk." << disk_id << " "
<< vm->get_oid() << " "
@@ -1478,7 +1478,7 @@ void TransferManager::epilog_stop_action(int vid)
//MV vm_tm_mad hostname:remote_system_dir fe:system_dir vmid dsid(system)
xfr << "MV "
<< vm_tm_mad << " "
- << vm->get_hostname() << ":" << vm->get_remote_system_dir() << " "
+ << vm->get_hostname() << ":" << vm->get_system_dir() << " "
<< nd.get_nebula_hostname() << ":" << vm->get_system_dir() << " "
<< vm->get_oid() << " "
<< vm->get_ds_id() << endl;
@@ -1563,7 +1563,7 @@ int TransferManager::epilog_delete_commands(VirtualMachine *vm,
}
host = vm->get_previous_hostname();
- system_dir = vm->get_previous_remote_system_dir();
+ system_dir = vm->get_previous_system_dir();
vm_tm_mad = vm->get_previous_tm_mad();
vm_ds_id = vm->get_previous_ds_id();
@@ -1571,7 +1571,7 @@ int TransferManager::epilog_delete_commands(VirtualMachine *vm,
else
{
host = vm->get_hostname();
- system_dir = vm->get_remote_system_dir();
+ system_dir = vm->get_system_dir();
vm_tm_mad = vm->get_tm_mad();
vm_ds_id = vm->get_ds_id();
@@ -2068,7 +2068,7 @@ void TransferManager::saveas_hot_action(int vid)
xfr << "CPDS "
<< tm_mad << " "
<< vm->get_hostname() << ":"
- << vm->get_remote_system_dir() << "/disk." << disk_id << " "
+ << vm->get_system_dir() << "/disk." << disk_id << " "
<< src << " "
<< snap_id << " "
<< vm->get_oid() << " "
@@ -2122,7 +2122,7 @@ void TransferManager::migrate_transfer_command(
<< vm->get_tm_mad() << " "
<< vm->get_previous_hostname() << " "
<< vm->get_hostname() << " "
- << vm->get_remote_system_dir() << " "
+ << vm->get_system_dir() << " "
<< vm->get_oid() << " "
<< vm->get_ds_id()
<< endl;
@@ -2150,7 +2150,7 @@ int TransferManager::snapshot_transfer_command(
xfr << snap_action << " "
<< tm_mad << " "
<< vm->get_hostname() << ":"
- << vm->get_remote_system_dir() << "/disk." << disk_id << " "
+ << vm->get_system_dir() << "/disk." << disk_id << " "
<< snap_id << " "
<< vm->get_oid() << " "
<< ds_id
diff --git a/src/vm/History.cc b/src/vm/History.cc
index 6bfa6d3240..b93035503c 100644
--- a/src/vm/History.cc
+++ b/src/vm/History.cc
@@ -45,7 +45,6 @@ History::History(
cid(-1),
vmm_mad_name(""),
tm_mad_name(""),
- ds_location(""),
ds_id(0),
stime(0),
etime(0),
@@ -69,7 +68,6 @@ History::History(
int _cid,
const string& _vmm,
const string& _tmm,
- const string& _ds_location,
int _ds_id,
const string& _vm_info):
oid(_oid),
@@ -79,7 +77,6 @@ History::History(
cid(_cid),
vmm_mad_name(_vmm),
tm_mad_name(_tmm),
- ds_location(_ds_location),
ds_id(_ds_id),
stime(0),
etime(0),
@@ -104,9 +101,12 @@ void History::non_persistent_data()
ostringstream os;
string vm_lhome;
+ string ds_location;
Nebula& nd = Nebula::instance();
+ nd.get_ds_location(ds_location);
+
// ----------- Local Locations ------------
os.str("");
os << nd.get_vms_location() << oid;
@@ -133,18 +133,16 @@ void History::non_persistent_data()
token_file = os.str();
// ----------- Remote Locations ------------
-
os.str("");
-
os << ds_location << "/" << ds_id << "/" << oid;
- rsystem_dir = os.str();
+ system_dir = os.str();
os << "/checkpoint";
checkpoint_file = os.str();
os.str("");
- os << rsystem_dir << "/deployment." << seq;
+ os << system_dir << "/deployment." << seq;
rdeployment_file = os.str();
}
@@ -304,9 +302,8 @@ string& History::to_xml(string& xml, bool database) const
"" << cid << "" <<
"" << stime << "" <<
"" << etime << "" <<
- "" << one_util::escape_xml(vmm_mad_name)<<""<<
- "" << one_util::escape_xml(tm_mad_name) <<"" <<
- ""<< one_util::escape_xml(ds_location) <<""<<
+ "" << one_util::escape_xml(vmm_mad_name)<<""<<
+ "" << one_util::escape_xml(tm_mad_name) <<"" <<
"" << ds_id << "" <<
"" << prolog_stime << ""<<
"" << prolog_etime << ""<<
@@ -344,9 +341,8 @@ int History::rebuild_attributes()
rc += xpath(cid , "/HISTORY/CID", -1);
rc += xpath(stime , "/HISTORY/STIME", 0);
rc += xpath(etime , "/HISTORY/ETIME", 0);
- rc += xpath(vmm_mad_name , "/HISTORY/VMMMAD", "not_found");
- rc += xpath(tm_mad_name , "/HISTORY/TMMAD", "not_found");
- rc += xpath(ds_location , "/HISTORY/DS_LOCATION", "not_found");
+ rc += xpath(vmm_mad_name , "/HISTORY/VM_MAD", "not_found");
+ rc += xpath(tm_mad_name , "/HISTORY/TM_MAD", "not_found");
rc += xpath(ds_id , "/HISTORY/DS_ID", 0);
rc += xpath(prolog_stime , "/HISTORY/PSTIME", 0);
rc += xpath(prolog_etime , "/HISTORY/PETIME", 0);
diff --git a/src/vm/VirtualMachine.cc b/src/vm/VirtualMachine.cc
index 7cf2ca9864..01efd708ee 100644
--- a/src/vm/VirtualMachine.cc
+++ b/src/vm/VirtualMachine.cc
@@ -1679,8 +1679,8 @@ void VirtualMachine::add_history(
to_xml_extended(vm_xml, 0);
- history = new History(oid, seq, hid, hostname, cid, vmm_mad, tm_mad,
- ds_location, ds_id, vm_xml);
+ history = new History(oid, seq, hid, hostname, cid, vmm_mad, tm_mad, ds_id,
+ vm_xml);
history_records.push_back(history);
};
@@ -1707,7 +1707,6 @@ void VirtualMachine::cp_history()
history->cid,
history->vmm_mad_name,
history->tm_mad_name,
- history->ds_location,
history->ds_id,
vm_xml);
@@ -1739,7 +1738,6 @@ void VirtualMachine::cp_previous_history()
previous_history->cid,
previous_history->vmm_mad_name,
previous_history->tm_mad_name,
- previous_history->ds_location,
previous_history->ds_id,
vm_xml);
@@ -3908,18 +3906,6 @@ int VirtualMachine::from_xml(const string &xml_str)
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */
-string VirtualMachine::get_system_dir() const
-{
- ostringstream oss;
-
- oss << history->ds_location << "/" << history->ds_id << "/"<< oid;
-
- return oss.str();
-};
-
-/* -------------------------------------------------------------------------- */
-/* -------------------------------------------------------------------------- */
-
int VirtualMachine::update_info(const string& monitor_data)
{
int rc;
diff --git a/src/vmm/LibVirtDriverKVM.cc b/src/vmm/LibVirtDriverKVM.cc
index 32a74bbc39..84edb15c2b 100644
--- a/src/vmm/LibVirtDriverKVM.cc
+++ b/src/vmm/LibVirtDriverKVM.cc
@@ -514,7 +514,7 @@ int LibVirtDriver::deployment_description_kvm(
{
ostringstream dev;
- dev << vm->get_remote_system_dir() << "/disk." << disk_id;
+ dev << vm->get_system_dir() << "/disk." << disk_id;
file << "\t\t\n"
<< "\t\t\t