]> git.proxmox.com Git - qemu-server.git/commit
fix #1905: Allow moving unused disks
authorFilip Schauer <f.schauer@proxmox.com>
Mon, 19 Feb 2024 11:11:39 +0000 (12:11 +0100)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Fri, 12 Apr 2024 09:45:25 +0000 (11:45 +0200)
commit1f743141e3095d07874e171d6c03b335d9c7e572
treed52dc449a0420eadf00ee5c3733d8c9c5e3f9cb8
parent2db4c27283e34652f60ceb2f39e13f3e616cb561
fix #1905: Allow moving unused disks

In the past, moving unused disks to another storage was prohibited due
to oversights in the handling of unused disks. This commit rectifies
this limitation by allowing the movement of unused disks.

Historical context:
* 16 Sep 2010 r5164 qemu-server/pve2: The disknames sub was removed.
* 17 Sep 2010 r5170 qemu-server/pve2: Unused disks were introduced.
* 28 Jan 2011 r5461 qemu-server/pve2: The same disknames sub that was
   removed in r5164 was brought back. Since unused disks were not around
   yet in r5164 the disknames sub did not consider unused disks.
* 6-8 Aug 2012 c1175c92..f91b2e45 qemu-server.git: Disk resize was
   introduced. In commit c1175c92 in sub qemu_block_resize unused disks
   were not taken into account and in commit 2f48a4f5 (8 Aug 2012) the
   resize API call was changed to only allow disks matching the ones in
   the disknames sub. Since sub disknames did not contain any unused
   disks, those were not allowed at all in the resize API call.
* 27 May 2013 586bfa78 qemu-server.git: Disk move was introduced. The
   API call implementation borrowed heavily from disk resize, including
   the behaviour of not taking unused disks into account. Thus, unused
   disk could not be moved, which persists to this day.

In summary, this behaviour was introduced because the handling of unused
disks was overlooked and it was never changed.

There is no inherent reason why unused disks should be restricted from
being moved to another storage. These disks cannot use the
qemu_drive_mirror, but they can still be moved with qemu_img_convert,
the same way as any other disk of a stopped VM.

Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
PVE/API2/Qemu.pm
PVE/QemuServer.pm