[pve-devel] [PATCH qemu-server] qm: import: use schema variant with 'import-from' disk allocation support

Fiona Ebner f.ebner at proxmox.com
Wed May 28 11:08:46 CEST 2025


As reported in the community forum [0], it was not possible to use the
extended schema that supports disk allocation with 'import-from' for
'qm import'. Align it more closely to the VM creation endpoint.

[0]: https://forum.proxmox.com/threads/166734/

Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
---

Better viewed with the '-w' option for the diff.

 PVE/CLI/qm.pm | 69 +++++++++++++++++++++++++++------------------------
 1 file changed, 36 insertions(+), 33 deletions(-)

diff --git a/PVE/CLI/qm.pm b/PVE/CLI/qm.pm
index 3e3a4c91..616f3ad5 100755
--- a/PVE/CLI/qm.pm
+++ b/PVE/CLI/qm.pm
@@ -990,40 +990,43 @@ __PACKAGE__->register_method({
     description => "Import a foreign virtual guest from a supported import source, such as an ESXi storage.",
     parameters => {
 	additionalProperties => 0,
-	properties => PVE::QemuServer::json_config_properties({
-	    vmid => get_standard_option('pve-vmid', { completion => \&PVE::Cluster::complete_next_vmid }),
-	    'source' => {
-		type => 'string',
-		description => 'The import source volume id.',
+	properties => PVE::QemuServer::json_config_properties(
+	    {
+		vmid => get_standard_option('pve-vmid', { completion => \&PVE::Cluster::complete_next_vmid }),
+		'source' => {
+		    type => 'string',
+		    description => 'The import source volume id.',
+		},
+		storage => get_standard_option('pve-storage-id', {
+		    description => "Default storage.",
+		    completion => \&PVE::QemuServer::complete_storage,
+		}),
+		'live-import' => {
+		    type => 'boolean',
+		    optional => 1,
+		    default => 0,
+		    description => "Immediately start the VM and copy the data in the background.",
+		},
+		'dryrun' => {
+		    type => 'boolean',
+		    optional => 1,
+		    default => 0,
+		    description => "Show the create command and exit without doing anything.",
+		},
+		delete => {
+		    type => 'string', format => 'pve-configid-list',
+		    description => "A list of settings you want to delete.",
+		    optional => 1,
+		},
+		format => {
+		    type => 'string',
+		    description => 'Target format',
+		    enum => [ 'raw', 'qcow2', 'vmdk' ],
+		    optional => 1,
+		},
 	    },
-	    storage => get_standard_option('pve-storage-id', {
-		description => "Default storage.",
-		completion => \&PVE::QemuServer::complete_storage,
-	    }),
-	    'live-import' => {
-		type => 'boolean',
-		optional => 1,
-		default => 0,
-		description => "Immediately start the VM and copy the data in the background.",
-	    },
-	    'dryrun' => {
-		type => 'boolean',
-		optional => 1,
-		default => 0,
-		description => "Show the create command and exit without doing anything.",
-	    },
-	    delete => {
-		type => 'string', format => 'pve-configid-list',
-		description => "A list of settings you want to delete.",
-		optional => 1,
-	    },
-	    format => {
-		type => 'string',
-		description => 'Target format',
-		enum => [ 'raw', 'qcow2', 'vmdk' ],
-		optional => 1,
-	    },
-	}),
+	    1, # with_disk_alloc
+	),
     },
     returns => { type => 'null' },
     code => sub {
-- 
2.39.5





More information about the pve-devel mailing list