** Description changed:

+ === Begin SRU Template ===
+ [Impact] 
+ mount-image-callback fails to mount images that are qcow2 formatted.
+ 
+ This function in mount-image-callback works in other Ubuntu releases
+ but not on xenial.  The function does succeed some times, but is
+ brittle.
+ 
+ The fix applied is also applied upstream, and consists mainly of adding
+ 
+  blockdev --rereadpt /dev/nbdX
+  udevadm settle
+ 
+ where 'nbdX' is the device that mount-image-callback has set up to
+ point to the file that is to be mounted.
+ 
+ These above added function should not be harmful in any case.
+ 
+ [Test Case]
+ In a fresh install:
+ 
+ $ sudo apt-get update -q && sudo apt-get install -qy cloud-image-utils
+ 
+ $ 
url=http://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img
+ $ wget "$url" -O xenial-server-cloudimg-amd64-disk1.img
+ $ cp -a xenial-server-cloudimg-amd64-disk1.img disk.img
+ 
+ $ sudo mount-image-callback -v disk.img true
+ waiting on pidfile for /dev/nbd0 in /sys/block/nbd0/pid
+ connected disk.img (qcow2) to /dev/nbd0. waiting for device.
+ 
+ [Regression Potential] 
+ The regression potential stems from additional udev events
+ caused by calling blockdev --rereadpt.
+ 
+ udev events should not cause unwanted side effects, but could.
+ 
+ [Other Info]
+ 
+ === End SRU Template ===
+ 
  On xenial only:
  
  $ wget 
http://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img
  $ cp -a xenial-server-cloudimg-amd64-disk1.img disk.img
  $ sudo mount-image-callback -v disk.img true
  waiting on pidfile for /dev/nbd0 in /sys/block/nbd0/pid
  connected disk.img (qcow2) to /dev/nbd0. waiting for device.
  partitioned disk.
  waiting for /dev/nbd0p1 part=1 to be ready.
  waiting for /dev/nbd0p1 part=1 to be ready.
  waiting for /dev/nbd0p1 part=1 to be ready.
  waiting for /dev/nbd0p1 part=1 to be ready.
  waiting for /dev/nbd0p1 part=1 to be ready.
  waiting for /dev/nbd0p1 part=1 to be ready.
  waiting for /dev/nbd0p1 part=1 to be ready.
  waiting for /dev/nbd0p1 part=1 to be ready.
  waiting for /dev/nbd0p1 part=1 to be ready.
  gave up on waiting for /dev/nbd0p1
  $ echo $?
  1
  
  This fix seems to work and should be safe.
  === modified file 'bin/mount-image-callback'
  --- bin/mount-image-callback    2018-01-03 15:44:47 +0000
  +++ bin/mount-image-callback    2018-01-04 17:21:23 +0000
  @@ -316,6 +316,8 @@
          fi
  
          i=0
  +       [ -b "$mdev" ] || blockdev --rereadpt $nbd ||
  +               { error "blockdev --rereadpt $nbd failed"; return 1; }
          while :; do
                  [ -b "$mdev" ] && break
                  i=$(($i+1))
  
  ProblemType: Bug
  DistroRelease: Ubuntu 16.04
  Package: cloud-image-utils 0.27-0ubuntu24
  ProcVersionSignature: User Name 4.4.0-104.127-generic 4.4.98
  Uname: Linux 4.4.0-104-generic x86_64
  ApportVersion: 2.20.1-0ubuntu2.14
  Architecture: amd64
  Date: Thu Jan  4 17:23:15 2018
  Ec2AMI: ami-00000388
  Ec2AMIManifest: FIXME
  Ec2AvailabilityZone: nova
  Ec2InstanceType: m1.small
  Ec2Kernel: unavailable
  Ec2Ramdisk: unavailable
  PackageArchitecture: all
  ProcEnviron:
   TERM=screen
   PATH=(custom, no user)
   XDG_RUNTIME_DIR=<set>
   LANG=en_US.UTF-8
   SHELL=/bin/bash
  SourcePackage: cloud-utils
  UpgradeStatus: No upgrade log present (probably fresh install)

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1741300

Title:
  mount-image-callback fails on qcow image on xenial

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/cloud-utils/+bug/1741300/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to