From 047af2c506374aa44bb896a7df0cb5813bf3a123 Mon Sep 17 00:00:00 2001 From: Thierry Carrez Date: Wed, 30 Mar 2011 15:02:59 +0200 Subject: Add missing method that prevent HyperV compute nodes from starting up --- nova/virt/hyperv.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'nova/virt') 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 -- cgit From 6f274d0a5818633b072e432ba7182650f0d30001 Mon Sep 17 00:00:00 2001 From: Thierry Carrez Date: Wed, 30 Mar 2011 15:28:21 +0200 Subject: Do not push 'None' to authorized_keys when no key is specified --- nova/virt/libvirt_conn.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'nova/virt') diff --git a/nova/virt/libvirt_conn.py b/nova/virt/libvirt_conn.py index b28584cb6..f34ea7225 100644 --- a/nova/virt/libvirt_conn.py +++ b/nova/virt/libvirt_conn.py @@ -828,7 +828,10 @@ class LibvirtConnection(driver.ComputeDriver): if FLAGS.libvirt_type == 'lxc': target_partition = None - key = str(inst['key_data']) + if inst['key_data']: + key = str(inst['key_data']) + else: + key = None net = None nets = [] -- cgit From 23776e5b2bdb73df10be590b589c34788c28023a Mon Sep 17 00:00:00 2001 From: Josh Kearney Date: Wed, 30 Mar 2011 12:28:09 -0500 Subject: Avoid hard dependencies --- nova/virt/vmwareapi_conn.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'nova/virt') diff --git a/nova/virt/vmwareapi_conn.py b/nova/virt/vmwareapi_conn.py index 87c3fa299..34d29a4e5 100644 --- a/nova/virt/vmwareapi_conn.py +++ b/nova/virt/vmwareapi_conn.py @@ -43,10 +43,12 @@ from nova import flags from nova import log as logging from nova import utils from nova.virt.vmwareapi import error_util -from nova.virt.vmwareapi import vim from nova.virt.vmwareapi import vim_util from nova.virt.vmwareapi.vmops import VMWareVMOps + +vim = None + LOG = logging.getLogger("nova.virt.vmwareapi_conn") FLAGS = flags.FLAGS @@ -78,6 +80,13 @@ flags.DEFINE_string('vmwareapi_vlan_interface', TIME_BETWEEN_API_CALL_RETRIES = 2.0 +def get_imported_vim(): + """Avoid any hard dependencies.""" + global vim + if vim is None: + vim = __import__("nova.virt.vmwareapi.vim") + + class Failure(Exception): """Base Exception class for handling task failures.""" @@ -109,7 +118,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): @@ -204,6 +213,7 @@ class VMWareAPISession(object): self._session_id = None self.vim = None self._create_session() + get_imported_vim() def _get_vim_object(self): """Create the VIM Object instance.""" -- cgit From be4be55bf03c907f46e76fffe3457743915d734a Mon Sep 17 00:00:00 2001 From: Josh Kearney Date: Wed, 30 Mar 2011 13:50:02 -0500 Subject: Handle in vim.py --- nova/virt/vmwareapi/vim.py | 15 +++++++++++---- nova/virt/vmwareapi_conn.py | 10 ---------- 2 files changed, 11 insertions(+), 14 deletions(-) (limited to 'nova/virt') diff --git a/nova/virt/vmwareapi/vim.py b/nova/virt/vmwareapi/vim.py index ba14f1512..1c850595d 100644 --- a/nova/virt/vmwareapi/vim.py +++ b/nova/virt/vmwareapi/vim.py @@ -21,10 +21,14 @@ 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: + suds = True + from suds import WebFault + from suds.client import Client + from suds.plugin import MessagePlugin + from suds.sudsobject import Property +except ImportError: + suds = False from nova import flags from nova.virt.vmwareapi import error_util @@ -75,6 +79,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 diff --git a/nova/virt/vmwareapi_conn.py b/nova/virt/vmwareapi_conn.py index 34d29a4e5..b909e659d 100644 --- a/nova/virt/vmwareapi_conn.py +++ b/nova/virt/vmwareapi_conn.py @@ -47,8 +47,6 @@ from nova.virt.vmwareapi import vim_util from nova.virt.vmwareapi.vmops import VMWareVMOps -vim = None - LOG = logging.getLogger("nova.virt.vmwareapi_conn") FLAGS = flags.FLAGS @@ -80,13 +78,6 @@ flags.DEFINE_string('vmwareapi_vlan_interface', TIME_BETWEEN_API_CALL_RETRIES = 2.0 -def get_imported_vim(): - """Avoid any hard dependencies.""" - global vim - if vim is None: - vim = __import__("nova.virt.vmwareapi.vim") - - class Failure(Exception): """Base Exception class for handling task failures.""" @@ -213,7 +204,6 @@ class VMWareAPISession(object): self._session_id = None self.vim = None self._create_session() - get_imported_vim() def _get_vim_object(self): """Create the VIM Object instance.""" -- cgit From 2eadc55dbd66af7b5adb3c21fe9cc91cd04b0f8b Mon Sep 17 00:00:00 2001 From: Josh Kearney Date: Wed, 30 Mar 2011 13:56:02 -0500 Subject: Whoops --- nova/virt/vmwareapi_conn.py | 1 + 1 file changed, 1 insertion(+) (limited to 'nova/virt') diff --git a/nova/virt/vmwareapi_conn.py b/nova/virt/vmwareapi_conn.py index b909e659d..20c1b2b45 100644 --- a/nova/virt/vmwareapi_conn.py +++ b/nova/virt/vmwareapi_conn.py @@ -43,6 +43,7 @@ from nova import flags from nova import log as logging from nova import utils from nova.virt.vmwareapi import error_util +from nova.virt.vmwareapi import vim from nova.virt.vmwareapi import vim_util from nova.virt.vmwareapi.vmops import VMWareVMOps -- cgit From 5d71e187dc6eddab19ecdc0feb97e41263e09a84 Mon Sep 17 00:00:00 2001 From: Brian Lamar Date: Thu, 31 Mar 2011 17:19:59 -0400 Subject: Hopefully absolved us of the suds issue? --- nova/virt/vmwareapi/vim.py | 47 ++++++++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 25 deletions(-) (limited to 'nova/virt') diff --git a/nova/virt/vmwareapi/vim.py b/nova/virt/vmwareapi/vim.py index 1c850595d..159e16a80 100644 --- a/nova/virt/vmwareapi/vim.py +++ b/nova/virt/vmwareapi/vim.py @@ -22,13 +22,9 @@ Classes for making VMware VI SOAP calls. import httplib try: - suds = True - from suds import WebFault - from suds.client import Client - from suds.plugin import MessagePlugin - from suds.sudsobject import Property + import suds except ImportError: - suds = False + suds = None from nova import flags from nova.virt.vmwareapi import error_util @@ -46,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. as opposed to 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. as opposed to test + context.envelope.prune() + context.envelope.walk(self.addAttributeForValue) class Vim: @@ -91,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") @@ -134,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 = [] @@ -170,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 -- cgit From ec30c42b3b4532743c8353c5e9fa04ae00803db3 Mon Sep 17 00:00:00 2001 From: Ilya Alekseyev Date: Mon, 4 Apr 2011 18:31:35 +0400 Subject: network injection check fixed --- nova/virt/libvirt_conn.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nova/virt') diff --git a/nova/virt/libvirt_conn.py b/nova/virt/libvirt_conn.py index f34ea7225..c952f6f47 100644 --- a/nova/virt/libvirt_conn.py +++ b/nova/virt/libvirt_conn.py @@ -842,7 +842,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 -- cgit From 350aaa819c8f97e0bcbd9e4d0f6f0da41784b630 Mon Sep 17 00:00:00 2001 From: Ilya Alekseyev Date: Mon, 4 Apr 2011 22:39:39 +0400 Subject: working with network_ref like with mapping --- nova/virt/libvirt_conn.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nova/virt') diff --git a/nova/virt/libvirt_conn.py b/nova/virt/libvirt_conn.py index c952f6f47..babbc610d 100644 --- a/nova/virt/libvirt_conn.py +++ b/nova/virt/libvirt_conn.py @@ -842,7 +842,7 @@ class LibvirtConnection(driver.ComputeDriver): for (network_ref, mapping) in network_info: ifc_num += 1 - if not network_ref.injected: + if not network_ref['injected']: continue have_injected_networks = True -- cgit