dib fails to cleanup images with several partitions and volumes

Bug #1777861 reported by Yolanda Robla on 2018-06-20
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
diskimage-builder
Undecided
Ian Wienand

Bug Description

When having an image with different partitions and volumes, the order of the cleanup is incorrectly set.

As a sample, when using that schema:

- local_loop:
    name: image0
- partitioning:
    base: image0
    label: gpt
    partitions:
      - name: root
        flags: [ boot ]
        size: 23G
      - name: ESP
        type: 'EF00'
        size: 8MiB
        mkfs:
          type: vfat
          mount:
            mount_point: /boot/efi
            fstab:
              options: "defaults"
              fsck-passno: 1
      - name: BSP
        type: 'EF02'
        size: 8MiB
- lvm:
    name: lvm
    base: [ root ]
    pvs:
        - name: pv
          base: root
          options: [ "--force" ]
    vgs:
        - name: vg
          base: [ "pv" ]
          options: [ "--force" ]
    lvs:
        - name: lv_root
          base: vg
          extents: 28%VG
        - name: lv_tmp
          base: vg
          extents: 4%VG
        - name: lv_var
          base: vg
          extents: 40%VG
        - name: lv_log
          base: vg
          extents: 23%VG
        - name: lv_audit
          base: vg
          extents: 4%VG
        - name: lv_home
          base: vg
          extents: 1%VG
- mkfs:
    name: fs_root
    base: lv_root
    type: xfs
    label: "img-rootfs"
    mount:
        mount_point: /
        fstab:
            options: "rw,relatime"
            fck-passno: 1
- mkfs:
    name: fs_tmp
    base: lv_tmp
    type: xfs
    mount:
        mount_point: /tmp
        fstab:
            options: "rw,nosuid,nodev,noexec,relatime"
- mkfs:
    name: fs_var
    base: lv_var
    type: xfs
    mount:
        mount_point: /var
        fstab:
            options: "rw,relatime"
- mkfs:
    name: fs_log
    base: lv_log
    type: xfs
    mount:
        mount_point: /var/log
        fstab:
            options: "rw,relatime"
- mkfs:
    name: fs_audit
    base: lv_audit
    type: xfs
    mount:
        mount_point: /var/log/audit
        fstab:
            options: "rw,relatime"
- mkfs:
    name: fs_home
    base: lv_home
    type: xfs
    mount:
        mount_point: /home
        fstab:
            options: "rw,nodev,relatime"

The system unmounts first the ESP and BSP partitions, but then goes up in the tree and tries to detach the image, without having cleaned the root partition and volumes first.

Sample of the iteration: https://paste.fedoraproject.org/paste/ljXthlbiJbLvr0J7tG64rg

Changed in diskimage-builder:
status: New → In Progress
assignee: nobody → Yolanda Robla (yolanda.robla)
Changed in diskimage-builder:
assignee: Yolanda Robla (yolanda.robla) → Ian Wienand (iwienand)

Reviewed: https://review.openstack.org/576876
Committed: https://git.openstack.org/cgit/openstack/diskimage-builder/commit/?id=64bb87f7b500d95c54bae70c30507687948af963
Submitter: Zuul
Branch: master

commit 64bb87f7b500d95c54bae70c30507687948af963
Author: Yolanda Robla <email address hidden>
Date: Wed Jun 20 16:25:59 2018 +0200

    Only detach device if all partitions have been cleaned

    Currently there is a bug, that tries to detach the device from a
    partition at the first try, without considering that there may be
    other partitions and volumes on it. Ensure that the detach is done
    properly, and add a test to ensure that this happens correctly.

    Change-Id: I35c5a473509f17a70270a2cbf5bf579faaeb123a
    Fixes-Bug: #1777861

Changed in diskimage-builder:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers