Synology: Add support for UC-Series model
Use regular expression of firmware version to check if the model supports Cinder driver or not. Closes-Bug: #1817259 Change-Id: I166be597d62d8e5fb221da73fd79487379917850
This commit is contained in:
parent
6785bf614b
commit
66bfd46e4b
@ -1104,10 +1104,10 @@ class SynoCommonTestCase(test.TestCase):
|
|||||||
|
|
||||||
def test__check_ds_version(self):
|
def test__check_ds_version(self):
|
||||||
ver1 = 'DSM 6.1-9999'
|
ver1 = 'DSM 6.1-9999'
|
||||||
ver2 = 'DSM 6.0.2-9999'
|
ver2 = 'DSM UC 1.0-9999 Update 2'
|
||||||
ver3 = 'DSM 6.0.1-9999 Update 2'
|
ver3 = 'DSM 6.0.1-9999 Update 2'
|
||||||
ver4 = 'DSM 6.0-9999 Update 2'
|
ver4 = 'DSM 6.0-9999 Update 2'
|
||||||
ver5 = 'DSM 5.2-9999 '
|
ver5 = 'DSM 5.2-9999'
|
||||||
out = {
|
out = {
|
||||||
'data': {
|
'data': {
|
||||||
},
|
},
|
||||||
|
@ -20,6 +20,7 @@ import json
|
|||||||
import math
|
import math
|
||||||
from os import urandom
|
from os import urandom
|
||||||
from random import randint
|
from random import randint
|
||||||
|
import re
|
||||||
|
|
||||||
from cryptography.hazmat.backends import default_backend
|
from cryptography.hazmat.backends import default_backend
|
||||||
from cryptography.hazmat.primitives.asymmetric import padding
|
from cryptography.hazmat.primitives.asymmetric import padding
|
||||||
@ -856,17 +857,26 @@ class SynoCommon(object):
|
|||||||
reason=_('data not found'))
|
reason=_('data not found'))
|
||||||
firmware_version = out['data']['firmware_ver']
|
firmware_version = out['data']['firmware_ver']
|
||||||
|
|
||||||
# e.g. 'DSM 6.1-7610', 'DSM 6.0.1-7370', 'DSM 6.0-7321 update 3'
|
# e.g. 'DSM 6.1-7610', 'DSM 6.0.1-7321 update 3', 'DSM UC 1.0-6789'
|
||||||
version = firmware_version.split()[1].split('-')[0]
|
pattern = re.compile(r"^(.*) (\d+)\.(\d+)(?:\.(\d+))?-(\d+)"
|
||||||
versions = version.split('.')
|
r"(?: [uU]pdate (\d+))?$")
|
||||||
major, minor, hotfix = (versions[0],
|
matches = pattern.match(firmware_version)
|
||||||
versions[1],
|
|
||||||
versions[2] if len(versions) is 3 else '0')
|
|
||||||
|
|
||||||
major, minor, hotfix = (int(major), int(minor), int(hotfix))
|
if not matches:
|
||||||
|
m = (_('DS version %s is not supported') %
|
||||||
|
firmware_version)
|
||||||
|
raise exception.VolumeDriverException(message=m)
|
||||||
|
|
||||||
if (6 > major) or (major is 6 and minor is 0 and hotfix < 2):
|
os_name = matches.group(1)
|
||||||
m = (_('DS version %s is not supperted') %
|
major = int(matches.group(2))
|
||||||
|
minor = int(matches.group(3))
|
||||||
|
hotfix = int(matches.group(4)) if matches.group(4) else 0
|
||||||
|
|
||||||
|
if os_name == 'DSM UC':
|
||||||
|
return
|
||||||
|
elif (os_name == 'DSM' and
|
||||||
|
((6 > major) or (major is 6 and minor is 0 and hotfix < 2))):
|
||||||
|
m = (_('DS version %s is not supported') %
|
||||||
firmware_version)
|
firmware_version)
|
||||||
raise exception.VolumeDriverException(message=m)
|
raise exception.VolumeDriverException(message=m)
|
||||||
|
|
||||||
|
@ -31,10 +31,11 @@ class SynoISCSIDriver(driver.ISCSIDriver):
|
|||||||
|
|
||||||
Version history:
|
Version history:
|
||||||
1.0.0 - Initial driver. Provide Cinder minimum features
|
1.0.0 - Initial driver. Provide Cinder minimum features
|
||||||
|
1.0.1 - Add support for UC series model
|
||||||
"""
|
"""
|
||||||
# ThirdPartySystems wiki page
|
# ThirdPartySystems wiki page
|
||||||
CI_WIKI_NAME = 'Synology_DSM_CI'
|
CI_WIKI_NAME = 'Synology_DSM_CI'
|
||||||
VERSION = '1.0.0'
|
VERSION = '1.0.1'
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(SynoISCSIDriver, self).__init__(*args, **kwargs)
|
super(SynoISCSIDriver, self).__init__(*args, **kwargs)
|
||||||
|
@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
Added support for UC-Series model to Synology Cinder driver.
|
Loading…
Reference in New Issue
Block a user