Creating backup on the snapshot of a in-use volume doesn't work.

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

Bug Description

Creating backup on the snapshot of a in-use volume doesn't work.

What I do:
1. Boot a VM.
2. Create a volume and attach it to the VM from step1.
3. Create backup on the volume from step2.

The driver supports backup_use_temp_snapshot and snapshot_remote_attachable,
check file cinder/volume/drivers/emc/emc_cli_iscsi.py.
```
    def backup_use_temp_snapshot(self):
        return True

    def snapshot_remote_attachable(self):
        return True
```

The c-vol log shows:
2016-05-03 17:21:24.348 DEBUG cinder.volume.driver [req-8b451b13-b13d-45ba-9250-c95c0c301056 admin] Creating a new backup for volume volume-727e9830-b88f-4c0a-b22f-701aaedbb619. _get_backup_volume_temp_snapshot /opt/stack/cinder/cinder/volume/driver.py:1104
2016-05-03 17:21:24.447 INFO cinder.volume.drivers.emc.emc_vnx_cli [req-8b451b13-b13d-45ba-9250-c95c0c301056 admin] Create snapshot: snapshot-5e4373bb-7a72-4105-aa8f-86384577cfc7: volume: volume-727e9830-b88f-4c0a-b22f-701aaedbb619

The c-bak log shows:
2016-05-03 17:21:25.248 ERROR oslo_messaging.rpc.dispatcher [req-8b451b13-b13d-45ba-9250-c95c0c301056 admin] Exception during message handling: Can't attach snapshot.
2016-05-03 17:21:25.248 4056 ERROR oslo_messaging.rpc.dispatcher Traceback (most recent call last):
2016-05-03 17:21:25.248 4056 ERROR oslo_messaging.rpc.dispatcher File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py", line 138, in _dispatch_and_reply
2016-05-03 17:21:25.248 4056 ERROR oslo_messaging.rpc.dispatcher incoming.message))
2016-05-03 17:21:25.248 4056 ERROR oslo_messaging.rpc.dispatcher File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py", line 185, in _dispatch
2016-05-03 17:21:25.248 4056 ERROR oslo_messaging.rpc.dispatcher return self._do_dispatch(endpoint, method, ctxt, args)
2016-05-03 17:21:25.248 4056 ERROR oslo_messaging.rpc.dispatcher File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py", line 127, in _do_dispatch
2016-05-03 17:21:25.248 4056 ERROR oslo_messaging.rpc.dispatcher result = func(ctxt, **new_args)
2016-05-03 17:21:25.248 4056 ERROR oslo_messaging.rpc.dispatcher File "/opt/stack/cinder/cinder/backup/manager.py", line 871, in create_backup
2016-05-03 17:21:25.248 4056 ERROR oslo_messaging.rpc.dispatcher return self.manager.create_backup(context, backup)
2016-05-03 17:21:25.248 4056 ERROR oslo_messaging.rpc.dispatcher File "/opt/stack/cinder/cinder/backup/manager.py", line 311, in create_backup
2016-05-03 17:21:25.248 4056 ERROR oslo_messaging.rpc.dispatcher self._update_backup_error(backup, context, six.text_type(err))
2016-05-03 17:21:25.248 4056 ERROR oslo_messaging.rpc.dispatcher File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 220, in __exit__
2016-05-03 17:21:25.248 4056 ERROR oslo_messaging.rpc.dispatcher self.force_reraise()
2016-05-03 17:21:25.248 4056 ERROR oslo_messaging.rpc.dispatcher File "/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py", line 196, in force_reraise
2016-05-03 17:21:25.248 4056 ERROR oslo_messaging.rpc.dispatcher six.reraise(self.type_, self.value, self.tb)
2016-05-03 17:21:25.248 4056 ERROR oslo_messaging.rpc.dispatcher File "/opt/stack/cinder/cinder/backup/manager.py", line 305, in create_backup
2016-05-03 17:21:25.248 4056 ERROR oslo_messaging.rpc.dispatcher self._run_backup(context, backup, volume)
2016-05-03 17:21:25.248 4056 ERROR oslo_messaging.rpc.dispatcher File "/opt/stack/cinder/cinder/backup/manager.py", line 341, in _run_backup
2016-05-03 17:21:25.248 4056 ERROR oslo_messaging.rpc.dispatcher properties, is_snapshot)
2016-05-03 17:21:25.248 4056 ERROR oslo_messaging.rpc.dispatcher File "/opt/stack/cinder/cinder/backup/manager.py", line 813, in _attach_device
2016-05-03 17:21:25.248 4056 ERROR oslo_messaging.rpc.dispatcher raise NotImplementedError(msg)
2016-05-03 17:21:25.248 4056 ERROR oslo_messaging.rpc.dispatcher NotImplementedError: Can't attach snapshot.
2016-05-03 17:21:25.248 4056 ERROR oslo_messaging.rpc.dispatcher
2016-05-03 17:21:55.736 DEBUG oslo_service.periodic_task [req-8b451b13-b13d-45ba-9250-c95c0c301056 admin] Running periodic task BackupManager._publish_service_capabilities run_periodic_tasks /usr/local/lib/python2.7/dist-packages/oslo_service/periodic_task.py:215

Xing Yang (xing-yang)
Changed in cinder:
assignee: nobody → Xing Yang (xing-yang)
importance: Undecided → High
status: New → Confirmed
tags: added: backup-service
Xing Yang (xing-yang)
Changed in cinder:
milestone: none → newton-2
Revision history for this message
Xing Yang (xing-yang) wrote :

Non-disruptive backup using the temp snapshot path is broken even on the local node.

Xing Yang (xing-yang)
Changed in cinder:
milestone: newton-2 → newton-1
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/321943

Changed in cinder:
status: Confirmed → In Progress
Changed in cinder:
milestone: newton-1 → newton-2
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

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

commit 763dd8cdc5c48b7771d081dcd8b9e37a8f6c0a71
Author: xing-yang <email address hidden>
Date: Sun May 15 08:08:21 2016 -0400

    Fix backup using temp snapshot code path

    - Non-disruptive backup using a temp snapshot works in Liberty
    but was broken in Mitaka.
    - Backup a snapshot directly without creating a temp volume
    worked when the feature was first added in Mitaka but was broken
    later in Mitaka.

    This patch provides a fix as follows:
    1. It checks an existing config option backup_use_same_host.
       By default, this option is False.
    2. When the backup service starts, it checks the above option. If
       the option is True, the backup service will find volume manager
       on the current node and get volume backends.
    3. If the option is True and backup_use_temp_snapshot returns True,
       volume service returns the snapshot to the backup service in
       get_backup_device and backup will be performed using the snapshot.
       Otherwise, the volume will be returned as the backup device and
       the backup will be performed using the volume.

    This fix is a Mitaka backport candidate. After this is merged,
    we will provide a more complete fix which allows backup using
    temp snapshot to happen on a remote node as well and we will
    also clean up the code to get volume backends on the backup node.

    The unit test test_backup_volume_inuse_temp_snapshot in test_volume.py
    is removed. This test was testing backup_volume in
    cinder/volume/driver.py, but this code path is not used any more.
    Backup now starts in create_backup in backup/manager.py which calls
    _run_backup which calls _attach_snapshot in volume/driver.py. The new
    test test_create_backup_with_temp_snapshot in test_backup.py tests
    the new code path.

    Change-Id: I2e0c115e1dacf9eea73803cdbb1452bfeb56d87c
    Closes-Bug: #1578034
    Closes-Bug: #1575886

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/328063

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
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (stable/mitaka)

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

commit cf5fab9e215d738a84456dbc5c349c507bc9d3fc
Author: xing-yang <email address hidden>
Date: Sun May 15 08:08:21 2016 -0400

    Fix backup using temp snapshot code path

    - Non-disruptive backup using a temp snapshot works in Liberty
    but was broken in Mitaka.
    - Backup a snapshot directly without creating a temp volume
    worked when the feature was first added in Mitaka but was broken
    later in Mitaka.

    This patch provides a fix as follows:
    1. It checks an existing config option backup_use_same_host.
       By default, this option is False.
    2. When the backup service starts, it checks the above option. If
       the option is True, the backup service will find volume manager
       on the current node and get volume backends.
    3. If the option is True and backup_use_temp_snapshot returns True,
       volume service returns the snapshot to the backup service in
       get_backup_device and backup will be performed using the snapshot.
       Otherwise, the volume will be returned as the backup device and
       the backup will be performed using the volume.

    This fix is a Mitaka backport candidate. After this is merged,
    we will provide a more complete fix which allows backup using
    temp snapshot to happen on a remote node as well and we will
    also clean up the code to get volume backends on the backup node.

    The unit test test_backup_volume_inuse_temp_snapshot in test_volume.py
    is removed. This test was testing backup_volume in
    cinder/volume/driver.py, but this code path is not used any more.
    Backup now starts in create_backup in backup/manager.py which calls
    _run_backup which calls _attach_snapshot in volume/driver.py. The new
    test test_create_backup_with_temp_snapshot in test_backup.py tests
    the new code path.

    Note: The return value is changed for _attach_snapshot() in
    volume/driver.py. It now returns a dictionary of attach_info.

    Closes-Bug: #1578034
    Closes-Bug: #1575886
    (cherry picked from commit 763dd8cdc5c48b7771d081dcd8b9e37a8f6c0a71)

    Conflicts:
     cinder/backup/manager.py
     cinder/tests/unit/test_volume.py

    Change-Id: I2e0c115e1dacf9eea73803cdbb1452bfeb56d87c

tags: added: in-stable-mitaka
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.

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/468591

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.