NetApp cDOT vserver deletion fails if no lifs present

If no LIFs are present on a vserver (such as can happen if an error
occurs during share creation in driver_handles_share_servers=True
mode), the vserver deletion fails due to a recent change. This makes
the deletion path more resilient.

Change-Id: I475b7b00cd5ba6bb111e2002bb8faa49e4878592
Closes-Bug: #1607029
This commit is contained in:
Clinton Knight 2016-07-27 14:05:32 -04:00 committed by Goutham Pacha Ravi
parent 4e9f52022f
commit bcd2855e8e
3 changed files with 12 additions and 6 deletions

View File

@ -320,8 +320,10 @@ class NetAppCmodeMultiSVMFileStorageLibrary(
vserver_client = self._get_api_client(vserver=vserver) vserver_client = self._get_api_client(vserver=vserver)
network_interfaces = vserver_client.get_network_interfaces() network_interfaces = vserver_client.get_network_interfaces()
home_port = network_interfaces[0]['home-port'] vlan = None
vlan = home_port.split('-')[1] if network_interfaces:
home_port = network_interfaces[0]['home-port']
vlan = home_port.split('-')[1]
@utils.synchronized('netapp-VLAN-%s' % vlan, external=True) @utils.synchronized('netapp-VLAN-%s' % vlan, external=True)
def _delete_vserver_with_lock(): def _delete_vserver_with_lock():

View File

@ -698,7 +698,8 @@ class NetAppFileStorageLibraryTestCase(test.TestCase):
mock_delete_vserver_vlan.assert_called_once_with( mock_delete_vserver_vlan.assert_called_once_with(
c_fake.NETWORK_INTERFACES) c_fake.NETWORK_INTERFACES)
def test_delete_vserver_with_ipspace(self): @ddt.data([], c_fake.NETWORK_INTERFACES)
def test_delete_vserver_with_ipspace(self, interfaces):
self.mock_object(self.library._client, self.mock_object(self.library._client,
'get_vserver_ipspace', 'get_vserver_ipspace',
@ -714,7 +715,7 @@ class NetAppFileStorageLibraryTestCase(test.TestCase):
'_delete_vserver_vlan') '_delete_vserver_vlan')
self.mock_object(vserver_client, self.mock_object(vserver_client,
'get_network_interfaces', 'get_network_interfaces',
mock.Mock(return_value=c_fake.NETWORK_INTERFACES)) mock.Mock(return_value=interfaces))
security_services = fake.NETWORK_INFO['security_services'] security_services = fake.NETWORK_INFO['security_services']
@ -727,8 +728,7 @@ class NetAppFileStorageLibraryTestCase(test.TestCase):
fake.VSERVER1, vserver_client, security_services=security_services) fake.VSERVER1, vserver_client, security_services=security_services)
self.library._client.delete_ipspace.assert_called_once_with( self.library._client.delete_ipspace.assert_called_once_with(
fake.IPSPACE) fake.IPSPACE)
mock_delete_vserver_vlan.assert_called_once_with( mock_delete_vserver_vlan.assert_called_once_with(interfaces)
c_fake.NETWORK_INTERFACES)
def test_delete_vserver_vlan(self): def test_delete_vserver_vlan(self):

View File

@ -0,0 +1,4 @@
---
fixes:
- Fixed issue with NetApp cDOT share server cleanup when LIF creation fails
while setting up a new vServer.