コード例 #1
0
 def __init__(self, host_ip, host_username, host_password,
              api_retry_count, scheme="https"):
     super(VMWareESXConnection, self).__init__()
     session = VMWareAPISession(host_ip, host_username, host_password,
                                api_retry_count, scheme=scheme)
     self._vmops = VMWareVMOps(session)
コード例 #2
0
class VMWareESXConnection(driver.ComputeDriver):
    """The ESX host connection object."""

    def __init__(self, host_ip, host_username, host_password,
                 api_retry_count, scheme="https"):
        super(VMWareESXConnection, self).__init__()
        session = VMWareAPISession(host_ip, host_username, host_password,
                                   api_retry_count, scheme=scheme)
        self._vmops = VMWareVMOps(session)

    def init_host(self, host):
        """Do the initialization that needs to be done."""
        # FIXME(sateesh): implement this
        pass

    def list_instances(self):
        """List VM instances."""
        return self._vmops.list_instances()

    def spawn(self, context, instance, image_meta, network_info,
              block_device_mapping=None):
        """Create VM instance."""
        self._vmops.spawn(context, instance, image_meta, network_info)

    def snapshot(self, context, instance, name):
        """Create snapshot from a running VM instance."""
        self._vmops.snapshot(context, instance, name)

    def reboot(self, instance, network_info, reboot_type):
        """Reboot VM instance."""
        self._vmops.reboot(instance, network_info)

    def destroy(self, instance, network_info, block_device_info=None,
                cleanup=True):
        """Destroy VM instance."""
        self._vmops.destroy(instance, network_info)

    def pause(self, instance):
        """Pause VM instance."""
        self._vmops.pause(instance)

    def unpause(self, instance):
        """Unpause paused VM instance."""
        self._vmops.unpause(instance)

    def suspend(self, instance):
        """Suspend the specified instance."""
        self._vmops.suspend(instance)

    def resume(self, instance):
        """Resume the suspended VM instance."""
        self._vmops.resume(instance)

    def get_info(self, instance_name):
        """Return info about the VM instance."""
        return self._vmops.get_info(instance_name)

    def get_diagnostics(self, instance):
        """Return data about VM diagnostics."""
        return self._vmops.get_info(instance)

    def get_console_output(self, instance):
        """Return snapshot of console."""
        return self._vmops.get_console_output(instance)

    def get_ajax_console(self, instance):
        """Return link to instance's ajax console."""
        return self._vmops.get_ajax_console(instance)

    def attach_volume(self, connection_info, instance_name, mountpoint):
        """Attach volume storage to VM instance."""
        pass

    def detach_volume(self, connection_info, instance_name, mountpoint):
        """Detach volume storage to VM instance."""
        pass

    def get_console_pool_info(self, console_type):
        """Get info about the host on which the VM resides."""
        return {'address': FLAGS.vmwareapi_host_ip,
                'username': FLAGS.vmwareapi_host_username,
                'password': FLAGS.vmwareapi_host_password}

    def update_available_resource(self, ctxt, host):
        """This method is supported only by libvirt."""
        return

    def host_power_action(self, host, action):
        """Reboots, shuts down or powers up the host."""
        pass

    def set_host_enabled(self, host, enabled):
        """Sets the specified host's ability to accept new instances."""
        pass

    def plug_vifs(self, instance, network_info):
        """Plug VIFs into networks."""
        self._vmops.plug_vifs(instance, network_info)

    def unplug_vifs(self, instance, network_info):
        """Unplug VIFs from networks."""
        self._vmops.unplug_vifs(instance, network_info)