copy_image_to_volume failed for modify_volume from fusioncompute

Change-Id: I7b4ea1440b3f7b9c64b3d1563bb71ad0c4b1f859
This commit is contained in:
DongZhi 2016-12-07 23:38:35 +08:00 committed by Dong Zhi
parent 09bf790158
commit 76625bad6a
14 changed files with 66 additions and 52 deletions

View File

@ -22,8 +22,8 @@ import urlparse
from oslo_config import cfg
from oslo_log import log as logging
from cinder.volume.drivers.huawei.vrm.conf import FC_DRIVER_CONF
from cinder.volume.drivers.huawei.vrm.http_client import VRMHTTPClient
from cinder.volume.drivers.huawei.fusioncompute.conf import FC_DRIVER_CONF
from cinder.volume.drivers.huawei.fusioncompute.http_client import VRMHTTPClient
TASK_WAITING = 'waiting'

View File

@ -21,7 +21,7 @@
from oslo_log import log as logging
from cinder.i18n import _
from cinder.volume.drivers.huawei.vrm.base_proxy import BaseProxy
from cinder.volume.drivers.huawei.fusioncompute.base_proxy import BaseProxy
TASK_WAITING = 'waiting'

View File

@ -100,6 +100,16 @@ VRM_opts = [
cfg.StrOpt('export_version',
default='v6.0',
help='export version of VHD'),
cfg.StrOpt('glance_host',
default='v6.0',
help='ip of glance server'),
cfg.StrOpt('glance_port',
default='v6.0',
help='ip of glance server'),
cfg.StrOpt('glance_host_ip',
default='v6.0',
help='ip of glance server'),
]
CONF = cfg.CONF
CONF.register_group(VRM_group)

View File

@ -22,8 +22,8 @@ import json
from oslo_log import log as logging
from cinder.i18n import _
from cinder.volume.drivers.huawei.vrm.base_proxy import BaseProxy
from cinder.volume.drivers.huawei.vrm import exception as driver_exception
from cinder.volume.drivers.huawei.fusioncompute.base_proxy import BaseProxy
from cinder.volume.drivers.huawei.fusioncompute import exception as driver_exception
TASK_WAITING = 'waiting'
TASK_RUNNING = 'running'

View File

@ -20,7 +20,7 @@
from oslo_log import log as logging
from cinder.volume.drivers.huawei.vrm.base_proxy import BaseProxy
from cinder.volume.drivers.huawei.fusioncompute.base_proxy import BaseProxy
TASK_WAITING = 'waiting'

View File

@ -25,9 +25,9 @@ from oslo_config import cfg
from oslo_log import log as logging
from cinder.i18n import _
from cinder.volume.drivers.huawei.vrm.conf import FC_DRIVER_CONF
from cinder.volume.drivers.huawei.vrm import exception as driver_exception
from cinder.volume.drivers.huawei.vrm import utils as apiutils
from cinder.volume.drivers.huawei.fusioncompute.conf import FC_DRIVER_CONF
from cinder.volume.drivers.huawei.fusioncompute import exception as driver_exception
from cinder.volume.drivers.huawei.fusioncompute import utils as apiutils
try:
from eventlet import sleep
@ -249,7 +249,7 @@ class VRMHTTPClient(object):
'Content-Type'] = 'application/json;charset=UTF-8'
kwargs['data'] = kwargs['body']
body = apiutils.str_drop_password_key(kwargs['body'])
# body = apiutils.str_drop_password_key(kwargs['body'])
# LOG.info(_("[VRM-CINDER] request body [%s]"), body)
del kwargs['body']

View File

@ -21,9 +21,9 @@ from oslo_config import cfg
from oslo_log import log as logging
from cinder.i18n import _
from cinder.volume.drivers.huawei.vrm.base_proxy import BaseProxy
from cinder.volume.drivers.huawei.vrm import exception as driver_exception
from cinder.volume.drivers.huawei.vrm.utils import Delete_Snapshot_Code
from cinder.volume.drivers.huawei.fusioncompute.base_proxy import BaseProxy
from cinder.volume.drivers.huawei.fusioncompute import exception as driver_exception
from cinder.volume.drivers.huawei.fusioncompute.utils import Delete_Snapshot_Code
try:
from eventlet import sleep

View File

@ -25,9 +25,9 @@ from oslo_log import log as logging
from cinder import exception
from cinder.i18n import _
from cinder.volume.drivers.huawei.vrm.base_proxy import BaseProxy
from cinder.volume.drivers.huawei.vrm.conf import FC_DRIVER_CONF
from cinder.volume.drivers.huawei.vrm.task_proxy import TaskProxy
from cinder.volume.drivers.huawei.fusioncompute.base_proxy import BaseProxy
from cinder.volume.drivers.huawei.fusioncompute.conf import FC_DRIVER_CONF
from cinder.volume.drivers.huawei.fusioncompute.task_proxy import TaskProxy
try:
from eventlet import sleep
@ -386,14 +386,9 @@ class VmProxy(BaseProxy):
else:
template = 'false'
if CONF.glance_host is None or str(CONF.glance_port) is None \
or FC_DRIVER_CONF.glance_server_ip is None:
raise exception.ParameterNotFound(param='glance_host or '
'glance_port or glance_ip')
endpoint = CONF.glance_host + ":" + str(CONF.glance_port)
token = kwargs.get('auth_token')
serviceIp = FC_DRIVER_CONF.glance_server_ip
endpoint = str(FC_DRIVER_CONF.glance_host) + ":" + str(FC_DRIVER_CONF.glance_port)
serviceIp = FC_DRIVER_CONF.glance_host_ip
body = {
'name': 'cinder-vm-' + name,
'group': 'FSP',

View File

@ -21,9 +21,9 @@ import json
from cinder import exception as cinder_exception
from cinder.i18n import _
from cinder.volume.drivers.huawei.vrm.base_proxy import BaseProxy
from cinder.volume.drivers.huawei.vrm import exception as driver_exception
from cinder.volume.drivers.huawei.vrm.task_proxy import TaskProxy
from cinder.volume.drivers.huawei.fusioncompute.base_proxy import BaseProxy
from cinder.volume.drivers.huawei.fusioncompute import exception as driver_exception
from cinder.volume.drivers.huawei.fusioncompute.task_proxy import TaskProxy
from oslo_log import log as logging

View File

@ -24,10 +24,10 @@ from oslo_log import log as logging
from cinder import exception as cinder_exception
from cinder.i18n import _
from cinder.volume.drivers.huawei.vrm.base_proxy import BaseProxy
from cinder.volume.drivers.huawei.vrm import exception as driver_exception
from cinder.volume.drivers.huawei.vrm.task_proxy import TaskProxy
from cinder.volume.drivers.huawei.vrm.utils import Delete_Snapshot_Code
from cinder.volume.drivers.huawei.fusioncompute.base_proxy import BaseProxy
from cinder.volume.drivers.huawei.fusioncompute import exception as driver_exception
from cinder.volume.drivers.huawei.fusioncompute.task_proxy import TaskProxy
from cinder.volume.drivers.huawei.fusioncompute.utils import Delete_Snapshot_Code
CONF = cfg.CONF

View File

@ -21,8 +21,8 @@ from oslo_log import log as logging
from cinder import exception as cinder_exception
from cinder.i18n import _
from cinder.volume.drivers.huawei.vrm.conf import FC_DRIVER_CONF
from cinder.volume.drivers.huawei.vrm import exception as driver_exception
from cinder.volume.drivers.huawei.fusioncompute.conf import FC_DRIVER_CONF
from cinder.volume.drivers.huawei.fusioncompute import exception as driver_exception
TASK_WAITING = 'waiting'
TASK_RUNNING = 'running'

View File

@ -23,15 +23,15 @@ from cinder import exception
from cinder.i18n import _
from cinder import volume
from cinder.volume import driver
from cinder.volume.drivers.huawei.vrm.cluster_proxy import ClusterProxy
from cinder.volume.drivers.huawei.vrm.conf import FC_DRIVER_CONF
from cinder.volume.drivers.huawei.vrm.datastore_proxy import DatastoreProxy
from cinder.volume.drivers.huawei.vrm import exception as driver_exception
from cinder.volume.drivers.huawei.vrm.host_proxy import HostProxy
from cinder.volume.drivers.huawei.vrm.http_client import VRMHTTPClient
from cinder.volume.drivers.huawei.vrm.vm_proxy import VmProxy
from cinder.volume.drivers.huawei.vrm.volume_proxy import VolumeProxy
from cinder.volume.drivers.huawei.vrm.volume_snapshot_proxy import \
from cinder.volume.drivers.huawei.fusioncompute.cluster_proxy import ClusterProxy
from cinder.volume.drivers.huawei.fusioncompute.conf import FC_DRIVER_CONF
from cinder.volume.drivers.huawei.fusioncompute.datastore_proxy import DatastoreProxy
from cinder.volume.drivers.huawei.fusioncompute import exception as driver_exception
from cinder.volume.drivers.huawei.fusioncompute.host_proxy import HostProxy
from cinder.volume.drivers.huawei.fusioncompute.http_client import VRMHTTPClient
from cinder.volume.drivers.huawei.fusioncompute.vm_proxy import VmProxy
from cinder.volume.drivers.huawei.fusioncompute.volume_proxy import VolumeProxy
from cinder.volume.drivers.huawei.fusioncompute.volume_snapshot_proxy import \
VolumeSnapshotProxy
from cinder.volume import utils as volume_utils
@ -53,6 +53,17 @@ def metadata_to_dict(metadata):
return result
def string_to_dict(string):
if string is not None:
dic = {}
split_string = string.split(',')
for item in split_string:
ts = item.split("=")
if ts.__len__() == 2:
dic[ts[0]] = ts[1]
return dic
LOG = logging.getLogger(__name__)
CONF = cfg.CONF
@ -563,7 +574,7 @@ class VRMDriver(driver.VolumeDriver):
LOG.info(_("[BRM-DRIVER] start _vrm_unpack_provider_location() "))
kvalue = None
kvs = {}
if not isinstance(provider_location, None) and len(
if provider_location is not None and len(
provider_location) > 0:
items = provider_location.split(',')
for item in items:
@ -763,7 +774,6 @@ class VRMDriver(driver.VolumeDriver):
:return:
'''
LOG.info(_("[BRM-DRIVER] start create_volume() "))
vol_meta = volume.get('volume_metadata')
vol_meta_dict = metadata_to_dict(vol_meta)
linked_clone = vol_meta_dict.get('linked_clone')
@ -806,14 +816,14 @@ class VRMDriver(driver.VolumeDriver):
"[CINDER-BRM] host format exception, host is %s ") %
volume.get('host'))
raise ex
datastore = self._choose_datastore(ds_meta)
if datastore:
LOG.info(_("[CINDER-VRM] datastore [%s],"), datastore)
args_dict['independent'] = "false"
if str(datastore.get('storageType')).upper() in ['LUN']:
LOG.info(_("[CINDER-VRM] rdm disk [%s]"), volume['id'])
args_dict['size'] = int(datastore.get('capacityGB'))
args_dict['independent'] = True
args_dict['independent'] = "true"
args_dict['ds_urn'] = datastore.get('urn')
is_thin = self.check_thin(datastore, is_thin)
@ -894,7 +904,7 @@ class VRMDriver(driver.VolumeDriver):
LOG.info(_("[BRM-DRIVER] start delete_volume() "))
self._vrm_delete_volume(volume)
def create_export(self, context, volume):
def create_export(self, context, volume, connector):
'''create_export
create_export
@ -1239,9 +1249,8 @@ class VRMDriver(driver.VolumeDriver):
args_dict['volume_id'] = os_vol_id
args_dict['volume_size'] = vol_size
args_dict['is_thin'] = FC_DRIVER_CONF.vrm_is_thin
vol_meta = volume.get('volume_metadata')
vol_meta_dict = metadata_to_dict(vol_meta)
vol_meta = volume.get('provider_location')
vol_meta_dict = string_to_dict(vol_meta)
linked_clone = vol_meta_dict.get('linked_clone')
args_dict['volume_urn'] = vol_meta_dict.get('urn')
if linked_clone is None:
@ -1555,7 +1564,7 @@ class VRMDriver(driver.VolumeDriver):
'''
pass
def detach_volume(self, context, volume):
def detach_volume(self, context, volume, detachment):
'''detach_volume
:param context:

View File

@ -18,7 +18,7 @@ from oslo_log import log as logging
from cinder import context as cinder_context
from cinder.i18n import _
from cinder.volume.drivers.huawei.vrm.vrm_driver import VRMDriver
from cinder.volume.drivers.huawei.fusioncompute.vrm_driver import VRMDriver
def metadata_to_dict(metadata):

View File

@ -35,6 +35,6 @@ commands = oslo_debug_helper {posargs}
# E123, E125 skipped as they are invalid PEP-8.
show-source = True
ignore = E123,E125,N342,H104,W391
ignore = E123,E125,N342,H104,W391,E501
builtins = _
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build