All of lore.kernel.org
 help / color / mirror / Atom feed
* [Bug 1901892] [NEW] qemu-img create corrupts the qcow2 if the file already exists
@ 2020-10-28 13:40 Pablo Schandin
  2021-05-09 14:57 ` [Bug 1901892] " Thomas Huth
  2021-07-09  4:17 ` Launchpad Bug Tracker
  0 siblings, 2 replies; 3+ messages in thread
From: Pablo Schandin @ 2020-10-28 13:40 UTC (permalink / raw)
  To: qemu-devel

Public bug reported:

When creating a disk using qemu-img create command, if the destination
path of the qcow2 file already exists, it will show the error saying
that it cannot get a lock so it exits with exit status 1 but it will
corrupt the qcow2 file anyway.

Steps to reproduce:
1. Have a guest running with a root (vda) and a second device (vdc).
In my case is a clean Ubuntu 16.04 image with kernel 4.4.0-190-generic x86_64
vdc disk is called testadddisk-3.qcow2
2. vdc is an xfs over lvm.
pvcreacte /dev/vdc
vgcreate myVg /dev/vdc
lvcreate -l+100%FREE -n myLv myVg
mkfs.xfs /dev/mapper/myVg-myLv
mount /dev/mapper/myVg-myLv /mnt
3. Create disk IO on that device in the guest.
while true ; do dd if=/dev/zero of=/mnt/testfile bs=1024 count=1000 ; sleep 1; done
4. Execute the command to create a new device but use the same name of the device attached:
sudo qemu-img create -f qcow2 testadddisk-3.qcow2 20G
The output of the command is this:
Formatting 'testadddisk-3.qcow2', fmt=qcow2 size=21474836480 cluster_size=65536 lazy_refcounts=off refcount_bits=16
qemu-img: testadddisk-3.qcow2: Failed to get "write" lock
Is another process using the image?

The write continues in the guest but when it is shutdown, when it is powered on again you get this:
error: Failed to start domain testadddisk
error: internal error: process exited while connecting to monitor: 2020-10-27T22:00:51.628374Z qemu-system-x86_64: -drive file=/var/lib/vmImages/testadddisk-3.qcow2,format=qcow2,if=none,id=drive-virtio-disk2: Image is not in qcow2 format

I run the qemu-img create command with an strace and I believe that
first it tries to open the file in write mode, then does a truncate on
it and after that says it cannot get a lock. The output is in the file
attached. As well as the guest xml just in case.

The host: 
Ubuntu 18.04.5 LTS
4.15.0-112-generic x86_64
qemu packages installed:
ii  qemu-block-extra:amd64                 1:2.11+dfsg-1ubuntu7.32                         amd64        extra block backend modules for qemu-system and qemu-utils
ii  qemu-kvm                               1:2.11+dfsg-1ubuntu7.31                         amd64        QEMU Full virtualization on x86 hardware
ii  qemu-system-common                     1:2.11+dfsg-1ubuntu7.32                         amd64        QEMU full system emulation binaries (common files)
ii  qemu-system-x86                        1:2.11+dfsg-1ubuntu7.31                         amd64        QEMU full system emulation binaries (x86)
ii  qemu-utils                             1:2.11+dfsg-1ubuntu7.32                         amd64        QEMU utilities

** Affects: qemu
     Importance: Undecided
         Status: New

** Attachment added: "testadddisk-strace-dumxml.txt"
   https://bugs.launchpad.net/bugs/1901892/+attachment/5428520/+files/testadddisk-strace-dumxml.txt

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1901892

Title:
  qemu-img create corrupts the qcow2 if the file already exists

Status in QEMU:
  New

Bug description:
  When creating a disk using qemu-img create command, if the destination
  path of the qcow2 file already exists, it will show the error saying
  that it cannot get a lock so it exits with exit status 1 but it will
  corrupt the qcow2 file anyway.

  Steps to reproduce:
  1. Have a guest running with a root (vda) and a second device (vdc).
  In my case is a clean Ubuntu 16.04 image with kernel 4.4.0-190-generic x86_64
  vdc disk is called testadddisk-3.qcow2
  2. vdc is an xfs over lvm.
  pvcreacte /dev/vdc
  vgcreate myVg /dev/vdc
  lvcreate -l+100%FREE -n myLv myVg
  mkfs.xfs /dev/mapper/myVg-myLv
  mount /dev/mapper/myVg-myLv /mnt
  3. Create disk IO on that device in the guest.
  while true ; do dd if=/dev/zero of=/mnt/testfile bs=1024 count=1000 ; sleep 1; done
  4. Execute the command to create a new device but use the same name of the device attached:
  sudo qemu-img create -f qcow2 testadddisk-3.qcow2 20G
  The output of the command is this:
  Formatting 'testadddisk-3.qcow2', fmt=qcow2 size=21474836480 cluster_size=65536 lazy_refcounts=off refcount_bits=16
  qemu-img: testadddisk-3.qcow2: Failed to get "write" lock
  Is another process using the image?

  The write continues in the guest but when it is shutdown, when it is powered on again you get this:
  error: Failed to start domain testadddisk
  error: internal error: process exited while connecting to monitor: 2020-10-27T22:00:51.628374Z qemu-system-x86_64: -drive file=/var/lib/vmImages/testadddisk-3.qcow2,format=qcow2,if=none,id=drive-virtio-disk2: Image is not in qcow2 format

  I run the qemu-img create command with an strace and I believe that
  first it tries to open the file in write mode, then does a truncate on
  it and after that says it cannot get a lock. The output is in the file
  attached. As well as the guest xml just in case.

  The host: 
  Ubuntu 18.04.5 LTS
  4.15.0-112-generic x86_64
  qemu packages installed:
  ii  qemu-block-extra:amd64                 1:2.11+dfsg-1ubuntu7.32                         amd64        extra block backend modules for qemu-system and qemu-utils
  ii  qemu-kvm                               1:2.11+dfsg-1ubuntu7.31                         amd64        QEMU Full virtualization on x86 hardware
  ii  qemu-system-common                     1:2.11+dfsg-1ubuntu7.32                         amd64        QEMU full system emulation binaries (common files)
  ii  qemu-system-x86                        1:2.11+dfsg-1ubuntu7.31                         amd64        QEMU full system emulation binaries (x86)
  ii  qemu-utils                             1:2.11+dfsg-1ubuntu7.32                         amd64        QEMU utilities

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug 1901892] Re: qemu-img create corrupts the qcow2 if the file already exists
  2020-10-28 13:40 [Bug 1901892] [NEW] qemu-img create corrupts the qcow2 if the file already exists Pablo Schandin
@ 2021-05-09 14:57 ` Thomas Huth
  2021-07-09  4:17 ` Launchpad Bug Tracker
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Huth @ 2021-05-09 14:57 UTC (permalink / raw)
  To: qemu-devel

The QEMU project is currently moving its bug tracking to another system.
For this we need to know which bugs are still valid and which could be
closed already. Thus we are setting the bug state to "Incomplete" now.

If the bug has already been fixed in the latest upstream version of QEMU,
then please close this ticket as "Fix released".

If it is not fixed yet and you think that this bug report here is still
valid, then you have two options:

1) If you already have an account on gitlab.com, please open a new ticket
for this problem in our new tracker here:

    https://gitlab.com/qemu-project/qemu/-/issues

and then close this ticket here on Launchpad (or let it expire auto-
matically after 60 days). Please mention the URL of this bug ticket on
Launchpad in the new ticket on GitLab.

2) If you don't have an account on gitlab.com and don't intend to get
one, but still would like to keep this ticket opened, then please switch
the state back to "New" or "Confirmed" within the next 60 days (other-
wise it will get closed as "Expired"). We will then eventually migrate
the ticket automatically to the new system (but you won't be the reporter
of the bug in the new system and thus you won't get notified on changes
anymore).

Thank you and sorry for the inconvenience.


** Changed in: qemu
       Status: New => Incomplete

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1901892

Title:
  qemu-img create corrupts the qcow2 if the file already exists

Status in QEMU:
  Incomplete

Bug description:
  When creating a disk using qemu-img create command, if the destination
  path of the qcow2 file already exists, it will show the error saying
  that it cannot get a lock so it exits with exit status 1 but it will
  corrupt the qcow2 file anyway.

  Steps to reproduce:
  1. Have a guest running with a root (vda) and a second device (vdc).
  In my case is a clean Ubuntu 16.04 image with kernel 4.4.0-190-generic x86_64
  vdc disk is called testadddisk-3.qcow2
  2. vdc is an xfs over lvm.
  pvcreacte /dev/vdc
  vgcreate myVg /dev/vdc
  lvcreate -l+100%FREE -n myLv myVg
  mkfs.xfs /dev/mapper/myVg-myLv
  mount /dev/mapper/myVg-myLv /mnt
  3. Create disk IO on that device in the guest.
  while true ; do dd if=/dev/zero of=/mnt/testfile bs=1024 count=1000 ; sleep 1; done
  4. Execute the command to create a new device but use the same name of the device attached:
  sudo qemu-img create -f qcow2 testadddisk-3.qcow2 20G
  The output of the command is this:
  Formatting 'testadddisk-3.qcow2', fmt=qcow2 size=21474836480 cluster_size=65536 lazy_refcounts=off refcount_bits=16
  qemu-img: testadddisk-3.qcow2: Failed to get "write" lock
  Is another process using the image?

  The write continues in the guest but when it is shutdown, when it is powered on again you get this:
  error: Failed to start domain testadddisk
  error: internal error: process exited while connecting to monitor: 2020-10-27T22:00:51.628374Z qemu-system-x86_64: -drive file=/var/lib/vmImages/testadddisk-3.qcow2,format=qcow2,if=none,id=drive-virtio-disk2: Image is not in qcow2 format

  I run the qemu-img create command with an strace and I believe that
  first it tries to open the file in write mode, then does a truncate on
  it and after that says it cannot get a lock. The output is in the file
  attached. As well as the guest xml just in case.

  The host: 
  Ubuntu 18.04.5 LTS
  4.15.0-112-generic x86_64
  qemu packages installed:
  ii  qemu-block-extra:amd64                 1:2.11+dfsg-1ubuntu7.32                         amd64        extra block backend modules for qemu-system and qemu-utils
  ii  qemu-kvm                               1:2.11+dfsg-1ubuntu7.31                         amd64        QEMU Full virtualization on x86 hardware
  ii  qemu-system-common                     1:2.11+dfsg-1ubuntu7.32                         amd64        QEMU full system emulation binaries (common files)
  ii  qemu-system-x86                        1:2.11+dfsg-1ubuntu7.31                         amd64        QEMU full system emulation binaries (x86)
  ii  qemu-utils                             1:2.11+dfsg-1ubuntu7.32                         amd64        QEMU utilities

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug 1901892] Re: qemu-img create corrupts the qcow2 if the file already exists
  2020-10-28 13:40 [Bug 1901892] [NEW] qemu-img create corrupts the qcow2 if the file already exists Pablo Schandin
  2021-05-09 14:57 ` [Bug 1901892] " Thomas Huth
@ 2021-07-09  4:17 ` Launchpad Bug Tracker
  1 sibling, 0 replies; 3+ messages in thread
From: Launchpad Bug Tracker @ 2021-07-09  4:17 UTC (permalink / raw)
  To: qemu-devel

[Expired for QEMU because there has been no activity for 60 days.]

** Changed in: qemu
       Status: Incomplete => Expired

-- 
You received this bug notification because you are a member of qemu-
devel-ml, which is subscribed to QEMU.
https://bugs.launchpad.net/bugs/1901892

Title:
  qemu-img create corrupts the qcow2 if the file already exists

Status in QEMU:
  Expired

Bug description:
  When creating a disk using qemu-img create command, if the destination
  path of the qcow2 file already exists, it will show the error saying
  that it cannot get a lock so it exits with exit status 1 but it will
  corrupt the qcow2 file anyway.

  Steps to reproduce:
  1. Have a guest running with a root (vda) and a second device (vdc).
  In my case is a clean Ubuntu 16.04 image with kernel 4.4.0-190-generic x86_64
  vdc disk is called testadddisk-3.qcow2
  2. vdc is an xfs over lvm.
  pvcreacte /dev/vdc
  vgcreate myVg /dev/vdc
  lvcreate -l+100%FREE -n myLv myVg
  mkfs.xfs /dev/mapper/myVg-myLv
  mount /dev/mapper/myVg-myLv /mnt
  3. Create disk IO on that device in the guest.
  while true ; do dd if=/dev/zero of=/mnt/testfile bs=1024 count=1000 ; sleep 1; done
  4. Execute the command to create a new device but use the same name of the device attached:
  sudo qemu-img create -f qcow2 testadddisk-3.qcow2 20G
  The output of the command is this:
  Formatting 'testadddisk-3.qcow2', fmt=qcow2 size=21474836480 cluster_size=65536 lazy_refcounts=off refcount_bits=16
  qemu-img: testadddisk-3.qcow2: Failed to get "write" lock
  Is another process using the image?

  The write continues in the guest but when it is shutdown, when it is powered on again you get this:
  error: Failed to start domain testadddisk
  error: internal error: process exited while connecting to monitor: 2020-10-27T22:00:51.628374Z qemu-system-x86_64: -drive file=/var/lib/vmImages/testadddisk-3.qcow2,format=qcow2,if=none,id=drive-virtio-disk2: Image is not in qcow2 format

  I run the qemu-img create command with an strace and I believe that
  first it tries to open the file in write mode, then does a truncate on
  it and after that says it cannot get a lock. The output is in the file
  attached. As well as the guest xml just in case.

  The host: 
  Ubuntu 18.04.5 LTS
  4.15.0-112-generic x86_64
  qemu packages installed:
  ii  qemu-block-extra:amd64                 1:2.11+dfsg-1ubuntu7.32                         amd64        extra block backend modules for qemu-system and qemu-utils
  ii  qemu-kvm                               1:2.11+dfsg-1ubuntu7.31                         amd64        QEMU Full virtualization on x86 hardware
  ii  qemu-system-common                     1:2.11+dfsg-1ubuntu7.32                         amd64        QEMU full system emulation binaries (common files)
  ii  qemu-system-x86                        1:2.11+dfsg-1ubuntu7.31                         amd64        QEMU full system emulation binaries (x86)
  ii  qemu-utils                             1:2.11+dfsg-1ubuntu7.32                         amd64        QEMU utilities

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-07-09  4:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-28 13:40 [Bug 1901892] [NEW] qemu-img create corrupts the qcow2 if the file already exists Pablo Schandin
2021-05-09 14:57 ` [Bug 1901892] " Thomas Huth
2021-07-09  4:17 ` Launchpad Bug Tracker

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.