示例#1
0
    def reboot(self, context, instance, network_info, reboot_type,
               block_device_info=None, bad_volumes_callback=None):
        pod_id = self.hyper.find_pod_id_by_uuid(instance["uuid"])
        if not pod_id:
            return
        self._stop(pod_id, instance)
        try:
            network.teardown_network(pod_id, network_info)
            if network_info:
                self.unplug_vifs(instance, network_info)
        except Exception as e:
            LOG.warning(_('Cannot destroy the pod network'
                          ' during reboot {0}').format(e),
                        exc_info=True)
            return

        binds = self._get_key_binds(pod_id, instance)
        dns = self._extract_dns_entries(network_info)
        self.hyper.start(pod_id, binds=binds, dns=dns)
        try:
            if network_info:
                self.plug_vifs(instance, network_info)
                #self._attach_vifs(instance, network_info) #todo: remove?
        except Exception as e:
            LOG.warning(_('Cannot setup network on reboot: {0}'), e,
                        exc_info=True)
            return
示例#2
0
 def cleanup(self, context, instance, network_info, block_device_info=None,
             destroy_disks=True, migrate_data=None, destroy_vifs=True):
     """Cleanup after instance being destroyed by Hypervisor."""
     pod_id = self.hyper.find_pod_id_by_uuid(instance["uuid"])
     if not pod_id:
         self.unplug_vifs(instance, network_info)
         return
     self.hyper.remove_pod(pod_id, force=True)
     network.teardown_network(pod_id, network_info)
     self.unplug_vifs(instance, network_info)
     if CONF.hyper.inject_key:
         self._cleanup_key(instance)