Backup snapshot fail due to not Initializes the driver's client

Bug #1594225 reported by huanan
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
High
Xing Yang

Bug Description

When backup snapshot, i got the following error:

2016-06-17 22:01:42.163 DEBUG oslo_concurrency.lockutils [^[[01;36mreq-2a4dc4a7-d2ee-40c8-beb5-56951951d970 ^[[00;36m515b0e063767468f89ec2cbe94d3291e c0b0b1dc91814333aa17f2e4e0cc9d34] ^[[01;35mLock "huawei" released by "cinder.volume.drivers.huawei.huawei_driver.initialize_connection" :: held 0.003s^[[00m ^[[00;33mfrom (pid=19372) inner /usr/local/lib/python2.7/dist-packages/oslo_concurrency/lockutils.py:282^[[00m
2016-06-17 22:01:42.283 ERROR oslo_messaging.rpc.server [^[[01;36mreq-2a4dc4a7-d2ee-40c8-beb5-56951951d970 ^[[00;36m515b0e063767468f89ec2cbe94d3291e c0b0b1dc91814333aa17f2e4e0cc9d34] ^[[01;35mException during message handling^[[00m2016-06-17 22:01:42.283 TRACE oslo_messaging.rpc.server ^[[01;35m^[[00mTraceback (most recent call last):
2016-06-17 22:01:42.283 TRACE oslo_messaging.rpc.server ^[[01;35m^[[00m File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/server.py", line 133, in _process_incoming
2016-06-17 22:01:42.283 TRACE oslo_messaging.rpc.server ^[[01;35m^[[00m res = self.dispatcher.dispatch(message)
2016-06-17 22:01:42.283 TRACE oslo_messaging.rpc.server ^[[01;35m^[[00m File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py", line 150, in dispatch
2016-06-17 22:01:42.283 TRACE oslo_messaging.rpc.server ^[[01;35m^[[00m return self._do_dispatch(endpoint, method, ctxt, args)
2016-06-17 22:01:42.283 TRACE oslo_messaging.rpc.server ^[[01;35m^[[00m File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py", line 121, in _do_dispatch
2016-06-17 22:01:42.283 TRACE oslo_messaging.rpc.server ^[[01;35m^[[00m result = func(ctxt, **new_args)
2016-06-17 22:01:42.283 TRACE oslo_messaging.rpc.server ^[[01;35m^[[00m File "/opt/stack/cinder/cinder/backup/manager.py", line 386, in create_backup
2016-06-17 22:01:42.283 TRACE oslo_messaging.rpc.server ^[[01;35m^[[00m self._update_backup_error(backup, context, six.text_type(err))
2016-06-17 22:01:42.283 TRACE oslo_messaging.rpc.server ^[[01;35m^[[00m File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 221, in __exit__
2016-06-17 22:01:42.283 TRACE oslo_messaging.rpc.server ^[[01;35m^[[00m self.force_reraise()
2016-06-17 22:01:42.283 TRACE oslo_messaging.rpc.server ^[[01;35m^[[00m File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 197, in force_reraise
2016-06-17 22:01:42.283 TRACE oslo_messaging.rpc.server ^[[01;35m^[[00m six.reraise(self.type_, self.value, self.tb)
2016-06-17 22:01:42.283 TRACE oslo_messaging.rpc.server ^[[01;35m^[[00m File "/opt/stack/cinder/cinder/backup/manager.py", line 380, in create_backup
2016-06-17 22:01:42.283 TRACE oslo_messaging.rpc.server ^[[01;35m^[[00m self._run_backup(context, backup, volume)
2016-06-17 22:01:42.283 TRACE oslo_messaging.rpc.server ^[[01;35m^[[00m File "/opt/stack/cinder/cinder/backup/manager.py", line 416, in _run_backup
2016-06-17 22:01:42.283 TRACE oslo_messaging.rpc.server ^[[01;35m^[[00m properties, is_snapshot)
2016-06-17 22:01:42.283 TRACE oslo_messaging.rpc.server ^[[01;35m^[[00m File "/opt/stack/cinder/cinder/backup/manager.py", line 893, in _attach_device
2016-06-17 22:01:42.283 TRACE oslo_messaging.rpc.server ^[[01;35m^[[00m context, backup_device, properties)
2016-06-17 22:01:42.283 TRACE oslo_messaging.rpc.server ^[[01;35m^[[00m File "/opt/stack/cinder/cinder/volume/driver.py", line 984, in _attach_snapshot
2016-06-17 22:01:42.283 TRACE oslo_messaging.rpc.server ^[[01;35m^[[00m snapshot, properties)
2016-06-17 22:01:42.283 TRACE oslo_messaging.rpc.server ^[[01;35m^[[00m File "/opt/stack/cinder/cinder/volume/drivers/huawei/huawei_driver.py", line 1888, in initialize_connection_snapshot
2016-06-17 22:01:42.283 TRACE oslo_messaging.rpc.server ^[[01;35m^[[00m return self.initialize_connection(volume, connector)
2016-06-17 22:01:42.283 TRACE oslo_messaging.rpc.server ^[[01;35m^[[00m File "/usr/local/lib/python2.7/dist-packages/oslo_concurrency/lockutils.py", line 271, in inner
2016-06-17 22:01:42.283 TRACE oslo_messaging.rpc.server ^[[01;35m^[[00m return f(*args, **kwargs)
2016-06-17 22:01:42.283 TRACE oslo_messaging.rpc.server ^[[01;35m^[[00m File "/opt/stack/cinder/cinder/volume/drivers/huawei/huawei_driver.py", line 1724, in initialize_connection
2016-06-17 22:01:42.283 TRACE oslo_messaging.rpc.server ^[[01;35m^[[00m portgroup_id) = self.client.get_iscsi_params(connector)
2016-06-17 22:01:42.283 TRACE oslo_messaging.rpc.server ^[[01;35m^[[00mAttributeError: 'HuaweiISCSIDriver' object has no attribute 'client'
2016-06-17 22:01:42.283 TRACE oslo_messaging.rpc.server ^[[01;35m^[[00m

In Matika backup manage, it use do_setup initail volume driver :
    def _init_volume_driver(self, ctxt, driver):
        LOG.info(_LI("Starting volume driver %(driver_name)s (%(version)s)."),
                 {'driver_name': driver.__class__.__name__,
                  'version': driver.get_version()})
        try:
            driver.do_setup(ctxt)
            driver.check_for_setup_error()
        except Exception:
            LOG.exception(_LE("Error encountered during initialization of "
                              "driver: %(name)s."),
                          {'name': driver.__class__.__name__})
            # we don't want to continue since we failed
            # to initialize the driver correctly.
            return

        driver.set_initialized()

In Newton backup manage, it use import volume manage object initail volume driver by __init__() method:
    def _setup_volume_drivers(self):
        if CONF.enabled_backends:
            for backend in CONF.enabled_backends:
                host = "%s@%s" % (CONF.host, backend)
                mgr = importutils.import_object(CONF.volume_manager,
                                                host=host,
                                                service_name=backend)
                config = mgr.configuration
                backend_name = config.safe_get('volume_backend_name')
                LOG.debug("Registering backend %(backend)s (host=%(host)s "
                          "backend_name=%(backend_name)s).",
                          {'backend': backend, 'host': host,
                           'backend_name': backend_name})
                self.volume_managers[backend] = mgr
        else:
            default = importutils.import_object(CONF.volume_manager)
            LOG.debug("Registering default backend %s.", default)
            self.volume_managers['default'] = default

Most of the vendor driver use do_setup initail volume driver client. So in newton, Those who use do_setup initail volume driver client will not be able to normal use backup services.

Xing Yang (xing-yang)
Changed in cinder:
assignee: nobody → Xing Yang (xing-yang)
Revision history for this message
Eric Harney (eharney) wrote :

The backup code is doing the wrong thing here, the contract that people follow when writing volume drivers is that do_setup() will be called before the driver is used.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (master)

Fix proposed to branch: master
Review: https://review.openstack.org/331835

Changed in cinder:
status: New → In Progress
Revision history for this message
Xing Yang (xing-yang) wrote :

Looks that I missed the "_init_volume_driver" call. I tested with LVM and VNX which do not rely on the do_setup call and didn't catch this problem earlier.

huanan,
Can you please test this patch and see if it works for you now?
https://review.openstack.org/331835

Changed in cinder:
importance: Undecided → High
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

Reviewed: https://review.openstack.org/331835
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=cbdd0fa1fab24bbb891044b1e4aa56859cab75c4
Submitter: Jenkins
Branch: master

commit cbdd0fa1fab24bbb891044b1e4aa56859cab75c4
Author: xing-yang <email address hidden>
Date: Sat May 21 23:08:25 2016 -0400

    Call _init_volume_driver in backup manager

    When fixing backup using temp snapshot code path, the call to
    _init_volume_driver was missed:
        https://review.openstack.org/#/c/321943/

    For drivers that rely on do_setup to initialize the driver, this
    is a problem because the driver cannot be used without this call.

    This patch fixes the problem by calling _init_volume_driver in
    init_host.

    Change-Id: Ic197046a480dbf8d73a229580e59cd6d489355fa
    Closes-Bug: #1594225

Changed in cinder:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (stable/mitaka)

Fix proposed to branch: stable/mitaka
Review: https://review.openstack.org/334243

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (stable/mitaka)

Reviewed: https://review.openstack.org/334243
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=51abc42c6afdfbdc4f706a4f5f657fd86ba3ff2f
Submitter: Jenkins
Branch: stable/mitaka

commit 51abc42c6afdfbdc4f706a4f5f657fd86ba3ff2f
Author: xing-yang <email address hidden>
Date: Sat May 21 23:08:25 2016 -0400

    Call _init_volume_driver in backup manager

    When fixing backup using temp snapshot code path, the call to
    _init_volume_driver was missed:
        https://review.openstack.org/#/c/321943/

    For drivers that rely on do_setup to initialize the driver, this
    is a problem because the driver cannot be used without this call.

    This patch fixes the problem by calling _init_volume_driver in
    init_host.

    Change-Id: Ic197046a480dbf8d73a229580e59cd6d489355fa
    Closes-Bug: #1594225
    (cherry picked from commit cbdd0fa1fab24bbb891044b1e4aa56859cab75c4)

tags: added: in-stable-mitaka
Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/cinder 9.0.0.0b2

This issue was fixed in the openstack/cinder 9.0.0.0b2 development milestone.

Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/cinder 8.1.0

This issue was fixed in the openstack/cinder 8.1.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.