]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Introduce nbd-server-stop command
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 31 Jan 2013 13:47:49 +0000 (14:47 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Sat, 23 Feb 2013 07:16:42 +0000 (08:16 +0100)
This will be used after all migration work is done
to stop NBD server running on destination.  It
doesn't take any arguments, just issues a command.

src/qemu/qemu_monitor.c
src/qemu/qemu_monitor.h
src/qemu/qemu_monitor_json.c
src/qemu/qemu_monitor_json.h

index 239dcaedf96d33fd115231655f26361191bb2fa0..1ea224ee732117ef685783f5024f9cc87983c69d 100644 (file)
@@ -3507,3 +3507,22 @@ int qemuMonitorNBDServerAdd(qemuMonitorPtr mon,
 
     return qemuMonitorJSONNBDServerAdd(mon, deviceID, writable);
 }
+
+int qemuMonitorNBDServerStop(qemuMonitorPtr mon)
+{
+    VIR_DEBUG("mon=%p", mon);
+
+    if (!mon) {
+        virReportError(VIR_ERR_INVALID_ARG, "%s",
+                       _("monitor must not be NULL"));
+        return -1;
+    }
+
+    if (!mon->json) {
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+                       _("JSON monitor is required"));
+        return -1;
+    }
+
+    return qemuMonitorJSONNBDServerStop(mon);
+}
index 27c0587caa23497a9187bee4f61ac15b1ba59597..b3808a84ab4d51b38ad280797c8cc102ca1c6e65 100644 (file)
@@ -682,6 +682,7 @@ int qemuMonitorNBDServerStart(qemuMonitorPtr mon,
 int qemuMonitorNBDServerAdd(qemuMonitorPtr mon,
                             const char *deviceID,
                             bool writable);
+int qemuMonitorNBDServerStop(qemuMonitorPtr);
 /**
  * When running two dd process and using <> redirection, we need a
  * shell that will not truncate files.  These two strings serve that
index 664084370b1d8002b9c2f9eb3f491582688c3c41..50ce34735b95aff16ba97b904b784a7bab1f2c9c 100644 (file)
@@ -4688,3 +4688,24 @@ qemuMonitorJSONNBDServerAdd(qemuMonitorPtr mon,
     virJSONValueFree(reply);
     return ret;
 }
+
+int
+qemuMonitorJSONNBDServerStop(qemuMonitorPtr mon)
+{
+    int ret = -1;
+    virJSONValuePtr cmd;
+    virJSONValuePtr reply = NULL;
+
+    if (!(cmd = qemuMonitorJSONMakeCommand("nbd-server-stop",
+                                           NULL)))
+        return ret;
+
+    ret = qemuMonitorJSONCommand(mon, cmd, &reply);
+
+    if (ret == 0)
+        ret = qemuMonitorJSONCheckError(cmd, reply);
+
+    virJSONValueFree(cmd);
+    virJSONValueFree(reply);
+    return ret;
+}
index 366eced1e744cd721f96be8dccc697a3c0b6a021..7f65392b7326557031121a82aa60345b6fb01612 100644 (file)
@@ -340,4 +340,5 @@ int qemuMonitorJSONNBDServerStart(qemuMonitorPtr mon,
 int qemuMonitorJSONNBDServerAdd(qemuMonitorPtr mon,
                                 const char *deviceID,
                                 bool writable);
+int qemuMonitorJSONNBDServerStop(qemuMonitorPtr mon);
 #endif /* QEMU_MONITOR_JSON_H */