mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-20 11:52:37 +09:00
Merge branch 'master' of git.opennebula.org:one
This commit is contained in:
commit
463e8343bc
8 files changed
+63
-12
No files matched your search
@@ -457,6 +457,10 @@ HM_MAD = [
|
||||
# SESSION_EXPIRATION_TIME: Time in seconds to keep an authenticated token as
|
||||
# valid. During this time, the driver is not used. Use 0 to disable session
|
||||
# caching
|
||||
#
|
||||
# ENABLE_OTHER_PERMISSIONS: Whether or not to enable the permissions for
|
||||
# 'other'. Users in the oneadmin group will still be able to change
|
||||
# these permissions. Values: YES or NO
|
||||
#*******************************************************************************
|
||||
|
||||
AUTH_MAD = [
|
||||
@@ -467,3 +471,4 @@ AUTH_MAD = [
|
||||
|
||||
SESSION_EXPIRATION_TIME = 900
|
||||
|
||||
ENABLE_OTHER_PERMISSIONS = "NO"
|
||||
@@ -115,7 +115,9 @@ EOT
|
||||
|
||||
def show_resource(id, options)
|
||||
resource = retrieve_resource(id)
|
||||
return -1, resource.message if OpenNebula.is_error?(resource)
|
||||
|
||||
rc = resource.info
|
||||
return -1, rc.message if OpenNebula.is_error?(rc)
|
||||
|
||||
if options[:xml]
|
||||
return 0, resource.to_xml(true)
|
||||
@@ -127,7 +129,6 @@ EOT
|
||||
|
||||
def perform_action(id, options, verbose, &block)
|
||||
resource = retrieve_resource(id)
|
||||
return -1, resource.message if OpenNebula.is_error?(resource)
|
||||
|
||||
rc = block.call(resource)
|
||||
if OpenNebula.is_error?(rc)
|
||||
@@ -282,10 +283,7 @@ EOT
|
||||
private
|
||||
|
||||
def retrieve_resource(id)
|
||||
resource = factory(id)
|
||||
|
||||
rc = resource.info
|
||||
OpenNebula.is_error?(rc) ? rc : resource
|
||||
factory(id)
|
||||
end
|
||||
|
||||
def pool_to_array(pool)
|
||||
|
||||
@@ -33,7 +33,7 @@ class ImageOCCI < Image
|
||||
<% if self['FSTYPE'] != nil and !self['FSTYPE'].empty? %>
|
||||
<FSTYPE><%= self['FSTYPE'] %></FSTYPE>
|
||||
<% end %>
|
||||
<PUBLIC><%= self['PUBLIC'] == "0" ? "NO" : "YES"%></PUBLIC>
|
||||
<PUBLIC><%= pub %></PUBLIC>
|
||||
<PERSISTENT><%= self['PERSISTENT'] == "0" ? "NO" : "YES"%></PERSISTENT>
|
||||
</STORAGE>
|
||||
}
|
||||
@@ -82,6 +82,12 @@ class ImageOCCI < Image
|
||||
|
||||
# Creates the OCCI representation of an Image
|
||||
def to_occi(base_url)
|
||||
if self['PERMISSIONS/GROUP_U'] == "1" || self['PERMISSIONS/OTHER_U'] == "1"
|
||||
pub = "YES"
|
||||
else
|
||||
pub = "NO"
|
||||
end
|
||||
|
||||
begin
|
||||
occi_im = ERB.new(OCCI_IMAGE)
|
||||
occi_im_text = occi_im.result(binding)
|
||||
|
||||
@@ -67,8 +67,9 @@ class VirtualMachineOCCI < VirtualMachine
|
||||
"SUSPENDED" => { :from => ["ACTIVE"], :action => :suspend},
|
||||
"RESUME" => { :from => ["STOPPED", "SUSPENDED"], :action => :resume},
|
||||
"CANCEL" => { :from => ["ACTIVE"], :action => :cancel},
|
||||
"REBOOT" => { :from => ["ACTIVE"], :action => :reboot},
|
||||
"SHUTDOWN" => { :from => ["ACTIVE"], :action => :shutdown},
|
||||
"DONE" => { :from => VM_STATE, :action => :finalize},
|
||||
"DONE" => { :from => VM_STATE, :action => :finalize}
|
||||
}
|
||||
|
||||
# Class constructor
|
||||
|
||||
@@ -34,7 +34,7 @@ class VirtualNetworkOCCI < VirtualNetwork
|
||||
<SIZE><%= network_size %></SIZE>
|
||||
<% end %>
|
||||
<USED_LEASES><%= self['TOTAL_LEASES'] %></USED_LEASES>
|
||||
<PUBLIC><%= self['PUBLIC'] == "0" ? "NO" : "YES"%></PUBLIC>
|
||||
<PUBLIC><%= pub %></PUBLIC>
|
||||
</NETWORK>
|
||||
}
|
||||
|
||||
@@ -65,6 +65,12 @@ class VirtualNetworkOCCI < VirtualNetwork
|
||||
network_size = ip_end.to_i - ip_start.to_i
|
||||
end
|
||||
|
||||
if self['PERMISSIONS/GROUP_U'] == "1" || self['PERMISSIONS/OTHER_U'] == "1"
|
||||
pub = "YES"
|
||||
else
|
||||
pub = "NO"
|
||||
end
|
||||
|
||||
begin
|
||||
occi = ERB.new(OCCI_NETWORK)
|
||||
occi_text = occi.result(binding)
|
||||
|
||||
@@ -64,9 +64,15 @@ echo "$IMAGE_REPOSITORY_PATH/`echo $CANONICAL_MD5 | cut -d ' ' -f1`"
|
||||
}
|
||||
|
||||
function fs_du {
|
||||
SIZE=`du -sk "$1" | cut -f1`
|
||||
if [ -d "$1" ]; then
|
||||
SIZE=`du -s "$1" | cut -f1`
|
||||
error=$?
|
||||
else
|
||||
SIZE=`stat -c %s "$1"`
|
||||
error=$?
|
||||
fi
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
if [ $error -ne 0 ]; then
|
||||
SIZE=0
|
||||
else
|
||||
SIZE=$(($SIZE/1024))
|
||||
|
||||
@@ -443,6 +443,8 @@ int PoolSQL::dump(ostringstream& oss,
|
||||
cmd << " WHERE " << where;
|
||||
}
|
||||
|
||||
cmd << " ORDER BY oid";
|
||||
|
||||
rc = db->exec(cmd, this);
|
||||
|
||||
oss << "</" << elem_name << ">";
|
||||
|
||||
@@ -42,7 +42,7 @@ void RequestManagerChmod::request_execute(xmlrpc_c::paramList const& paramList,
|
||||
PoolObjectSQL * object;
|
||||
string error_str;
|
||||
|
||||
if ( att.uid != 0 )
|
||||
if ( att.uid != 0 && att.gid != 0)
|
||||
{
|
||||
AuthRequest::Operation op = AuthRequest::MANAGE;
|
||||
PoolObjectAuth perms;
|
||||
@@ -71,6 +71,16 @@ void RequestManagerChmod::request_execute(xmlrpc_c::paramList const& paramList,
|
||||
group_a = -1;
|
||||
}
|
||||
|
||||
if ( other_u == perms.other_u )
|
||||
{
|
||||
other_u = -1;
|
||||
}
|
||||
|
||||
if ( other_m == perms.other_m )
|
||||
{
|
||||
other_m = -1;
|
||||
}
|
||||
|
||||
if ( other_a == perms.other_a )
|
||||
{
|
||||
other_a = -1;
|
||||
@@ -81,6 +91,23 @@ void RequestManagerChmod::request_execute(xmlrpc_c::paramList const& paramList,
|
||||
op = AuthRequest::ADMIN;
|
||||
}
|
||||
|
||||
if ( other_u != -1 || other_m != -1 || other_a != -1 )
|
||||
{
|
||||
string enable_other;
|
||||
|
||||
Nebula::instance().get_configuration_attribute(
|
||||
"ENABLE_OTHER_PERMISSIONS", enable_other);
|
||||
|
||||
if ( enable_other != "YES" )
|
||||
{
|
||||
failure_response(AUTHORIZATION,
|
||||
"Management of 'other' permissions is disabled in oned.conf",
|
||||
att);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
AuthRequest ar(att.uid, att.gid);
|
||||
|
||||
ar.add_auth(op, perms);
|
||||
|
||||
Reference in new issue
Block a user