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 DE7A81FF173 for ; Mon, 11 Nov 2024 14:55:57 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 61061CA15; Mon, 11 Nov 2024 14:55:15 +0100 (CET) Date: Mon, 11 Nov 2024 14:55:05 +0100 From: Fabian =?iso-8859-1?q?Gr=FCnbichler?= To: Proxmox VE development discussion References: <20241107165146.125935-1-f.ebner@proxmox.com> <20241107165146.125935-17-f.ebner@proxmox.com> In-Reply-To: <20241107165146.125935-17-f.ebner@proxmox.com> MIME-Version: 1.0 User-Agent: astroid/0.16.0 (https://github.com/astroidmail/astroid) Message-Id: <1731333292.yhqob90wre.astroid@yuna.none> X-SPAM-LEVEL: Spam detection results: 0 AWL 0.048 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] applied: [PATCH qemu-server v3 16/34] move nbd_stop helper to QMPHelpers module 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" On November 7, 2024 5:51 pm, Fiona Ebner wrote: > Like this nbd_stop() can be called from a module that cannot include > QemuServer.pm. > > Signed-off-by: Fiona Ebner > --- > > No changes in v3. > > PVE/API2/Qemu.pm | 3 ++- > PVE/CLI/qm.pm | 3 ++- > PVE/QemuServer.pm | 6 ------ > PVE/QemuServer/QMPHelpers.pm | 6 ++++++ > 4 files changed, 10 insertions(+), 8 deletions(-) > > diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm > index 848001b6..1c3cb271 100644 > --- a/PVE/API2/Qemu.pm > +++ b/PVE/API2/Qemu.pm > @@ -35,6 +35,7 @@ use PVE::QemuServer::Monitor qw(mon_cmd); > use PVE::QemuServer::Machine; > use PVE::QemuServer::Memory qw(get_current_memory); > use PVE::QemuServer::PCI; > +use PVE::QemuServer::QMPHelpers; > use PVE::QemuServer::USB; > use PVE::QemuMigrate; > use PVE::RPCEnvironment; > @@ -5910,7 +5911,7 @@ __PACKAGE__->register_method({ > return; > }, > 'nbdstop' => sub { > - PVE::QemuServer::nbd_stop($state->{vmid}); > + PVE::QemuServer::QMPHelpers::nbd_stop($state->{vmid}); > return; > }, > 'resume' => sub { > diff --git a/PVE/CLI/qm.pm b/PVE/CLI/qm.pm > index 8d8ce10a..47b87782 100755 > --- a/PVE/CLI/qm.pm > +++ b/PVE/CLI/qm.pm > @@ -35,6 +35,7 @@ use PVE::QemuServer::Agent qw(agent_available); > use PVE::QemuServer::ImportDisk; > use PVE::QemuServer::Monitor qw(mon_cmd); > use PVE::QemuServer::OVF; > +use PVE::QemuServer::QMPHelpers; > use PVE::QemuServer; > > use PVE::CLIHandler; > @@ -385,7 +386,7 @@ __PACKAGE__->register_method ({ > > my $vmid = $param->{vmid}; > > - eval { PVE::QemuServer::nbd_stop($vmid) }; > + eval { PVE::QemuServer::QMPHelpers::nbd_stop($vmid) }; > warn $@ if $@; > > return; > diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm > index 0df3bda0..49b6ca17 100644 > --- a/PVE/QemuServer.pm > +++ b/PVE/QemuServer.pm > @@ -8606,12 +8606,6 @@ sub generate_smbios1_uuid { > return "uuid=".generate_uuid(); > } > > -sub nbd_stop { > - my ($vmid) = @_; > - > - mon_cmd($vmid, 'nbd-server-stop', timeout => 25); > -} > - > sub create_reboot_request { > my ($vmid) = @_; > open(my $fh, '>', "/run/qemu-server/$vmid.reboot") > diff --git a/PVE/QemuServer/QMPHelpers.pm b/PVE/QemuServer/QMPHelpers.pm > index 0269ea46..826938de 100644 > --- a/PVE/QemuServer/QMPHelpers.pm > +++ b/PVE/QemuServer/QMPHelpers.pm > @@ -15,6 +15,12 @@ qemu_objectadd > qemu_objectdel > ); > > +sub nbd_stop { > + my ($vmid) = @_; > + > + mon_cmd($vmid, 'nbd-server-stop', timeout => 25); > +} > + > sub qemu_deviceadd { > my ($vmid, $devicefull) = @_; > > -- > 2.39.5 > > > > _______________________________________________ > pve-devel mailing list > pve-devel@lists.proxmox.com > https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel > > > _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel