~ubuntu-branches/ubuntu/raring/nova/raring-proposed

« back to all changes in this revision

Viewing changes to nova/virt/vmwareapi/driver.py

  • Committer: Package Import Robot
  • Author(s): Adam Gandelman
  • Date: 2013-08-09 10:12:27 UTC
  • mto: This revision was merged to the branch mainline in revision 107.
  • Revision ID: package-import@ubuntu.com-20130809101227-flqfubhwpot76pob
Tags: upstream-2013.1.3
ImportĀ upstreamĀ versionĀ 2013.1.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
126
126
class VMwareESXDriver(driver.ComputeDriver):
127
127
    """The ESX host connection object."""
128
128
 
 
129
    # VMwareAPI has both ESXi and vCenter API sets.
 
130
    # The ESXi API are a proper sub-set of the vCenter API.
 
131
    # That is to say, nearly all valid ESXi calls are
 
132
    # valid vCenter calls. There are some small edge-case
 
133
    # exceptions regarding VNC, CIM, User management & SSO.
 
134
 
129
135
    def __init__(self, virtapi, read_only=False, scheme="https"):
130
136
        super(VMwareESXDriver, self).__init__(virtapi)
131
137
 
219
225
        """Power off the specified instance."""
220
226
        self._vmops.power_off(instance)
221
227
 
222
 
    def power_on(self, instance):
 
228
    def power_on(self, context, instance, network_info,
 
229
                 block_device_info=None):
223
230
        """Power on the specified instance."""
224
 
        self._vmops.power_on(instance)
 
231
        self._vmops._power_on(instance)
225
232
 
226
233
    def poll_rebooting_instances(self, timeout, instances):
227
234
        """Poll for rebooting instances."""
330
337
        """Unplug VIFs from networks."""
331
338
        self._vmops.unplug_vifs(instance, network_info)
332
339
 
333
 
    def list_interfaces(self, instance_name):
334
 
        """
335
 
        Return the IDs of all the virtual network interfaces attached to the
336
 
        specified instance, as a list.  These IDs are opaque to the caller
337
 
        (they are only useful for giving back to this layer as a parameter to
338
 
        interface_stats).  These IDs only need to be unique for a given
339
 
        instance.
340
 
        """
341
 
        return self._vmops.list_interfaces(instance_name)
342
 
 
343
340
 
344
341
class VMwareVCDriver(VMwareESXDriver):
345
342
    """The ESX host connection object."""
346
343
 
 
344
    # The vCenter driver includes several additional VMware vSphere
 
345
    # capabilities that include API that act on hosts or groups of
 
346
    # hosts in clusters or non-cluster logical-groupings.
 
347
    #
 
348
    # vCenter is not a hypervisor itself, it works with multiple
 
349
    # hypervisor host machines and their guests. This fact can
 
350
    # subtly alter how vSphere and OpenStack interoperate.
 
351
 
347
352
    def __init__(self, virtapi, read_only=False, scheme="https"):
348
353
        super(VMwareVCDriver, self).__init__(virtapi)
349
354
        if not self._cluster_name:
381
386
    def finish_revert_migration(self, instance, network_info,
382
387
                                block_device_info=None):
383
388
        """Finish reverting a resize, powering back on the instance."""
384
 
        self._vmops.finish_revert_migration(instance)
 
389
        self._vmops.finish_revert_migration(instance, network_info,
 
390
                                            block_device_info)
385
391
 
386
392
    def finish_migration(self, context, migration, instance, disk_info,
387
393
                         network_info, image_meta, resize_instance=False,
388
394
                         block_device_info=None):
389
395
        """Completes a resize, turning on the migrated instance."""
390
396
        self._vmops.finish_migration(context, migration, instance, disk_info,
391
 
                                     network_info, image_meta, resize_instance)
 
397
                                     network_info, image_meta, resize_instance,
 
398
                                     block_device_info)
392
399
 
393
400
    def live_migration(self, context, instance_ref, dest,
394
401
                       post_method, recover_method, block_migration=False,
398
405
                                   post_method, recover_method,
399
406
                                   block_migration)
400
407
 
 
408
    def get_vnc_console(self, instance):
 
409
        """Return link to instance's VNC console using vCenter logic."""
 
410
        # In this situation, ESXi and vCenter require different
 
411
        # API logic to create a valid VNC console connection object.
 
412
        # In specific, vCenter does not actually run the VNC service
 
413
        # itself. You must talk to the VNC host underneath vCenter.
 
414
        return self._vmops.get_vnc_console_vcenter(instance)
 
415
 
401
416
 
402
417
class VMwareAPISession(object):
403
418
    """