diff --git a/src/acl/AclManager.cc b/src/acl/AclManager.cc
index 0fe8664fcd..8ffd997c8e 100644
--- a/src/acl/AclManager.cc
+++ b/src/acl/AclManager.cc
@@ -87,16 +87,6 @@ AclManager::AclManager(SqlDB * _db) : db(_db), lastOID(-1)
PoolObjectSQL::HOST,
AuthRequest::MANAGE,
error_str);
-
- // Users in USERS can use the default DATASTORE
- // @1 DATASTORE/#1 USE
- add_rule(AclRule::GROUP_ID |
- 1,
- AclRule::INDIVIDUAL_ID |
- 1 | // TODO: use DatastorePool::DEFAULT_DS_ID
- PoolObjectSQL::DATASTORE,
- AuthRequest::USE,
- error_str);
}
}
diff --git a/src/cli/one_helper.rb b/src/cli/one_helper.rb
index 16f08400f3..50cc513fc1 100644
--- a/src/cli/one_helper.rb
+++ b/src/cli/one_helper.rb
@@ -399,6 +399,18 @@ EOT
end
end
+ # If the cluster name is empty, returns a '-' char.
+ #
+ # @param str [String || Hash] Cluster name, or empty Hash (when )
+ # @return [String] the same Cluster name, or '-' if it is empty
+ def OpenNebulaHelper.cluster_str(str)
+ if str != nil && !str.empty?
+ str
+ else
+ "-"
+ end
+ end
+
def OpenNebulaHelper.update_template(id, resource)
require 'tempfile'
diff --git a/src/cli/one_helper/onedatastore_helper.rb b/src/cli/one_helper/onedatastore_helper.rb
index b94ad60a3f..5e4c4eecfb 100644
--- a/src/cli/one_helper/onedatastore_helper.rb
+++ b/src/cli/one_helper/onedatastore_helper.rb
@@ -57,11 +57,7 @@ class OneDatastoreHelper < OpenNebulaHelper::OneHelper
end
column :CLUSTER, "Name of the Cluster", :left, :size=>8 do |d|
- if d["CLUSTER"] == "none"
- "-"
- else
- d["CLUSTER"]
- end
+ OpenNebulaHelper.cluster_str(d["CLUSTER"])
end
column :IMAGES, "Number of Images", :left, :size=>6 do |d|
@@ -111,8 +107,7 @@ class OneDatastoreHelper < OpenNebulaHelper::OneHelper
puts str % ["NAME", datastore.name]
puts str % ["USER", datastore['UNAME']]
puts str % ["GROUP", datastore['GNAME']]
- puts str % ["CLUSTER", datastore['CLUSTER']]
- puts str % ["CLUSTER_ID", datastore['CLUSTER_ID']]
+ puts str % ["CLUSTER", OpenNebulaHelper.cluster_str(datastore['CLUSTER'])]
puts str % ["DS_MAD", datastore['DS_MAD']]
puts str % ["TM_MAD", datastore['TM_MAD']]
diff --git a/src/cli/one_helper/onehost_helper.rb b/src/cli/one_helper/onehost_helper.rb
index 63434231ba..1abdb32b4f 100644
--- a/src/cli/one_helper/onehost_helper.rb
+++ b/src/cli/one_helper/onehost_helper.rb
@@ -44,11 +44,7 @@ class OneHostHelper < OpenNebulaHelper::OneHelper
end
column :CLUSTER, "Name of the Cluster", :left, :size=>8 do |d|
- if d["CLUSTER"] == "none"
- "-"
- else
- d["CLUSTER"]
- end
+ OpenNebulaHelper.cluster_str(d["CLUSTER"])
end
column :RVM, "Number of Virtual Machines running", :size=>6 do |d|
@@ -126,7 +122,7 @@ class OneHostHelper < OpenNebulaHelper::OneHelper
puts str % ["ID", host.id.to_s]
puts str % ["NAME", host.name]
- puts str % ["CLUSTER", host['CLUSTER']]
+ puts str % ["CLUSTER", OpenNebulaHelper.cluster_str(host['CLUSTER'])]
puts str % ["STATE", host.state_str]
puts str % ["IM_MAD", host['IM_MAD']]
puts str % ["VM_MAD", host['VM_MAD']]
diff --git a/src/cli/one_helper/onevnet_helper.rb b/src/cli/one_helper/onevnet_helper.rb
index 8281f51eff..39907836b1 100644
--- a/src/cli/one_helper/onevnet_helper.rb
+++ b/src/cli/one_helper/onevnet_helper.rb
@@ -55,11 +55,7 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper
end
column :CLUSTER, "Name of the Cluster", :left, :size=>8 do |d|
- if d["CLUSTER"] == "none"
- "-"
- else
- d["CLUSTER"]
- end
+ OpenNebulaHelper.cluster_str(d["CLUSTER"])
end
column :TYPE, "Type of Virtual Network", :size=>6 do |d|
@@ -111,7 +107,7 @@ class OneVNetHelper < OpenNebulaHelper::OneHelper
puts str % ["NAME", vn['NAME']]
puts str % ["USER", vn['UNAME']]
puts str % ["GROUP", vn['GNAME']]
- puts str % ["CLUSTER", vn['CLUSTER']]
+ puts str % ["CLUSTER", OpenNebulaHelper.cluster_str(vn['CLUSTER'])]
puts str % ["TYPE", vn.type_str]
puts str % ["BRIDGE", vn["BRIDGE"]]
puts str % ["VLAN", OpenNebulaHelper.boolean_to_str(vn['VLAN'])]
diff --git a/src/cloud/ec2/etc/econe.conf b/src/cloud/ec2/etc/econe.conf
index f9ba61e670..02e352aa1b 100644
--- a/src/cloud/ec2/etc/econe.conf
+++ b/src/cloud/ec2/etc/econe.conf
@@ -37,6 +37,9 @@
# 0 = ERROR, 1 = WARNING, 2 = INFO, 3 = DEBUG
:debug_level: 3
+:cluster_id:
+:datastore_id:
+
# VM types allowed and its template file (inside templates directory)
:instance_types:
:m1.small:
diff --git a/src/cloud/ec2/lib/EC2QueryServer.rb b/src/cloud/ec2/lib/EC2QueryServer.rb
index 66c14ad2a0..9b02650a9c 100644
--- a/src/cloud/ec2/lib/EC2QueryServer.rb
+++ b/src/cloud/ec2/lib/EC2QueryServer.rb
@@ -79,7 +79,7 @@ class EC2QueryServer < CloudServer
return OpenNebula::Error.new('Unsupported'), 400
end
- rc = image.allocate(template)
+ rc = image.allocate(template, @config[:datastore_id]||1)
if OpenNebula.is_error?(rc)
return OpenNebula::Error.new('Unsupported'), 400
end
diff --git a/src/cloud/occi/etc/occi-server.conf b/src/cloud/occi/etc/occi-server.conf
index 5ab9849e09..971326cd20 100644
--- a/src/cloud/occi/etc/occi-server.conf
+++ b/src/cloud/occi/etc/occi-server.conf
@@ -37,6 +37,9 @@
# 0 = ERROR, 1 = WARNING, 2 = INFO, 3 = DEBUG
:debug_level: 3
+:cluster_id:
+:datastore_id:
+
# VM types allowed and its template file (inside templates directory)
:instance_types:
:small:
diff --git a/src/cloud/occi/lib/OCCIServer.rb b/src/cloud/occi/lib/OCCIServer.rb
index a3102da56c..ee3fc5d406 100755
--- a/src/cloud/occi/lib/OCCIServer.rb
+++ b/src/cloud/occi/lib/OCCIServer.rb
@@ -342,7 +342,7 @@ class OCCIServer < CloudServer
template = network.to_one_template
return template, 500 if OpenNebula.is_error?(template)
- rc = network.allocate(template)
+ rc = network.allocate(template, @config[:cluster_id]||ClusterPool::NONE_CLUSTER_ID)
if OpenNebula.is_error?(rc)
return rc, CloudServer::HTTP_ERROR_CODE[rc.errno]
end
@@ -446,7 +446,7 @@ class OCCIServer < CloudServer
template = image.to_one_template
return template, 500 if OpenNebula.is_error?(template)
- rc = image.allocate(template)
+ rc = image.allocate(template, @config[:datastore_id]||1t)
if OpenNebula.is_error?(rc)
return rc, CloudServer::HTTP_ERROR_CODE[rc.errno]
end
diff --git a/src/cluster/ClusterPool.cc b/src/cluster/ClusterPool.cc
index c96d660ca1..32d549b1dc 100644
--- a/src/cluster/ClusterPool.cc
+++ b/src/cluster/ClusterPool.cc
@@ -26,7 +26,7 @@
/* Regular ones start from ID 100 */
/* -------------------------------------------------------------------------- */
-const string ClusterPool::NONE_CLUSTER_NAME = "none";
+const string ClusterPool::NONE_CLUSTER_NAME = "";
const int ClusterPool::NONE_CLUSTER_ID = -1;
/* -------------------------------------------------------------------------- */
diff --git a/src/datastore/Datastore.cc b/src/datastore/Datastore.cc
index f5fbb57dd8..ea7b1d50e8 100644
--- a/src/datastore/Datastore.cc
+++ b/src/datastore/Datastore.cc
@@ -49,6 +49,8 @@ Datastore::Datastore(
tm_mad(""),
base_path("")
{
+ group_u = 1;
+
if (ds_template != 0)
{
obj_template = ds_template;
diff --git a/src/datastore/DatastorePool.cc b/src/datastore/DatastorePool.cc
index 1557659a39..f98396ca38 100644
--- a/src/datastore/DatastorePool.cc
+++ b/src/datastore/DatastorePool.cc
@@ -44,6 +44,7 @@ DatastorePool::DatastorePool(SqlDB * db):
if (get_lastOID() == -1) //lastOID is set in PoolSQL::init_cb
{
DatastoreTemplate * ds_tmpl;
+ Datastore * ds;
int rc;
@@ -110,6 +111,18 @@ DatastorePool::DatastorePool(SqlDB * db):
goto error_bootstrap;
}
+ ds = get(rc, true);
+
+ ds->set_permissions(
+ -1,-1,-1,
+ -1,-1,-1,
+ 1,-1,-1,
+ error_str);
+
+ update(ds);
+
+ ds->unlock();
+
// User created datastores will start from ID 100
set_update_lastOID(99);
}
diff --git a/src/onedb/3.3.0_to_3.3.80.rb b/src/onedb/3.3.0_to_3.3.80.rb
index 3dff69249c..3fd8ee4631 100644
--- a/src/onedb/3.3.0_to_3.3.80.rb
+++ b/src/onedb/3.3.0_to_3.3.80.rb
@@ -115,7 +115,7 @@ module Migrator
" 1" <<
" 1" <<
" 0" <<
- " 0" <<
+ " 1" <<
" 0" <<
" 0" <<
" 0" <<
@@ -126,7 +126,7 @@ module Migrator
" shared" <<
" #{var_location}/datastores/0" <<
" -1" <<
- " none" <<
+ " " <<
" " <<
" " <<
" " <<
@@ -141,7 +141,7 @@ module Migrator
:uid => 0,
:gid => 0,
:owner_u => 1,
- :group_u => 0,
+ :group_u => 1,
:other_u => 0)
# Last oid for cluster_pool and datastore_pool
@@ -169,7 +169,7 @@ module Migrator
# Add Cluster elements
doc.root.add_element("CLUSTER_ID").text = "-1"
- doc.root.add_element("CLUSTER").text = "none"
+ doc.root.add_element("CLUSTER").text = ""
@db[:host_pool].insert(
:oid => row[:oid],
@@ -198,7 +198,7 @@ module Migrator
# Add Cluster elements
doc.root.add_element("CLUSTER_ID").text = "-1"
- doc.root.add_element("CLUSTER").text = "none"
+ doc.root.add_element("CLUSTER").text = ""
@db[:network_pool].insert(
:oid => row[:oid],
@@ -272,7 +272,7 @@ module Migrator
" 1" <<
" 1" <<
" 0" <<
- " 0" <<
+ " 1" <<
" 0" <<
" 0" <<
" 0" <<
@@ -283,7 +283,7 @@ module Migrator
" shared" <<
" #{var_location}/datastores/1" <<
" -1" <<
- " none" <<
+ " " <<
images_element <<
" " <<
" " <<
@@ -298,7 +298,7 @@ module Migrator
:uid => 0,
:gid => 0,
:owner_u => 1,
- :group_u => 0,
+ :group_u => 1,
:other_u => 0)
return true