summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xnova/virt/vmwareapi/driver.py14
-rw-r--r--nova/virt/vmwareapi/vmops.py9
-rw-r--r--nova/virt/vmwareapi/volumeops.py9
3 files changed, 15 insertions, 17 deletions
diff --git a/nova/virt/vmwareapi/driver.py b/nova/virt/vmwareapi/driver.py
index 798a2fde3..553c50891 100755
--- a/nova/virt/vmwareapi/driver.py
+++ b/nova/virt/vmwareapi/driver.py
@@ -1,5 +1,6 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
+# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
# Copyright (c) 2012 VMware, Inc.
# Copyright (c) 2011 Citrix Systems, Inc.
# Copyright 2011 OpenStack Foundation
@@ -143,11 +144,9 @@ class VMwareESXDriver(driver.ComputeDriver):
self._session = VMwareAPISession(self._host_ip,
host_username, host_password,
api_retry_count, scheme=scheme)
- self._cluster_name = CONF.vmwareapi_cluster_name
- self._volumeops = volumeops.VMwareVolumeOps(self._session,
- self._cluster_name)
+ self._volumeops = volumeops.VMwareVolumeOps(self._session)
self._vmops = vmops.VMwareVMOps(self._session, self.virtapi,
- self._volumeops, self._cluster_name)
+ self._volumeops)
self._host = host.Host(self._session)
self._host_state = None
@@ -346,14 +345,19 @@ class VMwareVCDriver(VMwareESXDriver):
def __init__(self, virtapi, read_only=False, scheme="https"):
super(VMwareVCDriver, self).__init__(virtapi)
+ self._cluster_name = CONF.vmwareapi_cluster_name
if not self._cluster_name:
self._cluster = None
else:
self._cluster = vm_util.get_cluster_ref_from_name(
- self._session, self._cluster_name)
+ self._session, self._cluster_name)
if self._cluster is None:
raise exception.NotFound(_("VMware Cluster %s is not found")
% self._cluster_name)
+ self._volumeops = volumeops.VMwareVolumeOps(self._session,
+ self._cluster)
+ self._vmops = vmops.VMwareVMOps(self._session, self.virtapi,
+ self._volumeops, self._cluster)
self._vc_state = None
@property
diff --git a/nova/virt/vmwareapi/vmops.py b/nova/virt/vmwareapi/vmops.py
index 911edbe97..0b46ccb72 100644
--- a/nova/virt/vmwareapi/vmops.py
+++ b/nova/virt/vmwareapi/vmops.py
@@ -1,5 +1,6 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
+# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
# Copyright (c) 2012 VMware, Inc.
# Copyright (c) 2011 Citrix Systems, Inc.
# Copyright 2011 OpenStack Foundation
@@ -75,17 +76,13 @@ RESIZE_TOTAL_STEPS = 4
class VMwareVMOps(object):
"""Management class for VM-related tasks."""
- def __init__(self, session, virtapi, volumeops, cluster_name=None):
+ def __init__(self, session, virtapi, volumeops, cluster=None):
"""Initializer."""
self.compute_api = compute.API()
self._session = session
self._virtapi = virtapi
self._volumeops = volumeops
- if not cluster_name:
- self._cluster = None
- else:
- self._cluster = vm_util.get_cluster_ref_from_name(
- self._session, cluster_name)
+ self._cluster = cluster
self._instance_path_base = VMWARE_PREFIX + CONF.base_dir_name
self._default_root_device = 'vda'
self._rescue_suffix = '-rescue'
diff --git a/nova/virt/vmwareapi/volumeops.py b/nova/virt/vmwareapi/volumeops.py
index dd8f60f2a..df51cf8d8 100644
--- a/nova/virt/vmwareapi/volumeops.py
+++ b/nova/virt/vmwareapi/volumeops.py
@@ -1,5 +1,6 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
+# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
# Copyright (c) 2012 VMware, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
@@ -35,13 +36,9 @@ class VMwareVolumeOps(object):
Management class for Volume-related tasks
"""
- def __init__(self, session, cluster_name=None):
+ def __init__(self, session, cluster=None):
self._session = session
- if not cluster_name:
- self._cluster = None
- else:
- self._cluster = vm_util.get_cluster_ref_from_name(
- self._session, cluster_name)
+ self._cluster = cluster
def attach_disk_to_vm(self, vm_ref, instance_name,
adapter_type, disk_type, vmdk_path=None,