diff --git a/include/Nebula.h b/include/Nebula.h index 5b5aee1c73..b0d6e49f2a 100644 --- a/include/Nebula.h +++ b/include/Nebula.h @@ -243,6 +243,18 @@ public: return ds_location; }; + /** + * Returns the default vms location. When ONE_LOCATION is defined this path + * points to $ONE_LOCATION/var/vms, otherwise it is /var/lib/one/vms. This + * location stores vm related files: deployment, transfer, context, and + * logs (in self-contained mode only) + * @return the vms location. + */ + const string& get_vms_location() + { + return vms_location; + }; + /** * Returns the path of the log file for a VM, depending where OpenNebula is * installed, @@ -261,7 +273,7 @@ public: } else { - oss << nebula_location << "var/" << oid << "/vm.log"; + oss << vms_location << oid << "/vm.log"; } return oss.str(); @@ -315,6 +327,7 @@ private: var_location = "/var/lib/one/"; remotes_location = "/var/lib/one/remotes/"; ds_location = "/var/lib/one/datastores/"; + vms_location = "/var/lib/one/vms/"; } else { @@ -331,6 +344,7 @@ private: var_location = nebula_location + "var/"; remotes_location = nebula_location + "var/remotes/"; ds_location = nebula_location + "var/datastores/"; + vms_location = nebula_location + "var/vms/"; } }; @@ -380,7 +394,7 @@ private: { delete clpool; } - + if ( docpool != 0) { delete docpool; @@ -464,6 +478,7 @@ private: string hook_location; string remotes_location; string ds_location; + string vms_location; string hostname; diff --git a/include/VirtualMachine.h b/include/VirtualMachine.h index 8753242563..b9a528ce8b 100644 --- a/include/VirtualMachine.h +++ b/include/VirtualMachine.h @@ -381,9 +381,9 @@ public: /** * Returns the transfer filename. The transfer file is in the form: - * $ONE_LOCATION/var/$VM_ID/transfer.$SEQ + * $ONE_LOCATION/var/vms/$VM_ID/transfer.$SEQ * or, in case that OpenNebula is installed in root - * /var/lib/one/$VM_ID/transfer.$SEQ + * /var/lib/one/vms/$VM_ID/transfer.$SEQ * The hasHistory() function MUST be called before this one. * @return the transfer filename */ @@ -394,9 +394,9 @@ public: /** * Returns the deployment filename. The deployment file is in the form: - * $ONE_LOCATION/var/$VM_ID/deployment.$SEQ + * $ONE_LOCATION/var/vms/$VM_ID/deployment.$SEQ * or, in case that OpenNebula is installed in root - * /var/lib/one/$VM_ID/deployment.$SEQ + * /var/lib/one/vms/$VM_ID/deployment.$SEQ * The hasHistory() function MUST be called before this one. * @return the deployment filename */ @@ -407,9 +407,9 @@ public: /** * Returns the context filename. The context file is in the form: - * $ONE_LOCATION/var/$VM_ID/context.sh + * $ONE_LOCATION/var/vms/$VM_ID/context.sh * or, in case that OpenNebula is installed in root - * /var/lib/one/$VM_ID/context.sh + * /var/lib/one/vms/$VM_ID/context.sh * The hasHistory() function MUST be called before this one. * @return the deployment filename */ @@ -420,7 +420,7 @@ public: /** * Returns the remote deployment filename. The file is in the form: - * $VM_DIR/$VM_ID/images/deployment.$SEQ + * $DS_LOCATION/$SYSTEM_DS/$VM_ID/deployment.$SEQ * The hasHistory() function MUST be called before this one. * @return the deployment filename */ @@ -432,7 +432,7 @@ public: /** * Returns the checkpoint filename for the current host. The checkpoint file * is in the form: - * $VM_DIR/$VM_ID/images/checkpoint + * $DS_LOCATION/$SYSTEM_DS/$VM_ID/checkpoint * The hasHistory() function MUST be called before this one. * @return the checkpoint filename */ diff --git a/src/vm/History.cc b/src/vm/History.cc index 9d4234e89d..de8ee9ea52 100644 --- a/src/vm/History.cc +++ b/src/vm/History.cc @@ -107,7 +107,7 @@ void History::non_persistent_data() // ----------- Local Locations ------------ os.str(""); - os << nd.get_var_location() << oid; + os << nd.get_vms_location() << oid; vm_lhome = os.str(); diff --git a/src/vm/VirtualMachine.cc b/src/vm/VirtualMachine.cc index ceda4a7b2e..07f2cc7296 100644 --- a/src/vm/VirtualMachine.cc +++ b/src/vm/VirtualMachine.cc @@ -171,7 +171,7 @@ int VirtualMachine::select(SqlDB * db) //Create support directories for this VM //-------------------------------------------------------------------------- oss.str(""); - oss << nd.get_var_location() << oid; + oss << nd.get_vms_location() << oid; mkdir(oss.str().c_str(), 0700); chmod(oss.str().c_str(), 0700);