Commit Graph

12 Commits

Author SHA1 Message Date
Fiona Ebner
d5d3501a0b image convert: collect options in hash argument
In preparation to add another option and to improve style for the
callers.

One of the test cases that specified $is_zero_initialized is for a
non-existent storage, so the option was not added there.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Tested-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Link: https://lore.proxmox.com/20250404133204.239783-16-f.ebner@proxmox.com
2025-04-06 20:18:52 +02:00
Fiona Ebner
e4cbea4436 import: add source size parameter to do_import()
The file_size_info() will return the size of the image based on
guessing the format. When importing via API, the correct size is
already known, so it's better to pass it in. The root-only 'qm'
commands for disk import and OVF import will still use auto-detection
for backwards compatibility. It might make sense to be able to
explicitly specify the format there too to get the correct size in all
cases.

New callers should detect the size according to the appropriate format
first.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2024-12-09 09:07:17 +01:00
Fiona Ebner
f6039cedf1 disk import: warn when fallback is used instead of requested format
Might avoid some confusion. Reported in the community forum:
https://forum.proxmox.com/threads/142988/

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2024-03-14 14:01:12 +01:00
Dominic Jäger
e6ac9fed7b api: support VM disk import
Extend qm importdisk functionality to the API.

Co-authored-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Co-authored-by: Dominic Jäger <d.jaeger@proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2022-04-04 16:41:13 +02:00
Thomas Lamprecht
c75bf16117 qm importdisk: tell user to what VM disk we actually imported
as else one has no idea what the imported disk is, especially if
multiple unused disks are already present..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-10-29 19:11:21 +01:00
Thomas Lamprecht
5600c5b22f cleanup do_import, s/optional/params/ and move skiplock into params
mixed with indentation changes a whole lot of other changes which
should normally not mixed to much together, but this is all a bit
tangled and I'm not sure if splitting it into two or three parts
would help anybody.. just use "-w" (ignore whitespace changes) when
looking at the diff..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-10-29 19:11:21 +01:00
Dominic Jäger
7f384190de Add skiplock to do_import
Functions like qm importovf can now set the "lock" property in a config file
before calling do_import.

Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
2019-10-29 19:11:21 +01:00
Dominik Csapak
af1f1ec038 fix #2395: refactor qemu_img_convert to accept files as source
and use it also for efidisk creation and importdisk
this way we correctly handle zfs-over-iscsi options for those cases

also write tests for it

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-10-17 13:57:21 +02:00
Emmanuel Kasper
6cb0144ae3 do not overwrite global signal handlers
perls 'local' must be either used in front of each $SIG{...}
assignments or they must be put in a list, else it affects only the
first variable and the rest are *not* in local context.

In all cases the global signal handlers we overwrote were in cli programs or
forked workers, not in daemons.
2017-09-14 15:25:28 +02:00
Fabian Grünbichler
21463b9a04 import disk: add \n to die 2017-06-01 11:40:06 +02:00
Fabian Grünbichler
0f0aa6b71e import disk: downgrade hotplug failure to warning 2017-06-01 11:15:14 +02:00
Emmanuel Kasper
b94e047acb Add ImportDisk module to import external disk images into a VM
Each disk passed as paramater is add as 'unused[n]' in the vm.conf
(the default) or ide[n]|scsi[n]|sata[n]
We rely on qemu-img(1) convert heuristics to detect the file type,
as this works in most case.
2017-06-01 11:05:35 +02:00