QNAP: driver changes share size when manage share

After manage share, driver updates the share size.
The share size should not be updated.

Change-Id: I5f670495cd61b63d1c0669c274b502a6a691e4e2
Closes-Bug: #1773761
This commit is contained in:
Chris Yang 2018-05-28 18:38:17 +08:00
parent 500c7e075a
commit a3314dbef9
4 changed files with 14 additions and 5 deletions

View File

@ -499,7 +499,6 @@ class QnapAPIExecutor(object):
'action': 'share_property',
'sharename': share_dict['sharename'],
'old_sharename': share_dict['old_sharename'],
'vol_size': six.text_type(share_dict['new_size']) + 'GB',
'dedup': 'sha512' if share_dict['deduplication'] else 'off',
'compression': '1' if share_dict['compression'] else '0',
'thin_pro': '1' if share_dict['thin_provision'] else '0',
@ -515,6 +514,8 @@ class QnapAPIExecutor(object):
'recycle_bin_administrators_only': '0',
'sid': self.sid,
}
if share_dict.get('new_size'):
params['vol_size'] = six.text_type(share_dict['new_size']) + 'GB'
sanitized_params = self._sanitize_params(params)
sanitized_params = urllib.parse.urlencode(sanitized_params)

View File

@ -17,6 +17,7 @@ Share driver for QNAP Storage.
This driver supports QNAP Storage for NFS.
"""
import datetime
import math
import re
import time
@ -70,9 +71,11 @@ class QnapShareDriver(driver.ShareDriver):
1.0.3 - Add supports for Thin Provisioning, SSD Cache, Deduplication
and Compression.
1.0.4 - Add support for QES fw 2.0.0.
1.0.5 - Fix bug #1773761, when user tries to manage share, the size
of managed share should not be changed.
"""
DRIVER_VERSION = '1.0.4'
DRIVER_VERSION = '1.0.5'
def __init__(self, *args, **kwargs):
"""Initialize QnapShareDriver."""
@ -837,12 +840,11 @@ class QnapShareDriver(driver.ShareDriver):
vol_no = existing_share.find('vol_no').text
vol = self.api_executor.get_specific_volinfo(vol_no)
vol_size_gb = int(vol.find('size').text) / units.Gi
vol_size_gb = math.ceil(float(vol.find('size').text) / units.Gi)
share_dict = {
'sharename': share_name,
'old_sharename': share_name,
'new_size': vol_size_gb,
'thin_provision': qnap_thin_provision,
'compression': qnap_compression,
'deduplication': qnap_deduplication,

View File

@ -475,7 +475,6 @@ class QnapAPITestCase(QnapShareDriverBaseTestCase):
'action': 'share_property',
'sharename': 'fakeVolId',
'old_sharename': 'fakeVolId',
'vol_size': '100GB',
'dedup': 'off',
'compression': '1',
'thin_pro': '1',
@ -491,6 +490,8 @@ class QnapAPITestCase(QnapShareDriverBaseTestCase):
'recycle_bin_administrators_only': '0',
'sid': 'fakeSid',
}
if expect_share_dict.get('new_size'):
fake_params['vol_size'] = '100GB'
sanitized_params = self._sanitize_params(fake_params)
fake_url = (
'/cgi-bin/priv/privWizard.cgi?%s' % sanitized_params)

View File

@ -0,0 +1,5 @@
---
fixes:
- |
Fixed the QNAP driver so that it does not modify the
share size on the back end when manila manages a share.