[pve-devel] [PATCH 5/6] add qm nbdstop
Alexandre Derumier
aderumier at odiso.com
Tue Nov 8 04:29:33 CET 2016
we use it to stop remote nbd server
Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
PVE/CLI/qm.pm | 24 ++++++++++++++++++++++++
PVE/QemuServer.pm | 6 ++++++
2 files changed, 30 insertions(+)
diff --git a/PVE/CLI/qm.pm b/PVE/CLI/qm.pm
index a0e0ba5..1013d2f 100755
--- a/PVE/CLI/qm.pm
+++ b/PVE/CLI/qm.pm
@@ -220,6 +220,28 @@ __PACKAGE__->register_method ({
}});
__PACKAGE__->register_method ({
+ name => 'nbdstop',
+ path => 'nbdstop',
+ method => 'PUT',
+ description => "Stop embedded nbd server.",
+ parameters => {
+ additionalProperties => 0,
+ properties => {
+ vmid => get_standard_option('pve-vmid', { completion => \&PVE::QemuServer::complete_vmid }),
+ },
+ },
+ returns => { type => 'null'},
+ code => sub {
+ my ($param) = @_;
+
+ my $vmid = $param->{vmid};
+
+ PVE::QemuServer::nbd_stop($vmid);
+
+ return undef;
+ }});
+
+__PACKAGE__->register_method ({
name => 'mtunnel',
path => 'mtunnel',
method => 'POST',
@@ -531,6 +553,8 @@ our $cmddef = {
mtunnel => [ __PACKAGE__, 'mtunnel', []],
+ nbdstop => [ __PACKAGE__, 'nbdstop', ['vmid']],
+
terminal => [ __PACKAGE__, 'terminal', ['vmid']],
};
diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 66c4c50..7965c05 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -6356,4 +6356,10 @@ sub complete_storage {
return $res;
}
+sub nbd_stop {
+ my ($vmid) = @_;
+
+ vm_mon_cmd($vmid, 'nbd-server-stop');
+}
+
1;
--
2.1.4
More information about the pve-devel
mailing list