mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
Merge branch 'feature-1681'
This commit is contained in:
commit
dc9a6711e0
@ -195,6 +195,7 @@ private:
|
||||
int gid,
|
||||
const string& uname,
|
||||
const string& gname,
|
||||
int umask,
|
||||
DatastoreTemplate* ds_template,
|
||||
int cluster_id,
|
||||
const string& cluster_name);
|
||||
|
@ -75,6 +75,7 @@ public:
|
||||
* @param gid the id of the group this object is assigned to
|
||||
* @param uname name of the user
|
||||
* @param gname name of the group
|
||||
* @param umask permissions umask
|
||||
* @param ds_template Datastore definition template
|
||||
* @param oid the id assigned to the Datastore
|
||||
* @param cluster_id the id of the cluster this Datastore will belong to
|
||||
@ -88,6 +89,7 @@ public:
|
||||
int gid,
|
||||
const string& uname,
|
||||
const string& gname,
|
||||
int umask,
|
||||
DatastoreTemplate * ds_template,
|
||||
int * oid,
|
||||
int cluster_id,
|
||||
@ -182,7 +184,7 @@ private:
|
||||
*/
|
||||
PoolObjectSQL * create()
|
||||
{
|
||||
return new Datastore(-1,-1,"","", 0, -1, "");
|
||||
return new Datastore(-1,-1,"","", 0, 0, -1, "");
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -127,6 +127,7 @@ protected:
|
||||
int gid,
|
||||
const string& uname,
|
||||
const string& gname,
|
||||
int umask,
|
||||
int type,
|
||||
Template * _template_contents);
|
||||
|
||||
|
@ -38,6 +38,7 @@ public:
|
||||
* @param gid the id of the group this object is assigned to
|
||||
* @param uname name of the owner user
|
||||
* @param gname name of the group
|
||||
* @param umask permissions umask
|
||||
* @param type for the new Document
|
||||
* @param template_contents a Template object
|
||||
* @param oid the id assigned to the Document
|
||||
@ -49,13 +50,14 @@ public:
|
||||
int gid,
|
||||
const string& uname,
|
||||
const string& gname,
|
||||
int umask,
|
||||
int type,
|
||||
Template * template_contents,
|
||||
int * oid,
|
||||
string& error_str)
|
||||
{
|
||||
*oid = PoolSQL::allocate(
|
||||
new Document(-1, uid, gid, uname, gname, type, template_contents),
|
||||
new Document(-1, uid, gid, uname, gname, umask, type, template_contents),
|
||||
error_str);
|
||||
|
||||
return *oid;
|
||||
@ -115,7 +117,7 @@ private:
|
||||
*/
|
||||
PoolObjectSQL * create()
|
||||
{
|
||||
return new Document(-1,-1,-1,"","",0,0);
|
||||
return new Document(-1,-1,-1,"","",0,0,0);
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -615,6 +615,7 @@ protected:
|
||||
int gid,
|
||||
const string& uname,
|
||||
const string& gname,
|
||||
int umask,
|
||||
ImageTemplate* img_template);
|
||||
|
||||
virtual ~Image();
|
||||
|
@ -54,6 +54,7 @@ public:
|
||||
* @param gid the id of the group this object is assigned to
|
||||
* @param uname name of the user
|
||||
* @param gname name of the group
|
||||
* @param umask permissions umask
|
||||
* @param img_template template associated with the image
|
||||
* @param ds_id the id of the datastore
|
||||
* @param ds_name the name of the datastore
|
||||
@ -73,6 +74,7 @@ public:
|
||||
int gid,
|
||||
const string& uname,
|
||||
const string& gname,
|
||||
int umask,
|
||||
ImageTemplate * img_template,
|
||||
int ds_id,
|
||||
const string& ds_name,
|
||||
@ -219,7 +221,7 @@ private:
|
||||
*/
|
||||
PoolObjectSQL * create()
|
||||
{
|
||||
return new Image(-1,-1,"","",0);
|
||||
return new Image(-1,-1,"","",0,0);
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -518,6 +518,14 @@ protected:
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Initializes the object's permissions, according to the provided umask.
|
||||
*
|
||||
* @param umask Permission mask, similar to unix umask.
|
||||
* For example a umask of 137 will set the permissions "um- u-- ---"
|
||||
*/
|
||||
void set_umask(int umask);
|
||||
|
||||
/**
|
||||
* The object's unique ID
|
||||
*/
|
||||
|
@ -65,7 +65,8 @@ protected:
|
||||
Template * tmpl,
|
||||
int& id,
|
||||
string& error_str,
|
||||
RequestAttributes& att)
|
||||
RequestAttributes& att,
|
||||
int umask)
|
||||
{
|
||||
return -1;
|
||||
};
|
||||
@ -76,9 +77,10 @@ protected:
|
||||
string& error_str,
|
||||
RequestAttributes& att,
|
||||
int cluster_id,
|
||||
const string& cluster_name)
|
||||
const string& cluster_name,
|
||||
int umask)
|
||||
{
|
||||
return pool_allocate(_paramList, tmpl, id, error_str, att);
|
||||
return pool_allocate(_paramList, tmpl, id, error_str, att, umask);
|
||||
};
|
||||
|
||||
virtual int get_cluster_id(xmlrpc_c::paramList const& paramList)
|
||||
@ -139,7 +141,8 @@ public:
|
||||
Template * tmpl,
|
||||
int& id,
|
||||
string& error_str,
|
||||
RequestAttributes& att);
|
||||
RequestAttributes& att,
|
||||
int umask);
|
||||
|
||||
bool allocate_authorization(Template * obj_template,
|
||||
RequestAttributes& att,
|
||||
@ -178,7 +181,8 @@ public:
|
||||
string& error_str,
|
||||
RequestAttributes& att,
|
||||
int cluster_id,
|
||||
const string& cluster_name);
|
||||
const string& cluster_name,
|
||||
int umask);
|
||||
|
||||
int get_cluster_id(xmlrpc_c::paramList const& paramList)
|
||||
{
|
||||
@ -250,7 +254,8 @@ public:
|
||||
Template * tmpl,
|
||||
int& id,
|
||||
string& error_str,
|
||||
RequestAttributes& att);
|
||||
RequestAttributes& att,
|
||||
int umask);
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
@ -280,7 +285,8 @@ public:
|
||||
string& error_str,
|
||||
RequestAttributes& att,
|
||||
int cluster_id,
|
||||
const string& cluster_name);
|
||||
const string& cluster_name,
|
||||
int umask);
|
||||
|
||||
int get_cluster_id(xmlrpc_c::paramList const& paramList)
|
||||
{
|
||||
@ -320,7 +326,8 @@ public:
|
||||
Template * tmpl,
|
||||
int& id,
|
||||
string& error_str,
|
||||
RequestAttributes& att);
|
||||
RequestAttributes& att,
|
||||
int umask);
|
||||
|
||||
void log_xmlrpc_param(
|
||||
const xmlrpc_c::value& v,
|
||||
@ -351,7 +358,8 @@ public:
|
||||
Template * tmpl,
|
||||
int& id,
|
||||
string& error_str,
|
||||
RequestAttributes& att);
|
||||
RequestAttributes& att,
|
||||
int umask);
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
@ -386,7 +394,8 @@ public:
|
||||
string& error_str,
|
||||
RequestAttributes& att,
|
||||
int cluster_id,
|
||||
const string& cluster_name);
|
||||
const string& cluster_name,
|
||||
int umask);
|
||||
|
||||
int get_cluster_id(xmlrpc_c::paramList const& paramList)
|
||||
{
|
||||
@ -440,7 +449,8 @@ public:
|
||||
Template * tmpl,
|
||||
int& id,
|
||||
string& error_str,
|
||||
RequestAttributes& att);
|
||||
RequestAttributes& att,
|
||||
int umask);
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
@ -473,7 +483,8 @@ public:
|
||||
Template * tmpl,
|
||||
int& id,
|
||||
string& error_str,
|
||||
RequestAttributes& att);
|
||||
RequestAttributes& att,
|
||||
int umask);
|
||||
};
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
@ -49,7 +49,8 @@ protected:
|
||||
Template * tmpl,
|
||||
int& id,
|
||||
string& error_str,
|
||||
RequestAttributes& att) = 0;
|
||||
RequestAttributes& att,
|
||||
int umask) = 0;
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
@ -83,15 +84,16 @@ public:
|
||||
Template * tmpl,
|
||||
int& id,
|
||||
string& error_str,
|
||||
RequestAttributes& att)
|
||||
RequestAttributes& att,
|
||||
int umask)
|
||||
{
|
||||
VMTemplatePool * tpool = static_cast<VMTemplatePool *>(pool);
|
||||
|
||||
VirtualMachineTemplate * ttmpl =
|
||||
static_cast<VirtualMachineTemplate *>(tmpl);
|
||||
|
||||
return tpool->allocate(att.uid, att.gid, att.uname, att.gname, ttmpl,
|
||||
&id, error_str);
|
||||
return tpool->allocate(att.uid, att.gid, att.uname, att.gname, umask,
|
||||
ttmpl, &id, error_str);
|
||||
};
|
||||
};
|
||||
|
||||
@ -127,12 +129,13 @@ public:
|
||||
Template * tmpl,
|
||||
int& id,
|
||||
string& error_str,
|
||||
RequestAttributes& att)
|
||||
RequestAttributes& att,
|
||||
int umask)
|
||||
{
|
||||
DocumentPool * docpool = static_cast<DocumentPool *>(pool);
|
||||
Document * doc = docpool->get(source_id, true);
|
||||
|
||||
return docpool->allocate(att.uid, att.gid, att.uname, att.gname,
|
||||
return docpool->allocate(att.uid, att.gid, att.uname, att.gname, umask,
|
||||
doc->get_document_type(), tmpl, &id, error_str);
|
||||
};
|
||||
};
|
||||
|
@ -173,6 +173,14 @@ public:
|
||||
*/
|
||||
Quotas quota;
|
||||
|
||||
/**
|
||||
* Returns the UMASK template attribute (read as an octal number), or the
|
||||
* default UMASK from oned.conf if it does not exist
|
||||
*
|
||||
* @return the UMASK to create new objects
|
||||
*/
|
||||
int get_umask() const;
|
||||
|
||||
private:
|
||||
// -------------------------------------------------------------------------
|
||||
// Friends
|
||||
|
@ -117,6 +117,7 @@ protected:
|
||||
int gid,
|
||||
const string& uname,
|
||||
const string& gname,
|
||||
int umask,
|
||||
VirtualMachineTemplate * _template_contents);
|
||||
|
||||
~VMTemplate();
|
||||
|
@ -36,6 +36,9 @@ public:
|
||||
* allocated for the object.
|
||||
* @param uid user id (the owner of the Template)
|
||||
* @param gid the id of the group this object is assigned to
|
||||
* @param uname user name
|
||||
* @param gname group name
|
||||
* @param umask permissions umask
|
||||
* @param template_contents a VM Template object
|
||||
* @param oid the id assigned to the Template
|
||||
* @param error_str Returns the error reason, if any
|
||||
@ -46,6 +49,7 @@ public:
|
||||
int gid,
|
||||
const string& uname,
|
||||
const string& gname,
|
||||
int umask,
|
||||
VirtualMachineTemplate * template_contents,
|
||||
int * oid,
|
||||
string& error_str);
|
||||
@ -118,7 +122,7 @@ private:
|
||||
*/
|
||||
PoolObjectSQL * create()
|
||||
{
|
||||
return new VMTemplate(-1,-1,-1,"","",0);
|
||||
return new VMTemplate(-1,-1,-1,"","",0,0);
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -1220,6 +1220,7 @@ protected:
|
||||
int gid,
|
||||
const string& uname,
|
||||
const string& gname,
|
||||
int umask,
|
||||
VirtualMachineTemplate * _vm_template);
|
||||
|
||||
virtual ~VirtualMachine();
|
||||
|
@ -46,10 +46,14 @@ public:
|
||||
* Function to allocate a new VM object
|
||||
* @param uid user id (the owner of the VM)
|
||||
* @param gid the id of the group this object is assigned to
|
||||
* @param uname user name
|
||||
* @param gname group name
|
||||
* @param umask permissions umask
|
||||
* @param vm_template a VM Template object describing the VM
|
||||
* @param oid the id assigned to the VM (output)
|
||||
* @param error_str Returns the error reason, if any
|
||||
* @param on_hold flag to submit on hold
|
||||
*
|
||||
* @return oid on success, -1 error inserting in DB or -2 error parsing
|
||||
* the template
|
||||
*/
|
||||
@ -58,6 +62,7 @@ public:
|
||||
int gid,
|
||||
const string& uname,
|
||||
const string& gname,
|
||||
int umask,
|
||||
VirtualMachineTemplate * vm_template,
|
||||
int * oid,
|
||||
string& error_str,
|
||||
@ -249,7 +254,7 @@ private:
|
||||
*/
|
||||
PoolObjectSQL * create()
|
||||
{
|
||||
return new VirtualMachine(-1,-1,-1,"","",0);
|
||||
return new VirtualMachine(-1,-1,-1,"","",0,0);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -299,6 +299,7 @@ private:
|
||||
int gid,
|
||||
const string& _uname,
|
||||
const string& _gname,
|
||||
int _umask,
|
||||
int _cluster_id,
|
||||
const string& _cluster_name,
|
||||
VirtualNetworkTemplate * _vn_template = 0);
|
||||
|
@ -45,6 +45,9 @@ public:
|
||||
* Function to allocate a new VNET object
|
||||
* @param uid user identifier
|
||||
* @param gid the id of the group this object is assigned to
|
||||
* @param uname user name
|
||||
* @param gname group name
|
||||
* @param umask permissions umask
|
||||
* @param vn_template a VirtualNetworkTemplate describing the VNET
|
||||
* @param oid the id assigned to the VM (output)
|
||||
* @param cluster_id the id of the cluster this VNET will belong to
|
||||
@ -57,6 +60,7 @@ public:
|
||||
int gid,
|
||||
const string& uname,
|
||||
const string& gname,
|
||||
int umask,
|
||||
VirtualNetworkTemplate * vn_template,
|
||||
int * oid,
|
||||
int cluster_id,
|
||||
@ -169,7 +173,7 @@ private:
|
||||
*/
|
||||
PoolObjectSQL * create()
|
||||
{
|
||||
return new VirtualNetwork(-1,-1,"","",-1,"",0);
|
||||
return new VirtualNetwork(-1,-1,"","",0,-1,"",0);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -465,6 +465,10 @@ HM_MAD = [
|
||||
# ENABLE_OTHER_PERMISSIONS: Whether or not users can set the permissions for
|
||||
# 'other', so publishing or sharing resources with others. Users in the oneadmin
|
||||
# group will still be able to change these permissions. Values: YES or NO.
|
||||
#
|
||||
# DEFAULT_UMASK: Similar to Unix umask, sets the default resources permissions.
|
||||
# Its format must be 3 octal digits. For example a umask of 137 will set
|
||||
# the new object's permissions to 640 "um- u-- ---"
|
||||
#*******************************************************************************
|
||||
|
||||
AUTH_MAD = [
|
||||
@ -476,6 +480,8 @@ SESSION_EXPIRATION_TIME = 900
|
||||
|
||||
#ENABLE_OTHER_PERMISSIONS = "YES"
|
||||
|
||||
DEFAULT_UMASK = 177
|
||||
|
||||
#*******************************************************************************
|
||||
# Restricted Attributes Configuration
|
||||
#*******************************************************************************
|
||||
|
@ -270,6 +270,39 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
||||
exit 0
|
||||
end
|
||||
|
||||
umask_desc = <<-EOT.unindent
|
||||
Changes the umask used to create the default permissions. In a similar
|
||||
way to the Unix umask command, the expected value is a three-digit
|
||||
base-8 number. Each digit is a mask that disables permissions for the
|
||||
owner, group and other, respectively.
|
||||
|
||||
If mask is not given, or if it is an empty string, the umask will
|
||||
be unset
|
||||
EOT
|
||||
|
||||
command :umask, umask_desc, [:range, :userid_list], [:mask, nil] do
|
||||
helper.perform_actions(args[0],options,
|
||||
"umask changed") do |user|
|
||||
|
||||
rc = user.info
|
||||
|
||||
if OpenNebula.is_error?(rc)
|
||||
puts rc.message
|
||||
exit -1
|
||||
end
|
||||
|
||||
user.delete_element('/USER/TEMPLATE/UMASK')
|
||||
|
||||
tmp_str = user.template_str
|
||||
|
||||
if !args[1].nil? && args[1] != ""
|
||||
tmp_str << "\nUMASK = #{args[1]}"
|
||||
end
|
||||
|
||||
user.update(tmp_str)
|
||||
end
|
||||
end
|
||||
|
||||
login_desc = <<-EOT.unindent
|
||||
Creates the Login token for authentication
|
||||
Examples:
|
||||
|
@ -41,6 +41,7 @@ Datastore::Datastore(
|
||||
int gid,
|
||||
const string& uname,
|
||||
const string& gname,
|
||||
int umask,
|
||||
DatastoreTemplate* ds_template,
|
||||
int cluster_id,
|
||||
const string& cluster_name):
|
||||
@ -52,8 +53,6 @@ Datastore::Datastore(
|
||||
base_path(""),
|
||||
type(IMAGE_DS)
|
||||
{
|
||||
group_u = 1;
|
||||
|
||||
if (ds_template != 0)
|
||||
{
|
||||
obj_template = ds_template;
|
||||
@ -62,6 +61,10 @@ Datastore::Datastore(
|
||||
{
|
||||
obj_template = new DatastoreTemplate;
|
||||
}
|
||||
|
||||
set_umask(umask);
|
||||
|
||||
group_u = 1;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
@ -47,7 +47,6 @@ DatastorePool::DatastorePool(SqlDB * db):
|
||||
if (get_lastOID() == -1) //lastOID is set in PoolSQL::init_cb
|
||||
{
|
||||
DatastoreTemplate * ds_tmpl;
|
||||
Datastore * ds;
|
||||
|
||||
int rc;
|
||||
|
||||
@ -71,6 +70,7 @@ DatastorePool::DatastorePool(SqlDB * db):
|
||||
GroupPool::ONEADMIN_ID,
|
||||
UserPool::oneadmin_name,
|
||||
GroupPool::ONEADMIN_NAME,
|
||||
0137,
|
||||
ds_tmpl,
|
||||
&rc,
|
||||
ClusterPool::NONE_CLUSTER_ID,
|
||||
@ -104,6 +104,7 @@ DatastorePool::DatastorePool(SqlDB * db):
|
||||
GroupPool::ONEADMIN_ID,
|
||||
UserPool::oneadmin_name,
|
||||
GroupPool::ONEADMIN_NAME,
|
||||
0133,
|
||||
ds_tmpl,
|
||||
&rc,
|
||||
ClusterPool::NONE_CLUSTER_ID,
|
||||
@ -115,18 +116,6 @@ 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();
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// Create the default file datastore
|
||||
// ---------------------------------------------------------------------
|
||||
@ -149,6 +138,7 @@ DatastorePool::DatastorePool(SqlDB * db):
|
||||
GroupPool::ONEADMIN_ID,
|
||||
UserPool::oneadmin_name,
|
||||
GroupPool::ONEADMIN_NAME,
|
||||
0133,
|
||||
ds_tmpl,
|
||||
&rc,
|
||||
ClusterPool::NONE_CLUSTER_ID,
|
||||
@ -160,18 +150,6 @@ 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);
|
||||
}
|
||||
@ -194,6 +172,7 @@ int DatastorePool::allocate(
|
||||
int gid,
|
||||
const string& uname,
|
||||
const string& gname,
|
||||
int umask,
|
||||
DatastoreTemplate * ds_template,
|
||||
int * oid,
|
||||
int cluster_id,
|
||||
@ -205,7 +184,7 @@ int DatastorePool::allocate(
|
||||
string name;
|
||||
ostringstream oss;
|
||||
|
||||
ds = new Datastore(uid, gid, uname, gname,
|
||||
ds = new Datastore(uid, gid, uname, gname, umask,
|
||||
ds_template, cluster_id, cluster_name);
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
@ -25,6 +25,7 @@ Document::Document( int id,
|
||||
int _gid,
|
||||
const string& _uname,
|
||||
const string& _gname,
|
||||
int _umask,
|
||||
int _type,
|
||||
Template * _template_contents):
|
||||
PoolObjectSQL(id,DOCUMENT,"",_uid,_gid,_uname,_gname,table), type(_type)
|
||||
@ -37,6 +38,8 @@ Document::Document( int id,
|
||||
{
|
||||
obj_template = new Template;
|
||||
}
|
||||
|
||||
set_umask(_umask);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
@ -38,6 +38,7 @@ Image::Image(int _uid,
|
||||
int _gid,
|
||||
const string& _uname,
|
||||
const string& _gname,
|
||||
int _umask,
|
||||
ImageTemplate * _image_template):
|
||||
PoolObjectSQL(-1,IMAGE,"",_uid,_gid,_uname,_gname,table),
|
||||
type(OS),
|
||||
@ -64,6 +65,8 @@ Image::Image(int _uid,
|
||||
{
|
||||
obj_template = new ImageTemplate;
|
||||
}
|
||||
|
||||
set_umask(_umask);
|
||||
}
|
||||
|
||||
Image::~Image()
|
||||
|
@ -67,6 +67,7 @@ int ImagePool::allocate (
|
||||
int gid,
|
||||
const string& uname,
|
||||
const string& gname,
|
||||
int umask,
|
||||
ImageTemplate * img_template,
|
||||
int ds_id,
|
||||
const string& ds_name,
|
||||
@ -86,7 +87,7 @@ int ImagePool::allocate (
|
||||
string type;
|
||||
ostringstream oss;
|
||||
|
||||
img = new Image(uid, gid, uname, gname, img_template);
|
||||
img = new Image(uid, gid, uname, gname, umask, img_template);
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Check name & duplicates
|
||||
|
@ -225,6 +225,7 @@ void OpenNebulaTemplate::set_conf_default()
|
||||
#*******************************************************************************
|
||||
# SESSION_EXPIRATION_TIME
|
||||
# ENABLE_OTHER_PERMISSIONS
|
||||
# DEFAULT_UMASK
|
||||
#*******************************************************************************
|
||||
*/
|
||||
// SESSION_EXPIRATION_TIME
|
||||
@ -238,5 +239,11 @@ void OpenNebulaTemplate::set_conf_default()
|
||||
|
||||
attribute = new SingleAttribute("ENABLE_OTHER_PERMISSIONS",value);
|
||||
conf_default.insert(make_pair(attribute->name(),attribute));
|
||||
|
||||
// DEFAULT_UMASK
|
||||
value = "177";
|
||||
|
||||
attribute = new SingleAttribute("DEFAULT_UMASK",value);
|
||||
conf_default.insert(make_pair(attribute->name(),attribute));
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "PoolObjectSQL.h"
|
||||
#include "PoolObjectAuth.h"
|
||||
#include "SSLTools.h"
|
||||
#include "Nebula.h"
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
@ -305,3 +306,41 @@ error_value:
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
void PoolObjectSQL::set_umask(int umask)
|
||||
{
|
||||
int perms;
|
||||
bool enable_other;
|
||||
|
||||
Nebula::instance().get_configuration_attribute(
|
||||
"ENABLE_OTHER_PERMISSIONS", enable_other);
|
||||
|
||||
if (uid == 0 || gid == 0)
|
||||
{
|
||||
perms = 0777;
|
||||
}
|
||||
else if (enable_other)
|
||||
{
|
||||
perms = 0666;
|
||||
}
|
||||
else
|
||||
{
|
||||
perms = 0660;
|
||||
}
|
||||
|
||||
perms = perms & ~umask;
|
||||
|
||||
owner_u = ( (perms & 0400) != 0 ) ? 1 : 0;
|
||||
owner_m = ( (perms & 0200) != 0 ) ? 1 : 0;
|
||||
owner_a = ( (perms & 0100) != 0 ) ? 1 : 0;
|
||||
group_u = ( (perms & 0040) != 0 ) ? 1 : 0;
|
||||
group_m = ( (perms & 0020) != 0 ) ? 1 : 0;
|
||||
group_a = ( (perms & 0010) != 0 ) ? 1 : 0;
|
||||
other_u = ( (perms & 0004) != 0 ) ? 1 : 0;
|
||||
other_m = ( (perms & 0002) != 0 ) ? 1 : 0;
|
||||
other_a = ( (perms & 0001) != 0 ) ? 1 : 0;
|
||||
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
@ -131,13 +131,31 @@ void RequestManagerAllocate::request_execute(xmlrpc_c::paramList const& params,
|
||||
Template * tmpl = 0;
|
||||
|
||||
string error_str;
|
||||
int rc, id;
|
||||
int rc, id, umask;
|
||||
|
||||
Cluster * cluster = 0;
|
||||
int cluster_id = ClusterPool::NONE_CLUSTER_ID;
|
||||
string cluster_name = ClusterPool::NONE_CLUSTER_NAME;
|
||||
PoolObjectAuth cluster_perms;
|
||||
|
||||
User * user;
|
||||
UserPool * upool = Nebula::instance().get_upool();
|
||||
|
||||
user = upool->get(att.uid, true);
|
||||
|
||||
if ( user == 0 )
|
||||
{
|
||||
failure_response(NO_EXISTS,
|
||||
get_error(object_name(PoolObjectSQL::USER), att.uid),
|
||||
att);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
umask = user->get_umask();
|
||||
|
||||
user->unlock();
|
||||
|
||||
if ( do_template == true )
|
||||
{
|
||||
string str_tmpl = xmlrpc_c::value_string(params.getString(1));
|
||||
@ -179,7 +197,7 @@ void RequestManagerAllocate::request_execute(xmlrpc_c::paramList const& params,
|
||||
return;
|
||||
}
|
||||
|
||||
rc = pool_allocate(params, tmpl, id, error_str, att, cluster_id, cluster_name);
|
||||
rc = pool_allocate(params, tmpl, id, error_str, att, cluster_id, cluster_name, umask);
|
||||
|
||||
if ( rc < 0 )
|
||||
{
|
||||
@ -234,11 +252,13 @@ void RequestManagerAllocate::request_execute(xmlrpc_c::paramList const& params,
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int VirtualMachineAllocate::pool_allocate(xmlrpc_c::paramList const& paramList,
|
||||
Template * tmpl,
|
||||
int& id,
|
||||
string& error_str,
|
||||
RequestAttributes& att)
|
||||
int VirtualMachineAllocate::pool_allocate(
|
||||
xmlrpc_c::paramList const& paramList,
|
||||
Template * tmpl,
|
||||
int& id,
|
||||
string& error_str,
|
||||
RequestAttributes& att,
|
||||
int umask)
|
||||
{
|
||||
bool on_hold = false;
|
||||
|
||||
@ -252,8 +272,8 @@ int VirtualMachineAllocate::pool_allocate(xmlrpc_c::paramList const& paramList,
|
||||
|
||||
Template tmpl_back(*tmpl);
|
||||
|
||||
int rc = vmpool->allocate(att.uid, att.gid, att.uname, att.gname, ttmpl, &id,
|
||||
error_str, on_hold);
|
||||
int rc = vmpool->allocate(att.uid, att.gid, att.uname, att.gname, umask,
|
||||
ttmpl, &id, error_str, on_hold);
|
||||
|
||||
if ( rc < 0 )
|
||||
{
|
||||
@ -274,13 +294,14 @@ int VirtualNetworkAllocate::pool_allocate(
|
||||
string& error_str,
|
||||
RequestAttributes& att,
|
||||
int cluster_id,
|
||||
const string& cluster_name)
|
||||
const string& cluster_name,
|
||||
int umask)
|
||||
{
|
||||
VirtualNetworkPool * vpool = static_cast<VirtualNetworkPool *>(pool);
|
||||
VirtualNetworkTemplate * vtmpl=static_cast<VirtualNetworkTemplate *>(tmpl);
|
||||
|
||||
return vpool->allocate(att.uid, att.gid, att.uname, att.gname, vtmpl, &id,
|
||||
cluster_id, cluster_name, error_str);
|
||||
return vpool->allocate(att.uid, att.gid, att.uname, att.gname, umask,
|
||||
vtmpl, &id, cluster_id, cluster_name, error_str);
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
@ -309,18 +330,41 @@ void ImageAllocate::request_execute(xmlrpc_c::paramList const& params,
|
||||
|
||||
Nebula& nd = Nebula::instance();
|
||||
|
||||
UserPool * upool = nd.get_upool();
|
||||
DatastorePool * dspool = nd.get_dspool();
|
||||
ImagePool * ipool = static_cast<ImagePool *>(pool);
|
||||
ImageManager * imagem = nd.get_imagem();
|
||||
|
||||
ImageTemplate * tmpl = new ImageTemplate;
|
||||
ImageTemplate * tmpl;
|
||||
Template img_usage;
|
||||
|
||||
User * user;
|
||||
Datastore * ds;
|
||||
Image::DiskType ds_disk_type;
|
||||
|
||||
int umask;
|
||||
|
||||
// ------------------------- Get user's umask ------------------------------
|
||||
|
||||
user = upool->get(att.uid, true);
|
||||
|
||||
if ( user == 0 )
|
||||
{
|
||||
failure_response(NO_EXISTS,
|
||||
get_error(object_name(PoolObjectSQL::USER), att.uid),
|
||||
att);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
umask = user->get_umask();
|
||||
|
||||
user->unlock();
|
||||
|
||||
// ------------------------- Parse image template --------------------------
|
||||
|
||||
tmpl = new ImageTemplate;
|
||||
|
||||
rc = tmpl->parse_str_or_xml(str_tmpl, error_str);
|
||||
|
||||
if ( rc != 0 )
|
||||
@ -456,6 +500,7 @@ void ImageAllocate::request_execute(xmlrpc_c::paramList const& params,
|
||||
att.gid,
|
||||
att.uname,
|
||||
att.gname,
|
||||
umask,
|
||||
tmpl,
|
||||
ds_id,
|
||||
ds_name,
|
||||
@ -490,18 +535,20 @@ void ImageAllocate::request_execute(xmlrpc_c::paramList const& params,
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int TemplateAllocate::pool_allocate(xmlrpc_c::paramList const& _paramList,
|
||||
Template * tmpl,
|
||||
int& id,
|
||||
string& error_str,
|
||||
RequestAttributes& att)
|
||||
int TemplateAllocate::pool_allocate(
|
||||
xmlrpc_c::paramList const& paramList,
|
||||
Template * tmpl,
|
||||
int& id,
|
||||
string& error_str,
|
||||
RequestAttributes& att,
|
||||
int umask)
|
||||
{
|
||||
VMTemplatePool * tpool = static_cast<VMTemplatePool *>(pool);
|
||||
|
||||
VirtualMachineTemplate * ttmpl=static_cast<VirtualMachineTemplate *>(tmpl);
|
||||
|
||||
return tpool->allocate(att.uid, att.gid, att.uname, att.gname, ttmpl, &id,
|
||||
error_str);
|
||||
return tpool->allocate(att.uid, att.gid, att.uname, att.gname, umask, ttmpl,
|
||||
&id, error_str);
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
@ -514,7 +561,8 @@ int HostAllocate::pool_allocate(
|
||||
string& error_str,
|
||||
RequestAttributes& att,
|
||||
int cluster_id,
|
||||
const string& cluster_name)
|
||||
const string& cluster_name,
|
||||
int umask)
|
||||
{
|
||||
string host = xmlrpc_c::value_string(paramList.getString(1));
|
||||
string im_mad = xmlrpc_c::value_string(paramList.getString(2));
|
||||
@ -531,11 +579,13 @@ int HostAllocate::pool_allocate(
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int UserAllocate::pool_allocate(xmlrpc_c::paramList const& paramList,
|
||||
Template * tmpl,
|
||||
int& id,
|
||||
string& error_str,
|
||||
RequestAttributes& att)
|
||||
int UserAllocate::pool_allocate(
|
||||
xmlrpc_c::paramList const& paramList,
|
||||
Template * tmpl,
|
||||
int& id,
|
||||
string& error_str,
|
||||
RequestAttributes& att,
|
||||
int umask)
|
||||
{
|
||||
string uname = xmlrpc_c::value_string(paramList.getString(1));
|
||||
string passwd = xmlrpc_c::value_string(paramList.getString(2));
|
||||
@ -580,11 +630,13 @@ void UserAllocate::log_xmlrpc_param(
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int GroupAllocate::pool_allocate(xmlrpc_c::paramList const& paramList,
|
||||
Template * tmpl,
|
||||
int& id,
|
||||
string& error_str,
|
||||
RequestAttributes& att)
|
||||
int GroupAllocate::pool_allocate(
|
||||
xmlrpc_c::paramList const& paramList,
|
||||
Template * tmpl,
|
||||
int& id,
|
||||
string& error_str,
|
||||
RequestAttributes& att,
|
||||
int umask)
|
||||
{
|
||||
string gname = xmlrpc_c::value_string(paramList.getString(1));
|
||||
|
||||
@ -603,24 +655,27 @@ int DatastoreAllocate::pool_allocate(
|
||||
string& error_str,
|
||||
RequestAttributes& att,
|
||||
int cluster_id,
|
||||
const string& cluster_name)
|
||||
const string& cluster_name,
|
||||
int umask)
|
||||
{
|
||||
DatastorePool * dspool = static_cast<DatastorePool *>(pool);
|
||||
|
||||
DatastoreTemplate * ds_tmpl = static_cast<DatastoreTemplate *>(tmpl);
|
||||
|
||||
return dspool->allocate(att.uid, att.gid, att.uname, att.gname,
|
||||
return dspool->allocate(att.uid, att.gid, att.uname, att.gname, umask,
|
||||
ds_tmpl, &id, cluster_id, cluster_name, error_str);
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int ClusterAllocate::pool_allocate(xmlrpc_c::paramList const& paramList,
|
||||
Template * tmpl,
|
||||
int& id,
|
||||
string& error_str,
|
||||
RequestAttributes& att)
|
||||
int ClusterAllocate::pool_allocate(
|
||||
xmlrpc_c::paramList const& paramList,
|
||||
Template * tmpl,
|
||||
int& id,
|
||||
string& error_str,
|
||||
RequestAttributes& att,
|
||||
int umask)
|
||||
{
|
||||
string name = xmlrpc_c::value_string(paramList.getString(1));
|
||||
|
||||
@ -632,16 +687,18 @@ int ClusterAllocate::pool_allocate(xmlrpc_c::paramList const& paramList,
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int DocumentAllocate::pool_allocate(xmlrpc_c::paramList const& paramList,
|
||||
Template * tmpl,
|
||||
int& id,
|
||||
string& error_str,
|
||||
RequestAttributes& att)
|
||||
int DocumentAllocate::pool_allocate(
|
||||
xmlrpc_c::paramList const& paramList,
|
||||
Template * tmpl,
|
||||
int& id,
|
||||
string& error_str,
|
||||
RequestAttributes& att,
|
||||
int umask)
|
||||
{
|
||||
int type = xmlrpc_c::value_int(paramList.getInt(2));
|
||||
|
||||
DocumentPool * docpool = static_cast<DocumentPool *>(pool);
|
||||
|
||||
return docpool->allocate(att.uid, att.gid, att.uname, att.gname, type,
|
||||
tmpl, &id, error_str);
|
||||
return docpool->allocate(att.uid, att.gid, att.uname, att.gname, umask,
|
||||
type, tmpl, &id, error_str);
|
||||
}
|
||||
|
@ -28,15 +28,33 @@ void RequestManagerClone::request_execute(
|
||||
int source_id = xmlrpc_c::value_int(paramList.getInt(1));
|
||||
string name = xmlrpc_c::value_string(paramList.getString(2));
|
||||
|
||||
int rc, new_id;
|
||||
int rc, new_id, umask;
|
||||
|
||||
PoolObjectAuth perms;
|
||||
|
||||
Template * tmpl;
|
||||
PoolObjectSQL * source_obj;
|
||||
User * user;
|
||||
|
||||
UserPool * upool = Nebula::instance().get_upool();
|
||||
|
||||
string error_str;
|
||||
|
||||
user = upool->get(att.uid, true);
|
||||
|
||||
if ( user == 0 )
|
||||
{
|
||||
failure_response(NO_EXISTS,
|
||||
get_error(object_name(PoolObjectSQL::USER), att.uid),
|
||||
att);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
umask = user->get_umask();
|
||||
|
||||
user->unlock();
|
||||
|
||||
source_obj = pool->get(source_id, true);
|
||||
|
||||
if ( source_obj == 0 )
|
||||
@ -80,7 +98,7 @@ void RequestManagerClone::request_execute(
|
||||
}
|
||||
}
|
||||
|
||||
rc = pool_allocate(source_id, tmpl, new_id, error_str, att);
|
||||
rc = pool_allocate(source_id, tmpl, new_id, error_str, att, umask);
|
||||
|
||||
if ( rc < 0 )
|
||||
{
|
||||
|
@ -229,7 +229,7 @@ void ImageClone::request_execute(
|
||||
int clone_id = xmlrpc_c::value_int(paramList.getInt(1));
|
||||
string name = xmlrpc_c::value_string(paramList.getString(2));
|
||||
|
||||
int rc, new_id, ds_id, size;
|
||||
int rc, new_id, ds_id, size, umask;
|
||||
string error_str, ds_name, ds_data;
|
||||
|
||||
Image::DiskType disk_type;
|
||||
@ -239,11 +239,30 @@ void ImageClone::request_execute(
|
||||
Template img_usage;
|
||||
Image * img;
|
||||
Datastore * ds;
|
||||
User * user;
|
||||
|
||||
Nebula& nd = Nebula::instance();
|
||||
|
||||
DatastorePool * dspool = nd.get_dspool();
|
||||
ImagePool * ipool = static_cast<ImagePool *>(pool);
|
||||
UserPool * upool = nd.get_upool();
|
||||
|
||||
// ------------------------- Get user's umask ------------------------------
|
||||
|
||||
user = upool->get(att.uid, true);
|
||||
|
||||
if ( user == 0 )
|
||||
{
|
||||
failure_response(NO_EXISTS,
|
||||
get_error(object_name(PoolObjectSQL::USER), att.uid),
|
||||
att);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
umask = user->get_umask();
|
||||
|
||||
user->unlock();
|
||||
|
||||
// ------------------------- Get source Image info -------------------------
|
||||
|
||||
@ -360,6 +379,7 @@ void ImageClone::request_execute(
|
||||
att.gid,
|
||||
att.uname,
|
||||
att.gname,
|
||||
umask,
|
||||
tmpl,
|
||||
ds_id,
|
||||
ds_name,
|
||||
|
@ -30,6 +30,7 @@ void VMTemplateInstantiate::request_execute(xmlrpc_c::paramList const& paramList
|
||||
|
||||
int rc;
|
||||
int vid;
|
||||
int umask;
|
||||
|
||||
ostringstream sid;
|
||||
|
||||
@ -37,11 +38,13 @@ void VMTemplateInstantiate::request_execute(xmlrpc_c::paramList const& paramList
|
||||
|
||||
Nebula& nd = Nebula::instance();
|
||||
|
||||
VirtualMachinePool* vmpool = nd.get_vmpool();
|
||||
VMTemplatePool * tpool = static_cast<VMTemplatePool *>(pool);
|
||||
VirtualMachinePool* vmpool = nd.get_vmpool();
|
||||
VMTemplatePool * tpool = static_cast<VMTemplatePool *>(pool);
|
||||
UserPool * upool = nd.get_upool();
|
||||
|
||||
VirtualMachineTemplate * tmpl;
|
||||
VMTemplate * rtmpl;
|
||||
User * user;
|
||||
|
||||
string error_str;
|
||||
string aname;
|
||||
@ -53,6 +56,25 @@ void VMTemplateInstantiate::request_execute(xmlrpc_c::paramList const& paramList
|
||||
on_hold = xmlrpc_c::value_boolean(paramList.getBoolean(3));
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
/* Get user's umask */
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
user = upool->get(att.uid, true);
|
||||
|
||||
if ( user == 0 )
|
||||
{
|
||||
failure_response(NO_EXISTS,
|
||||
get_error(object_name(PoolObjectSQL::USER), att.uid),
|
||||
att);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
umask = user->get_umask();
|
||||
|
||||
user->unlock();
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
/* Get, check and clone the template */
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -138,8 +160,8 @@ void VMTemplateInstantiate::request_execute(xmlrpc_c::paramList const& paramList
|
||||
|
||||
Template tmpl_back(*tmpl);
|
||||
|
||||
rc = vmpool->allocate(att.uid, att.gid, att.uname, att.gname, tmpl, &vid,
|
||||
error_str, on_hold);
|
||||
rc = vmpool->allocate(att.uid, att.gid, att.uname, att.gname, umask,
|
||||
tmpl, &vid, error_str, on_hold);
|
||||
|
||||
if ( rc < 0 )
|
||||
{
|
||||
|
@ -681,8 +681,9 @@ void VirtualMachineSaveDisk::request_execute(xmlrpc_c::paramList const& paramLis
|
||||
{
|
||||
Nebula& nd = Nebula::instance();
|
||||
|
||||
ImagePool * ipool = nd.get_ipool();
|
||||
DatastorePool * dspool = nd.get_dspool();
|
||||
ImagePool * ipool = nd.get_ipool();
|
||||
DatastorePool * dspool = nd.get_dspool();
|
||||
UserPool * upool = nd.get_upool();
|
||||
|
||||
int id = xmlrpc_c::value_int(paramList.getInt(1));
|
||||
int disk_id = xmlrpc_c::value_int(paramList.getInt(2));
|
||||
@ -695,8 +696,10 @@ void VirtualMachineSaveDisk::request_execute(xmlrpc_c::paramList const& paramLis
|
||||
|
||||
Image * img;
|
||||
Datastore * ds;
|
||||
User * user;
|
||||
Image::DiskType ds_disk_type;
|
||||
|
||||
int umask;
|
||||
int rc;
|
||||
string error_str;
|
||||
|
||||
@ -730,6 +733,25 @@ void VirtualMachineSaveDisk::request_execute(xmlrpc_c::paramList const& paramLis
|
||||
return;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Get user's umask
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
user = upool->get(att.uid, true);
|
||||
|
||||
if ( user == 0 )
|
||||
{
|
||||
failure_response(NO_EXISTS,
|
||||
get_error(object_name(PoolObjectSQL::USER), att.uid),
|
||||
att);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
umask = user->get_umask();
|
||||
|
||||
user->unlock();
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Get the data of the Image to be saved
|
||||
// -------------------------------------------------------------------------
|
||||
@ -859,6 +881,7 @@ void VirtualMachineSaveDisk::request_execute(xmlrpc_c::paramList const& paramLis
|
||||
att.gid,
|
||||
att.uname,
|
||||
att.gname,
|
||||
umask,
|
||||
itemplate,
|
||||
ds_id,
|
||||
ds_name,
|
||||
|
@ -197,8 +197,8 @@ int User::from_xml(const string& xml)
|
||||
rc += obj_template->from_xml_node(content[0]);
|
||||
|
||||
ObjectXML::free_nodes(content);
|
||||
|
||||
rc += quota.from_xml(this);
|
||||
|
||||
rc += quota.from_xml(this);
|
||||
|
||||
if (rc != 0)
|
||||
{
|
||||
@ -283,6 +283,30 @@ bool User::pass_is_valid(const string& pass, string& error_str)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int User::get_umask() const
|
||||
{
|
||||
string umask_st;
|
||||
int umask;
|
||||
|
||||
istringstream iss;
|
||||
|
||||
get_template_attribute("UMASK", umask_st);
|
||||
|
||||
if(umask_st.empty())
|
||||
{
|
||||
Nebula::instance().get_configuration_attribute("DEFAULT_UMASK",umask_st);
|
||||
}
|
||||
|
||||
iss.str(umask_st);
|
||||
|
||||
iss >> oct >> umask;
|
||||
|
||||
return (umask & 0777);
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
@ -43,6 +43,7 @@ VirtualMachine::VirtualMachine(int id,
|
||||
int _gid,
|
||||
const string& _uname,
|
||||
const string& _gname,
|
||||
int umask,
|
||||
VirtualMachineTemplate * _vm_template):
|
||||
PoolObjectSQL(id,VM,"",_uid,_gid,_uname,_gname,table),
|
||||
last_poll(0),
|
||||
@ -70,6 +71,8 @@ VirtualMachine::VirtualMachine(int id,
|
||||
}
|
||||
|
||||
user_obj_template = new Template(false,'=',"USER_TEMPLATE");
|
||||
|
||||
set_umask(umask);
|
||||
}
|
||||
|
||||
VirtualMachine::~VirtualMachine()
|
||||
|
@ -210,6 +210,7 @@ int VirtualMachinePool::allocate (
|
||||
int gid,
|
||||
const string& uname,
|
||||
const string& gname,
|
||||
int umask,
|
||||
VirtualMachineTemplate * vm_template,
|
||||
int * oid,
|
||||
string& error_str,
|
||||
@ -220,7 +221,7 @@ int VirtualMachinePool::allocate (
|
||||
// ------------------------------------------------------------------------
|
||||
// Build a new Virtual Machine object
|
||||
// ------------------------------------------------------------------------
|
||||
vm = new VirtualMachine(-1, uid, gid, uname, gname, vm_template);
|
||||
vm = new VirtualMachine(-1, uid, gid, uname, gname, umask, vm_template);
|
||||
|
||||
if ( _submit_on_hold == true || on_hold )
|
||||
{
|
||||
|
@ -28,6 +28,7 @@ VMTemplate::VMTemplate(int id,
|
||||
int _gid,
|
||||
const string& _uname,
|
||||
const string& _gname,
|
||||
int umask,
|
||||
VirtualMachineTemplate * _template_contents):
|
||||
PoolObjectSQL(id,TEMPLATE,"",_uid,_gid,_uname,_gname,table),
|
||||
regtime(time(0))
|
||||
@ -40,6 +41,8 @@ VMTemplate::VMTemplate(int id,
|
||||
{
|
||||
obj_template = new VirtualMachineTemplate;
|
||||
}
|
||||
|
||||
set_umask(umask);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
@ -28,6 +28,7 @@ int VMTemplatePool::allocate (
|
||||
int gid,
|
||||
const string& uname,
|
||||
const string& gname,
|
||||
int umask,
|
||||
VirtualMachineTemplate * template_contents,
|
||||
int * oid,
|
||||
string& error_str)
|
||||
@ -40,7 +41,7 @@ int VMTemplatePool::allocate (
|
||||
// ------------------------------------------------------------------------
|
||||
// Build a new VMTemplate object
|
||||
// ------------------------------------------------------------------------
|
||||
vm_template = new VMTemplate(-1, uid, gid, uname, gname,template_contents);
|
||||
vm_template = new VMTemplate(-1, uid, gid, uname, gname, umask, template_contents);
|
||||
|
||||
// Check name
|
||||
vm_template->get_template_attribute("NAME", name);
|
||||
|
@ -36,6 +36,7 @@ VirtualNetwork::VirtualNetwork(int _uid,
|
||||
int _gid,
|
||||
const string& _uname,
|
||||
const string& _gname,
|
||||
int _umask,
|
||||
int _cluster_id,
|
||||
const string& _cluster_name,
|
||||
VirtualNetworkTemplate * _vn_template):
|
||||
@ -53,6 +54,8 @@ VirtualNetwork::VirtualNetwork(int _uid,
|
||||
{
|
||||
obj_template = new VirtualNetworkTemplate;
|
||||
}
|
||||
|
||||
set_umask(_umask);
|
||||
};
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
@ -81,6 +81,7 @@ int VirtualNetworkPool::allocate (
|
||||
int gid,
|
||||
const string& uname,
|
||||
const string& gname,
|
||||
int umask,
|
||||
VirtualNetworkTemplate * vn_template,
|
||||
int * oid,
|
||||
int cluster_id,
|
||||
@ -92,7 +93,7 @@ int VirtualNetworkPool::allocate (
|
||||
string name;
|
||||
ostringstream oss;
|
||||
|
||||
vn = new VirtualNetwork(uid, gid, uname, gname,
|
||||
vn = new VirtualNetwork(uid, gid, uname, gname, umask,
|
||||
cluster_id, cluster_name, vn_template);
|
||||
|
||||
// Check name
|
||||
|
Loading…
x
Reference in New Issue
Block a user