image backend checklist - dianaclarke/openstack-notes GitHub Wiki

  • Generic Questions

  • base

    • What about this short circuit case in Image.cache()? Answer: assume the caller will only call these new methods when they actually want to create something. That is, feel free to ditch the abort logic.
         # If self.path doesn't exist or base doesn't exit...
    
         if not self.exists() or not os.path.exists(base):
             self.create_image(fetch_func_sync, base, size,
                               *args, **kwargs)
    
  • flat

    • Example paths:

         NoBacking(instance, disk_name='disk')
      
         base: instances/_base/sha1-image-uuid
         path: instances/instance-uuid/disk
      
    • Shouldn't use the image cache for create_from_func DONE

    • Should ensure_tree(self.path)? NO

      • Before: no
      • After: no, this really only makes sense for ploop
    • Should remove_path_on_error(self.path)? YES

      • Before: sometimes
      • After: yes, we should cleanup on error
      • Tested: [TODO]
    • Should os.path.exists(self.path) short circuit? Confirm correct: NO

      • Before: yes
      • After: no, we are intentionally not short circuiting on self.path exists anymore
    • Verify base size? YES

      • create_from_image case only
    • Should resize? YES

      • Before: if size:, plus if size and size > self.get_disk_size from Image.cache()
      • After: if size and size > cached_image.virtual_size: (create_from_image case only)
    • Should preallocate? YES

      • preallocate: maybe
      • _can_fallocate: maybe (inherited)
      • Tested: yes, but not full branch coverage
    • Matt's was quite different. Why? DONE

      • Especially the libvirt_utils.create_image() call
  • qcow2

    • Example paths:

         Qcow2(instance, disk_name='disk')
      
         base: instances/_base/sha1-image-uuid
         path: instances/instance-uuid/disk
      
    • Should ensure_tree(self.path)? NO

      • Before: no
      • After: no, this really only makes sense for ploop
    • Should remove_path_on_error(self.path)? YES

      • Before: yes
      • After: yes
      • Tested: [TODO]
    • Should os.path.exists(self.path) short circuit? NO

      • Before: no
      • After: no, we are intentionally not short circuiting on self.path exists anymore
    • Verify base size? YES

      • create_from_image case only
    • Should resize? YES

      • Before: if size:, plus if size and size > self.get_disk_size from Image.cache()
      • After: if size and size > cached_image.virtual_size: (create_from_image case only)
    • Should preallocate? YES

      • preallocate: maybe
      • _can_fallocate: maybe (inherited)
  • lvm

    • Example paths:

         Lvm(instance, disk_name='disk')
      
         base: instances/_base/sha1-image-uuid
         path: /dev/some-volume-group/instance-uuid_disk
      
    • Shouldn't use the image cache for create_from_func DONE

    • Should ensure_tree(self.path)? NO

      • Before: no
      • After: no, this really only makes sense for ploop
    • Should self.remove_volume_on_error(self.path)? YES

      • Before: yes
      • After: yes
      • Tested: ish, on key manager KeyError [TODO]
    • Should os.path.exists(self.path) short circuit? NO

      • Before: no
      • After: no, we are intentionally not short circuiting on self.path exists anymore
    • Verify base size? YES

      • create_from_image case only
    • Should resize? YES

      • Before: if resize:, plus if size and size > self.get_disk_size from Image.cache()
      • After: if size and size > cached_image.virtual_size: (create_from_image case only)
    • Should preallocate? NO

      • preallocate: maybe <--- dead? [TODO]
      • _can_fallocate: NO
  • rbd

    • Example paths:

         Rbd(instance, disk_name='disk')
      
           base: instances/_base/sha1-image-uuid
           path: rbd:FakePool/instance-uuid_disk:id=FakeUser:conf=FakeConf
       rbd_name: instance-uuid_disk
      
      • Note that the clone case has a nested lock() call, revisit that N/A
        • no longer has the lock
    • Should ensure_tree? NO

      • I don't think so since it didn't before and they are not regular file paths
    • Should remove_path_on_error? YES

      • It didn't before, but perhaps it should using remove_volume_on_error. The clone case calls remove_volume_on_error. Should the create_from_image and create_from_func cases do that too?
        • Matt said we should always clean up on error, come back to this.
        • Tested: [TODO]
    • Should os.path.exists(self.rbd_name) short circuit? NO

      • Before: yes
      • After: no, we are intentionally not short circuiting on self.rbd_name exists anymore
    • Verify base size? YES

      • create_from_image case only
    • Should resize? YES

      • Before: if size and size > self.get_disk_size from Rbd.create_image(), plus if size and size > self.get_disk_size from Image.cache()
      • After: if size and size > cached_image.virtual_size: (create_from_image case only)
      • What about the clone case? It does not resize, should it? [TODO]
        • Matt says yes, it should resize in the clone case. Come back to this later.
    • Should preallocate? NO

      • preallocate: NO
      • _can_fallocate: NO
  • ploop

    • Example paths:

         Ploop(instance, disk_name='disk')
      
         base: instances/_base/sha1-image-uuid
         path: instances/instance-uuid/disk
       target: instances/instance-uuid/disk/root.hds
      
    • Should ensure_tree(self.path)? YES

      • Before: yes
      • After: yes, b/c the backend nests one level deeper than the others
      • Tested: [TODO]
    • Should remove_path_on_error(self.path)? YES

      • Why the special remove function? Answer: b/c this backend nests one level deeper than the others
      • Before: yes
      • After: yes
      • Tested: [TODO]
    • Should os.path.exists(self.path) short circuit? NO

      • Before: yes
      • After: no, we are intentionally not short circuiting on self.path exists anymore
    • Verify base size? YES

      • create_from_image case only
    • Should resize? YES

      • Before: if size: from Ploop.create_image(), plus if size and size > self.get_disk_size from Image.cache()
      • After: if size and size > cached_image.virtual_size: (create_from_image case only)
    • Should preallocate? NO

      • preallocate: NO
      • _can_fallocate: maybe (inherited)
      • But! There are preallocate unit tests for ploop... why? [TODO]