1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-22 18:50:08 +03:00

Merge remote-tracking branch 'origin/master' into feature-1664

This commit is contained in:
Daniel Molina 2013-01-24 17:41:44 +01:00
commit 79b238bf33
952 changed files with 5024 additions and 2288 deletions

3
NOTICE
View File

@ -1,7 +1,6 @@
OpenNebula Open Source Project
--------------------------------------------------------------------------------
Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org)
Copyright 2010-2012, C12G Labs S.L. (C12G.com)
Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs
--------------------------------------------------------------------------------
You can find more information about the project, release notes and

View File

@ -167,7 +167,7 @@ Support mailing list: http://opennebula.org/support:support
## LICENSE
Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org)
Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs
Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain

View File

@ -1,5 +1,5 @@
# -------------------------------------------------------------------------- #
# Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) #
# Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# not use this file except in compliance with the License. You may obtain #

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
@ -108,6 +108,13 @@ public:
*/
void del_gid_rules(int gid);
/**
* Deletes rules that apply to this cluster id
*
* @param cid The cluster id
*/
void del_cid_rules(int cid);
/**
* Deletes all rules that apply to this resource
*
@ -127,6 +134,7 @@ public:
* @param all True if the user can perform the operation over any object
* @param oids Set of object IDs over which the user can operate
* @param gids Set of object group IDs over which the user can operate
* @param cids Set of object cluster IDs over which the user can operate
*/
void reverse_search(int uid,
int gid,
@ -134,7 +142,8 @@ public:
AuthRequest::Operation op,
bool& all,
vector<int>& oids,
vector<int>& gids);
vector<int>& gids,
vector<int>& cids);
/* ---------------------------------------------------------------------- */
/* DB management */
@ -179,10 +188,12 @@ private:
* @param user_req user/group id and flags
* @param resource_oid_req 64 bit request, ob. type and individual oid
* @param resource_gid_req 64 bit request, ob. type and group id
* @param resource_cid_req 64 bit request, ob. type and cluster id
* @param resource_all_req 64 bit request, ob. type and all flag
* @param rights_req Requested rights
* @param individual_obj_type Mask with ob. type and individual flags
* @param group_obj_type Mask with ob. type and group flags
* @param cluster_obj_type Mask with ob. type and cluster flags
* @param rules ACL rules to match
*
* @return true if any rule grants permission
@ -191,10 +202,12 @@ private:
long long user_req,
long long resource_oid_req,
long long resource_gid_req,
long long resource_cid_req,
long long resource_all_req,
long long rights_req,
long long individual_obj_type,
long long group_obj_type,
long long cluster_obj_type,
multimap<long long, AclRule*> &rules);
/**
@ -204,10 +217,12 @@ private:
* @param user_req user/group id and flags
* @param resource_oid_req 64 bit request, ob. type and individual oid
* @param resource_gid_req 64 bit request, ob. type and group id
* @param resource_cid_req 64 bit request, ob. type and cluster id
* @param resource_all_req 64 bit request, ob. type and all flag
* @param rights_req Requested rights
* @param individual_obj_type Mask with ob. type and individual flags
* @param group_obj_type Mask with ob. type and group flags
* @param cluster_obj_type Mask with ob. type and cluster flags
* @param tmp_rules Temporary map group of ACL rules
*
* @return true if any rule grants permission
@ -216,10 +231,12 @@ private:
long long user_req,
long long resource_oid_req,
long long resource_gid_req,
long long resource_cid_req,
long long resource_all_req,
long long rights_req,
long long individual_obj_type,
long long group_obj_type,
long long cluster_obj_type,
multimap<long long, AclRule*> &tmp_rules);
/**

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
@ -36,10 +36,12 @@ public:
// ------------------------------------------------------------------------
static const long long INDIVIDUAL_ID;
static const long long GROUP_ID;
static const long long ALL_ID;
static const long long CLUSTER_ID;
// ------------------------------------------------------------------------
/**
@ -50,9 +52,9 @@ public:
/**
* Main ACL rule constructor
*/
AclRule(int _oid,
long long _user,
long long _resource,
AclRule(int _oid,
long long _user,
long long _resource,
long long _rights):
oid(_oid), user(_user), resource(_resource), rights(_rights)
{
@ -64,8 +66,8 @@ public:
*/
void set(int _oid,
long long _user,
long long _resource,
long long _user,
long long _resource,
long long _rights)
{
oid = _oid;
@ -189,8 +191,8 @@ private:
int oid;
/**
* 64 bit integer holding a user compound:
*
* 64 bit integer holding a user compound:
*
* 32 bits 32 bits
* +-----------------------+-----------------------+
* | Type (user,group,all) | user/group ID |
@ -200,7 +202,7 @@ private:
/**
* 64 bit integer holding a resource compound
*
*
* 32 bits 32 bits
* +-----------------------+-----------------------+
* | Type (VM, Host...) | resource ID |
@ -241,6 +243,11 @@ private:
static const int num_auth_operations;
static const AuthRequest::Operation auth_operations[];
/**
* Objects that cannot be used with the CLUSTER(%) selector
*/
static const long long INVALID_CLUSTER_OBJECTS;
};
#endif /*ACL_RULE_H*/

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
@ -48,7 +48,7 @@ public:
if ((size >0 && !isalpha(aname[0]))||
(size >=3 && (aname[0]=='X' && aname[1]=='M' && aname[2]=='L')))
{
attribute_name.insert(0,"ONE_");
attribute_name.insert(0,"ONE_");
}
};
@ -198,7 +198,7 @@ public:
*/
Attribute* clone() const
{
return new SingleAttribute(*this);
return new SingleAttribute(*this);
};
private:
@ -246,6 +246,15 @@ public:
*/
string vector_value(const char *name) const;
/**
* Returns the boolean value
* @param name of the attribute
* @param value Bool value ("YES" is true)
*
* @return 0 on success, -1 otherwise
*/
int vector_value(const char *name, bool& value) const;
/**
* Returns the integer value
*
@ -336,7 +345,36 @@ public:
oss << value;
replace(name, oss.str());
}
}
/**
* Replace the value of the given vector attribute
*/
void replace(const string& name, const char* value)
{
string svalue(value);
replace(name, svalue);
}
/**
* Replace the value of the given vector attribute
*/
void replace(const string& name, bool value)
{
string b_value;
if (value == true)
{
b_value = "YES";
}
else
{
b_value = "NO";
}
replace(name, b_value);
}
/**
* Removes given the vector attribute
@ -357,7 +395,7 @@ public:
*/
Attribute* clone() const
{
return new VectorAttribute(*this);
return new VectorAttribute(*this);
};
private:

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* ------------------------------------------------------------------------ */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
@ -32,20 +32,13 @@ class Cluster : public PoolObjectSQL
public:
/**
* Returns the SYSTEM_DS attribute, or the system DS id if it is not defined
* Returns the SYSTEM_DS attribute
*
* @return the SYSTEM_DS attribute, or the system DS id if it is not defined
* @return the SYSTEM_DS attribute
*/
int get_ds_id()
{
int ds_id;
if ( obj_template->get("SYSTEM_DS", ds_id) == false )
{
ds_id = DatastorePool::SYSTEM_DS_ID;
}
return ds_id;
return system_ds;
}
/**
@ -100,32 +93,11 @@ public:
/**
* Adds this datastore ID to the set.
* @param id to be added to the cluster
* @param ds_type Datastore type
* @param error_msg Error message, if any
* @return 0 on success
*/
int add_datastore(int id, string& error_msg)
{
// TODO: should fail for any system DS?
if ( id == DatastorePool::SYSTEM_DS_ID )
{
ostringstream oss;
oss << "Datastore '"<< DatastorePool::SYSTEM_DS_NAME
<< "' cannot be added to any cluster.";
error_msg = oss.str();
return -1;
}
int rc = datastores.add_collection_id(id);
if ( rc < 0 )
{
error_msg = "Datastore ID is already in the cluster set.";
}
return rc;
}
int add_datastore(int id, Datastore::DatastoreType ds_type, string& error_msg);
/**
* Deletes this datastore ID from the set.
@ -133,17 +105,7 @@ public:
* @param error_msg Error message, if any
* @return 0 on success
*/
int del_datastore(int id, string& error_msg)
{
int rc = datastores.del_collection_id(id);
if ( rc < 0 )
{
error_msg = "Datastore ID is not part of the cluster set.";
}
return rc;
}
int del_datastore(int id, string& error_msg);
/**
* Adds this vnet ID to the set.
@ -219,13 +181,18 @@ private:
virtual ~Cluster(){};
// *************************************************************************
// Object Collections (Private)
// Attributes (Private)
// *************************************************************************
ObjectCollection hosts;
ObjectCollection datastores;
ObjectCollection vnets;
/**
* System datastore id
*/
int system_ds;
// *************************************************************************
// DataBase implementation (Private)
// *************************************************************************

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* ------------------------------------------------------------------------ */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* ------------------------------------------------------------------------ */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
@ -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);

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
@ -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, "");
};
};

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
@ -127,6 +127,7 @@ protected:
int gid,
const string& uname,
const string& gname,
int umask,
int type,
Template * _template_contents);

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
@ -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);
};
};

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* ------------------------------------------------------------------------ */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* ------------------------------------------------------------------------ */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* ------------------------------------------------------------------------ */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* ------------------------------------------------------------------------ */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
@ -615,6 +615,7 @@ protected:
int gid,
const string& uname,
const string& gname,
int umask,
ImageTemplate* img_template);
virtual ~Image();

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
@ -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);
};
};

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
@ -62,6 +62,8 @@ public:
ATTACH_FAILURE, /**< Sent by the VMM when an attach action fails */
DETACH_SUCCESS, /**< Sent by the VMM when a detach action succeeds */
DETACH_FAILURE, /**< Sent by the VMM when a detach action fails */
CLEANUP_SUCCESS, /**< Sent by the VMM when a cleanup action succeeds */
CLEANUP_FAILURE, /**< Sent by the VMM when a cleanup action fails */
DEPLOY, /**< Sent by the DM to deploy a VM on a host */
SUSPEND, /**< Sent by the DM to suspend an running VM */
RESTORE, /**< Sent by the DM to restore a suspended VM */
@ -145,7 +147,7 @@ private:
* the history registers
* @param vm with the lock aquired
*/
void clean_up_vm (VirtualMachine *vm);
void clean_up_vm (VirtualMachine *vm, bool dispose);
void save_success_action(int vid);
@ -185,6 +187,8 @@ private:
void detach_failure_action(int vid);
void cleanup_callback_action(int vid);
void deploy_action(int vid);
void suspend_action(int vid);

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
@ -288,11 +288,19 @@ public:
return oss.str();
};
/**
* Returns the name of the host running oned
* @return the name
*/
const string& get_nebula_hostname()
{
return hostname;
};
/**
* Returns the version of oned
* @return the version
*/
static string version()
{
return "OpenNebula 3.9.0";
@ -303,32 +311,74 @@ public:
return "3.9.0";
}
/**
* Starts all the modules and services for OpenNebula
*/
void start();
// -----------------------------------------------------------------------
// Configuration attributes (read from oned.conf)
// -----------------------------------------------------------------------
/**
* Gets a configuration attribute for oned
* @param name of the attribute
* @param value of the attribute
*/
void get_configuration_attribute(
const char * name,
string& value) const
{
string _name(name);
nebula_configuration->Template::get(_name,value);
nebula_configuration->Template::get(_name, value);
};
/**
* Gets a configuration attribute for oned, bool version
*/
void get_configuration_attribute(
const char * name,
bool& value) const
{
string _name(name);
nebula_configuration->Template::get(_name, value);
};
/**
* Gets an XML document with all of the configuration attributes
* @return the XML
*/
string get_configuration_xml() const
{
string xml;
return nebula_configuration->to_xml(xml);
};
// -----------------------------------------------------------------------
// Default Quotas
// -----------------------------------------------------------------------
/**
* Get the default quotas for OpenNebula users
* @return the default quotas
*/
const DefaultQuotas& get_default_user_quota()
{
return default_user_quota;
};
/**
* Set the default quotas for OpenNebula users
* @param tmpl template with the default quotas
* @param error describes the error if any
*
* @return 0 if success
*/
int set_default_user_quota(Template *tmpl, string& error)
{
int rc;
rc = default_user_quota.set(tmpl, error);
int rc = default_user_quota.set(tmpl, error);
if ( rc == 0 )
{
@ -338,15 +388,25 @@ public:
return rc;
};
/**
* Get the default quotas for OpenNebula for groups
* @return the default quotas
*/
const DefaultQuotas& get_default_group_quota()
{
return default_group_quota;
};
/**
* Set the default quotas for OpenNebula groups
* @param tmpl template with the default quotas
* @param error describes the error if any
*
* @return 0 if success
*/
int set_default_group_quota(Template *tmpl, string& error)
{
int rc;
rc = default_group_quota.set(tmpl, error);
int rc = default_group_quota.set(tmpl, error);
if ( rc == 0 )
{

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
@ -148,6 +148,18 @@ public:
*/
int get_nodes(const char * xpath_expr, vector<xmlNodePtr>& content);
/**
* Adds a copy of the node as a child of the node in the xpath expression.
* The source node must be cleaned by the caller.
*
* @param xpath_expr Path of the parent node
* @param node Node copy and add
* @param new_name New name for the node copy
*
* @return 0 on success, -1 otherwise
*/
int add_node(const char * xpath_expr, xmlNodePtr node, const char * new_name);
/**
* Frees a vector of XMLNodes, as returned by the get_nodes function
* @param content the vector of xmlNodePtr

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
@ -34,6 +34,7 @@ public:
oid(-1),
uid(-1),
gid(-1),
cid(-1),
owner_u(1),
owner_m(1),
owner_a(0),
@ -60,6 +61,7 @@ public:
int oid;
int uid;
int gid;
int cid;
int owner_u;
int owner_m;

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
@ -110,7 +110,7 @@ public:
other_u(0),
other_m(0),
other_a(0),
obj_template(0),
obj_template(0),
table(_table)
{
pthread_mutex_init(&mutex,0);
@ -164,7 +164,7 @@ public:
{
return gname;
};
/**
* Changes the object's owner
* @param _uid New User ID
@ -349,6 +349,21 @@ public:
return obj_template->get(name,value);
}
/**
* Gets a boolean attribute (single) (YES = true)
* @param name of the attribute
* @param value of the attribute (True if "YES", false otherwise)
*
* @return True if the Single attribute was found and is a valid boolean
* value
*/
bool get_template_attribute(
const char * name,
bool& value) const
{
return obj_template->get(name,value);
}
/**
* Adds a new attribute to the template (replacing it if
* already defined), the object's mutex SHOULD be locked
@ -503,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
*/

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
@ -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)
@ -86,11 +88,20 @@ protected:
return ClusterPool::NONE_CLUSTER_ID;
};
virtual int add_to_cluster(Cluster* cluster, int id, string& error_msg)
virtual int add_to_cluster(
Cluster* cluster,
int id,
Datastore::DatastoreType ds_type,
string& error_msg)
{
return -1;
};
virtual Datastore::DatastoreType get_ds_type(int oid)
{
return Datastore::FILE_DS;
};
protected:
ClusterPool * clpool;
@ -130,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,
@ -169,14 +181,19 @@ 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)
{
return xmlrpc_c::value_int(paramList.getInt(2));
};
int add_to_cluster(Cluster* cluster, int id, string& error_msg)
int add_to_cluster(
Cluster* cluster,
int id,
Datastore::DatastoreType ds_type,
string& error_msg)
{
return cluster->add_vnet(id, error_msg);
};
@ -237,7 +254,8 @@ public:
Template * tmpl,
int& id,
string& error_str,
RequestAttributes& att);
RequestAttributes& att,
int umask);
};
/* ------------------------------------------------------------------------- */
@ -267,14 +285,19 @@ 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)
{
return xmlrpc_c::value_int(paramList.getInt(5));
};
int add_to_cluster(Cluster* cluster, int id, string& error_msg)
int add_to_cluster(
Cluster* cluster,
int id,
Datastore::DatastoreType ds_type,
string& error_msg)
{
return cluster->add_host(id, error_msg);
};
@ -303,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,
@ -334,7 +358,8 @@ public:
Template * tmpl,
int& id,
string& error_str,
RequestAttributes& att);
RequestAttributes& att,
int umask);
};
/* ------------------------------------------------------------------------- */
@ -369,16 +394,35 @@ 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)
{
return xmlrpc_c::value_int(paramList.getInt(2));
};
int add_to_cluster(Cluster* cluster, int id, string& error_msg)
virtual Datastore::DatastoreType get_ds_type(int oid)
{
return cluster->add_datastore(id, error_msg);
Datastore::DatastoreType ds_type = Datastore::FILE_DS;
Datastore *ds = static_cast<DatastorePool*>(pool)->get(oid, true);
if ( ds != 0 )
{
ds_type = ds->get_type();
ds->unlock();
}
return ds_type;
};
int add_to_cluster(
Cluster* cluster,
int id,
Datastore::DatastoreType ds_type,
string& error_msg)
{
return cluster->add_datastore(id, ds_type, error_msg);
};
};
@ -405,7 +449,8 @@ public:
Template * tmpl,
int& id,
string& error_str,
RequestAttributes& att);
RequestAttributes& att,
int umask);
};
/* ------------------------------------------------------------------------- */
@ -438,7 +483,8 @@ public:
Template * tmpl,
int& id,
string& error_str,
RequestAttributes& att);
RequestAttributes& att,
int umask);
};
/* -------------------------------------------------------------------------- */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
@ -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);
};
};

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
@ -65,7 +65,24 @@ protected:
PoolSQL * pool,
PoolObjectSQL::ObjectType type);
virtual int add_object(Cluster* cluster, int id, string& error_msg) = 0;
virtual Datastore::DatastoreType get_ds_type(PoolObjectSQL *obj)
{
return Datastore::FILE_DS;
};
/**
* Add object to cluster id collection
* @param cluster where to add the object
* @param id of the object
* @param ds_type Datastore type, will be ignored for different objects
* @param error_msg Error reason, if any
* @return 0 on success
*/
virtual int add_object(
Cluster* cluster,
int id,
Datastore::DatastoreType ds_type,
string& error_msg) = 0;
virtual int del_object(Cluster* cluster, int id, string& error_msg) = 0;
@ -86,7 +103,11 @@ public:
~RequestManagerClusterHost(){};
virtual int add_object(Cluster* cluster, int id, string& error_msg)
virtual int add_object(
Cluster* cluster,
int id,
Datastore::DatastoreType ds_type,
string& error_msg)
{
return cluster->add_host(id, error_msg);
};
@ -169,9 +190,18 @@ public:
~RequestManagerClusterDatastore(){};
virtual int add_object(Cluster* cluster, int id, string& error_msg)
virtual Datastore::DatastoreType get_ds_type(PoolObjectSQL *obj)
{
return cluster->add_datastore(id, error_msg);
return static_cast<Datastore*>(obj)->get_type();
};
virtual int add_object(
Cluster* cluster,
int id,
Datastore::DatastoreType ds_type,
string& error_msg)
{
return cluster->add_datastore(id, ds_type, error_msg);
};
virtual int del_object(Cluster* cluster, int id, string& error_msg)
@ -253,7 +283,11 @@ public:
~RequestManagerClusterVNet(){};
virtual int add_object(Cluster* cluster, int id, string& error_msg)
virtual int add_object(
Cluster* cluster,
int id,
Datastore::DatastoreType ds_type,
string& error_msg)
{
return cluster->add_vnet(id, error_msg);
};

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
@ -268,6 +268,8 @@ public:
};
~ClusterDelete(){};
int drop(int oid, PoolObjectSQL * object, string& error_msg);
};
/* ------------------------------------------------------------------------- */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
@ -53,7 +53,7 @@ public:
TemplateUpdateTemplate():
RequestManagerUpdateTemplate("TemplateUpdateTemplate",
"Updates a virtual machine template")
{
{
Nebula& nd = Nebula::instance();
pool = nd.get_tpool();
auth_object = PoolObjectSQL::TEMPLATE;
@ -65,13 +65,31 @@ public:
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class VirtualMachineUpdateTemplate: public RequestManagerUpdateTemplate
{
public:
VirtualMachineUpdateTemplate():
RequestManagerUpdateTemplate("VirtualMachineUpdateTemplate",
"Updates a virtual machine user template")
{
Nebula& nd = Nebula::instance();
pool = nd.get_vmpool();
auth_object = PoolObjectSQL::VM;
};
~VirtualMachineUpdateTemplate(){};
};
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
class ImageUpdateTemplate: public RequestManagerUpdateTemplate
{
public:
ImageUpdateTemplate():
RequestManagerUpdateTemplate("ImageUpdateTemplate",
"Updates an image template")
{
{
Nebula& nd = Nebula::instance();
pool = nd.get_ipool();
auth_object = PoolObjectSQL::IMAGE;
@ -89,10 +107,11 @@ public:
HostUpdateTemplate():
RequestManagerUpdateTemplate("HostUpdateTemplate",
"Updates a host template")
{
{
Nebula& nd = Nebula::instance();
pool = nd.get_hpool();
auth_object = PoolObjectSQL::HOST;
auth_op = AuthRequest::ADMIN;
};
~HostUpdateTemplate(){};
@ -107,7 +126,7 @@ public:
VirtualNetworkUpdateTemplate():
RequestManagerUpdateTemplate("VirtualNetworkUpdateTemplate",
"Updates a vnet template")
{
{
Nebula& nd = Nebula::instance();
pool = nd.get_vnpool();
auth_object = PoolObjectSQL::NET;
@ -125,7 +144,7 @@ public:
UserUpdateTemplate():
RequestManagerUpdateTemplate("UserUpdateTemplate",
"Updates a user template")
{
{
Nebula& nd = Nebula::instance();
pool = nd.get_upool();
auth_object = PoolObjectSQL::USER;

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* ------------------------------------------------------------------------ */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
@ -278,6 +278,22 @@ public:
const string& name,
bool& value) const;
/**
* Trims the trailing spaces in the NAME attribute
* @return True if the attribute was found and trimmed
*/
virtual bool trim_name()
{
return trim("NAME");
};
/**
* Trims the trailing spaces in the attribute
* @param name of the attribute
* @return True if the attribute was found and trimmed
*/
virtual bool trim(const string& name);
friend ostream& operator<<(ostream& os, const Template& t);
/**

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
@ -54,6 +54,7 @@ public:
EPILOG_DELETE,
EPILOG_DELETE_PREVIOUS,
EPILOG_DELETE_STOP,
EPILOG_DELETE_BOTH,
CHECKPOINT,
DRIVER_CANCEL,
FINALIZE
@ -138,6 +139,20 @@ public:
VirtualMachine * vm,
ostream& xfr);
/**
* This function generates the the epilog_delete sequence for current,
* front-end and previous hosts.
* @param vm pointer to VM, locked
* @param xfr stream to write the commands
* @param local true to delete the front-end
* @param previous true to delete the previous host
*
* @return 0 on success
*/
int epilog_delete_commands(VirtualMachine *vm,
ostream& xfr,
bool local,
bool previous);
private:
/**
* Thread id for the Transfer Manager
@ -247,7 +262,8 @@ private:
void epilog_stop_action(int vid);
/**
* This function starts the epilog_delete sequence
* This function starts the epilog_delete sequence in the current host
* @param vid the Virtual Machine ID
*/
void epilog_delete_action(int vid)
{
@ -256,22 +272,32 @@ private:
/**
* This function starts the epilog_delete_stop sequence on the local host
* i.e. the front-end (the VM is not running)
* @param vid the Virtual Machine ID
*/
void epilog_delete_stop_action(int vid)
{
epilog_delete_action(true, vid);
}
/**
* This function starts the epilog_delete sequence on the previous host
* @param vid the Virtual Machine ID
*/
void epilog_delete_previous_action(int vid);
/**
* This function starts the epilog_delete sequence on the current and
* previous hosts
* @param vid the Virtual Machine ID
*/
void epilog_delete_both_action(int vid);
/**
* This function starts the epilog_delete sequence
*/
void epilog_delete_action(bool local, int vid);
/**
* This function starts the epilog_delete sequence on the previous host
*/
void epilog_delete_previous_action(int vid);
/**
* This function starts the epilog sequence
*/

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
@ -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

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
@ -117,6 +117,7 @@ protected:
int gid,
const string& uname,
const string& gname,
int umask,
VirtualMachineTemplate * _template_contents);
~VMTemplate();

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
@ -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);
};
};

View File

@ -1,5 +1,5 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2012, OpenNebula Project Leads (OpenNebula.org) */
/* Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
@ -81,14 +81,15 @@ public:
SHUTDOWN = 12,
CANCEL = 13,
FAILURE = 14,
CLEANUP = 15,
CLEANUP_RESUBMIT = 15,
UNKNOWN = 16,
HOTPLUG = 17,
SHUTDOWN_POWEROFF = 18,
BOOT_UNKNOWN = 19,
BOOT_POWEROFF = 20,
BOOT_SUSPENDED = 21,
BOOT_STOPPED = 22
BOOT_STOPPED = 22,
CLEANUP_DELETE = 23
};
// -------------------------------------------------------------------------
@ -702,6 +703,13 @@ public:
*(static_cast<VirtualMachineTemplate *>(obj_template)));
};
/**
* This function replaces the *user template*.
* @param tmpl_str new contents
* @param error string describing the error if any
* @return 0 on success
*/
int replace_template(const string& tmpl_str, string& error);
// ------------------------------------------------------------------------
// States
@ -1044,6 +1052,12 @@ private:
*/
FileLog * _log;
/**
* User template to store custom metadata. This template can be updated
*
*/
Template * user_obj_template;
// *************************************************************************
// DataBase implementation (Private)
// *************************************************************************
@ -1207,6 +1221,7 @@ protected:
int gid,
const string& uname,
const string& gname,
int umask,
VirtualMachineTemplate * _vm_template);
virtual ~VirtualMachine();

Some files were not shown because too many files have changed in this diff Show More