mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-27 07:22:07 +03:00
qemu: Introduce nbd-server-add command
This will be used with new migration scheme. This patch creates basically just monitor stub functions. Wiring them into something useful is done in later patches.
This commit is contained in:
parent
bb6359e8d4
commit
c833d8111d
@ -3485,3 +3485,25 @@ int qemuMonitorNBDServerStart(qemuMonitorPtr mon,
|
||||
|
||||
return qemuMonitorJSONNBDServerStart(mon, host, port);
|
||||
}
|
||||
|
||||
int qemuMonitorNBDServerAdd(qemuMonitorPtr mon,
|
||||
const char *deviceID,
|
||||
bool writable)
|
||||
{
|
||||
VIR_DEBUG("mon=%p deviceID=%s",
|
||||
mon, deviceID);
|
||||
|
||||
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 qemuMonitorJSONNBDServerAdd(mon, deviceID, writable);
|
||||
}
|
||||
|
@ -679,6 +679,9 @@ char *qemuMonitorGetTargetArch(qemuMonitorPtr mon);
|
||||
int qemuMonitorNBDServerStart(qemuMonitorPtr mon,
|
||||
const char *host,
|
||||
unsigned int port);
|
||||
int qemuMonitorNBDServerAdd(qemuMonitorPtr mon,
|
||||
const char *deviceID,
|
||||
bool writable);
|
||||
/**
|
||||
* When running two dd process and using <> redirection, we need a
|
||||
* shell that will not truncate files. These two strings serve that
|
||||
|
@ -4663,3 +4663,28 @@ cleanup:
|
||||
virJSONValueFree(data);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
qemuMonitorJSONNBDServerAdd(qemuMonitorPtr mon,
|
||||
const char *deviceID,
|
||||
bool writable)
|
||||
{
|
||||
int ret = -1;
|
||||
virJSONValuePtr cmd;
|
||||
virJSONValuePtr reply = NULL;
|
||||
|
||||
if (!(cmd = qemuMonitorJSONMakeCommand("nbd-server-add",
|
||||
"s:device", deviceID,
|
||||
"b:writable", writable,
|
||||
NULL)))
|
||||
return ret;
|
||||
|
||||
ret = qemuMonitorJSONCommand(mon, cmd, &reply);
|
||||
|
||||
if (ret == 0)
|
||||
ret = qemuMonitorJSONCheckError(cmd, reply);
|
||||
|
||||
virJSONValueFree(cmd);
|
||||
virJSONValueFree(reply);
|
||||
return ret;
|
||||
}
|
||||
|
@ -337,4 +337,7 @@ char *qemuMonitorJSONGetTargetArch(qemuMonitorPtr mon);
|
||||
int qemuMonitorJSONNBDServerStart(qemuMonitorPtr mon,
|
||||
const char *host,
|
||||
unsigned int port);
|
||||
int qemuMonitorJSONNBDServerAdd(qemuMonitorPtr mon,
|
||||
const char *deviceID,
|
||||
bool writable);
|
||||
#endif /* QEMU_MONITOR_JSON_H */
|
||||
|
Loading…
Reference in New Issue
Block a user