From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 109D41FF2C8 for ; Wed, 17 Jul 2024 11:42:52 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 5EEC738860; Wed, 17 Jul 2024 11:42:47 +0200 (CEST) From: Max Carrara To: pve-devel@lists.proxmox.com Date: Wed, 17 Jul 2024 11:40:23 +0200 Message-Id: <20240717094034.124857-26-m.carrara@proxmox.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240717094034.124857-1-m.carrara@proxmox.com> References: <20240717094034.124857-1-m.carrara@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.030 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [RFC pve-storage 25/36] plugin: esxi: make helper methods private 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: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" The methods `get_manifest`, `esxi_mount` and `esxi_unmount` are made private in order to prevent them from accidentally becoming part of the plugin's public interface in the future. Similar to the BTRFS changes, adapt the call sites accordingly. This means that calls like my $manifest = $class->get_manifest($storeid, $scfg, 0); are changed to my $manifest = get_manifest($class, $storeid, $scfg, 0); because the methods cannot be accessed via the `$class` reference anymore. Signed-off-by: Max Carrara --- src/PVE/Storage/ESXiPlugin.pm | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/PVE/Storage/ESXiPlugin.pm b/src/PVE/Storage/ESXiPlugin.pm index 2bab7f8..355a33c 100644 --- a/src/PVE/Storage/ESXiPlugin.pm +++ b/src/PVE/Storage/ESXiPlugin.pm @@ -120,7 +120,7 @@ my sub is_old : prototype($) { return !defined($mtime) || ($mtime + 30) < CORE::time(); } -sub get_manifest : prototype($$$;$) { +my sub get_manifest : prototype($$$;$) { my ($class, $storeid, $scfg, $force_query) = @_; my $rundir = run_path($storeid); @@ -177,12 +177,12 @@ my sub is_mounted : prototype($) { return PVE::Systemd::is_unit_active($scope_name_base . '.scope'); } -sub esxi_mount : prototype($$$;$) { +my sub esxi_mount : prototype($$$;$) { my ($class, $storeid, $scfg, $force_requery) = @_; return if !$force_requery && is_mounted($storeid); - $class->get_manifest($storeid, $scfg, $force_requery); + get_manifest($class, $storeid, $scfg, $force_requery); my $rundir = run_path($storeid); my $manifest_file = "$rundir/manifest.json"; @@ -253,7 +253,7 @@ sub esxi_mount : prototype($$$;$) { } } -sub esxi_unmount : prototype($$$) { +my sub esxi_unmount : prototype($$$) { my ($class, $storeid, $scfg) = @_; my $scope_name_base = scope_name_base($storeid); @@ -287,7 +287,7 @@ sub get_import_metadata : prototype($$$$$) { die "storage '$storeid' is not activated\n"; } - my $manifest = $class->get_manifest($storeid, $scfg, 0); + my $manifest = get_manifest($class, $storeid, $scfg, 0); my $contents = file_get_contents($vmx_path); my $vmx = PVE::Storage::ESXiPlugin::VMX->parse( $storeid, @@ -351,13 +351,13 @@ sub on_delete_hook { sub activate_storage { my ($class, $storeid, $scfg, $cache) = @_; - $class->esxi_mount($storeid, $scfg, 0); + esxi_mount($class, $storeid, $scfg, 0); } sub deactivate_storage { my ($class, $storeid, $scfg, $cache) = @_; - $class->esxi_unmount($storeid, $scfg); + esxi_unmount($class, $storeid, $scfg); my $rundir = run_path($storeid); remove_tree($rundir); # best-effort, ignore errors for now @@ -418,7 +418,7 @@ sub list_volumes { return if !grep { $_ eq 'import' } @$content_types; - my $data = $class->get_manifest($storeid, $scfg, 0); + my $data = get_manifest($class, $storeid, $scfg, 0); my $res = []; for my $dc_name (keys $data->%*) { -- 2.39.2 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel