Merge "Netapp: Fix for DHSS=True backup vserver creation"

This commit is contained in:
Zuul authored and Gerrit Code Review committed 2026-07-09 12:05:14 +00:00
commit 0920a02b5b
5 files changed
+55 -7

No files matched your search

@@ -53,6 +53,7 @@ EVOLOPNOTUNDERWAY = '13171'
EVOLMOVE_CANNOT_MOVE_TO_CFO = '13633'
EAGGRDOESNOTEXIST = '14420'
EVOL_NOT_MOUNTED = '14716'
EVSERVERALREADYUSED = '14922'
EVSERVERALREADYSTARTED = '14923'
ESIS_CLONE_NOT_LICENSED = '14956'
EOBJECTNOTFOUND = '15661'
@@ -38,6 +38,7 @@ EREST_ENTRY_NOT_FOUND = '4'
EREST_NOT_AUTHORIZED = '6'
EREST_SNAPMIRROR_INITIALIZING = '917536'
EREST_VSERVER_NOT_FOUND = '13434920'
EREST_VSERVER_NAME_IN_USE = '13434908'
EREST_ANOTHER_VOLUME_OPERATION = '13107406'
EREST_LICENSE_NOT_INSTALLED = '1115127'
EREST_SNAPSHOT_NOT_SPECIFIED = '1638515'
@@ -37,6 +37,7 @@ from manila.message import message_field
from manila.share.drivers.netapp.dataontap.client import api as netapp_api
from manila.share.drivers.netapp.dataontap.client import client_cmode
from manila.share.drivers.netapp.dataontap.client import client_cmode_rest
from manila.share.drivers.netapp.dataontap.client import rest_api
from manila.share.drivers.netapp.dataontap.cluster_mode import data_motion
from manila.share.drivers.netapp.dataontap.cluster_mode import lib_base
from manila.share.drivers.netapp import utils as na_utils
@@ -2857,10 +2858,17 @@ class NetAppCmodeMultiSVMFileStorageLibrary(
aggr_list,
'Default',
client_cmode_rest.DEFAULT_SECURITY_CERT_EXPIRE_DAYS,
backend_config.netapp_delete_retention_hours,
backend_config.netapp_enable_logical_space_reporting,
)
except netapp_api.NaApiError as e:
with excutils.save_and_reraise_exception() as exc_context:
if 'already used' in e.message:
# NOTE: Suppress the error when the backup vserver already
# exists. ZAPI returns EVSERVERALREADYUSED (14922) and the
# REST client returns EREST_VSERVER_NAME_IN_USE (13434908)
# for this condition.
if e.code in (netapp_api.EVSERVERALREADYUSED,
rest_api.EREST_VSERVER_NAME_IN_USE):
exc_context.reraise = False
return des_vserver
@@ -28,6 +28,8 @@ from manila.common import constants
from manila import context
from manila import exception
from manila.share.drivers.netapp.dataontap.client import api as netapp_api
from manila.share.drivers.netapp.dataontap.client import client_cmode_rest
from manila.share.drivers.netapp.dataontap.client import rest_api
from manila.share.drivers.netapp.dataontap.cluster_mode import data_motion
from manila.share.drivers.netapp.dataontap.cluster_mode import lib_base
from manila.share.drivers.netapp.dataontap.cluster_mode import lib_multi_svm
@@ -4485,7 +4487,25 @@ class NetAppFileStorageLibraryTestCase(test.TestCase):
fake_current_network_allocations, fake_new_network_allocations,
export_locations=None)
def test__get_backup_vserver(self):
# NOTE: The two messages below are the verbatim error strings that ONTAP
# returns for the same "name already in use" condition. The legacy ZAPI
# client phrases it using "Vserver", while the REST client uses "SVM"
# (the modern term for the same object) and also mentions "IPspace or
# cluster" because in ONTAP an SVM name shares a namespace with IPspace
# and cluster names. _get_backup_vserver suppresses this condition by
# matching the error *code* (EVSERVERALREADYUSED /
# EREST_VSERVER_NAME_IN_USE), not the message text, so the exact wording
# here is illustrative only.
@ddt.data(
# Legacy ZAPI client returns error code 14922 for this condition.
{'code': netapp_api.EVSERVERALREADYUSED,
'message': 'The Vserver name is already used by another Vserver. '},
# REST client returns error code 13434908 for this condition.
{'code': rest_api.EREST_VSERVER_NAME_IN_USE,
'message': 'Invalid SVM name. The name is already in use by '
'another SVM, IPspace or cluster.'},
)
def test__get_backup_vserver(self, api_error):
mock_dest_client = mock.Mock()
self.mock_object(self.library,
'_get_backend',
@@ -4499,12 +4519,22 @@ class NetAppFileStorageLibraryTestCase(test.TestCase):
self.mock_object(mock_dest_client,
'list_non_root_aggregates',
mock.Mock(return_value=['aggr1', 'aggr2']))
self.mock_object(mock_dest_client,
'create_vserver',
mock.Mock(side_effect=netapp_api.NaApiError(
message='Vserver name is already used by another'
' Vserver')))
mock_create_vserver = self.mock_object(
mock_dest_client,
'create_vserver',
mock.Mock(side_effect=netapp_api.NaApiError(
code=api_error['code'], message=api_error['message'])))
self.library._get_backup_vserver(fake.SHARE_BACKUP, fake.SHARE_SERVER)
mock_create_vserver.assert_called_once_with(
'backup_fake_id',
None,
None,
['aggr1', 'aggr2'],
'Default',
client_cmode_rest.DEFAULT_SECURITY_CERT_EXPIRE_DAYS,
12,
False,
)
def test__delete_backup_vserver(self):
mock_api_client = mock.Mock()
@@ -0,0 +1,8 @@
---
fixes:
- |
NetApp ONTAP driver: Fixed share backup failure in ``driver_handles_share_servers=True``
(DHSS=True) mode, where the destination backup vserver could not be created because
the retention period and logical space reporting parameters were not passed to the
vserver creation call. See `bug 2154820
<https://bugs.launchpad.net/manila/+bug/2154820>`_ for more details.