public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Dominic Jäger" <d.jaeger@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: Re: [pve-devel] [PATCH v7 qemu-server] Add API for import wizards
Date: Thu, 1 Apr 2021 12:19:08 +0200	[thread overview]
Message-ID: <20210401101908.GA80830@mala> (raw)
In-Reply-To: <1617202583.o619p5czdy.astroid@nora.none>

On Wed, Mar 31, 2021 at 05:12:28PM +0200, Fabian Grünbichler wrote:
> this is starting to shape up nicely. as promised, I now took a stab at 
> (roughly!) integrating this into our regular flow (see diff below):
> ....
> 
> - we could likely drop the separate import_disk API call, and let the 
>   `importdisk` CLI command prepare parameters for a regular VM config 
>   update
I think dropping importdisk is a good idea, too.

> I'm sure I've missed some corner cases, as I've only tested create_vm 
> with importing, and not the other newly exposed APIs.

I didn't get the importdisk API to work yet.
But I'd look closer at stuff like that
	if (!$device_options) {
	    $device_options = "$storeid:0"; <=== should be -1
	}
only if we keep it?

One thing is important: That import parameter was at the place of the default storage

 PVE/API2/Qemu.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index 41e1ab7..73af497 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -1469,7 +1469,7 @@ my $update_vm_api  = sub {
 		    PVE::QemuServer::vmconfig_register_unused_drive($storecfg, $vmid, $conf, PVE::QemuServer::parse_drive($opt, $conf->{pending}->{$opt}))
 			if defined($conf->{pending}->{$opt});
 
-		    &$create_disks($rpcenv, $authuser, $conf->{pending}, $arch, $storecfg, $vmid, undef, {$opt => $param->{$opt}}, {$opt => $import_devices->{$opt}});
+		    &$create_disks($rpcenv, $authuser, $conf->{pending}, $arch, $storecfg, $vmid, undef, {$opt => $param->{$opt}}, undef, {$opt => $import_devices->{$opt}});
 		} elsif ($opt =~ m/^serial\d+/) {
 		    if ((!defined($conf->{$opt}) || $conf->{$opt} eq 'socket') && $param->{$opt} eq 'socket') {
 			$rpcenv->check_vm_perm($authuser, $vmid, undef, ['VM.Config.HWType']);


> stat shows how much boilerplace/duplication this removes, although there 
> is probably even more potential here since `create_vm` partly duplicates 
> the `update_vm_api` sub that ends up calling `create_disks`:
Is that urgent?




  reply	other threads:[~2021-04-01 10:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-26 12:32 [pve-devel] [PATCH v7 storage] Optionally allow blockdev in abs_filesystem_path Dominic Jäger
2021-03-26 12:32 ` [pve-devel] [PATCH v7 qemu-server] Add API for import wizards Dominic Jäger
2021-03-31 15:12   ` Fabian Grünbichler
2021-04-01 10:19     ` Dominic Jäger [this message]
2021-04-01 11:30       ` Fabian Grünbichler
2021-03-26 12:32 ` [pve-devel] [PATCH v7 manager] gui: Add import for disk & VM Dominic Jäger
2021-04-01 13:40 ` [pve-devel] applied: [PATCH v7 storage] Optionally allow blockdev in abs_filesystem_path 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=20210401101908.GA80830@mala \
    --to=d.jaeger@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