[pve-devel] [PATCH qemu-server v6 0/3] Add qm importdisk command

Emmanuel Kasper e.kasper at proxmox.com
Thu Jun 1 10:26:36 CEST 2017


V6 changes:
 * use die if false(); instead of false or die(); in qm.pm
 * use vmconfig_apply_pending and vmconfig_hotplug_pending to update vm conf in ImportDisk.pm
 * make sure we display the error of the eval block in ImportDisk.pm
 * in the do_import sub in ImportDisk.pm do not retest the path to allocated disk as this was already tested

v5 changes:
 * QemuServer.pm
     * rename choose_dst_disk_format to resolve_dst_disk_format
     ( as the end user chooses, but the computer resolve)
     * fix a uninitialized value warning when format was unspecified
     when called without $srv_volname being set
 * ImportDisk.pm
     * remove data dumper
     * use file_size_info from Storage.pm module
     * always call choose_dst_disk_format
     * fix comment
     * remove $dst hash ref
     * remove unnecessary vm_is_volid_owner()
     * merge create_unused_ and create_active_ in my $create_drive
     * check if requested drive_name is valid before allocating disk image
     * check if requested drive_name is available once we locked (should not happpen but ...)
     * extract optional params early to avoid lots of hash dereferencing later on
 * qm.pm
     * use the right format for storage command line parameter
     * add extra parameters checks:
       * vm should not be locked
       * source file must be a regular file
       * storage must be valid


v4 changes:
 * add optional switch -format to select between raw|qcow2|vmdk, like qm move_disk.
 For this the code handling target format in clone_disk was factored out in a
 separate sub that we reuse
 * fix overwriting of vm.conf when importdisk and ovfdisk were combined
 (was bitten by autovivification)
 * rename command and package from diskimport to importdisk, because we
 mostly have listsnapshots, move_disk, etc ... (verb + name)
 * useful nitpicks from Thomas about code formatting

v3 changes:
 * when command lines parameters are mandatory, do not hide them behind switches

Emmanuel Kasper (3):
  Refactor the resolution of target disk format in own sub
  Add ImportDisk module to import external disk images into a VM
  Add new qm command 'importdisk' to import external disk images

 PVE/CLI/qm.pm                | 51 +++++++++++++++++++++++
 PVE/QemuServer.pm            | 33 ++++++++++-----
 PVE/QemuServer/ImportDisk.pm | 98 ++++++++++++++++++++++++++++++++++++++++++++
 PVE/QemuServer/Makefile      |  1 +
 4 files changed, 172 insertions(+), 11 deletions(-)
 create mode 100755 PVE/QemuServer/ImportDisk.pm

-- 
2.11.0





More information about the pve-devel mailing list