# limitations under the License. import logging from pumphouse import flows from pumphouse.tasks import server as server_tasks from pumphouse.tasks import flavor as flavor_tasks from pumphouse.tasks import secgroup as secgroup_tasks from pumphouse.tasks import network as network_tasks from pumphouse.tasks import identity as identity_tasks from pumphouse.tasks import utils as task_utils LOG = logging.getLogger(__name__) migrate_disk = flows.register("migrate_disk") post_hooks = flows.register("post_server") def migrate_server(context, server_id): server = context.src_cloud.nova.servers.get(server_id) server_id = server.id flavor_id = server.flavor["id"] flavor_retrieve = "flavor-{}-retrieve".format(flavor_id) resources = [] identity_flow = identity_tasks.migrate_server_identity(context, server.to_dict()) resources.append(identity_flow) tenant = context.src_cloud.keystone.tenants.get(server.tenant_id) server_secgroups = server.list_security_group() for secgroup in server_secgroups: secgroup_retrieve = "secgroup-{}-retrieve".format(secgroup.id)
# Copyright (c) 2014 Mirantis Inc. # # 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 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 pumphouse import flows from . import nova migrate_nic = flows.register("network", default="nova") migrate_nic.add("nova", nova.migrate_nic)
from pumphouse import task from pumphouse import exceptions # from pumphouse.tasks import floating_ip as fip_tasks from pumphouse.tasks.network.nova import floating_ip as fip_tasks from pumphouse.tasks import image as image_tasks from pumphouse.tasks import snapshot as snapshot_tasks from pumphouse.tasks import volume as volume_tasks from pumphouse.tasks import utils as task_utils from pumphouse import utils LOG = logging.getLogger(__name__) HYPERVISOR_HOSTNAME_ATTR = "OS-EXT-SRV-ATTR:hypervisor_hostname" provision_server = flows.register("provision_server", default="image") class EvacuateServer(task.BaseCloudTask): """Migrates server within the cloud.""" def __init__(self, cloud, block_migration=True, disk_over_commit=False, *args, **kwargs): super(EvacuateServer, self).__init__(cloud, *args, **kwargs) self.block_migration = block_migration self.disk_over_commit = disk_over_commit def execute(self, server_info, **requires): server_id = server_info["id"] self.evacuation_event(server_info) # NOTE(akscram): The destination host will be chosen by the