Merge "fix restructuredtext formatting in docstrings that show up in the developer guide"
This commit is contained in:
		@@ -20,6 +20,7 @@ do
 | 
				
			|||||||
  ( cat <<EOF
 | 
					  ( cat <<EOF
 | 
				
			||||||
${heading}
 | 
					${heading}
 | 
				
			||||||
${underline}
 | 
					${underline}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.. automodule:: ${x}
 | 
					.. automodule:: ${x}
 | 
				
			||||||
  :members:
 | 
					  :members:
 | 
				
			||||||
  :undoc-members:
 | 
					  :undoc-members:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -96,7 +96,7 @@ exclude_trees = []
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# If true, the current module name will be prepended to all description
 | 
					# If true, the current module name will be prepended to all description
 | 
				
			||||||
# unit titles (such as .. function::).
 | 
					# unit titles (such as .. function::).
 | 
				
			||||||
#add_module_names = True
 | 
					add_module_names = False
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# If true, sectionauthor and moduleauthor directives will be shown in the
 | 
					# If true, sectionauthor and moduleauthor directives will be shown in the
 | 
				
			||||||
# output. They are ignored by default.
 | 
					# output. They are ignored by default.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -244,9 +244,9 @@ class FakeLDAP(object):
 | 
				
			|||||||
    def modify_s(self, dn, attrs):
 | 
					    def modify_s(self, dn, attrs):
 | 
				
			||||||
        """Modify the object at dn using the attribute list.
 | 
					        """Modify the object at dn using the attribute list.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        Args:
 | 
					        :param dn: a dn
 | 
				
			||||||
        dn -- a dn
 | 
					        :param attrs: a list of tuples in the following form::
 | 
				
			||||||
        attrs -- a list of tuples in the following form:
 | 
					
 | 
				
			||||||
            ([MOD_ADD | MOD_DELETE | MOD_REPACE], attribute, value)
 | 
					            ([MOD_ADD | MOD_DELETE | MOD_REPACE], attribute, value)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -126,11 +126,17 @@ class User(AuthBase):
 | 
				
			|||||||
    """Object representing a user
 | 
					    """Object representing a user
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    The following attributes are defined:
 | 
					    The following attributes are defined:
 | 
				
			||||||
    :id:       A system identifier for the user.  A string (for LDAP)
 | 
					
 | 
				
			||||||
    :name:     The user name, potentially in some more friendly format
 | 
					    ``id``
 | 
				
			||||||
    :access:   The 'username' for EC2 authentication
 | 
					      A system identifier for the user.  A string (for LDAP)
 | 
				
			||||||
    :secret:   The 'password' for EC2 authenticatoin
 | 
					    ``name``
 | 
				
			||||||
    :admin:    ???
 | 
					      The user name, potentially in some more friendly format
 | 
				
			||||||
 | 
					    ``access``
 | 
				
			||||||
 | 
					      The 'username' for EC2 authentication
 | 
				
			||||||
 | 
					    ``secret``
 | 
				
			||||||
 | 
					      The 'password' for EC2 authenticatoin
 | 
				
			||||||
 | 
					    ``admin``
 | 
				
			||||||
 | 
					      ???
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __init__(self, id, name, access, secret, admin):
 | 
					    def __init__(self, id, name, access, secret, admin):
 | 
				
			||||||
@@ -256,35 +262,35 @@ class AuthManager(object):
 | 
				
			|||||||
        a project with the same name as the user. This way, older tools
 | 
					        a project with the same name as the user. This way, older tools
 | 
				
			||||||
        that have no project knowledge will still work.
 | 
					        that have no project knowledge will still work.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @type access: str
 | 
					        :type access: str
 | 
				
			||||||
        @param access: Access key for user in the form "access:project".
 | 
					        :param access: Access key for user in the form "access:project".
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @type signature: str
 | 
					        :type signature: str
 | 
				
			||||||
        @param signature: Signature of the request.
 | 
					        :param signature: Signature of the request.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @type params: list of str
 | 
					        :type params: list of str
 | 
				
			||||||
        @param params: Web paramaters used for the signature.
 | 
					        :param params: Web paramaters used for the signature.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @type verb: str
 | 
					        :type verb: str
 | 
				
			||||||
        @param verb: Web request verb ('GET' or 'POST').
 | 
					        :param verb: Web request verb ('GET' or 'POST').
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @type server_string: str
 | 
					        :type server_string: str
 | 
				
			||||||
        @param server_string: Web request server string.
 | 
					        :param server_string: Web request server string.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @type path: str
 | 
					        :type path: str
 | 
				
			||||||
        @param path: Web request path.
 | 
					        :param path: Web request path.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @type check_type: str
 | 
					        :type check_type: str
 | 
				
			||||||
        @param check_type: Type of signature to check. 'ec2' for EC2, 's3' for
 | 
					        :param check_type: Type of signature to check. 'ec2' for EC2, 's3' for
 | 
				
			||||||
                           S3. Any other value will cause signature not to be
 | 
					                           S3. Any other value will cause signature not to be
 | 
				
			||||||
                           checked.
 | 
					                           checked.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @type headers: list
 | 
					        :type headers: list
 | 
				
			||||||
        @param headers: HTTP headers passed with the request (only needed for
 | 
					        :param headers: HTTP headers passed with the request (only needed for
 | 
				
			||||||
                        s3 signature checks)
 | 
					                        s3 signature checks)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @rtype: tuple (User, Project)
 | 
					        :rtype: tuple (User, Project)
 | 
				
			||||||
        @return: User and project that the request represents.
 | 
					        :return: User and project that the request represents.
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        # TODO(vish): check for valid timestamp
 | 
					        # TODO(vish): check for valid timestamp
 | 
				
			||||||
        (access_key, _sep, project_id) = access.partition(':')
 | 
					        (access_key, _sep, project_id) = access.partition(':')
 | 
				
			||||||
@@ -362,11 +368,11 @@ class AuthManager(object):
 | 
				
			|||||||
    def is_superuser(self, user):
 | 
					    def is_superuser(self, user):
 | 
				
			||||||
        """Checks for superuser status, allowing user to bypass authorization
 | 
					        """Checks for superuser status, allowing user to bypass authorization
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @type user: User or uid
 | 
					        :type user: User or uid
 | 
				
			||||||
        @param user: User to check.
 | 
					        :param user: User to check.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @rtype: bool
 | 
					        :rtype: bool
 | 
				
			||||||
        @return: True for superuser.
 | 
					        :return: True for superuser.
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        if not isinstance(user, User):
 | 
					        if not isinstance(user, User):
 | 
				
			||||||
            user = self.get_user(user)
 | 
					            user = self.get_user(user)
 | 
				
			||||||
@@ -380,11 +386,11 @@ class AuthManager(object):
 | 
				
			|||||||
    def is_admin(self, user):
 | 
					    def is_admin(self, user):
 | 
				
			||||||
        """Checks for admin status, allowing user to access all projects
 | 
					        """Checks for admin status, allowing user to access all projects
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @type user: User or uid
 | 
					        :type user: User or uid
 | 
				
			||||||
        @param user: User to check.
 | 
					        :param user: User to check.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @rtype: bool
 | 
					        :rtype: bool
 | 
				
			||||||
        @return: True for admin.
 | 
					        :return: True for admin.
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        if not isinstance(user, User):
 | 
					        if not isinstance(user, User):
 | 
				
			||||||
            user = self.get_user(user)
 | 
					            user = self.get_user(user)
 | 
				
			||||||
@@ -426,17 +432,17 @@ class AuthManager(object):
 | 
				
			|||||||
        see if the user is the project_manager of the specified project. It
 | 
					        see if the user is the project_manager of the specified project. It
 | 
				
			||||||
        is the same as calling is_project_manager(user, project).
 | 
					        is the same as calling is_project_manager(user, project).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @type user: User or uid
 | 
					        :type user: User or uid
 | 
				
			||||||
        @param user: User to check.
 | 
					        :param user: User to check.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @type role: str
 | 
					        :type role: str
 | 
				
			||||||
        @param role: Role to check.
 | 
					        :param role: Role to check.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @type project: Project or project_id
 | 
					        :type project: Project or project_id
 | 
				
			||||||
        @param project: Project in which to look for local role.
 | 
					        :param project: Project in which to look for local role.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @rtype: bool
 | 
					        :rtype: bool
 | 
				
			||||||
        @return: True if the user has the role.
 | 
					        :return: True if the user has the role.
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        if role == 'projectmanager':
 | 
					        if role == 'projectmanager':
 | 
				
			||||||
            if not project:
 | 
					            if not project:
 | 
				
			||||||
@@ -465,14 +471,14 @@ class AuthManager(object):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        The 'projectmanager' role is special and can't be added or removed.
 | 
					        The 'projectmanager' role is special and can't be added or removed.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @type user: User or uid
 | 
					        :type user: User or uid
 | 
				
			||||||
        @param user: User to which to add role.
 | 
					        :param user: User to which to add role.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @type role: str
 | 
					        :type role: str
 | 
				
			||||||
        @param role: Role to add.
 | 
					        :param role: Role to add.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @type project: Project or project_id
 | 
					        :type project: Project or project_id
 | 
				
			||||||
        @param project: Project in which to add local role.
 | 
					        :param project: Project in which to add local role.
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        if role not in FLAGS.allowed_roles:
 | 
					        if role not in FLAGS.allowed_roles:
 | 
				
			||||||
            raise exception.UserRoleNotFound(role_id=role)
 | 
					            raise exception.UserRoleNotFound(role_id=role)
 | 
				
			||||||
@@ -498,14 +504,14 @@ class AuthManager(object):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        The 'projectmanager' role is special and can't be added or removed.
 | 
					        The 'projectmanager' role is special and can't be added or removed.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @type user: User or uid
 | 
					        :type user: User or uid
 | 
				
			||||||
        @param user: User from which to remove role.
 | 
					        :param user: User from which to remove role.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @type role: str
 | 
					        :type role: str
 | 
				
			||||||
        @param role: Role to remove.
 | 
					        :param role: Role to remove.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @type project: Project or project_id
 | 
					        :type project: Project or project_id
 | 
				
			||||||
        @param project: Project in which to remove local role.
 | 
					        :param project: Project in which to remove local role.
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        uid = User.safe_id(user)
 | 
					        uid = User.safe_id(user)
 | 
				
			||||||
        pid = Project.safe_id(project)
 | 
					        pid = Project.safe_id(project)
 | 
				
			||||||
@@ -560,23 +566,23 @@ class AuthManager(object):
 | 
				
			|||||||
                       member_users=None):
 | 
					                       member_users=None):
 | 
				
			||||||
        """Create a project
 | 
					        """Create a project
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @type name: str
 | 
					        :type name: str
 | 
				
			||||||
        @param name: Name of the project to create. The name will also be
 | 
					        :param name: Name of the project to create. The name will also be
 | 
				
			||||||
        used as the project id.
 | 
					        used as the project id.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @type manager_user: User or uid
 | 
					        :type manager_user: User or uid
 | 
				
			||||||
        @param manager_user: This user will be the project manager.
 | 
					        :param manager_user: This user will be the project manager.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @type description: str
 | 
					        :type description: str
 | 
				
			||||||
        @param project: Description of the project. If no description is
 | 
					        :param project: Description of the project. If no description is
 | 
				
			||||||
        specified, the name of the project will be used.
 | 
					        specified, the name of the project will be used.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @type member_users: list of User or uid
 | 
					        :type member_users: list of User or uid
 | 
				
			||||||
        @param: Initial project members. The project manager will always be
 | 
					        :param: Initial project members. The project manager will always be
 | 
				
			||||||
        added as a member, even if he isn't specified in this list.
 | 
					        added as a member, even if he isn't specified in this list.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @rtype: Project
 | 
					        :rtype: Project
 | 
				
			||||||
        @return: The new project.
 | 
					        :return: The new project.
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        if member_users:
 | 
					        if member_users:
 | 
				
			||||||
            member_users = [User.safe_id(u) for u in member_users]
 | 
					            member_users = [User.safe_id(u) for u in member_users]
 | 
				
			||||||
@@ -594,14 +600,14 @@ class AuthManager(object):
 | 
				
			|||||||
    def modify_project(self, project, manager_user=None, description=None):
 | 
					    def modify_project(self, project, manager_user=None, description=None):
 | 
				
			||||||
        """Modify a project
 | 
					        """Modify a project
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @type name: Project or project_id
 | 
					        :type name: Project or project_id
 | 
				
			||||||
        @param project: The project to modify.
 | 
					        :param project: The project to modify.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @type manager_user: User or uid
 | 
					        :type manager_user: User or uid
 | 
				
			||||||
        @param manager_user: This user will be the new project manager.
 | 
					        :param manager_user: This user will be the new project manager.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @type description: str
 | 
					        :type description: str
 | 
				
			||||||
        @param project: This will be the new description of the project.
 | 
					        :param project: This will be the new description of the project.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        LOG.audit(_("modifying project %s"), Project.safe_id(project))
 | 
					        LOG.audit(_("modifying project %s"), Project.safe_id(project))
 | 
				
			||||||
@@ -645,11 +651,11 @@ class AuthManager(object):
 | 
				
			|||||||
    def get_project_vpn_data(project):
 | 
					    def get_project_vpn_data(project):
 | 
				
			||||||
        """Gets vpn ip and port for project
 | 
					        """Gets vpn ip and port for project
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @type project: Project or project_id
 | 
					        :type project: Project or project_id
 | 
				
			||||||
        @param project: Project from which to get associated vpn data
 | 
					        :param project: Project from which to get associated vpn data
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @rvalue: tuple of (str, str)
 | 
					        :rvalue: tuple of (str, str)
 | 
				
			||||||
        @return: A tuple containing (ip, port) or None, None if vpn has
 | 
					        :return: A tuple containing (ip, port) or None, None if vpn has
 | 
				
			||||||
                 not been allocated for user.
 | 
					                 not been allocated for user.
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -696,24 +702,24 @@ class AuthManager(object):
 | 
				
			|||||||
    def create_user(self, name, access=None, secret=None, admin=False):
 | 
					    def create_user(self, name, access=None, secret=None, admin=False):
 | 
				
			||||||
        """Creates a user
 | 
					        """Creates a user
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @type name: str
 | 
					        :type name: str
 | 
				
			||||||
        @param name: Name of the user to create.
 | 
					        :param name: Name of the user to create.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @type access: str
 | 
					        :type access: str
 | 
				
			||||||
        @param access: Access Key (defaults to a random uuid)
 | 
					        :param access: Access Key (defaults to a random uuid)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @type secret: str
 | 
					        :type secret: str
 | 
				
			||||||
        @param secret: Secret Key (defaults to a random uuid)
 | 
					        :param secret: Secret Key (defaults to a random uuid)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @type admin: bool
 | 
					        :type admin: bool
 | 
				
			||||||
        @param admin: Whether to set the admin flag. The admin flag gives
 | 
					        :param admin: Whether to set the admin flag. The admin flag gives
 | 
				
			||||||
        superuser status regardless of roles specified for the user.
 | 
					        superuser status regardless of roles specified for the user.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @type create_project: bool
 | 
					        :type create_project: bool
 | 
				
			||||||
        @param: Whether to create a project for the user with the same name.
 | 
					        :param: Whether to create a project for the user with the same name.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @rtype: User
 | 
					        :rtype: User
 | 
				
			||||||
        @return: The new user.
 | 
					        :return: The new user.
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        if access is None:
 | 
					        if access is None:
 | 
				
			||||||
            access = str(uuid.uuid4())
 | 
					            access = str(uuid.uuid4())
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -49,26 +49,40 @@ def enforce(match_list, target_dict, credentials_dict):
 | 
				
			|||||||
    """Enforces authorization of some rules against credentials.
 | 
					    """Enforces authorization of some rules against credentials.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    :param match_list: nested tuples of data to match against
 | 
					    :param match_list: nested tuples of data to match against
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        The basic brain supports three types of match lists:
 | 
					        The basic brain supports three types of match lists:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            1) rules
 | 
					            1) rules
 | 
				
			||||||
            looks like: ('rule:compute:get_instance',)
 | 
					
 | 
				
			||||||
 | 
					                looks like: ``('rule:compute:get_instance',)``
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                Retrieves the named rule from the rules dict and recursively
 | 
					                Retrieves the named rule from the rules dict and recursively
 | 
				
			||||||
                checks against the contents of the rule.
 | 
					                checks against the contents of the rule.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            2) roles
 | 
					            2) roles
 | 
				
			||||||
            looks like: ('role:compute:admin',)
 | 
					
 | 
				
			||||||
 | 
					                looks like: ``('role:compute:admin',)``
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                Matches if the specified role is in credentials_dict['roles'].
 | 
					                Matches if the specified role is in credentials_dict['roles'].
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            3) generic
 | 
					            3) generic
 | 
				
			||||||
            ('tenant_id:%(tenant_id)s',)
 | 
					
 | 
				
			||||||
 | 
					                looks like: ``('tenant_id:%(tenant_id)s',)``
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                Substitutes values from the target dict into the match using
 | 
					                Substitutes values from the target dict into the match using
 | 
				
			||||||
                the % operator and matches them against the creds dict.
 | 
					                the % operator and matches them against the creds dict.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        Combining rules:
 | 
					        Combining rules:
 | 
				
			||||||
        The brain returns True if any of the outer tuple of rules match
 | 
					
 | 
				
			||||||
        and also True if all of the inner tuples match. You can use this to
 | 
					            The brain returns True if any of the outer tuple of rules
 | 
				
			||||||
        perform simple boolean logic.  For example, the following rule would
 | 
					            match and also True if all of the inner tuples match. You
 | 
				
			||||||
        return True if the creds contain the role 'admin' OR the if the
 | 
					            can use this to perform simple boolean logic.  For
 | 
				
			||||||
        tenant_id matches the target dict AND the the creds contains the
 | 
					            example, the following rule would return True if the creds
 | 
				
			||||||
        role 'compute_sysadmin':
 | 
					            contain the role 'admin' OR the if the tenant_id matches
 | 
				
			||||||
 | 
					            the target dict AND the the creds contains the role
 | 
				
			||||||
 | 
					            'compute_sysadmin':
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            ::
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    "rule:combined": (
 | 
					                    "rule:combined": (
 | 
				
			||||||
@@ -77,21 +91,22 @@ def enforce(match_list, target_dict, credentials_dict):
 | 
				
			|||||||
                    )
 | 
					                    )
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
        Note that rule and role are reserved words in the credentials match, so
 | 
					        Note that rule and role are reserved words in the credentials match, so
 | 
				
			||||||
        you can't match against properties with those names. Custom brains may
 | 
					        you can't match against properties with those names. Custom brains may
 | 
				
			||||||
        also add new reserved words. For example, the HttpBrain adds http as a
 | 
					        also add new reserved words. For example, the HttpBrain adds http as a
 | 
				
			||||||
        reserved word.
 | 
					        reserved word.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    :param target_dict: dict of object properties
 | 
					    :param target_dict: dict of object properties
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      Target dicts contain as much information as we can about the object being
 | 
					      Target dicts contain as much information as we can about the object being
 | 
				
			||||||
      operated on.
 | 
					      operated on.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    :param credentials_dict: dict of actor properties
 | 
					    :param credentials_dict: dict of actor properties
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      Credentials dicts contain as much information as we can about the user
 | 
					      Credentials dicts contain as much information as we can about the user
 | 
				
			||||||
      performing the action.
 | 
					      performing the action.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    :raises NotAuthorized if the check fails
 | 
					    :raises NotAuthorized: if the check fails
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
    global _BRAIN
 | 
					    global _BRAIN
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -173,7 +173,7 @@ def handle_flagfiles(args, tempdir=None):
 | 
				
			|||||||
def handle_flagfiles_managed(args):
 | 
					def handle_flagfiles_managed(args):
 | 
				
			||||||
    '''A context manager for handle_flagfiles() which removes temp files.
 | 
					    '''A context manager for handle_flagfiles() which removes temp files.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    For use with the 'with' statement, i.e.
 | 
					    For use with the 'with' statement, i.e.::
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        with handle_flagfiles_managed(args) as args:
 | 
					        with handle_flagfiles_managed(args) as args:
 | 
				
			||||||
             # Do stuff
 | 
					             # Do stuff
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -79,28 +79,28 @@ def publisher_id(service, host=None):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def notify(publisher_id, event_type, priority, payload):
 | 
					def notify(publisher_id, event_type, priority, payload):
 | 
				
			||||||
    """
 | 
					    """Sends a notification using the specified driver
 | 
				
			||||||
    Sends a notification using the specified driver
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Notify parameters:
 | 
					    :param publisher_id: the source worker_type.host of the message
 | 
				
			||||||
 | 
					    :param event_type:   the literal type of event (ex. Instance Creation)
 | 
				
			||||||
    publisher_id - the source worker_type.host of the message
 | 
					    :param priority:     patterned after the enumeration of Python logging
 | 
				
			||||||
    event_type - the literal type of event (ex. Instance Creation)
 | 
					                         levels in the set (DEBUG, WARN, INFO, ERROR, CRITICAL)
 | 
				
			||||||
    priority - patterned after the enumeration of Python logging levels in
 | 
					    :param payload:       A python dictionary of attributes
 | 
				
			||||||
               the set (DEBUG, WARN, INFO, ERROR, CRITICAL)
 | 
					 | 
				
			||||||
    payload - A python dictionary of attributes
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Outgoing message format includes the above parameters, and appends the
 | 
					    Outgoing message format includes the above parameters, and appends the
 | 
				
			||||||
    following:
 | 
					    following:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    message_id - a UUID representing the id for this notification
 | 
					    message_id
 | 
				
			||||||
    timestamp - the GMT timestamp the notification was sent at
 | 
					      a UUID representing the id for this notification
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    timestamp
 | 
				
			||||||
 | 
					      the GMT timestamp the notification was sent at
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    The composite message will be constructed as a dictionary of the above
 | 
					    The composite message will be constructed as a dictionary of the above
 | 
				
			||||||
    attributes, which will then be sent via the transport mechanism defined
 | 
					    attributes, which will then be sent via the transport mechanism defined
 | 
				
			||||||
    by the driver.
 | 
					    by the driver.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Message example:
 | 
					    Message example::
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        {'message_id': str(uuid.uuid4()),
 | 
					        {'message_id': str(uuid.uuid4()),
 | 
				
			||||||
         'publisher_id': 'compute.host1',
 | 
					         'publisher_id': 'compute.host1',
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,7 +17,9 @@
 | 
				
			|||||||
r"""
 | 
					r"""
 | 
				
			||||||
Configuration options which may be set on the command line or in config files.
 | 
					Configuration options which may be set on the command line or in config files.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
The schema for each option is defined using the Opt sub-classes e.g.
 | 
					The schema for each option is defined using the Opt sub-classes, e.g.:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					::
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    common_opts = [
 | 
					    common_opts = [
 | 
				
			||||||
        cfg.StrOpt('bind_host',
 | 
					        cfg.StrOpt('bind_host',
 | 
				
			||||||
@@ -28,7 +30,7 @@ The schema for each option is defined using the Opt sub-classes e.g.
 | 
				
			|||||||
                   help='Port number to listen on')
 | 
					                   help='Port number to listen on')
 | 
				
			||||||
    ]
 | 
					    ]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Options can be strings, integers, floats, booleans, lists or 'multi strings':
 | 
					Options can be strings, integers, floats, booleans, lists or 'multi strings'::
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    enabled_apis_opt = cfg.ListOpt('enabled_apis',
 | 
					    enabled_apis_opt = cfg.ListOpt('enabled_apis',
 | 
				
			||||||
                                   default=['ec2', 'osapi_compute'],
 | 
					                                   default=['ec2', 'osapi_compute'],
 | 
				
			||||||
@@ -41,7 +43,7 @@ Options can be strings, integers, floats, booleans, lists or 'multi strings':
 | 
				
			|||||||
                                                  default=DEFAULT_EXTENSIONS)
 | 
					                                                  default=DEFAULT_EXTENSIONS)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Option schemas are registered with with the config manager at runtime, but
 | 
					Option schemas are registered with with the config manager at runtime, but
 | 
				
			||||||
before the option is referenced:
 | 
					before the option is referenced::
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    class ExtensionManager(object):
 | 
					    class ExtensionManager(object):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -57,7 +59,7 @@ before the option is referenced:
 | 
				
			|||||||
                ....
 | 
					                ....
 | 
				
			||||||
 | 
					
 | 
				
			||||||
A common usage pattern is for each option schema to be defined in the module or
 | 
					A common usage pattern is for each option schema to be defined in the module or
 | 
				
			||||||
class which uses the option:
 | 
					class which uses the option::
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    opts = ...
 | 
					    opts = ...
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -72,7 +74,7 @@ class which uses the option:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
An option may optionally be made available via the command line. Such options
 | 
					An option may optionally be made available via the command line. Such options
 | 
				
			||||||
must registered with the config manager before the command line is parsed (for
 | 
					must registered with the config manager before the command line is parsed (for
 | 
				
			||||||
the purposes of --help and CLI arg validation):
 | 
					the purposes of --help and CLI arg validation)::
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    cli_opts = [
 | 
					    cli_opts = [
 | 
				
			||||||
        cfg.BoolOpt('verbose',
 | 
					        cfg.BoolOpt('verbose',
 | 
				
			||||||
@@ -88,7 +90,7 @@ the purposes of --help and CLI arg validation):
 | 
				
			|||||||
    def add_common_opts(conf):
 | 
					    def add_common_opts(conf):
 | 
				
			||||||
        conf.register_cli_opts(cli_opts)
 | 
					        conf.register_cli_opts(cli_opts)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
The config manager has a single CLI option defined by default, --config-file:
 | 
					The config manager has a single CLI option defined by default, --config-file::
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    class ConfigOpts(object):
 | 
					    class ConfigOpts(object):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -101,7 +103,7 @@ The config manager has a single CLI option defined by default, --config-file:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
Option values are parsed from any supplied config files using SafeConfigParser.
 | 
					Option values are parsed from any supplied config files using SafeConfigParser.
 | 
				
			||||||
If none are specified, a default set is used e.g. glance-api.conf and
 | 
					If none are specified, a default set is used e.g. glance-api.conf and
 | 
				
			||||||
glance-common.conf:
 | 
					glance-common.conf::
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    glance-api.conf:
 | 
					    glance-api.conf:
 | 
				
			||||||
      [DEFAULT]
 | 
					      [DEFAULT]
 | 
				
			||||||
@@ -116,7 +118,7 @@ are parsed in order, with values in later files overriding those in earlier
 | 
				
			|||||||
files.
 | 
					files.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
The parsing of CLI args and config files is initiated by invoking the config
 | 
					The parsing of CLI args and config files is initiated by invoking the config
 | 
				
			||||||
manager e.g.
 | 
					manager e.g.::
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    conf = ConfigOpts()
 | 
					    conf = ConfigOpts()
 | 
				
			||||||
    conf.register_opt(BoolOpt('verbose', ...))
 | 
					    conf.register_opt(BoolOpt('verbose', ...))
 | 
				
			||||||
@@ -124,7 +126,7 @@ manager e.g.
 | 
				
			|||||||
    if conf.verbose:
 | 
					    if conf.verbose:
 | 
				
			||||||
        ...
 | 
					        ...
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Options can be registered as belonging to a group:
 | 
					Options can be registered as belonging to a group::
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    rabbit_group = cfg.OptionGroup(name='rabbit',
 | 
					    rabbit_group = cfg.OptionGroup(name='rabbit',
 | 
				
			||||||
                                   title='RabbitMQ options')
 | 
					                                   title='RabbitMQ options')
 | 
				
			||||||
@@ -143,7 +145,7 @@ Options can be registered as belonging to a group:
 | 
				
			|||||||
        conf.register_opt(rabbit_port_opt, group='rabbit')
 | 
					        conf.register_opt(rabbit_port_opt, group='rabbit')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
If no group is specified, options belong to the 'DEFAULT' section of config
 | 
					If no group is specified, options belong to the 'DEFAULT' section of config
 | 
				
			||||||
files:
 | 
					files::
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    glance-api.conf:
 | 
					    glance-api.conf:
 | 
				
			||||||
      [DEFAULT]
 | 
					      [DEFAULT]
 | 
				
			||||||
@@ -158,13 +160,14 @@ files:
 | 
				
			|||||||
      password = guest
 | 
					      password = guest
 | 
				
			||||||
      virtual_host = /
 | 
					      virtual_host = /
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Command-line options in a group are automatically prefixed with the group name:
 | 
					Command-line options in a group are automatically prefixed with the
 | 
				
			||||||
 | 
					group name::
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    --rabbit-host localhost --rabbit-port 9999
 | 
					    --rabbit-host localhost --rabbit-port 9999
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Option values in the default group are referenced as attributes/properties on
 | 
					Option values in the default group are referenced as attributes/properties on
 | 
				
			||||||
the config manager; groups are also attributes on the config manager, with
 | 
					the config manager; groups are also attributes on the config manager, with
 | 
				
			||||||
attributes for each of the options associated with the group:
 | 
					attributes for each of the options associated with the group::
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    server.start(app, conf.bind_port, conf.bind_host, conf)
 | 
					    server.start(app, conf.bind_port, conf.bind_host, conf)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -173,7 +176,7 @@ attributes for each of the options associated with the group:
 | 
				
			|||||||
        port=conf.rabbit.port,
 | 
					        port=conf.rabbit.port,
 | 
				
			||||||
        ...)
 | 
					        ...)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Option values may reference other values using PEP 292 string substitution:
 | 
					Option values may reference other values using PEP 292 string substitution::
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    opts = [
 | 
					    opts = [
 | 
				
			||||||
        cfg.StrOpt('state_path',
 | 
					        cfg.StrOpt('state_path',
 | 
				
			||||||
@@ -191,15 +194,15 @@ Note that interpolation can be avoided by using '$$'.
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
For command line utilities that dispatch to other command line utilities, the
 | 
					For command line utilities that dispatch to other command line utilities, the
 | 
				
			||||||
disable_interspersed_args() method is available. If this this method is called,
 | 
					disable_interspersed_args() method is available. If this this method is called,
 | 
				
			||||||
then parsing e.g.
 | 
					then parsing e.g.::
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  script --verbose cmd --debug /tmp/mything
 | 
					  script --verbose cmd --debug /tmp/mything
 | 
				
			||||||
 | 
					
 | 
				
			||||||
will no longer return:
 | 
					will no longer return::
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ['cmd', '/tmp/mything']
 | 
					  ['cmd', '/tmp/mything']
 | 
				
			||||||
 | 
					
 | 
				
			||||||
as the leftover arguments, but will instead return:
 | 
					as the leftover arguments, but will instead return::
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ['cmd', '--debug', '/tmp/mything']
 | 
					  ['cmd', '--debug', '/tmp/mything']
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -307,9 +310,12 @@ class ConfigFileValueError(Error):
 | 
				
			|||||||
def find_config_files(project=None, prog=None):
 | 
					def find_config_files(project=None, prog=None):
 | 
				
			||||||
    """Return a list of default configuration files.
 | 
					    """Return a list of default configuration files.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    :param project: an optional project name
 | 
				
			||||||
 | 
					    :param prog: the program name, defaulting to the basename of sys.argv[0]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    We default to two config files: [${project}.conf, ${prog}.conf]
 | 
					    We default to two config files: [${project}.conf, ${prog}.conf]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    And we look for those config files in the following directories:
 | 
					    And we look for those config files in the following directories::
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      ~/.${project}/
 | 
					      ~/.${project}/
 | 
				
			||||||
      ~/
 | 
					      ~/
 | 
				
			||||||
@@ -324,9 +330,6 @@ def find_config_files(project=None, prog=None):
 | 
				
			|||||||
    '~/.foo/bar.conf']
 | 
					    '~/.foo/bar.conf']
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    If no project name is supplied, we only look for ${prog.conf}.
 | 
					    If no project name is supplied, we only look for ${prog.conf}.
 | 
				
			||||||
 | 
					 | 
				
			||||||
    :param project: an optional project name
 | 
					 | 
				
			||||||
    :param prog: the program name, defaulting to the basename of sys.argv[0]
 | 
					 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
    if prog is None:
 | 
					    if prog is None:
 | 
				
			||||||
        prog = os.path.basename(sys.argv[0])
 | 
					        prog = os.path.basename(sys.argv[0])
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -68,15 +68,15 @@ def enforce(context, action, target):
 | 
				
			|||||||
       :param context: nova context
 | 
					       :param context: nova context
 | 
				
			||||||
       :param action: string representing the action to be checked
 | 
					       :param action: string representing the action to be checked
 | 
				
			||||||
           this should be colon separated for clarity.
 | 
					           this should be colon separated for clarity.
 | 
				
			||||||
           i.e. compute:create_instance
 | 
					           i.e. ``compute:create_instance``,
 | 
				
			||||||
                compute:attach_volume
 | 
					           ``compute:attach_volume``,
 | 
				
			||||||
                volume:attach_volume
 | 
					           ``volume:attach_volume``
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       :param object: dictionary representing the object of the action
 | 
					       :param object: dictionary representing the object of the action
 | 
				
			||||||
           for object creation this should be a dictionary representing the
 | 
					           for object creation this should be a dictionary representing the
 | 
				
			||||||
           location of the object e.g. {'project_id': context.project_id}
 | 
					           location of the object e.g. ``{'project_id': context.project_id}``
 | 
				
			||||||
 | 
					
 | 
				
			||||||
       :raises: `nova.exception.PolicyNotAllowed` if verification fails.
 | 
					       :raises nova.exception.PolicyNotAllowed: if verification fails.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
    init()
 | 
					    init()
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -194,6 +194,7 @@ class Scheduler(object):
 | 
				
			|||||||
                                block_migration=False,
 | 
					                                block_migration=False,
 | 
				
			||||||
                                disk_over_commit=False):
 | 
					                                disk_over_commit=False):
 | 
				
			||||||
        """Live migration scheduling method.
 | 
					        """Live migration scheduling method.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        :param context:
 | 
					        :param context:
 | 
				
			||||||
        :param instance_id:
 | 
					        :param instance_id:
 | 
				
			||||||
        :param dest: destination host
 | 
					        :param dest: destination host
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -79,16 +79,19 @@ def compute_fill_first_cost_fn(host_state, weighing_properties):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
def weighted_sum(weighted_fns, host_states, weighing_properties):
 | 
					def weighted_sum(weighted_fns, host_states, weighing_properties):
 | 
				
			||||||
    """Use the weighted-sum method to compute a score for an array of objects.
 | 
					    """Use the weighted-sum method to compute a score for an array of objects.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Normalize the results of the objective-functions so that the weights are
 | 
					    Normalize the results of the objective-functions so that the weights are
 | 
				
			||||||
    meaningful regardless of objective-function's range.
 | 
					    meaningful regardless of objective-function's range.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    host_list - [(host, HostInfo()), ...]
 | 
					    :param host_list:    ``[(host, HostInfo()), ...]``
 | 
				
			||||||
    weighted_fns - list of weights and functions like:
 | 
					    :param weighted_fns: list of weights and functions like::
 | 
				
			||||||
        [(weight, objective-functions), ...]
 | 
					 | 
				
			||||||
    weighing_properties is an arbitrary dict of values that can influence
 | 
					 | 
				
			||||||
        weights.
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Returns a single WeightedHost object which represents the best
 | 
					        [(weight, objective-functions), ...]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    :param weighing_properties: an arbitrary dict of values that can
 | 
				
			||||||
 | 
					        influence weights.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    :returns: a single WeightedHost object which represents the best
 | 
				
			||||||
              candidate.
 | 
					              candidate.
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -179,7 +179,8 @@ class SchedulerManager(manager.Manager):
 | 
				
			|||||||
        :param context: security context
 | 
					        :param context: security context
 | 
				
			||||||
        :param host: hostname
 | 
					        :param host: hostname
 | 
				
			||||||
        :returns:
 | 
					        :returns:
 | 
				
			||||||
            example format is below.
 | 
					            example format is below::
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                {'resource':D, 'usage':{proj_id1:D, proj_id2:D}}
 | 
					                {'resource':D, 'usage':{proj_id1:D, proj_id2:D}}
 | 
				
			||||||
                D: {'vcpus': 3, 'memory_mb': 2048, 'local_gb': 2048,
 | 
					                D: {'vcpus': 3, 'memory_mb': 2048, 'local_gb': 2048,
 | 
				
			||||||
                    'vcpus_used': 12, 'memory_mb_used': 10240,
 | 
					                    'vcpus_used': 12, 'memory_mb_used': 10240,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -116,6 +116,7 @@ def vpn_ping(address, port, timeout=0.05, session_id=None):
 | 
				
			|||||||
    Returns False on a failure. Basic packet structure is below.
 | 
					    Returns False on a failure. Basic packet structure is below.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Client packet (14 bytes)::
 | 
					    Client packet (14 bytes)::
 | 
				
			||||||
 | 
					
 | 
				
			||||||
         0 1      8 9  13
 | 
					         0 1      8 9  13
 | 
				
			||||||
        +-+--------+-----+
 | 
					        +-+--------+-----+
 | 
				
			||||||
        |x| cli_id |?????|
 | 
					        |x| cli_id |?????|
 | 
				
			||||||
@@ -125,6 +126,7 @@ def vpn_ping(address, port, timeout=0.05, session_id=None):
 | 
				
			|||||||
        ? = unknown, probably flags/padding
 | 
					        ? = unknown, probably flags/padding
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Server packet (26 bytes)::
 | 
					    Server packet (26 bytes)::
 | 
				
			||||||
 | 
					
 | 
				
			||||||
         0 1      8 9  13 14    21 2225
 | 
					         0 1      8 9  13 14    21 2225
 | 
				
			||||||
        +-+--------+-----+--------+----+
 | 
					        +-+--------+-----+--------+----+
 | 
				
			||||||
        |x| srv_id |?????| cli_id |????|
 | 
					        |x| srv_id |?????| cli_id |????|
 | 
				
			||||||
@@ -162,27 +164,29 @@ def fetchfile(url, target):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def execute(*cmd, **kwargs):
 | 
					def execute(*cmd, **kwargs):
 | 
				
			||||||
    """
 | 
					    """Helper method to execute command with optional retry.
 | 
				
			||||||
    Helper method to execute command with optional retry.
 | 
					
 | 
				
			||||||
    If you add a run_as_root=True command, don't forget to add the
 | 
					    If you add a run_as_root=True command, don't forget to add the
 | 
				
			||||||
    corresponding filter to nova.rootwrap !
 | 
					    corresponding filter to nova.rootwrap !
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    :cmd                Passed to subprocess.Popen.
 | 
					    :param cmd:                Passed to subprocess.Popen.
 | 
				
			||||||
    :process_input      Send to opened process.
 | 
					    :param process_input:      Send to opened process.
 | 
				
			||||||
    :check_exit_code    Single bool, int, or list of allowed exit codes.
 | 
					    :param check_exit_code:    Single bool, int, or list of allowed exit
 | 
				
			||||||
                        Defaults to [0].  Raise exception.ProcessExecutionError
 | 
					                               codes.  Defaults to [0].  Raise
 | 
				
			||||||
                        unless program exits with one of these code.
 | 
					                               exception.ProcessExecutionError unless
 | 
				
			||||||
    :delay_on_retry     True | False. Defaults to True. If set to True, wait a
 | 
					                               program exits with one of these code.
 | 
				
			||||||
                        short amount of time before retrying.
 | 
					    :param delay_on_retry:     True | False. Defaults to True. If set to
 | 
				
			||||||
    :attempts           How many times to retry cmd.
 | 
					                               True, wait a short amount of time
 | 
				
			||||||
    :run_as_root        True | False. Defaults to False. If set to True,
 | 
					                               before retrying.
 | 
				
			||||||
 | 
					    :param attempts:           How many times to retry cmd.
 | 
				
			||||||
 | 
					    :param run_as_root:        True | False. Defaults to False. If set to True,
 | 
				
			||||||
                               the command is prefixed by the command specified
 | 
					                               the command is prefixed by the command specified
 | 
				
			||||||
                               in the root_helper FLAG.
 | 
					                               in the root_helper FLAG.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    :raises exception.Error on receiving unknown arguments
 | 
					    :raises exception.Error: on receiving unknown arguments
 | 
				
			||||||
    :raises exception.ProcessExecutionError
 | 
					    :raises exception.ProcessExecutionError:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    :returns a tuple, (stdout, stderr) from the spawned process, or None if
 | 
					    :returns: a tuple, (stdout, stderr) from the spawned process, or None if
 | 
				
			||||||
             the command fails.
 | 
					             the command fails.
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -795,14 +799,16 @@ _semaphores = {}
 | 
				
			|||||||
def synchronized(name, external=False):
 | 
					def synchronized(name, external=False):
 | 
				
			||||||
    """Synchronization decorator.
 | 
					    """Synchronization decorator.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Decorating a method like so:
 | 
					    Decorating a method like so::
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @synchronized('mylock')
 | 
					        @synchronized('mylock')
 | 
				
			||||||
        def foo(self, *args):
 | 
					        def foo(self, *args):
 | 
				
			||||||
           ...
 | 
					           ...
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ensures that only one thread will execute the bar method at a time.
 | 
					    ensures that only one thread will execute the bar method at a time.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Different methods can share the same lock:
 | 
					    Different methods can share the same lock::
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        @synchronized('mylock')
 | 
					        @synchronized('mylock')
 | 
				
			||||||
        def foo(self, *args):
 | 
					        def foo(self, *args):
 | 
				
			||||||
           ...
 | 
					           ...
 | 
				
			||||||
@@ -1601,7 +1607,8 @@ class UndoManager(object):
 | 
				
			|||||||
    def rollback_and_reraise(self, msg=None):
 | 
					    def rollback_and_reraise(self, msg=None):
 | 
				
			||||||
        """Rollback a series of actions then re-raise the exception.
 | 
					        """Rollback a series of actions then re-raise the exception.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        NOTE(sirp): This should only be called within an exception handler.
 | 
					        .. note:: (sirp) This should only be called within an
 | 
				
			||||||
 | 
					                  exception handler.
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        with save_and_reraise_exception():
 | 
					        with save_and_reraise_exception():
 | 
				
			||||||
            if msg:
 | 
					            if msg:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -19,8 +19,9 @@
 | 
				
			|||||||
Handles all requests relating to Virtual Storage Arrays (VSAs).
 | 
					Handles all requests relating to Virtual Storage Arrays (VSAs).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Experimental code. Requires special VSA image.
 | 
					Experimental code. Requires special VSA image.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
For assistance and guidelines pls contact
 | 
					For assistance and guidelines pls contact
 | 
				
			||||||
    Zadara Storage Inc & Openstack community
 | 
					Zadara Storage Inc & Openstack community
 | 
				
			||||||
"""
 | 
					"""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from nova import compute
 | 
					from nova import compute
 | 
				
			||||||
@@ -143,9 +144,8 @@ class API(base.Base):
 | 
				
			|||||||
    def create(self, context, display_name='', display_description='',
 | 
					    def create(self, context, display_name='', display_description='',
 | 
				
			||||||
                vc_count=1, instance_type=None, image_name=None,
 | 
					                vc_count=1, instance_type=None, image_name=None,
 | 
				
			||||||
                availability_zone=None, storage=[], shared=None):
 | 
					                availability_zone=None, storage=[], shared=None):
 | 
				
			||||||
        """
 | 
					        """Provision VSA instance with compute instances and volumes
 | 
				
			||||||
        Provision VSA instance with corresponding compute instances
 | 
					
 | 
				
			||||||
        and associated volumes
 | 
					 | 
				
			||||||
        :param storage: List of dictionaries with following keys:
 | 
					        :param storage: List of dictionaries with following keys:
 | 
				
			||||||
                        disk_name, num_disks, size
 | 
					                        disk_name, num_disks, size
 | 
				
			||||||
        :param shared: Specifies if storage is dedicated or shared.
 | 
					        :param shared: Specifies if storage is dedicated or shared.
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user