[Bug 1160462] [NEW] Don't run resizefs hook during installation of an LXC container with cloud-init

Jean-Baptiste Lallement jean-baptiste at ubuntu.com
Tue Mar 26 16:16:32 UTC 2013


Public bug reported:

Raring AMD64
cloud-init 0.7.2~bzr795-0ubuntu1

During the provisioning of an LXC guest with the template ubuntu-cloud,
cloud-init executes the hook resizefs and fails with:

2013-03-26 15:11:09,545 - util.py[DEBUG]: Running resizefs (<module 'cloudinit.config.cc_resizefs' from '/usr/lib/python2.7/dist-packages/cloudinit/config/cc_resizefs.pyc'>) failed
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/cloudinit/stages.py", line 553, in _run_modules
    cc.run(run_name, mod.handle, func_args, freq=freq)
  File "/usr/lib/python2.7/dist-packages/cloudinit/cloud.py", line 63, in run
    return self._runners.run(name, functor, args, freq, clear_on_fail)
  File "/usr/lib/python2.7/dist-packages/cloudinit/helpers.py", line 197, in run
    results = functor(*args)
  File "/usr/lib/python2.7/dist-packages/cloudinit/config/cc_resizefs.py", line 78, in handle
    if not stat.S_ISBLK(os.stat(devpth).st_mode):
OSError: [Errno 2] No such file or directory: '/dev/sdb1'

It shouldn't try to resize the hard drive and there should be an error
handler in the code.

TEST CASE:
1. Create a user-data file with the following content:
====8<========8<========8<========8<========8<====
#cloud-config
locale: en_US.UTF-8

password: ubuntu
chpasswd: { expire: False }
ssh_pwauth: True

ssh_authorized_keys:
 - SOMEPUBKEY

apt_sources:
 - source: deb http://archive.ubuntu.com/ubuntu raring restricted multiverse
 - source: deb-src http://archive.ubuntu.com/ubuntu raring restricted multiverse

byobu_by_default: system

packages:
 - eatmydata
 - autopkgtest
 - dpkg-dev
 - pbuilder
 - bzr

runcmd:
 - [sh, -xc, "echo '127.0.1.1 autopkgtest' >> /etc/hosts" ]
====>8========>8========>8========>8========>8====

2. On an AMD64 host provision an LXC guest with the command (replace user-data by the path to the user-data file you created above)
  $ sudo lxc-create -n raring-armhf-20130326 -t ubuntu-cloud -- -r raring -a amd64 -s daily -u user-data

3. Start the container and wait
  $ sudo lxc-start -n raring-armhf-20130326

ProblemType: Bug
DistroRelease: Ubuntu 13.04
Package: cloud-init (not installed)
ProcVersionSignature: Ubuntu 3.8.0-13.23-generic 3.8.3
Uname: Linux 3.8.0-13-generic x86_64
ApportVersion: 2.9.2-0ubuntu4
Architecture: amd64
Date: Tue Mar 26 17:06:46 2013
MarkForUpload: True
ProcEnviron:
 TERM=xterm
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: cloud-init
UpgradeStatus: Upgraded to raring on 2012-01-31 (419 days ago)

** Affects: cloud-init (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: amd64 apport-bug qa-manual-testing raring

** Description changed:

  Raring AMD64
  cloud-init 0.7.2~bzr795-0ubuntu1
  
  During the provisioning of an LXC guest with the template ubuntu-cloud,
  cloud-init executes the hook resizefs and fails with:
  
  2013-03-26 15:11:09,545 - util.py[DEBUG]: Running resizefs (<module 'cloudinit.config.cc_resizefs' from '/usr/lib/python2.7/dist-packages/cloudinit/config/cc_resizefs.pyc'>) failed
  Traceback (most recent call last):
-   File "/usr/lib/python2.7/dist-packages/cloudinit/stages.py", line 553, in _run_modules
-     cc.run(run_name, mod.handle, func_args, freq=freq)
-   File "/usr/lib/python2.7/dist-packages/cloudinit/cloud.py", line 63, in run
-     return self._runners.run(name, functor, args, freq, clear_on_fail)
-   File "/usr/lib/python2.7/dist-packages/cloudinit/helpers.py", line 197, in run
-     results = functor(*args)
-   File "/usr/lib/python2.7/dist-packages/cloudinit/config/cc_resizefs.py", line 78, in handle
-     if not stat.S_ISBLK(os.stat(devpth).st_mode):
+   File "/usr/lib/python2.7/dist-packages/cloudinit/stages.py", line 553, in _run_modules
+     cc.run(run_name, mod.handle, func_args, freq=freq)
+   File "/usr/lib/python2.7/dist-packages/cloudinit/cloud.py", line 63, in run
+     return self._runners.run(name, functor, args, freq, clear_on_fail)
+   File "/usr/lib/python2.7/dist-packages/cloudinit/helpers.py", line 197, in run
+     results = functor(*args)
+   File "/usr/lib/python2.7/dist-packages/cloudinit/config/cc_resizefs.py", line 78, in handle
+     if not stat.S_ISBLK(os.stat(devpth).st_mode):
  OSError: [Errno 2] No such file or directory: '/dev/sdb1'
  
- It shouldn't try to resize the hard drive
+ It shouldn't try to resize the hard drive and there should be an error
+ handler in the code.
  
  TEST CASE:
  1. Create a user-data file with the following content:
  ====8<========8<========8<========8<========8<====
  #cloud-config
  locale: en_US.UTF-8
  
  password: ubuntu
  chpasswd: { expire: False }
  ssh_pwauth: True
  
  ssh_authorized_keys:
-  - SOMEPUBKEY
+  - SOMEPUBKEY
  
- apt_sources: 
-  - source: deb http://archive.ubuntu.com/ubuntu raring restricted multiverse
-  - source: deb-src http://archive.ubuntu.com/ubuntu raring restricted multiverse
+ apt_sources:
+  - source: deb http://archive.ubuntu.com/ubuntu raring restricted multiverse
+  - source: deb-src http://archive.ubuntu.com/ubuntu raring restricted multiverse
  
  byobu_by_default: system
  
  packages:
-  - eatmydata
-  - autopkgtest
-  - dpkg-dev
-  - pbuilder
-  - bzr
+  - eatmydata
+  - autopkgtest
+  - dpkg-dev
+  - pbuilder
+  - bzr
  
  runcmd:
-  - [sh, -xc, "echo '127.0.1.1 autopkgtest' >> /etc/hosts" ]
+  - [sh, -xc, "echo '127.0.1.1 autopkgtest' >> /etc/hosts" ]
  ====>8========>8========>8========>8========>8====
  
  2. On an AMD64 host provision an LXC guest with the command (replace user-data by the path to the user-data file you created above)
-   $ sudo lxc-create -n raring-armhf-20130326 -t ubuntu-cloud -- -r raring -a amd64 -s daily -u user-data
+   $ sudo lxc-create -n raring-armhf-20130326 -t ubuntu-cloud -- -r raring -a amd64 -s daily -u user-data
  
  3. Start the container and wait
-   $ sudo lxc-start -n raring-armhf-20130326
+   $ sudo lxc-start -n raring-armhf-20130326
  
  ProblemType: Bug
  DistroRelease: Ubuntu 13.04
  Package: cloud-init (not installed)
  ProcVersionSignature: Ubuntu 3.8.0-13.23-generic 3.8.3
  Uname: Linux 3.8.0-13-generic x86_64
  ApportVersion: 2.9.2-0ubuntu4
  Architecture: amd64
  Date: Tue Mar 26 17:06:46 2013
  MarkForUpload: True
  ProcEnviron:
-  TERM=xterm
-  PATH=(custom, no user)
-  XDG_RUNTIME_DIR=<set>
-  LANG=en_US.UTF-8
-  SHELL=/bin/bash
+  TERM=xterm
+  PATH=(custom, no user)
+  XDG_RUNTIME_DIR=<set>
+  LANG=en_US.UTF-8
+  SHELL=/bin/bash
  SourcePackage: cloud-init
  UpgradeStatus: Upgraded to raring on 2012-01-31 (419 days ago)

-- 
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to cloud-init in Ubuntu.
https://bugs.launchpad.net/bugs/1160462

Title:
  Don't run resizefs hook during installation of an LXC container with
  cloud-init

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



More information about the Ubuntu-server-bugs mailing list