← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 2129678] [NEW] create image in libvirt fails

 

Public bug reported:

This error occur when trying to create a VM.

The clue here is volume_clear none and use the volume with add and
destroy VM

/etc/nova/nova.conf
..
[libvirt]
inject_password = true
images_type = lvm
images_volume_group = nova-local-lvm
volume_clear = none
.......


See the log from /var/log/nova/nova-compute.log
025-10-23 00:27:02.949 103952 INFO nova.virt.libvirt.driver [None req-28d813b5-3a36-4673-8efc-ae25e07762ac 27573b9f810c4d01a6718af94184292b 258773ad8d2c4aa483bfa2ad5ce9ca81 - - default default] [instance: 44a45080-19d3-4eff-af98-eb00e299ddbe] Creating image(s)
2025-10-23 00:27:10.667 103952 ERROR root [None req-28d813b5-3a36-4673-8efc-ae25e07762ac 27573b9f810c4d01a6718af94184292b 258773ad8d2c4aa483bfa2ad5ce9ca81 - - default default] Original exception being dropped: ['Traceback (most recent call last):\n', '  File "/usr/lib/python3/dist-packages/nova/virt/libvirt/imagebackend.py", line 883, in remove_volume_on_error\n    yield\n', '  File "/usr/lib/python3/dist-packages/nova/virt/libvirt/imagebackend.py", line 873, in create_image\n    create_lvm_image(base, size)\n', '  File "/usr/lib/python3/dist-packages/oslo_concurrency/lockutils.py", line 415, in inner\n    return f(*args, **kwargs)\n           ^^^^^^^^^^^^^^^^^^\n', '  File "/usr/lib/python3/dist-packages/nova/virt/libvirt/imagebackend.py", line 828, in create_lvm_image\n    lvm.create_volume(self.vg, self.lv,\n', '  File "/usr/lib/python3/dist-packages/nova/virt/libvirt/storage/lvm.py", line 79, in create_volume\n    nova.privsep.fs.lvcreate(size, lv, vg)\n', '  File "/usr/lib/python3/dist-packages/oslo_privsep/priv_context.py", line 263, in _wrap\n    return self.channel.remote_call(name, args, kwargs,\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n', '  File "/usr/lib/python3/dist-packages/oslo_privsep/daemon.py", line 219, in remote_call\n    raise exc_type(*result[2])\n', "oslo_concurrency.processutils.ProcessExecutionError: Unexpected error while running command.\nCommand: lvcreate -L 1073741824b -n 44a45080-19d3-4eff-af98-eb00e299ddbe_disk nova-local-lvm\nExit code: 5\nStdout: ''\nStderr: 'WARNING: gpt signature detected on /dev/nova-local-lvm/44a45080-19d3-4eff-af98-eb00e299ddbe_disk at offset 512. Wipe it? [y/n]: [n]\\n  Aborted wiping of gpt.\\n  1 existing signature left on the device.\\n  Failed to wipe signatures on logical volume nova-local-lvm/44a45080-19d3-4eff-af98-eb00e299ddbe_disk.\\n  Aborting. Failed to wipe start of new LV.\\n'\n"]: nova.exception.VolumesNotRemoved: Failed to remove volume(s): (Unexpected error while running command.

The following fix fixes it for me
against upstream/master

$ git diff
diff --git a/nova/privsep/fs.py b/nova/privsep/fs.py
index 0ba25ca852..2ca8ff973c 100644
--- a/nova/privsep/fs.py
+++ b/nova/privsep/fs.py
@@ -47,6 +47,7 @@ def umount(mountpoint):
 @nova.privsep.sys_admin_pctxt.entrypoint
 def lvcreate(size, lv, vg, preallocated=None):
     cmd = ['lvcreate']
+    cmd.extend(['-y'])
     if not preallocated:
         cmd.extend(['-L', '%db' % size])
     else:


The clue here is that zero is default which causes wipe, but yes is NOT default

       -W|--wipesignatures y|n
              Controls detection and subsequent wiping of signatures on  new  LVs.
              There  is a prompt for each signature detected to confirm its wiping
              (unless --yes is used to override confirmations.)  When  not  speci‐
              fied,  signatures  are  wiped whenever zeroing is done (see --zero).
              This  behaviour  can  be   configured   with   lvm.conf(5)   alloca‐
              tion/wipe_signatures_when_zeroing_new_lvs.   If blkid wiping is used
              (lvm.conf(5) allocation/use_blkid_wiping) and LVM is  compiled  with
              blkid  wiping  support,  then the blkid(8) library is used to detect
              the signatures (use blkid -k to list the signatures that are  recog‐
              nized).   Otherwise,  native  LVM  code is used to detect signatures
              (only MD RAID, swap and LUKS signatures are detected in this  case.)
              The LV is not wiped if the read only flag is set.

       -y|--yes
              Do  not  prompt for confirmation interactively but always assume the
              answer yes. Use with extreme caution.  (For automatic no, see -qq.)

       -Z|--zero y|n
              Controls zeroing of the first 4KiB of data in the new  LV.   Default
              is y.  Snapshot COW volumes are always zeroed.  For thin pools, this
              controls zeroing of provisioned blocks.  LV is  not  zeroed  if  the
              read  only flag is set.  Warning: trying to mount an unzeroed LV can
              cause the system to hang.

Environment 
Debian bookworm with Openstack epoxy. ( But have used my fix since OpenStack zed )

** 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/2129678

Title:
  create image in libvirt fails

Status in OpenStack Compute (nova):
  New

Bug description:
  This error occur when trying to create a VM.

  The clue here is volume_clear none and use the volume with add and
  destroy VM

  /etc/nova/nova.conf
  ..
  [libvirt]
  inject_password = true
  images_type = lvm
  images_volume_group = nova-local-lvm
  volume_clear = none
  .......

  
  See the log from /var/log/nova/nova-compute.log
  025-10-23 00:27:02.949 103952 INFO nova.virt.libvirt.driver [None req-28d813b5-3a36-4673-8efc-ae25e07762ac 27573b9f810c4d01a6718af94184292b 258773ad8d2c4aa483bfa2ad5ce9ca81 - - default default] [instance: 44a45080-19d3-4eff-af98-eb00e299ddbe] Creating image(s)
  2025-10-23 00:27:10.667 103952 ERROR root [None req-28d813b5-3a36-4673-8efc-ae25e07762ac 27573b9f810c4d01a6718af94184292b 258773ad8d2c4aa483bfa2ad5ce9ca81 - - default default] Original exception being dropped: ['Traceback (most recent call last):\n', '  File "/usr/lib/python3/dist-packages/nova/virt/libvirt/imagebackend.py", line 883, in remove_volume_on_error\n    yield\n', '  File "/usr/lib/python3/dist-packages/nova/virt/libvirt/imagebackend.py", line 873, in create_image\n    create_lvm_image(base, size)\n', '  File "/usr/lib/python3/dist-packages/oslo_concurrency/lockutils.py", line 415, in inner\n    return f(*args, **kwargs)\n           ^^^^^^^^^^^^^^^^^^\n', '  File "/usr/lib/python3/dist-packages/nova/virt/libvirt/imagebackend.py", line 828, in create_lvm_image\n    lvm.create_volume(self.vg, self.lv,\n', '  File "/usr/lib/python3/dist-packages/nova/virt/libvirt/storage/lvm.py", line 79, in create_volume\n    nova.privsep.fs.lvcreate(size, lv, vg)\n', '  File "/usr/lib/python3/dist-packages/oslo_privsep/priv_context.py", line 263, in _wrap\n    return self.channel.remote_call(name, args, kwargs,\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n', '  File "/usr/lib/python3/dist-packages/oslo_privsep/daemon.py", line 219, in remote_call\n    raise exc_type(*result[2])\n', "oslo_concurrency.processutils.ProcessExecutionError: Unexpected error while running command.\nCommand: lvcreate -L 1073741824b -n 44a45080-19d3-4eff-af98-eb00e299ddbe_disk nova-local-lvm\nExit code: 5\nStdout: ''\nStderr: 'WARNING: gpt signature detected on /dev/nova-local-lvm/44a45080-19d3-4eff-af98-eb00e299ddbe_disk at offset 512. Wipe it? [y/n]: [n]\\n  Aborted wiping of gpt.\\n  1 existing signature left on the device.\\n  Failed to wipe signatures on logical volume nova-local-lvm/44a45080-19d3-4eff-af98-eb00e299ddbe_disk.\\n  Aborting. Failed to wipe start of new LV.\\n'\n"]: nova.exception.VolumesNotRemoved: Failed to remove volume(s): (Unexpected error while running command.

  The following fix fixes it for me
  against upstream/master

  $ git diff
  diff --git a/nova/privsep/fs.py b/nova/privsep/fs.py
  index 0ba25ca852..2ca8ff973c 100644
  --- a/nova/privsep/fs.py
  +++ b/nova/privsep/fs.py
  @@ -47,6 +47,7 @@ def umount(mountpoint):
   @nova.privsep.sys_admin_pctxt.entrypoint
   def lvcreate(size, lv, vg, preallocated=None):
       cmd = ['lvcreate']
  +    cmd.extend(['-y'])
       if not preallocated:
           cmd.extend(['-L', '%db' % size])
       else:

  
  The clue here is that zero is default which causes wipe, but yes is NOT default

         -W|--wipesignatures y|n
                Controls detection and subsequent wiping of signatures on  new  LVs.
                There  is a prompt for each signature detected to confirm its wiping
                (unless --yes is used to override confirmations.)  When  not  speci‐
                fied,  signatures  are  wiped whenever zeroing is done (see --zero).
                This  behaviour  can  be   configured   with   lvm.conf(5)   alloca‐
                tion/wipe_signatures_when_zeroing_new_lvs.   If blkid wiping is used
                (lvm.conf(5) allocation/use_blkid_wiping) and LVM is  compiled  with
                blkid  wiping  support,  then the blkid(8) library is used to detect
                the signatures (use blkid -k to list the signatures that are  recog‐
                nized).   Otherwise,  native  LVM  code is used to detect signatures
                (only MD RAID, swap and LUKS signatures are detected in this  case.)
                The LV is not wiped if the read only flag is set.

         -y|--yes
                Do  not  prompt for confirmation interactively but always assume the
                answer yes. Use with extreme caution.  (For automatic no, see -qq.)

         -Z|--zero y|n
                Controls zeroing of the first 4KiB of data in the new  LV.   Default
                is y.  Snapshot COW volumes are always zeroed.  For thin pools, this
                controls zeroing of provisioned blocks.  LV is  not  zeroed  if  the
                read  only flag is set.  Warning: trying to mount an unzeroed LV can
                cause the system to hang.

  Environment 
  Debian bookworm with Openstack epoxy. ( But have used my fix since OpenStack zed )

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