<reponame>bopopescu/nova-token
begin_unit
comment|'#'
nl|'\n'
comment|'# Copyright (C) 2014 Red Hat, Inc'
nl|'\n'
comment|'#'
nl|'\n'
comment|'# Licensed under the Apache License, Version 2.0 (the "License"); you may'
nl|'\n'
comment|'# not use this file except in compliance with the License. You may obtain'
nl|'\n'
comment|'# a copy of the License at'
nl|'\n'
comment|'#'
nl|'\n'
comment|'#     http://www.apache.org/licenses/LICENSE-2.0'
nl|'\n'
comment|'#'
nl|'\n'
comment|'# Unless required by applicable law or agreed to in writing, software'
nl|'\n'
comment|'# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT'
nl|'\n'
comment|'# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the'
nl|'\n'
comment|'# License for the specific language governing permissions and limitations'
nl|'\n'
comment|'# under the License.'
nl|'\n'
comment|'#'
nl|'\n'
nl|'\n'
name|'from'
name|'oslo_utils'
name|'import'
name|'strutils'
newline|'\n'
nl|'\n'
name|'from'
name|'nova'
name|'import'
name|'exception'
newline|'\n'
nl|'\n'
DECL|variable|FORMAT_RAW
name|'FORMAT_RAW'
op|'='
string|'"raw"'
newline|'\n'
DECL|variable|FORMAT_QCOW2
name|'FORMAT_QCOW2'
op|'='
string|'"qcow2"'
newline|'\n'
nl|'\n'
DECL|variable|ALL_FORMATS
name|'ALL_FORMATS'
op|'='
op|'['
nl|'\n'
name|'FORMAT_RAW'
op|','
nl|'\n'
name|'FORMAT_QCOW2'
op|','
nl|'\n'
op|']'
newline|'\n'
nl|'\n'
nl|'\n'
DECL|class|Image
name|'class'
name|'Image'
op|'('
name|'object'
op|')'
op|':'
newline|'\n'
indent|'    '
string|'"""Base class for all image types.\n\n    All image types have a format, though for many of\n    them only a subset of formats will commonly be\n    used. For example, block devices are almost\n    always going to be FORMAT_RAW. Though it is in\n    fact possible from a technical POV to store a\n    qcow2 data inside a block device, Nova does not\n    (at this time) make use of such possibilities.\n    """'
newline|'\n'
nl|'\n'
DECL|member|__init__
name|'def'
name|'__init__'
op|'('
name|'self'
op|','
name|'format'
op|')'
op|':'
newline|'\n'
indent|'        '
string|'"""Create a new abstract image\n\n        :param format: one of the format constants\n        """'
newline|'\n'
name|'super'
op|'('
name|'Image'
op|','
name|'self'
op|')'
op|'.'
name|'__init__'
op|'('
op|')'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'format'
op|'='
name|'format'
newline|'\n'
nl|'\n'
name|'if'
name|'format'
name|'not'
name|'in'
name|'ALL_FORMATS'
op|':'
newline|'\n'
indent|'            '
name|'raise'
name|'exception'
op|'.'
name|'InvalidImageFormat'
op|'('
name|'format'
op|'='
name|'format'
op|')'
newline|'\n'
nl|'\n'
DECL|member|__repr__
dedent|''
dedent|''
name|'def'
name|'__repr__'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|'        '
name|'msg'
op|'='
string|'"<"'
op|'+'
name|'self'
op|'.'
name|'__class__'
op|'.'
name|'__name__'
op|'+'
string|'":"'
op|'+'
name|'str'
op|'('
name|'self'
op|'.'
name|'__dict__'
op|')'
op|'+'
string|'">"'
newline|'\n'
name|'return'
name|'strutils'
op|'.'
name|'mask_password'
op|'('
name|'msg'
op|')'
newline|'\n'
nl|'\n'
DECL|member|__eq__
dedent|''
name|'def'
name|'__eq__'
op|'('
name|'self'
op|','
name|'other'
op|')'
op|':'
newline|'\n'
indent|'        '
name|'return'
op|'('
op|'('
name|'self'
op|'.'
name|'__class__'
op|'=='
name|'other'
op|'.'
name|'__class__'
op|')'
name|'and'
nl|'\n'
op|'('
name|'self'
op|'.'
name|'__dict__'
op|'=='
name|'other'
op|'.'
name|'__dict__'
op|')'
op|')'
newline|'\n'
nl|'\n'
DECL|member|__hash__
dedent|''
name|'def'
name|'__hash__'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|'        '
name|'return'
name|'hash'
op|'('
name|'str'
op|'('
name|'self'
op|'.'
name|'__dict__'
op|')'
op|')'
newline|'\n'
nl|'\n'
nl|'\n'
DECL|class|LocalImage
dedent|''
dedent|''
name|'class'
name|'LocalImage'
op|'('
name|'Image'
op|')'
op|':'
newline|'\n'
indent|'    '
string|'"""Class for images that are paths within the\n    local filesystem\n    """'
newline|'\n'
nl|'\n'
DECL|member|__init__
name|'def'
name|'__init__'
op|'('
name|'self'
op|','
name|'path'
op|','
name|'format'
op|')'
op|':'
newline|'\n'
indent|'        '
string|'"""Create a new local image object\n\n        :param path: qualified filename of the image\n        :param format: one of the format constants\n        """'
newline|'\n'
name|'super'
op|'('
name|'LocalImage'
op|','
name|'self'
op|')'
op|'.'
name|'__init__'
op|'('
name|'format'
op|')'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'path'
op|'='
name|'path'
newline|'\n'
nl|'\n'
nl|'\n'
DECL|class|LocalFileImage
dedent|''
dedent|''
name|'class'
name|'LocalFileImage'
op|'('
name|'LocalImage'
op|')'
op|':'
newline|'\n'
indent|'    '
string|'"""Class for images that are files on a locally\n    accessible filesystem\n    """'
newline|'\n'
nl|'\n'
DECL|member|__init__
name|'def'
name|'__init__'
op|'('
name|'self'
op|','
name|'path'
op|','
name|'format'
op|')'
op|':'
newline|'\n'
indent|'        '
string|'"""Create a new local file object\n\n        :param path: qualified filename of the image\n        :param format: one of the format constants\n        """'
newline|'\n'
name|'super'
op|'('
name|'LocalFileImage'
op|','
name|'self'
op|')'
op|'.'
name|'__init__'
op|'('
name|'path'
op|','
name|'format'
op|')'
newline|'\n'
nl|'\n'
nl|'\n'
DECL|class|LocalBlockImage
dedent|''
dedent|''
name|'class'
name|'LocalBlockImage'
op|'('
name|'LocalImage'
op|')'
op|':'
newline|'\n'
indent|'    '
string|'"""Class for images that are block devices on\n    the local host\n    """'
newline|'\n'
nl|'\n'
DECL|member|__init__
name|'def'
name|'__init__'
op|'('
name|'self'
op|','
name|'path'
op|')'
op|':'
newline|'\n'
indent|'        '
string|'"""Create a new local file object\n\n        :param path: qualified filename of the image\n        """'
newline|'\n'
name|'super'
op|'('
name|'LocalBlockImage'
op|','
name|'self'
op|')'
op|'.'
name|'__init__'
op|'('
name|'path'
op|','
name|'FORMAT_RAW'
op|')'
newline|'\n'
nl|'\n'
nl|'\n'
DECL|class|RBDImage
dedent|''
dedent|''
name|'class'
name|'RBDImage'
op|'('
name|'Image'
op|')'
op|':'
newline|'\n'
indent|'    '
string|'"""Class for images that are volumes on a remote\n    RBD server\n    """'
newline|'\n'
nl|'\n'
DECL|member|__init__
name|'def'
name|'__init__'
op|'('
name|'self'
op|','
name|'name'
op|','
name|'pool'
op|','
name|'user'
op|','
name|'password'
op|','
name|'servers'
op|')'
op|':'
newline|'\n'
indent|'        '
string|'"""Create a new RBD image object\n\n        :param name: name of the image relative to the pool\n        :param pool: name of the pool holding the image\n        :param user: username to authenticate as\n        :param password: <PASSWORD> with\n        :param servers: list of hostnames for the server\n        """'
newline|'\n'
name|'super'
op|'('
name|'RBDImage'
op|','
name|'self'
op|')'
op|'.'
name|'__init__'
op|'('
name|'FORMAT_RAW'
op|')'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'name'
op|'='
name|'name'
newline|'\n'
name|'self'
op|'.'
name|'pool'
op|'='
name|'pool'
newline|'\n'
name|'self'
op|'.'
name|'user'
op|'='
name|'user'
newline|'\n'
name|'self'
op|'.'
name|'password'
op|'='
name|'password'
newline|'\n'
name|'self'
op|'.'
name|'servers'
op|'='
name|'servers'
newline|'\n'
dedent|''
dedent|''
endmarker|''
end_unit

begin_unit
comment|'#'
nl|'\n'
comment|'# Copyright (C) 2014 Red Hat, Inc'
nl|'\n'
comment|'#'
nl|'\n'
comment|'# Licensed under the Apache License, Version 2.0 (the "License"); you may'
nl|'\n'
comment|'# not use this file except in compliance with the License. You may obtain'
nl|'\n'
comment|'# a copy of the License at'
nl|'\n'
comment|'#'
nl|'\n'
comment|'#     http://www.apache.org/licenses/LICENSE-2.0'
nl|'\n'
comment|'#'
nl|'\n'
comment|'# Unless required by applicable law or agreed to in writing, software'
nl|'\n'
comment|'# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT'
nl|'\n'
comment|'# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the'
nl|'\n'
comment|'# License for the specific language governing permissions and limitations'
nl|'\n'
comment|'# under the License.'
nl|'\n'
comment|'#'
nl|'\n'
nl|'\n'
name|'from'
name|'oslo_utils'
name|'import'
name|'strutils'
newline|'\n'
nl|'\n'
name|'from'
name|'nova'
name|'import'
name|'exception'
newline|'\n'
nl|'\n'
DECL|variable|FORMAT_RAW
name|'FORMAT_RAW'
op|'='
string|'"raw"'
newline|'\n'
DECL|variable|FORMAT_QCOW2
name|'FORMAT_QCOW2'
op|'='
string|'"qcow2"'
newline|'\n'
nl|'\n'
DECL|variable|ALL_FORMATS
name|'ALL_FORMATS'
op|'='
op|'['
nl|'\n'
name|'FORMAT_RAW'
op|','
nl|'\n'
name|'FORMAT_QCOW2'
op|','
nl|'\n'
op|']'
newline|'\n'
nl|'\n'
nl|'\n'
DECL|class|Image
name|'class'
name|'Image'
op|'('
name|'object'
op|')'
op|':'
newline|'\n'
indent|'    '
string|'"""Base class for all image types.\n\n    All image types have a format, though for many of\n    them only a subset of formats will commonly be\n    used. For example, block devices are almost\n    always going to be FORMAT_RAW. Though it is in\n    fact possible from a technical POV to store a\n    qcow2 data inside a block device, Nova does not\n    (at this time) make use of such possibilities.\n    """'
newline|'\n'
nl|'\n'
DECL|member|__init__
name|'def'
name|'__init__'
op|'('
name|'self'
op|','
name|'format'
op|')'
op|':'
newline|'\n'
indent|'        '
string|'"""Create a new abstract image\n\n        :param format: one of the format constants\n        """'
newline|'\n'
name|'super'
op|'('
name|'Image'
op|','
name|'self'
op|')'
op|'.'
name|'__init__'
op|'('
op|')'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'format'
op|'='
name|'format'
newline|'\n'
nl|'\n'
name|'if'
name|'format'
name|'not'
name|'in'
name|'ALL_FORMATS'
op|':'
newline|'\n'
indent|'            '
name|'raise'
name|'exception'
op|'.'
name|'InvalidImageFormat'
op|'('
name|'format'
op|'='
name|'format'
op|')'
newline|'\n'
nl|'\n'
DECL|member|__repr__
dedent|''
dedent|''
name|'def'
name|'__repr__'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|'        '
name|'msg'
op|'='
string|'"<"'
op|'+'
name|'self'
op|'.'
name|'__class__'
op|'.'
name|'__name__'
op|'+'
string|'":"'
op|'+'
name|'str'
op|'('
name|'self'
op|'.'
name|'__dict__'
op|')'
op|'+'
string|'">"'
newline|'\n'
name|'return'
name|'strutils'
op|'.'
name|'mask_password'
op|'('
name|'msg'
op|')'
newline|'\n'
nl|'\n'
DECL|member|__eq__
dedent|''
name|'def'
name|'__eq__'
op|'('
name|'self'
op|','
name|'other'
op|')'
op|':'
newline|'\n'
indent|'        '
name|'return'
op|'('
op|'('
name|'self'
op|'.'
name|'__class__'
op|'=='
name|'other'
op|'.'
name|'__class__'
op|')'
name|'and'
nl|'\n'
op|'('
name|'self'
op|'.'
name|'__dict__'
op|'=='
name|'other'
op|'.'
name|'__dict__'
op|')'
op|')'
newline|'\n'
nl|'\n'
DECL|member|__hash__
dedent|''
name|'def'
name|'__hash__'
op|'('
name|'self'
op|')'
op|':'
newline|'\n'
indent|'        '
name|'return'
name|'hash'
op|'('
name|'str'
op|'('
name|'self'
op|'.'
name|'__dict__'
op|')'
op|')'
newline|'\n'
nl|'\n'
nl|'\n'
DECL|class|LocalImage
dedent|''
dedent|''
name|'class'
name|'LocalImage'
op|'('
name|'Image'
op|')'
op|':'
newline|'\n'
indent|'    '
string|'"""Class for images that are paths within the\n    local filesystem\n    """'
newline|'\n'
nl|'\n'
DECL|member|__init__
name|'def'
name|'__init__'
op|'('
name|'self'
op|','
name|'path'
op|','
name|'format'
op|')'
op|':'
newline|'\n'
indent|'        '
string|'"""Create a new local image object\n\n        :param path: qualified filename of the image\n        :param format: one of the format constants\n        """'
newline|'\n'
name|'super'
op|'('
name|'LocalImage'
op|','
name|'self'
op|')'
op|'.'
name|'__init__'
op|'('
name|'format'
op|')'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'path'
op|'='
name|'path'
newline|'\n'
nl|'\n'
nl|'\n'
DECL|class|LocalFileImage
dedent|''
dedent|''
name|'class'
name|'LocalFileImage'
op|'('
name|'LocalImage'
op|')'
op|':'
newline|'\n'
indent|'    '
string|'"""Class for images that are files on a locally\n    accessible filesystem\n    """'
newline|'\n'
nl|'\n'
DECL|member|__init__
name|'def'
name|'__init__'
op|'('
name|'self'
op|','
name|'path'
op|','
name|'format'
op|')'
op|':'
newline|'\n'
indent|'        '
string|'"""Create a new local file object\n\n        :param path: qualified filename of the image\n        :param format: one of the format constants\n        """'
newline|'\n'
name|'super'
op|'('
name|'LocalFileImage'
op|','
name|'self'
op|')'
op|'.'
name|'__init__'
op|'('
name|'path'
op|','
name|'format'
op|')'
newline|'\n'
nl|'\n'
nl|'\n'
DECL|class|LocalBlockImage
dedent|''
dedent|''
name|'class'
name|'LocalBlockImage'
op|'('
name|'LocalImage'
op|')'
op|':'
newline|'\n'
indent|'    '
string|'"""Class for images that are block devices on\n    the local host\n    """'
newline|'\n'
nl|'\n'
DECL|member|__init__
name|'def'
name|'__init__'
op|'('
name|'self'
op|','
name|'path'
op|')'
op|':'
newline|'\n'
indent|'        '
string|'"""Create a new local file object\n\n        :param path: qualified filename of the image\n        """'
newline|'\n'
name|'super'
op|'('
name|'LocalBlockImage'
op|','
name|'self'
op|')'
op|'.'
name|'__init__'
op|'('
name|'path'
op|','
name|'FORMAT_RAW'
op|')'
newline|'\n'
nl|'\n'
nl|'\n'
DECL|class|RBDImage
dedent|''
dedent|''
name|'class'
name|'RBDImage'
op|'('
name|'Image'
op|')'
op|':'
newline|'\n'
indent|'    '
string|'"""Class for images that are volumes on a remote\n    RBD server\n    """'
newline|'\n'
nl|'\n'
DECL|member|__init__
name|'def'
name|'__init__'
op|'('
name|'self'
op|','
name|'name'
op|','
name|'pool'
op|','
name|'user'
op|','
name|'password'
op|','
name|'servers'
op|')'
op|':'
newline|'\n'
indent|'        '
string|'"""Create a new RBD image object\n\n        :param name: name of the image relative to the pool\n        :param pool: name of the pool holding the image\n        :param user: username to authenticate as\n        :param password: <PASSWORD> with\n        :param servers: list of hostnames for the server\n        """'
newline|'\n'
name|'super'
op|'('
name|'RBDImage'
op|','
name|'self'
op|')'
op|'.'
name|'__init__'
op|'('
name|'FORMAT_RAW'
op|')'
newline|'\n'
nl|'\n'
name|'self'
op|'.'
name|'name'
op|'='
name|'name'
newline|'\n'
name|'self'
op|'.'
name|'pool'
op|'='
name|'pool'
newline|'\n'
name|'self'
op|'.'
name|'user'
op|'='
name|'user'
newline|'\n'
name|'self'
op|'.'
name|'password'
op|'='
name|'password'
newline|'\n'
name|'self'
op|'.'
name|'servers'
op|'='
name|'servers'
newline|'\n'
dedent|''
dedent|''
endmarker|''
end_unit
Base class for all image types.\n\n    All image types have a format, though for many of\n    them only a subset of formats will commonly be\n    used. For example, block devices are almost\n    always going to be FORMAT_RAW. Though it is in\n    fact possible from a technical POV to store a\n    qcow2 data inside a block device, Nova does not\n    (at this time) make use of such possibilities.\n Create a new abstract image\n\n        :param format: one of the format constants\n Class for images that are paths within the\n    local filesystem\n Create a new local image object\n\n        :param path: qualified filename of the image\n        :param format: one of the format constants\n Class for images that are files on a locally\n    accessible filesystem\n Create a new local file object\n\n        :param path: qualified filename of the image\n        :param format: one of the format constants\n Class for images that are block devices on\n    the local host\n Create a new local file object\n\n        :param path: qualified filename of the image\n Class for images that are volumes on a remote\n    RBD server\n Create a new RBD image object\n\n        :param name: name of the image relative to the pool\n        :param pool: name of the pool holding the image\n        :param user: username to authenticate as\n        :param password: <PASSWORD> with\n        :param servers: list of hostnames for the server\n