[pve-devel] [PATCH] check if volume exist on volume update.
Alexandre DERUMIER
aderumier at odiso.com
Mon Jun 25 07:25:38 CEST 2012
oh good idea, I'll check that today.
I'll also submit you qmp rework today.
----- Mail original -----
De: "Dietmar Maurer" <dietmar at proxmox.com>
À: "Alexandre Derumier" <aderumier at odiso.com>, pve-devel at pve.proxmox.com
Envoyé: Lundi 25 Juin 2012 07:10:18
Objet: RE: [pve-devel] [PATCH] check if volume exist on volume update.
comitted, thanks.
But wait, we already do those checks inside PVE::Storage::Plugin::activate_volumes()!
I suggest we modify PVE::Storage::RBDPlugin::activate_volume() to check if the volume exists?
- Dietmar
> -----Original Message-----
> From: pve-devel-bounces at pve.proxmox.com [mailto:pve-devel-
> bounces at pve.proxmox.com] On Behalf Of Alexandre Derumier
> Sent: Samstag, 23. Juni 2012 09:08
> To: pve-devel at pve.proxmox.com
> Subject: [pve-devel] [PATCH] check if volume exist on volume update.
>
> for the moment we check only if the real path exist on the host.
> This doesn't work for "virtual" device that host doesn't see.(like rbd, virtio-
> scsi,...).
>
> This add a check if the volid exist in the storage.
>
> Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
> ---
> PVE/API2/Qemu.pm | 15 ++++++++++++++-
> 1 files changed, 14 insertions(+), 1 deletions(-)
>
> diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm index
> c172fde..497c334 100644
> --- a/PVE/API2/Qemu.pm
> +++ b/PVE/API2/Qemu.pm
> @@ -88,7 +88,20 @@ my $create_disks = sub {
> my $path = $rpcenv->check_volume_access($authuser, $storecfg,
> $vmid, $volid);
> PVE::Storage::activate_volumes($storecfg, [ $volid ])
> if PVE::Storage::parse_volume_id ($volid, 1);
> - die "image '$path' does not exists\n" if (!(-f $path || -b $path));
> +
> + my ($storeid, $volname) = PVE::Storage::parse_volume_id($volid);
> + my $dl = PVE::Storage::vdisk_list($storecfg, $storeid, undef);
> + my $foundvolid = undef;
> +
> + PVE::Storage::foreach_volid($dl, sub {
> + my ($volumeid) = @_;
> + if($volumeid eq $volid) {
> + $foundvolid = 1;
> + return;
> + }
> + });
> +
> + die "image '$path' does not exists\n" if (!(-f $path || -b $path
> +|| $foundvolid));
> $res->{$ds} = $settings->{$ds};
> }
> });
> --
> 1.7.2.5
>
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
--
--
Alexandre D e rumier
Ingénieur Systèmes et Réseaux
Fixe : 03 20 68 88 85
Fax : 03 20 68 90 88
45 Bvd du Général Leclerc 59100 Roubaix
12 rue Marivaux 75002 Paris
More information about the pve-devel
mailing list