예제 #1
0
# distributed under the License is distributed on an AS IS BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and#
# limitations under the License.


from cloudferry.cloud import cloud
from cloudferry.lib.os.compute import nova_compute
from cloudferry.lib.os.identity import keystone
from cloudferry.lib.os.network import neutron
from cloudferry.lib.utils import log
from cloudferry.lib.utils import utils


LOG = log.getLogger(__name__)


class Grouping(object):
    def __init__(self, config, group_file, cloud_id):
        self.config = config
        if group_file is None:
            message = "Grouping config is not provided."
            LOG.error(message)
            raise ValueError(message)
        self.group_config = utils.read_yaml_file(group_file)
        resources = {'identity': keystone.KeystoneIdentity,
                     'network': neutron.NeutronNetwork,
                     'compute': nova_compute.NovaCompute}
        self.cloud = cloud.Cloud(resources, cloud_id, config)
예제 #2
0
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an AS IS BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and#
# limitations under the License.

from cloudferry.actions.image import get_info_images
from cloudferry.lib.base.action import transporter
from cloudferry.lib.utils import log
from cloudferry.lib.utils import utils as utl

LOG = log.getLogger(__name__)


class CopyFromGlanceToGlance(transporter.Transporter):
    def __init__(self, init):
        super(CopyFromGlanceToGlance, self).__init__(init)

    def run(self, images_info=None, **kwargs):
        dst_image = self.dst_cloud.resources[utl.IMAGE_RESOURCE]

        if not images_info:
            action_get_im = get_info_images.GetInfoImages(self.init,
                                                          cloud='src_cloud')
            images_info = action_get_im.run()

        new_info = dst_image.deploy(images_info)