]> git.proxmox.com Git - qemu-server.git/commit
map cloudinit disk to new vmid on restore
authorMira Limbeck <m.limbeck@proxmox.com>
Thu, 16 May 2019 12:07:01 +0000 (14:07 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 16 May 2019 14:29:02 +0000 (16:29 +0200)
commitc4ab3c558454a21e60b706f10d5eb0a1f513016c
tree020aca8bd05bae01f3e30fb9f2c684ba7dda97f9
parent7d761a016dce18c9cced0c01551b3bdaa87a1857
map cloudinit disk to new vmid on restore

Resolves the issue of restoring a VM that has a cloudinit drive
configured to a new VMID. The VMID of the disk name gets now remapped
correctly and in the process the cloudinit disk is created with the same size
as in PVE/API2/Qemu.pm create_disks and in PVE/QemuServer/Cloudinit
commit_cloudinit_disk as the same constant is used.

This is done by matching any line starting with either 'ide', 'sata' or
'scsi' and then check if it is a cloudinit drive. As cloudinit drives
are attached as cdrom, only those 3 are possible. For the cloudinit
check we use 'parse_drive' followed by 'drive_is_cloudinit' so no custom
regex is necessary.

'--targetstorage' is also taken into account on restore now for
cloudinit disks. If a target storage is specified the format is either
kept if possible, or changed to the default of that storage.

This should fix #1807 completely. The restore error was already resolved
with commit 7e8ab2a, but the vmid of the disk might not have matched the new
one.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
PVE/QemuServer.pm