diff --git a/share/doc/xsd/oned.conf b/share/doc/xsd/oned.conf index 4d056f2e0e..a2a131c552 100644 --- a/share/doc/xsd/oned.conf +++ b/share/doc/xsd/oned.conf @@ -160,17 +160,12 @@ MAC_PREFIX = "02:00" #******************************************************************************* # DataStore Configuration #******************************************************************************* -# DATASTORE_LOCATION: *Default* Path for Datastores in the hosts. It IS the -# same for all the hosts in the cluster. DATASTORE_LOCATION IS ONLY FOR THE -# HOSTS AND *NOT* THE FRONT-END. It defaults to /var/lib/one/datastores (or -# $ONE_LOCATION/var/datastores in self-contained mode) -# -# You can define a different DATASTORE_LOCATION in each cluster by updating -# its properties with onecluster update. -# -# DATASTORE_BASE_PATH: This is the base path for the SOURCE attribute of -# the images registered in a Datastore. This is a default value, that can be -# changed when the datastore is created. +# DATASTORE_LOCATION: Path for Datastores. It IS the same for all the hosts +# and front-end. It defaults to /var/lib/one/datastores (in self-contained mode +# defaults to $ONE_LOCATION/var/datastores). Each datastore has it's own +# directory (called BASE_PATH) in the form: $DATASTORE_LOCATION/ +# You can symlink this direcorty to any other path if needed. BASE_PATH is +# generated from this attribute each time oned is started. # # DATASTORE_CAPACITY_CHECK: Checks that there is enough capacity before # creating a new imag. Defaults to Yes @@ -191,8 +186,6 @@ MAC_PREFIX = "02:00" #DATASTORE_LOCATION = /var/lib/one/datastores -#DATASTORE_BASE_PATH = /var/lib/one/datastores - DATASTORE_CAPACITY_CHECK = "no" DEFAULT_IMAGE_TYPE = "OS" diff --git a/share/etc/oned.conf b/share/etc/oned.conf index 97810a3e10..193ff1ad28 100644 --- a/share/etc/oned.conf +++ b/share/etc/oned.conf @@ -217,23 +217,20 @@ VXLAN_IDS = [ #******************************************************************************* # DataStore Configuration #******************************************************************************* -# DATASTORE_LOCATION: *Default* Path for Datastores in the hosts. It IS the -# same for all the hosts in the cluster. DATASTORE_LOCATION IS ONLY FOR THE -# HOSTS AND *NOT* THE FRONT-END. It defaults to /var/lib/one/datastores (or -# $ONE_LOCATION/var/datastores in self-contained mode) -# -# DATASTORE_BASE_PATH: This is the base path for the SOURCE attribute of -# the images registered in a Datastore. This is a default value, that can be -# changed when the datastore is created. +# DATASTORE_LOCATION: Path for Datastores. It IS the same for all the hosts +# and front-end. It defaults to /var/lib/one/datastores (in self-contained mode +# defaults to $ONE_LOCATION/var/datastores). Each datastore has it's own +# directory (called BASE_PATH) in the form: $DATASTORE_LOCATION/ +# You can symlink this direcorty to any other path if needed. BASE_PATH is +# generated from this attribute each time oned is started. # # DATASTORE_CAPACITY_CHECK: Checks that there is enough capacity before -# creating a new imag. Defaults to Yes +# creating a new image. Defaults to Yes # # DEFAULT_IMAGE_TYPE: This can take values # OS Image file holding an operating system # CDROM Image file holding a CDROM -# DATABLOCK Image file holding a datablock, -# always created as an empty block +# DATABLOCK Image file holding a datablock, created as an empty block # # DEFAULT_DEVICE_PREFIX: This can be set to # hd IDE prefix @@ -245,8 +242,6 @@ VXLAN_IDS = [ #DATASTORE_LOCATION = /var/lib/one/datastores -#DATASTORE_BASE_PATH = /var/lib/one/datastores - DATASTORE_CAPACITY_CHECK = "yes" DEFAULT_IMAGE_TYPE = "OS" diff --git a/src/datastore/Datastore.cc b/src/datastore/Datastore.cc index 7f38554a56..c55d632601 100644 --- a/src/datastore/Datastore.cc +++ b/src/datastore/Datastore.cc @@ -444,11 +444,12 @@ int Datastore::set_ds_disk_type(string& s_dt, string& error) int Datastore::insert(SqlDB *db, string& error_str) { - int rc; + int rc; + string s_disk_type; + string s_ds_type; + string datastore_location; + ostringstream oss; - string s_disk_type; - string s_ds_type; - string datastore_location; // ------------------------------------------------------------------------- // Check default datastore attributes @@ -492,21 +493,15 @@ int Datastore::insert(SqlDB *db, string& error_str) goto error_common; } - erase_template_attribute("BASE_PATH", base_path); + remove_template_attribute("BASE_PATH"); - if (base_path.empty() == true ) - { - Nebula& nd = Nebula::instance(); - nd.get_configuration_attribute("DATASTORE_BASE_PATH", base_path); - } + Nebula::instance().get_ds_location(base_path); if ( base_path.at(base_path.size()-1) != '/' ) { base_path += "/"; } - add_template_attribute("BASE_PATH", base_path); - oss << base_path << oid; base_path = oss.str(); @@ -526,10 +521,7 @@ int Datastore::insert(SqlDB *db, string& error_str) //-------------------------------------------------------------------------- // Insert the Datastore //-------------------------------------------------------------------------- - - rc = insert_replace(db, false, error_str); - - return rc; + return insert_replace(db, false, error_str); error_exclusive: error_str = "SYSTEM datastores cannot have DS_MAD defined."; @@ -651,9 +643,9 @@ string& Datastore::to_xml(string& xml) const "" << gname << "" << "" << name << "" << perms_to_xml(perms_xml) << - "" << one_util::escape_xml(ds_mad) << "" << - "" << one_util::escape_xml(tm_mad) << "" << - "" << one_util::escape_xml(base_path)<< ""<< + "" << one_util::escape_xml(ds_mad) << "" << + "" << one_util::escape_xml(tm_mad) << "" << + "" << one_util::escape_xml(base_path) << "" << "" << type << "" << "" << disk_type << "" << "" << state << "" << @@ -681,6 +673,8 @@ int Datastore::from_xml(const string& xml) int int_state; vector content; + ostringstream oss; + // Initialize the internal XML object update_from_str(xml); @@ -693,7 +687,6 @@ int Datastore::from_xml(const string& xml) rc += xpath(name, "/DATASTORE/NAME", "not_found"); rc += xpath(ds_mad, "/DATASTORE/DS_MAD", "not_found"); rc += xpath(tm_mad, "/DATASTORE/TM_MAD", "not_found"); - rc += xpath(base_path, "/DATASTORE/BASE_PATH", "not_found"); rc += xpath(int_ds_type, "/DATASTORE/TYPE", -1); rc += xpath(int_disk_type,"/DATASTORE/DISK_TYPE", -1); rc += xpath(int_state, "/DATASTORE/STATE", 0); @@ -727,6 +720,17 @@ int Datastore::from_xml(const string& xml) ObjectXML::free_nodes(content); + Nebula::instance().get_ds_location(base_path); + + if ( base_path.at(base_path.size()-1) != '/' ) + { + base_path += "/"; + } + + oss << base_path << oid; + + base_path = oss.str(); + if (rc != 0) { return -1; @@ -871,28 +875,6 @@ int Datastore::post_update_template(string& error_str) return -1; } - /* ---------------------------------------------------------------------- */ - /* Set the BASE_PATH of the Datastore (class & template) */ - /* ---------------------------------------------------------------------- */ - - erase_template_attribute("BASE_PATH", new_base_path); - - if ( !new_base_path.empty()) - { - ostringstream oss; - - if ( new_base_path.at(new_base_path.size()-1) != '/' ) - { - new_base_path += "/"; - } - - add_template_attribute("BASE_PATH", new_base_path); - - oss << new_base_path << oid; - - base_path = oss.str(); - } - return 0; } diff --git a/src/nebula/NebulaTemplate.cc b/src/nebula/NebulaTemplate.cc index f7d0fa6870..aff20b6d2a 100644 --- a/src/nebula/NebulaTemplate.cc +++ b/src/nebula/NebulaTemplate.cc @@ -435,7 +435,6 @@ void OpenNebulaTemplate::set_conf_default() # Datastore Configuration #******************************************************************************* # DATASTORE_LOCATION -# DATASTORE_BASE_PATH # DATASTORE_CAPACITY_CHECK # DEFAULT_IMAGE_TYPE # DEFAULT_DEVICE_PREFIX @@ -443,7 +442,6 @@ void OpenNebulaTemplate::set_conf_default() #******************************************************************************* */ set_conf_single("DATASTORE_LOCATION", var_location + "/datastores"); - set_conf_single("DATASTORE_BASE_PATH", var_location + "/datastores"); set_conf_single("DATASTORE_CAPACITY_CHECK", "YES"); set_conf_single("DEFAULT_IMAGE_TYPE", "OS"); set_conf_single("DEFAULT_DEVICE_PREFIX", "hd"); diff --git a/src/oca/java/test/oned.conf b/src/oca/java/test/oned.conf index e7e7ee1494..ebd387b144 100644 --- a/src/oca/java/test/oned.conf +++ b/src/oca/java/test/oned.conf @@ -190,17 +190,12 @@ MAC_PREFIX = "02:00" #******************************************************************************* # DataStore Configuration #******************************************************************************* -# DATASTORE_LOCATION: *Default* Path for Datastores in the hosts. It IS the -# same for all the hosts in the cluster. DATASTORE_LOCATION IS ONLY FOR THE -# HOSTS AND *NOT* THE FRONT-END. It defaults to /var/lib/one/datastores (or -# $ONE_LOCATION/var/datastores in self-contained mode) -# -# You can define a different DATASTORE_LOCATION in each cluster by updating -# its properties with onecluster update. -# -# DATASTORE_BASE_PATH: This is the base path for the SOURCE attribute of -# the images registered in a Datastore. This is a default value, that can be -# changed when the datastore is created. +# DATASTORE_LOCATION: Path for Datastores. It IS the same for all the hosts +# and front-end. It defaults to /var/lib/one/datastores (in self-contained mode +# defaults to $ONE_LOCATION/var/datastores). Each datastore has it's own +# directory (called BASE_PATH) in the form: $DATASTORE_LOCATION/ +# You can symlink this direcorty to any other path if needed. BASE_PATH is +# generated from this attribute each time oned is started. # # DATASTORE_CAPACITY_CHECK: Checks that there is enough capacity before # creating a new imag. Defaults to Yes @@ -222,8 +217,6 @@ MAC_PREFIX = "02:00" #DATASTORE_LOCATION = /var/lib/one/datastores -#DATASTORE_BASE_PATH = /var/lib/one/datastores - DATASTORE_CAPACITY_CHECK = "yes" DEFAULT_IMAGE_TYPE = "OS" diff --git a/src/sunstone/public/app/tabs/datastores-tab/form-panels/create.js b/src/sunstone/public/app/tabs/datastores-tab/form-panels/create.js index 6394a7ff4a..f108b36633 100644 --- a/src/sunstone/public/app/tabs/datastores-tab/form-panels/create.js +++ b/src/sunstone/public/app/tabs/datastores-tab/form-panels/create.js @@ -191,7 +191,6 @@ define(function(require) { var type = $('#disk_type', dialog).val(); var safe_dirs = $('#safe_dirs', dialog).val(); - var base_path = $('#base_path', dialog).val(); var restricted_dirs = $('#restricted_dirs', dialog).val(); var limit_transfer_bw = $('#limit_transfer_bw', dialog).val(); var datastore_capacity_check = $('#datastore_capacity_check', dialog).is(':checked'); @@ -230,9 +229,6 @@ define(function(require) { if (ds_type != "SYSTEM_DS") ds_obj.datastore.ds_mad = ds_mad; - if (base_path) - ds_obj.datastore.base_path = base_path; - if (safe_dirs) ds_obj.datastore.safe_dirs = safe_dirs; @@ -382,7 +378,6 @@ define(function(require) { $('label[for="datastore_capacity_check"],input#datastore_capacity_check', dialog).parent().fadeIn(); $('input#safe_dirs', dialog).removeAttr('disabled'); $('select#disk_type', dialog).removeAttr('disabled'); - $('input#base_path', dialog).removeAttr('disabled'); $('input#limit_mb', dialog).removeAttr('disabled'); $('input#restricted_dirs', dialog).removeAttr('disabled'); $('label[for="bridge_list"],input#bridge_list', dialog).parent().fadeIn(); @@ -410,7 +405,6 @@ define(function(require) { $('select#disk_type', dialog).val('RBD'); $('select#disk_type', dialog).attr('disabled', 'disabled'); $('input#safe_dirs', dialog).removeAttr('disabled'); - $('input#base_path', dialog).removeAttr('disabled'); $('input#limit_mb', dialog).removeAttr('disabled'); $('input#restricted_dirs', dialog).removeAttr('disabled'); } @@ -430,7 +424,6 @@ define(function(require) { $('select#disk_type', dialog).val('block'); $('select#disk_type', dialog).attr('disabled', 'disabled'); $('input#safe_dirs', dialog).removeAttr('disabled'); - $('input#base_path', dialog).removeAttr('disabled'); $('input#limit_mb', dialog).removeAttr('disabled'); $('input#restricted_dirs', dialog).removeAttr('disabled'); } @@ -448,7 +441,6 @@ define(function(require) { $('select#disk_type', dialog).val('block'); $('select#disk_type', dialog).attr('disabled', 'disabled'); $('input#safe_dirs', dialog).removeAttr('disabled'); - $('input#base_path', dialog).removeAttr('disabled'); $('input#limit_mb', dialog).removeAttr('disabled'); $('input#restricted_dirs', dialog).removeAttr('disabled'); } @@ -475,7 +467,6 @@ define(function(require) { $('label[for="no_decompress"],input#no_decompress', dialog).parent().fadeIn(); $('label[for="datastore_capacity_check"],input#datastore_capacity_check', dialog).parent().fadeIn(); $('input#safe_dirs', dialog).removeAttr('disabled'); - $('input#base_path', dialog).removeAttr('disabled'); $('input#limit_mb', dialog).removeAttr('disabled'); $('input#restricted_dirs', dialog).removeAttr('disabled'); } @@ -493,7 +484,6 @@ define(function(require) { $('label[for="no_decompress"],input#no_decompress', dialog).parent().hide(); $('label[for="datastore_capacity_check"],input#datastore_capacity_check', dialog).parent().hide(); $('input#safe_dirs', dialog).attr('disabled', 'disabled'); - $('input#base_path', dialog).attr('disabled', 'disabled'); $('input#limit_mb', dialog).attr('disabled', 'disabled'); $('input#restricted_dirs', dialog).attr('disabled', 'disabled'); } @@ -514,7 +504,6 @@ define(function(require) { $('label[for="no_decompress"],input#no_decompress', dialog).parent().hide(); $('label[for="datastore_capacity_check"],input#datastore_capacity_check', dialog).parent().hide(); $('input#safe_dirs', dialog).attr('disabled', 'disabled'); - $('input#base_path', dialog).attr('disabled', 'disabled'); $('input#limit_mb', dialog).attr('disabled', 'disabled'); $('input#restricted_dirs', dialog).attr('disabled', 'disabled'); } @@ -532,7 +521,6 @@ define(function(require) { $('label[for="no_decompress"],input#no_decompress', dialog).parent().hide(); $('label[for="datastore_capacity_check"],input#datastore_capacity_check', dialog).parent().hide(); $('input#safe_dirs', dialog).attr('disabled', 'disabled'); - $('input#base_path', dialog).attr('disabled', 'disabled'); $('input#limit_mb', dialog).attr('disabled', 'disabled'); $('input#restricted_dirs', dialog).attr('disabled', 'disabled'); $('label[for="vcenter_cluster"],input#vcenter_cluster', dialog).parent().fadeIn(); @@ -544,7 +532,6 @@ define(function(require) { $('select#tm_mad', dialog).val('shared'); $('input#safe_dirs', dialog).removeAttr('disabled'); $('select#disk_type', dialog).removeAttr('disabled'); - $('input#base_path', dialog).removeAttr('disabled'); $('input#limit_mb', dialog).removeAttr('disabled'); $('input#restricted_dirs', dialog).removeAttr('disabled'); $('label[for="limit_transfer_bw"],input#limit_transfer_bw', dialog).parent().fadeIn(); diff --git a/src/sunstone/public/app/tabs/datastores-tab/form-panels/create/wizard.hbs b/src/sunstone/public/app/tabs/datastores-tab/form-panels/create/wizard.hbs index c32f1f99da..af56966390 100644 --- a/src/sunstone/public/app/tabs/datastores-tab/form-panels/create/wizard.hbs +++ b/src/sunstone/public/app/tabs/datastores-tab/form-panels/create/wizard.hbs @@ -130,13 +130,13 @@
-
-
- - -