← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1352806] [NEW] virt: Mounting error in is_image_partitionless function when nova boot

 

Public bug reported:

If we set
inject_partition = -1
inject_password = True
in nova.conf, nova boot will sucessfully inject password but there are errors when nova try to resize2fs the image:

4-08-05 11:58:01.230 DEBUG nova.virt.disk.api [req-ab691c7b-
4d50-4281-a1a4-a0de3d5d000a ] [admin admin] Unable to mount image
/opt/stack/data/nova/instances/7523c41f-9d70-41eb-95e9-7b0b1daa926b/disk
with error Error mounting /opt/stack/data/nova/instances/7523c41f-9d70
-41eb-95e9-7b0b1daa926b/disk with libguestfs (mount_options: /dev/sda on
/ (options: ''): mount: you must specify the filesystem type). Cannot
resize.from (pid=27490) is_image_partitionless
/opt/stack/nova/nova/virt/disk/api.py:218

The root cause it that there is a config: inject_partition to tell
guestfs the partition in the image disk.

    cfg.IntOpt('inject_partition',
                default=-2,
                help='The partition to inject to : '
                     '-2 => disable, -1 => inspect (libguestfs only), '
                     '0 => not partitioned, >0 => partition number'),

when booting, there are 2 locations to invoke guestfs to load disk, but
the first do not pass the inject_partition parameter.

1. https://github.com/openstack/nova/blob/master/nova/virt/libvirt/driver.py#L2316 -> https://github.com/openstack/nova/blob/master/nova/virt/libvirt/driver.py#L2704 -> https://github.com/openstack/nova/blob/master/nova/virt/libvirt/imagebackend.py#L180 -> https://github.com/openstack/nova/blob/master/nova/virt/libvirt/imagebackend.py#L391 -> https://github.com/openstack/nova/blob/master/nova/virt/disk/api.py#L162 -> https://github.com/openstack/nova/blob/master/nova/virt/disk/api.py#L211
2. https://github.com/openstack/nova/blob/master/nova/virt/libvirt/driver.py#L2798 -> https://github.com/openstack/nova/blob/master/nova/virt/libvirt/driver.py#L2610 -> https://github.com/openstack/nova/blob/master/nova/virt/disk/api.py#L357

The first location  at https://github.com/openstack/nova/blob/master/nova/virt/disk/api.py#L211 just pass the None for partition:
fs = vfs.VFS.instance_for_image(image, 'qcow2', None)
which will make guestfs try to mount /dev/sda on /, this will make the Mounting error occured if we using cirros image.

To fix this issue we need pass the partition parameter which come from
CONF.libvirt.inject_partition like in
https://github.com/openstack/nova/blob/master/nova/virt/libvirt/driver.py#L2577


This bug related to https://bugs.launchpad.net/nova/+bug/1246852
and https://bugs.launchpad.net/nova/+bug/1279858
The bug: 1279858 told us that we should avoid guestfs loading disk twice. whick will make the booting slow.
The better approch is using cloud-init instead of guestfs.

** Affects: nova
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1352806

Title:
  virt: Mounting error in is_image_partitionless function when nova boot

Status in OpenStack Compute (Nova):
  New

Bug description:
  If we set
  inject_partition = -1
  inject_password = True
  in nova.conf, nova boot will sucessfully inject password but there are errors when nova try to resize2fs the image:

  4-08-05 11:58:01.230 DEBUG nova.virt.disk.api [req-ab691c7b-
  4d50-4281-a1a4-a0de3d5d000a ] [admin admin] Unable to mount image
  /opt/stack/data/nova/instances/7523c41f-9d70-41eb-
  95e9-7b0b1daa926b/disk with error Error mounting
  /opt/stack/data/nova/instances/7523c41f-9d70-41eb-
  95e9-7b0b1daa926b/disk with libguestfs (mount_options: /dev/sda on /
  (options: ''): mount: you must specify the filesystem type). Cannot
  resize.from (pid=27490) is_image_partitionless
  /opt/stack/nova/nova/virt/disk/api.py:218

  The root cause it that there is a config: inject_partition to tell
  guestfs the partition in the image disk.

      cfg.IntOpt('inject_partition',
                  default=-2,
                  help='The partition to inject to : '
                       '-2 => disable, -1 => inspect (libguestfs only), '
                       '0 => not partitioned, >0 => partition number'),

  when booting, there are 2 locations to invoke guestfs to load disk,
  but the first do not pass the inject_partition parameter.

  1. https://github.com/openstack/nova/blob/master/nova/virt/libvirt/driver.py#L2316 -> https://github.com/openstack/nova/blob/master/nova/virt/libvirt/driver.py#L2704 -> https://github.com/openstack/nova/blob/master/nova/virt/libvirt/imagebackend.py#L180 -> https://github.com/openstack/nova/blob/master/nova/virt/libvirt/imagebackend.py#L391 -> https://github.com/openstack/nova/blob/master/nova/virt/disk/api.py#L162 -> https://github.com/openstack/nova/blob/master/nova/virt/disk/api.py#L211
  2. https://github.com/openstack/nova/blob/master/nova/virt/libvirt/driver.py#L2798 -> https://github.com/openstack/nova/blob/master/nova/virt/libvirt/driver.py#L2610 -> https://github.com/openstack/nova/blob/master/nova/virt/disk/api.py#L357

  The first location  at https://github.com/openstack/nova/blob/master/nova/virt/disk/api.py#L211 just pass the None for partition:
  fs = vfs.VFS.instance_for_image(image, 'qcow2', None)
  which will make guestfs try to mount /dev/sda on /, this will make the Mounting error occured if we using cirros image.

  To fix this issue we need pass the partition parameter which come from
  CONF.libvirt.inject_partition like in
  https://github.com/openstack/nova/blob/master/nova/virt/libvirt/driver.py#L2577

  
  This bug related to https://bugs.launchpad.net/nova/+bug/1246852
  and https://bugs.launchpad.net/nova/+bug/1279858
  The bug: 1279858 told us that we should avoid guestfs loading disk twice. whick will make the booting slow.
  The better approch is using cloud-init instead of guestfs.

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1352806/+subscriptions


Follow ups

References