Image backups use local filesystem storage ,but failed to recover

Bug #1735877 reported by lumeihong
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Karbor
Fix Released
Undecided
jiaopengju

Bug Description

2017-11-30 10:45:28.813 8323 DEBUG karbor.services.protection.bank_plugins.file_system_bank_plugin [-] FsBank: list_objects. key: /checkpoints/4ef27d47-e42c-42c4-bd74-1a33dc5b9741/resource-data/7ea065ce-ee99-45a1-9b08-0e7fa67546ce/ list_objects /usr/lib/python2.7/site-packages/karbor/services/protection/bank_plugins/file_system_bank_plugin.py:183
2017-11-30 10:46:11.079 8323 DEBUG karbor.services.protection.bank_plugins.file_system_bank_plugin [-] FsBank: list_objects. key: /checkpoints/4ef27d47-e42c-42c4-bd74-1a33dc5b9741/resource-data/7ea065ce-ee99-45a1-9b08-0e7fa67546ce/ list_objects /usr/lib/python2.7/site-packages/karbor/services/protection/bank_plugins/file_system_bank_plugin.py:183
2017-11-30 10:47:34.757 8323 DEBUG karbor.services.protection.bank_plugins.file_system_bank_plugin [-] FsBank: get_object. key: /checkpoints/4ef27d47-e42c-42c4-bd74-1a33dc5b9741/resource-data/7ea065ce-ee99-45a1-9b08-0e7fa67546ce/metadata get_object /usr/lib/python2.7/site-packages/karbor/services/protection/bank_plugins/file_system_bank_plugin.py:166
2017-11-30 10:48:20.184 8323 DEBUG karbor.services.protection.bank_plugins.file_system_bank_plugin [-] FsBank: list_objects. key: /checkpoints/4ef27d47-e42c-42c4-bd74-1a33dc5b9741/resource-data/7ea065ce-ee99-45a1-9b08-0e7fa67546ce/ list_objects /usr/lib/python2.7/site-packages/karbor/services/protection/bank_plugins/file_system_bank_plugin.py:183
2017-11-30 10:49:35.168 8323 DEBUG karbor.services.protection.protection_plugins.image.image_protection_plugin [-] object num: 0, chunk num: 21 on_main /usr/lib/python2.7/site-packages/karbor/services/protection/protection_plugins/image/image_protection_plugin.py:207
2017-11-30 10:49:35.170 8323 ERROR karbor.services.protection.protection_plugins.image.image_protection_plugin [-] Restore image backup failed, image_id: 7ea065ce-ee99-45a1-9b08-0e7fa67546ce.: RestoreResourceFailed: Restore Image Backup failed: The chunks_num of restored image is invalid., id=7ea065ce-ee99-45a1-9b08-0e7fa67546ce, type=OS::Glance::Image
    def _list_object(self, path):
        obj_file_path = self.object_container_path + path
        if not os.path.isdir(obj_file_path):
            LOG.debug(_("Path is not a directory. name: %s"), obj_file_path)
            return ()
        try:
            if os.path.isdir(obj_file_path):
                return os.listdir(obj_file_path)//the problem is here
            else:
                base_dir = os.path.dirname(obj_file_path)
                base_name = os.path.basename(obj_file_path)
                return (
                    base_dir + '/' + obj_file
                    for obj_file in os.listdir(base_dir)
                    if obj_file.startswith(base_name)
                )
        except OSError:
            LOG.exception(_("List the object failed. path: %s"), obj_file_path)
            raise

Revision history for this message
lumeihong (lu-meihong) wrote :

Modified as follows, restore can be successful.

    def _list_object(self, path):
        obj_file_path = self.object_container_path + path
        if not os.path.isdir(obj_file_path):
            LOG.debug(_("Path is not a directory. name: %s"), obj_file_path)
            return ()
        try:
            if os.path.isdir(obj_file_path):
                LOG.info(_("Path is a directory. name: %s"), obj_file_path)
                if 'indices' in obj_file_path:
                    return os.listdir(obj_file_path)
                base_dir = os.path.dirname(obj_file_path)
                base_name = os.path.basename(obj_file_path)
                return (
                    path + obj_file
                    for obj_file in os.listdir(base_dir)
                    if obj_file.startswith(base_name)
                )
                #return os.listdir(obj_file_path)
            else:
                base_dir = os.path.dirname(obj_file_path)
                base_name = os.path.basename(obj_file_path)
                return (
                    base_dir + '/' + obj_file
                    for obj_file in os.listdir(base_dir)
                    if obj_file.startswith(base_name)
                )
        except OSError:
            LOG.exception(_("List the object failed. path: %s"), obj_file_path)
            raise

Revision history for this message
lumeihong (lu-meihong) wrote :

version is stable/pike

jiaopengju (pj-jiao)
Changed in karbor:
assignee: nobody → jiaopengju (pj-jiao)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to karbor (master)

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

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

Reviewed: https://review.openstack.org/530172
Committed: https://git.openstack.org/cgit/openstack/karbor/commit/?id=a6b174d821d8eb6d23976cf0a28b8714e3b18c2e
Submitter: Zuul
Branch: master

commit a6b174d821d8eb6d23976cf0a28b8714e3b18c2e
Author: jiaopengju <email address hidden>
Date: Wed Dec 27 12:37:52 2017 +0800

    Fix image restore failed with file system bank

    Change-Id: I98cc8abb445555d2ef23e5e4c5508bb2085f35b7
    Closes-Bug: #1735877

Changed in karbor:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/karbor 1.0.0

This issue was fixed in the openstack/karbor 1.0.0 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/karbor 1.1.0

This issue was fixed in the openstack/karbor 1.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.