diff options
| author | Vishvananda Ishaya <vishvananda@gmail.com> | 2011-04-05 14:44:39 -0700 |
|---|---|---|
| committer | Vishvananda Ishaya <vishvananda@gmail.com> | 2011-04-05 14:44:39 -0700 |
| commit | 7ab8478e312faabcbe2b2ef00c4b0a5cad2af11d (patch) | |
| tree | 8434388eb28e8a9f3ec3ce2d580662f0f21e3978 /nova/virt | |
| parent | 1654afaabba498ab690c07ccc6de858783dc1742 (diff) | |
| parent | 94ccd2f4a1c42a8574fe65972650428130ae850d (diff) | |
merged trunk
Diffstat (limited to 'nova/virt')
| -rw-r--r-- | nova/virt/hyperv.py | 4 | ||||
| -rw-r--r-- | nova/virt/libvirt_conn.py | 5 | ||||
| -rw-r--r-- | nova/virt/vmwareapi/vim.py | 50 | ||||
| -rw-r--r-- | nova/virt/vmwareapi_conn.py | 3 |
4 files changed, 36 insertions, 26 deletions
diff --git a/nova/virt/hyperv.py b/nova/virt/hyperv.py index a1ed5ebbf..13f403a66 100644 --- a/nova/virt/hyperv.py +++ b/nova/virt/hyperv.py @@ -485,3 +485,7 @@ class HyperVConnection(driver.ComputeDriver): def poll_rescued_instances(self, timeout): pass + + def update_available_resource(self, ctxt, host): + """This method is supported only by libvirt.""" + return diff --git a/nova/virt/libvirt_conn.py b/nova/virt/libvirt_conn.py index adcb2ffa3..4df26ecb5 100644 --- a/nova/virt/libvirt_conn.py +++ b/nova/virt/libvirt_conn.py @@ -841,7 +841,7 @@ class LibvirtConnection(driver.ComputeDriver): for (network_ref, mapping) in network_info: ifc_num += 1 - if not 'injected' in network_ref: + if not network_ref['injected']: continue have_injected_networks = True @@ -969,7 +969,8 @@ class LibvirtConnection(driver.ComputeDriver): 'nics': nics} if FLAGS.vnc_enabled: - xml_info['vncserver_host'] = FLAGS.vncserver_host + if FLAGS.libvirt_type != 'lxc': + xml_info['vncserver_host'] = FLAGS.vncserver_host if not rescue: if instance['kernel_id']: xml_info['kernel'] = xml_info['basepath'] + "/kernel" diff --git a/nova/virt/vmwareapi/vim.py b/nova/virt/vmwareapi/vim.py index ba14f1512..159e16a80 100644 --- a/nova/virt/vmwareapi/vim.py +++ b/nova/virt/vmwareapi/vim.py @@ -21,10 +21,10 @@ Classes for making VMware VI SOAP calls. import httplib
-from suds import WebFault
-from suds.client import Client
-from suds.plugin import MessagePlugin
-from suds.sudsobject import Property
+try:
+ import suds
+except ImportError:
+ suds = None
from nova import flags
from nova.virt.vmwareapi import error_util
@@ -42,24 +42,25 @@ flags.DEFINE_string('vmwareapi_wsdl_loc', 'Refer readme-vmware to setup')
-class VIMMessagePlugin(MessagePlugin):
+if suds:
+ class VIMMessagePlugin(suds.plugin.MessagePlugin):
- def addAttributeForValue(self, node):
- # suds does not handle AnyType properly.
- # VI SDK requires type attribute to be set when AnyType is used
- if node.name == 'value':
- node.set('xsi:type', 'xsd:string')
+ def addAttributeForValue(self, node):
+ # suds does not handle AnyType properly.
+ # VI SDK requires type attribute to be set when AnyType is used
+ if node.name == 'value':
+ node.set('xsi:type', 'xsd:string')
- def marshalled(self, context):
- """suds will send the specified soap envelope.
- Provides the plugin with the opportunity to prune empty
- nodes and fixup nodes before sending it to the server.
- """
- # suds builds the entire request object based on the wsdl schema.
- # VI SDK throws server errors if optional SOAP nodes are sent without
- # values, e.g. <test/> as opposed to <test>test</test>
- context.envelope.prune()
- context.envelope.walk(self.addAttributeForValue)
+ def marshalled(self, context):
+ """suds will send the specified soap envelope.
+ Provides the plugin with the opportunity to prune empty
+ nodes and fixup nodes before sending it to the server.
+ """
+ # suds builds the entire request object based on the wsdl schema.
+ # VI SDK throws server errors if optional SOAP nodes are sent
+ # without values, e.g. <test/> as opposed to <test>test</test>
+ context.envelope.prune()
+ context.envelope.walk(self.addAttributeForValue)
class Vim:
@@ -75,6 +76,9 @@ class Vim: protocol: http or https
host : ESX IPAddress[:port] or ESX Hostname[:port]
"""
+ if not suds:
+ raise Exception(_("Unable to import suds."))
+
self._protocol = protocol
self._host_name = host
wsdl_url = FLAGS.vmwareapi_wsdl_loc
@@ -84,7 +88,7 @@ class Vim: #wsdl_url = '%s://%s/sdk/vimService.wsdl' % (self._protocol,
# self._host_name)
url = '%s://%s/sdk' % (self._protocol, self._host_name)
- self.client = Client(wsdl_url, location=url,
+ self.client = suds.client.Client(wsdl_url, location=url,
plugins=[VIMMessagePlugin()])
self._service_content = \
self.RetrieveServiceContent("ServiceInstance")
@@ -127,7 +131,7 @@ class Vim: # check of the SOAP response
except error_util.VimFaultException, excep:
raise
- except WebFault, excep:
+ except suds.WebFault, excep:
doc = excep.document
detail = doc.childAtPath("/Envelope/Body/Fault/detail")
fault_list = []
@@ -163,7 +167,7 @@ class Vim: """Builds the request managed object."""
# Request Managed Object Builder
if type(managed_object) == type(""):
- mo = Property(managed_object)
+ mo = suds.sudsobject.Property(managed_object)
mo._type = managed_object
else:
mo = managed_object
diff --git a/nova/virt/vmwareapi_conn.py b/nova/virt/vmwareapi_conn.py index 87c3fa299..20c1b2b45 100644 --- a/nova/virt/vmwareapi_conn.py +++ b/nova/virt/vmwareapi_conn.py @@ -47,6 +47,7 @@ from nova.virt.vmwareapi import vim from nova.virt.vmwareapi import vim_util
from nova.virt.vmwareapi.vmops import VMWareVMOps
+
LOG = logging.getLogger("nova.virt.vmwareapi_conn")
FLAGS = flags.FLAGS
@@ -109,7 +110,7 @@ class VMWareESXConnection(object): def __init__(self, host_ip, host_username, host_password,
api_retry_count, scheme="https"):
session = VMWareAPISession(host_ip, host_username, host_password,
- api_retry_count, scheme=scheme)
+ api_retry_count, scheme=scheme)
self._vmops = VMWareVMOps(session)
def init_host(self, host):
|
