public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH v2 qemu-server] qm: import: use schema variant with 'import-from' disk allocation support
Date: Mon, 17 Nov 2025 11:33:19 +0100	[thread overview]
Message-ID: <20251117103337.26032-1-f.ebner@proxmox.com> (raw)

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@proxmox.com>
---

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

Changes in v2:
* Rebase on current master.

 src/PVE/CLI/qm.pm | 82 +++++++++++++++++++++++++----------------------
 1 file changed, 43 insertions(+), 39 deletions(-)

diff --git a/src/PVE/CLI/qm.pm b/src/PVE/CLI/qm.pm
index 2e56e234..9398780e 100755
--- a/src/PVE/CLI/qm.pm
+++ b/src/PVE/CLI/qm.pm
@@ -1084,47 +1084,51 @@ __PACKAGE__->register_method({
         "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.',
-            },
-            storage => get_standard_option(
-                'pve-storage-id',
-                {
-                    description => "Default storage.",
-                    completion => \&PVE::QemuServer::complete_storage,
+        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,
                 },
-            ),
-            '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.47.3



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


             reply	other threads:[~2025-11-17 10:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-17 10:33 Fiona Ebner [this message]
2025-11-17 16:10 ` Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251117103337.26032-1-f.ebner@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal