[pve-devel] [PATCH 4/5] add qm nbdstop
Alexandre Derumier
aderumier at odiso.com
Fri Oct 21 05:00:47 CEST 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 e513f33..a44204c 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',
@@ -520,6 +542,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 9da0b89..ca248d3 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -6255,4 +6255,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