X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_ro%2Fvimconn_vmware.py;h=dd3bba5f250a5be6fcdcf567cddb5f0bf0f8db40;hb=31e141b7336c646af63b674414f8c27cf6746bb3;hp=2e25c5073ab4d9f11ea7ba5dea61dfdbfc3b48c5;hpb=a8e5b7847d8731b96623f742e62dbb6016d42bff;p=osm%2FRO.git diff --git a/osm_ro/vimconn_vmware.py b/osm_ro/vimconn_vmware.py index 2e25c507..dd3bba5f 100644 --- a/osm_ro/vimconn_vmware.py +++ b/osm_ro/vimconn_vmware.py @@ -1466,7 +1466,7 @@ class vimconnector(vimconn.vimconnector): 'name': (optional) name for the interface. 'net_id': VIM network id where this interface must be connect to. Mandatory for type==virtual 'vpci': (optional) virtual vPCI address to assign at the VM. Can be ignored depending on VIM capabilities - 'model': (optional and only have sense for type==virtual) interface model: virtio, e2000, ... + 'model': (optional and only have sense for type==virtual) interface model: virtio, e1000, ... 'mac_address': (optional) mac address to assign to this interface #TODO: CHECK if an optional 'vlan' parameter is needed for VIMs when type if VF and net_id is not provided, the VLAN tag to be used. In case net_id is provided, the internal network vlan is used for tagging VF @@ -1588,6 +1588,7 @@ class vimconnector(vimconn.vimconnector): #If no mgmt, then the 1st NN in netlist is considered as primary net. primary_net = None primary_netname = None + primary_net_href = None network_mode = 'bridged' if net_list is not None and len(net_list) > 0: for net in net_list: @@ -1598,6 +1599,8 @@ class vimconnector(vimconn.vimconnector): try: primary_net_id = primary_net['net_id'] + url_list = [self.url, '/api/network/', primary_net_id] + primary_net_href = ''.join(url_list) network_dict = self.get_vcd_network(network_uuid=primary_net_id) if 'name' in network_dict: primary_netname = network_dict['name'] @@ -1667,9 +1670,9 @@ class vimconnector(vimconn.vimconnector): Configuration parameters for logical networks - + - + bridged @@ -1724,6 +1727,8 @@ class vimconnector(vimconn.vimconnector): false """.format(vmname_andid, + primary_netname, + primary_net_href, vapp_tempalte_href, vm_href, vm_id, @@ -1862,8 +1867,8 @@ class vimconnector(vimconn.vimconnector): # add NICs & connect to networks in netlist try: self.logger.info("Request to connect VM to a network: {}".format(net_list)) - nicIndex = 0 primary_nic_index = 0 + nicIndex = 0 for net in net_list: # openmano uses network id in UUID format. # vCloud Director need a name so we do reverse operation from provided UUID we lookup a name @@ -1881,6 +1886,10 @@ class vimconnector(vimconn.vimconnector): interface_net_name = self.get_network_name_by_id(network_uuid=interface_net_id) interface_network_mode = net['use'] + if interface_net_name == primary_netname: + nicIndex += 1 + continue + if interface_network_mode == 'mgmt': primary_nic_index = nicIndex @@ -1908,8 +1917,9 @@ class vimconnector(vimconn.vimconnector): if 'type' in net and net['type'] not in type_list: # fetching nic type from vnf if 'model' in net: - if net['model'] is not None and net['model'].lower() == 'virtio': - nic_type = 'VMXNET3' + if net['model'] is not None: + if net['model'].lower() == 'paravirt' or net['model'].lower() == 'virtio': + nic_type = 'VMXNET3' else: nic_type = net['model'] @@ -2774,11 +2784,16 @@ class vimconnector(vimconn.vimconnector): "VM details") xmlroot = XmlElementTree.fromstring(response.content) + result = response.content.replace("\n"," ") - hdd_mb = re.search('vcloud:capacity="(\d+)"\svcloud:storageProfileOverrideVmDefault=',result).group(1) - vm_details['hdd_mb'] = int(hdd_mb) if hdd_mb else None - cpus = re.search('Number of Virtual CPUs(\d+)',result).group(1) - vm_details['cpus'] = int(cpus) if cpus else None + hdd_match = re.search('vcloud:capacity="(\d+)"\svcloud:storageProfileOverrideVmDefault=',result) + if hdd_match: + hdd_mb = hdd_match.group(1) + vm_details['hdd_mb'] = int(hdd_mb) if hdd_mb else None + cpus_match = re.search('Number of Virtual CPUs(\d+)',result) + if cpus_match: + cpus = cpus_match.group(1) + vm_details['cpus'] = int(cpus) if cpus else None memory_mb = re.search('Memory Size(\d+)',result).group(1) vm_details['memory_mb'] = int(memory_mb) if memory_mb else None vm_details['status'] = vcdStatusCode2manoFormat[int(xmlroot.get('status'))] @@ -4634,6 +4649,8 @@ class vimconnector(vimconn.vimconnector): None """ + self.logger.info("Add network adapter to VM: network_name {} nicIndex {}".\ + format(network_name, nicIndex)) try: ip_address = None floating_ip = False