public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: Fabian Ebner <f.ebner@proxmox.com>, pve-devel@lists.proxmox.com
Subject: Re: [pve-devel] [RFC v10 qemu-server 6/7] api: support VM disk import
Date: Tue, 22 Feb 2022 16:33:14 +0100	[thread overview]
Message-ID: <1645543702.yy3gk3uhl6.astroid@nora.none> (raw)
In-Reply-To: <0ca7fc2e-a614-6e43-91ff-7f85f7922251@proxmox.com>

On February 22, 2022 1:11 pm, Fabian Ebner wrote:
> Am 13.01.22 um 11:08 schrieb Fabian Ebner:
>> @@ -89,6 +90,10 @@ my $check_storage_access = sub {
>>  	} else {
>>  	    PVE::Storage::check_volume_access($rpcenv, $authuser, $storecfg, $vmid, $volid);
>>  	}
>> +
>> +	if (my $source_image = $drive->{'import-from'}) {
>> +	    PVE::Storage::check_volume_access($rpcenv, $authuser, $storecfg, $vmid, $source_image);
>> +	}
>>      });
>>  
> 
> AFAICT, if $vmid doesn't match the one from the volume, the check
> requires Datastore.Allocate privileges on the storage, which might be a
> bit much for many scenarios. Should the check rather be something like
> 
> if ($ownerid) {
>     # check VM.Clone for owner VM
>     # Note that v11 will use clone_disk() for such disks

sounds sensible to me - if it's possible to copy the volume (and other 
stuff) already with that privilege, then re-using that check for the 
similar functionality here is fine.

check_volume_access is like that because it assumes that the caller 
already checked that changes/access to the guest itself is okay - so if 
a 'foreign' volume is queried, it requires more permissions since it 
assumes that assumption doesn't hold.

since most queries here will be for 'foreign' volumes, checking that 
cloning from that owner is okay and then passing in that vmid instead of 
the target one would probably be best (as that still handles the 
question of whether accessing the source storage is okay in general), 
and of course we'd need that fallback anyway in case there is no 
owner/we don't have clone permissions?

> } else {
>     # PVE::Storage::check_volume_access
> }
> 
> ?
> 




  reply	other threads:[~2022-02-22 15:33 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-13 10:08 [pve-devel] [RFC v10 qemu-server/manager] API for disk import and OVF Fabian Ebner
2022-01-13 10:08 ` [pve-devel] [PATCH v10 qemu-server 1/7] schema: add pve-volume-id-or-absolute-path Fabian Ebner
2022-01-13 10:08 ` [pve-devel] [PATCH v10 qemu-server 2/7] parse ovf: untaint path when calling file_size_info Fabian Ebner
     [not found]   ` <<20220113100831.34113-3-f.ebner@proxmox.com>
2022-01-17 15:38     ` Fabian Grünbichler
2022-01-13 10:08 ` [pve-devel] [PATCH v10 qemu-server 3/7] api: add endpoint for parsing .ovf files Fabian Ebner
2022-01-13 10:08 ` [pve-devel] [PATCH v10 manager 1/1] api: nodes: add readovf endpoint Fabian Ebner
     [not found]   ` <<20220113100831.34113-5-f.ebner@proxmox.com>
2022-01-17 15:38     ` Fabian Grünbichler
2022-01-18  8:35       ` Fabian Ebner
2022-01-18  9:56         ` Fabian Grünbichler
2022-01-13 10:08 ` [pve-devel] [PATCH v10 qemu-server 4/7] image convert: allow block device as source Fabian Ebner
2022-01-13 10:08 ` [pve-devel] [RFC v10 qemu-server 5/7] schema: drive: use separate schema when disk allocation is possible Fabian Ebner
2022-01-13 10:08 ` [pve-devel] [RFC v10 qemu-server 6/7] api: support VM disk import Fabian Ebner
     [not found]   ` <<20220113100831.34113-8-f.ebner@proxmox.com>
2022-01-17 15:39     ` Fabian Grünbichler
2022-01-18  8:51       ` Fabian Ebner
2022-01-26 11:40   ` Fabian Ebner
2022-01-26 12:42     ` Fabian Grünbichler
2022-01-27  8:21       ` Fabian Ebner
2022-01-27 10:43         ` Fabian Grünbichler
2022-02-22 12:11   ` Fabian Ebner
2022-02-22 15:33     ` Fabian Grünbichler [this message]
2022-01-13 10:08 ` [pve-devel] [RFC v10 qemu-server 7/7] api: create disks: factor out common part from if/else Fabian Ebner
     [not found] ` <<20220113100831.34113-1-f.ebner@proxmox.com>
2022-01-17 15:43   ` [pve-devel] [RFC v10 qemu-server/manager] API for disk import and OVF Fabian Grünbichler
2022-01-18  9:08     ` Fabian Ebner
2022-01-18 10:19       ` Fabian Grünbichler

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=1645543702.yy3gk3uhl6.astroid@nora.none \
    --to=f.gruenbichler@proxmox.com \
    --cc=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