tools/setup_{RedHat,Debian}.sh can try to process multiple loop devices

Bug #1586563 reported by Dave Walker
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
kolla
Fix Released
Wishlist
Dave Walker

Bug Description

I'm not quite sure how this happened, it would seem logical that it is due to running tools/setup_RedHat.sh multiple times, but i'm sure it failed on the first run.

Either way, it would be good if the script was idempotent. The losetup isn't safe from this and neither is the $DEV assignment.

Currently the parted command is passed multiple loop devices, which is failing.

Seeing this from the output:
{{
 sudo dd if=/dev/zero of=/docker bs=1M count=20480
20480+0 records in
20480+0 records out
21474836480 bytes (21 GB) copied, 48.1589 s, 446 MB/s
+ losetup -f /docker
++ awk -F: '/\/docker/ {print $1}'
++ losetup -a
+ DEV='/dev/loop0
/dev/loop2
/dev/loop3'
+ sudo parted /dev/loop0 /dev/loop2 /dev/loop3 -s -- mklabel msdos
Usage: parted [OPTION]... [DEVICE [COMMAND [PARAMETERS]...]...]
Apply COMMANDs with PARAMETERS to DEVICE. If no COMMAND(s) are given, run in
interactive mode.

OPTIONs:
  -h, --help displays this help message
  -l, --list lists partition layout on all block devices
  -m, --machine displays machine parseable output
  -s, --script never prompts for user intervention
  -v, --version displays the version
  -a, --align=[none|cyl|min|opt] alignment for new partitions

COMMANDs:
  align-check TYPE N check partition N for TYPE(min|opt) alignment
  help [COMMAND] print general help, or help on COMMAND
  mklabel,mktable LABEL-TYPE create a new disklabel (partition table)
  mkpart PART-TYPE [FS-TYPE] START END make a partition
  name NUMBER NAME name partition NUMBER as NAME
  print [devices|free|list,all|NUMBER] display the partition table, available devices, free space, all found partitions, or a particular partition
  quit exit program
  rescue START END rescue a lost partition near START and END
  rm NUMBER delete partition NUMBER
  select DEVICE choose the device to edit
  disk_set FLAG STATE change the FLAG on selected device
  disk_toggle [FLAG] toggle the state of FLAG on selected device
  set NUMBER FLAG STATE change the FLAG on partition NUMBER
  toggle [NUMBER [FLAG]] toggle the state of FLAG on partition NUMBER
  unit UNIT set the default unit to UNIT
  version display the version number and copyright information of GNU Parted

Report bugs to <email address hidden>
+ sudo rm -rf /var/lib/docker
+ sudo mkdir /var/lib/docker
+ sudo mkfs.btrfs -f /dev/loop0 /dev/loop2 /dev/loop3
btrfs-progs v3.19.1
See http://btrfs.wiki.kernel.org for more information.

Performing full device TRIM (20.00GiB) ...
Turning ON incompat feature 'extref': increased hardlink limit per file to 65536
Turning ON incompat feature 'skinny-metadata': reduced-size metadata extent refs
skipping duplicate device /dev/loop2 in FS
skipping duplicate device /dev/loop3 in FS
not enough free space

}}

This is caused by:
{{
# DEV=$(losetup -a | awk -F: '/\/docker/ {print $1}')

# echo $DEV
/dev/loop0 /dev/loop2 /dev/loop3

# losetup -a
/dev/loop0: [64768]:397121 (/docker)
/dev/loop2: [64768]:397121 (/docker)
/dev/loop3: [64768]:397121 (/docker)
}}

Dave Walker (davewalker)
summary: - tools/setup_RedHat.sh can try to process multiple loop devices
+ tools/setup_{RedHat,Debian}.sh can try to process multiple loop devices
Changed in kolla:
importance: Undecided → Wishlist
milestone: none → newton-2
assignee: nobody → Dave Walker (daviey-walker)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to kolla (master)

Reviewed: https://review.openstack.org/326347
Committed: https://git.openstack.org/cgit/openstack/kolla/commit/?id=334ef7d540fcfe6957b6872cda3f080d0b4b65ab
Submitter: Jenkins
Branch: master

commit 334ef7d540fcfe6957b6872cda3f080d0b4b65ab
Author: Dave Walker (Daviey) <email address hidden>
Date: Tue Jun 7 10:49:19 2016 +0100

    setup_{RedHat,Debian}.sh, make more idempotent

    Previously, when either setup_{RedHat,Debian}.sh was ran
    multiple times a mess was created due to multiple loop
    devices being setup.

    This change now looks to see if '/docker' or '/swapfile'
    already exist, and not re-create them if they do.

    *However*, /var/lib/docker (/docker) is still wiped - but it
    means that the script can run and bring the system into a
    constant vanilla state.

    Change-Id: I169662fa04c2bf644672ca75c3ee579795943727
    Closes-Bug: #1586563
    Signed-off-by: Dave Walker (Daviey) <email address hidden>

Changed in kolla:
status: New → Fix Released
Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/kolla 3.0.0.0b2

This issue was fixed in the openstack/kolla 3.0.0.0b2 development milestone.

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.