[pve-devel] applied: [PATCH qemu-server v3 16/34] move nbd_stop helper to QMPHelpers module
Fabian Grünbichler
f.gruenbichler at proxmox.com
Mon Nov 11 14:55:05 CET 2024
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 <f.ebner at proxmox.com>
> ---
>
> 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 at lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
>
>
>
More information about the pve-devel
mailing list