From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <d.jaeger@proxmox.com> Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id BB7866B0A1 for <pve-devel@lists.proxmox.com>; Mon, 8 Mar 2021 12:39:21 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id A7A2B1DC4D for <pve-devel@lists.proxmox.com>; Mon, 8 Mar 2021 12:38:51 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [212.186.127.180]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 1A62C1DC42 for <pve-devel@lists.proxmox.com>; Mon, 8 Mar 2021 12:38:51 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id DB3C14582F for <pve-devel@lists.proxmox.com>; Mon, 8 Mar 2021 12:38:50 +0100 (CET) Date: Mon, 8 Mar 2021 12:38:49 +0100 From: Dominic =?iso-8859-1?Q?J=E4ger?= <d.jaeger@proxmox.com> To: Proxmox VE development discussion <pve-devel@lists.proxmox.com> Message-ID: <20210308113849.GA78471@mala> References: <20210205100442.28163-1-d.jaeger@proxmox.com> <20210205100442.28163-2-d.jaeger@proxmox.com> <1612950071.k22hsf3al3.astroid@nora.none> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1612950071.k22hsf3al3.astroid@nora.none> User-Agent: Mutt/1.10.1 (2018-07-13) X-SPAM-LEVEL: Spam detection results: 0 AWL 1.654 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: Re: [pve-devel] [PATCH v4 manager] gui: Add import wizard for disk & VM X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com> List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe> List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/> List-Post: <mailto:pve-devel@lists.proxmox.com> List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help> List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe> X-List-Received-Date: Mon, 08 Mar 2021 11:39:21 -0000 On Wed, Feb 10, 2021 at 10:49:41AM +0100, Fabian Grünbichler wrote: > > > > diff --git a/PVE/API2/Nodes.pm b/PVE/API2/Nodes.pm > > index 8172231e..9bf75ab7 100644 > > --- a/PVE/API2/Nodes.pm > > +++ b/PVE/API2/Nodes.pm > > @@ -27,6 +27,7 @@ use PVE::HA::Env::PVE2; > > use PVE::HA::Config; > > use PVE::QemuConfig; > > use PVE::QemuServer; > > +use PVE::QemuServer::OVF; > > use PVE::API2::Subscription; > > use PVE::API2::Services; > > use PVE::API2::Network; > > @@ -224,6 +225,7 @@ __PACKAGE__->register_method ({ > > { name => 'subscription' }, > > { name => 'report' }, > > { name => 'tasks' }, > > + { name => 'readovf' }, > > { name => 'rrd' }, # fixme: remove? > > { name => 'rrddata' },# fixme: remove? > > { name => 'replication' }, > > @@ -2173,6 +2175,44 @@ __PACKAGE__->register_method ({ > > return undef; > > }}); > > this API endpoint belongs in qemu-server? I am not sure. It looked to me like qemu-server implied nodes/<node>/qemu/<vmid>/readovf but I wanted to avoid <vmid> and place it next to nodes/<node>/status, nodes/<node>/rrd, ... which are in this file? > > > > +__PACKAGE__->register_method ({ > > + name => 'readovf', > > + path => 'readovf', > > + method => 'GET', > > + proxyto => 'node', > > + description => "Read an .ovf manifest.", > > + parameters => { > > + additionalProperties => 0, > > + properties => { > > + node => get_standard_option('pve-node'), > > + manifest => { > > + description => ".ovf manifest", > > + type => 'string', > > + }, > > + }, > > + }, > > + returns => { > > + description => "VM config according to .ovf manifest and digest of manifest", > > + type => "object", > > according to the code below, this has a defined schema? Yes. Something like returns => { type => 'object', additionalProperties => 0, properties => { name => { type => 'string', optional => 1, }, cores => { type => 'integer', optional => 1, }, memory => { type => 'integer', optional => 1, }, ?? => { type => 'string', description => 'path of a disk image', }, ?? => { type => 'string', description => 'path of a disk image', }, .... }, but the only way I have found so far to return paths scsi1 => /some/image.img sata3 => /some/other.img is PVE::QemuServer::json_config_properties( which allows much more than can be read from the OVF at the moment. > > > + }, > > + code => sub { > > + my ($param) = @_; > > + > > + my $manifest = $param->{manifest}; > > + die "$manifest: non-existent or non-regular file\n" if (! -f $manifest); > > + > > + my $parsed = PVE::QemuServer::OVF::parse_ovf($manifest, 0, 1); > > + my $result; > > + $result->{cores} = $parsed->{qm}->{cores}; > > + $result->{name} = $parsed->{qm}->{name}; > > + $result->{memory} = $parsed->{qm}->{memory}; > > + my $disks = $parsed->{disks}; > > + foreach my $disk (@$disks) { > > + $result->{$disk->{disk_address}} = $disk->{backing_file}; > > + } > > + return $result; > > +}}); > > + > > # bash completion helper > > > > sub complete_templet_repo {