From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id C1977855C for ; Tue, 15 Nov 2022 15:23:08 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 9EF414442 for ; Tue, 15 Nov 2022 15:22:38 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Tue, 15 Nov 2022 15:22:38 +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 C440744C1F for ; Tue, 15 Nov 2022 15:22:37 +0100 (CET) Message-ID: <61cfcb3d-ceef-0325-4152-6e0a26d99be2@proxmox.com> Date: Tue, 15 Nov 2022 15:22:36 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Content-Language: en-US To: Fiona Ebner , pve-devel@lists.proxmox.com References: <20221115105526.3428334-1-s.hrdlicka@proxmox.com> <20221115105526.3428334-5-s.hrdlicka@proxmox.com> <94fa3244-7649-aa49-534b-0f1eebb5fab0@proxmox.com> From: Stefan Hrdlicka In-Reply-To: <94fa3244-7649-aa49-534b-0f1eebb5fab0@proxmox.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-SPAM-LEVEL: Spam detection results: =?UTF-8?Q?0=0A=09?=AWL 0.033 Adjusted score from AWL reputation of From: =?UTF-8?Q?address=0A=09?=BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict =?UTF-8?Q?Alignment=0A=09?=NICE_REPLY_A -0.001 Looks like a legit reply (A) SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF =?UTF-8?Q?Record=0A=09?=SPF_PASS -0.001 SPF: sender matches SPF record Subject: Re: [pve-devel] [PATCH V3 qemu-server 4/6] add ignore-storage-errors for removing VM with missing storage X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Nov 2022 14:23:08 -0000 On 11/15/22 13:17, Fiona Ebner wrote: > Am 15.11.22 um 11:55 schrieb Stefan Hrdlicka: >> @@ -2341,10 +2346,10 @@ sub destroy_vm { >> >> my $volid = $drive->{file}; >> return if !$volid || $volid =~ m|^/|; >> - >> - die "base volume '$volid' is still in use by linked cloned\n" >> - if PVE::Storage::volume_is_base_and_used($storecfg, $volid); >> - >> + my $result; >> + eval { $result = PVE::Storage::volume_is_base_and_used($storecfg, $volid) }; >> + die "Couldn't remove one or more disks: $@\n" if $@ && !$ignore_storage_errors; > > This error message is wrong. The check failed, not the removal. The > check should be repeated in vdisk_free anyways and you should get the > appropriate error then below :) yes :). > > AFAIU base volumes should still survive if they are still referenced by > linked clones, even when ignore-storage-errors is used (IMHO good). Is > that correct? Yes this is correct, the volumes still exist. > > Nothing new and not directly related: > I noticed that for containers, we don't have this heads-up check. Maybe > worth adding there too? Arguably minor issue is that I can have a > container template with a disk on lvm-thin and a second disk on > non-lvm-thin. Even if there is a linked clone, removing the template > might remove the lvm-thin disk, and then fail, because the second disk > is referenced. maybe a good idea, I will look into that > >> + die "base volume '$volid' is still in use by linked cloned\n" if $result; >> }); >> } >> >> @@ -2370,7 +2375,8 @@ sub destroy_vm { >> include_unused => 1, >> extra_keys => ['vmstate'], >> }; >> - PVE::QemuConfig->foreach_volume_full($conf, $include_opts, $remove_owned_drive); >> + eval { PVE::QemuConfig->foreach_volume_full($conf, $include_opts, $remove_owned_drive); }; >> + die "Couldn't remove one or more disks: $@\n" if $@ && !$ignore_storage_errors; > > So, $removed_owned_drive already ignores all storage errors beside if > PVE::Storage::path() fails right? Can't we just add an eval around that > and be done? No need for a new ignore-storage-errors parameter. Most > storage errors are already ignored even without that parameter right > now! I don't think it's a big issue to start ignoring the few missing > ones as well? Well I wasn't sure. Safe option was to tell the user that there is a problem and then the user decides if something should be forced deleted. But if you think this is fine without user input lets pretend this never existed :). > >> >> for my $snap (values %{$conf->{snapshots}}) { >> next if !defined($snap->{vmstate});