提交 aff1db9f 编写于 作者: M Matthias Bolte

remote generator, daemon: Output function bodies too

This patch just covers the simple functions without explicit return
values. There is more to be handled.

The generator collects the members of the XDR argument structs and uses
this information to generate the function bodies.

Exclude the generated files from offending syntax-checks.

Suggested by Richard W.M. Jones
上级 999f5b3e
......@@ -590,7 +590,7 @@ exclude_file_name_regexp--sc_avoid_write = \
exclude_file_name_regexp--sc_bindtextdomain = ^(tests|examples)/
exclude_file_name_regexp--sc_po_check = ^docs/
exclude_file_name_regexp--sc_po_check = ^(docs/|daemon/remote_generator\.pl$$)
exclude_file_name_regexp--sc_prohibit_VIR_ERR_NO_MEMORY = \
^(include/libvirt/virterror\.h|daemon/dispatch\.c|src/util/virterror\.c)$$
......@@ -611,7 +611,7 @@ exclude_file_name_regexp--sc_prohibit_close = \
exclude_file_name_regexp--sc_prohibit_doubled_word = ^po/
exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF = \
(^docs/api_extension/|^tests/qemuhelpdata/|\.(gif|ico|png)$$)
(^docs/api_extension/|^tests/qemuhelpdata/|\.(gif|ico|png)$$|daemon/.*_dispatch_bodies\.c$$)
_src2=src/(util/util|libvirt|lxc/lxc_controller)
exclude_file_name_regexp--sc_prohibit_fork_wrappers = \
......@@ -633,9 +633,9 @@ exclude_file_name_regexp--sc_prohibit_strncpy = \
exclude_file_name_regexp--sc_prohibit_xmlGetProp = ^src/util/xml\.c$$
exclude_file_name_regexp--sc_require_config_h = ^examples/
exclude_file_name_regexp--sc_require_config_h = ^(examples/|daemon/.*_dispatch_bodies\.c$$)
exclude_file_name_regexp--sc_require_config_h_first = ^examples/
exclude_file_name_regexp--sc_require_config_h_first = ^(examples/|daemon/.*_dispatch_bodies\.c$$)
exclude_file_name_regexp--sc_trailing_blank = (^docs/|\.(fig|gif|ico|png)$$)
......
......@@ -24,6 +24,8 @@ AVAHI_SOURCES = \
DISTCLEANFILES =
EXTRA_DIST = \
remote_generator.pl \
remote_dispatch_bodies.c \
qemu_dispatch_bodies.c \
libvirtd.conf \
libvirtd.init.in \
libvirtd.upstart \
......@@ -204,8 +206,10 @@ endif
remote.c: \
remote_dispatch_prototypes.h \
remote_dispatch_table.h \
remote_dispatch_bodies.c \
qemu_dispatch_prototypes.h \
qemu_dispatch_table.h
qemu_dispatch_table.h \
qemu_dispatch_bodies.c
remote.h: \
remote_dispatch_args.h \
......@@ -228,6 +232,9 @@ remote_dispatch_args.h: $(srcdir)/remote_generator.pl $(REMOTE_PROTOCOL)
remote_dispatch_ret.h: $(srcdir)/remote_generator.pl $(REMOTE_PROTOCOL)
$(AM_V_GEN)perl -w $(srcdir)/remote_generator.pl -c -r remote $(REMOTE_PROTOCOL) > $@
remote_dispatch_bodies.c: $(srcdir)/remote_generator.pl $(REMOTE_PROTOCOL)
$(AM_V_GEN)perl -w $(srcdir)/remote_generator.pl -c -b remote $(REMOTE_PROTOCOL) > $@
qemu_dispatch_prototypes.h: $(srcdir)/remote_generator.pl $(QEMU_PROTOCOL)
$(AM_V_GEN)perl -w $(srcdir)/remote_generator.pl -p qemu $(QEMU_PROTOCOL) > $@
......@@ -240,6 +247,9 @@ qemu_dispatch_args.h: $(srcdir)/remote_generator.pl $(QEMU_PROTOCOL)
qemu_dispatch_ret.h: $(srcdir)/remote_generator.pl $(QEMU_PROTOCOL)
$(AM_V_GEN)perl -w $(srcdir)/remote_generator.pl -r qemu $(QEMU_PROTOCOL) > $@
qemu_dispatch_bodies.c: $(srcdir)/remote_generator.pl $(QEMU_PROTOCOL)
$(AM_V_GEN)perl -w $(srcdir)/remote_generator.pl -b qemu $(QEMU_PROTOCOL) > $@
LOGROTATE_CONFS = libvirtd.qemu.logrotate libvirtd.lxc.logrotate \
libvirtd.uml.logrotate libvirtd.logrotate
......
/* Automatically generated by remote_generator.pl.
* Do not edit this file. Any changes you make will be lost.
*/
/* qemuDispatchMonitorCommand has to be implemented manually */
......@@ -1291,138 +1291,6 @@ cleanup:
return rv;
}
static int
remoteDispatchDomainAttachDevice(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_attach_device_args *args,
void *ret ATTRIBUTE_UNUSED)
{
virDomainPtr dom = NULL;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainAttachDevice(dom, args->xml) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
static int
remoteDispatchDomainAttachDeviceFlags(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_attach_device_flags_args *args,
void *ret ATTRIBUTE_UNUSED)
{
virDomainPtr dom = NULL;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainAttachDeviceFlags(dom, args->xml, args->flags) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
static int
remoteDispatchDomainUpdateDeviceFlags(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_update_device_flags_args *args,
void *ret ATTRIBUTE_UNUSED)
{
virDomainPtr dom = NULL;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainUpdateDeviceFlags(dom, args->xml, args->flags) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
static int
remoteDispatchDomainCreate(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_create_args *args,
void *ret ATTRIBUTE_UNUSED)
{
virDomainPtr dom = NULL;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainCreate(dom) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
static int
remoteDispatchDomainCreateWithFlags(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
......@@ -1517,105 +1385,6 @@ cleanup:
return rv;
}
static int
remoteDispatchDomainDestroy(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_destroy_args *args,
void *ret ATTRIBUTE_UNUSED)
{
virDomainPtr dom = NULL;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainDestroy(dom) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
static int
remoteDispatchDomainDetachDevice(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_detach_device_args *args,
void *ret ATTRIBUTE_UNUSED)
{
virDomainPtr dom = NULL;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainDetachDevice(dom, args->xml) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
static int
remoteDispatchDomainDetachDeviceFlags(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_detach_device_flags_args *args,
void *ret ATTRIBUTE_UNUSED)
{
virDomainPtr dom = NULL;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainDetachDeviceFlags(dom, args->xml, args->flags) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
static int
remoteDispatchDomainDumpXml(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
......@@ -2567,15 +2336,21 @@ cleanup:
}
static int
remoteDispatchDomainReboot(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_reboot_args *args,
void *ret ATTRIBUTE_UNUSED)
remoteDispatchDomainSetMemoryParameters(struct qemud_server *server
ATTRIBUTE_UNUSED,
struct qemud_client *client
ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *
hdr ATTRIBUTE_UNUSED,
remote_error * rerr,
remote_domain_set_memory_parameters_args
* args, void *ret ATTRIBUTE_UNUSED)
{
virDomainPtr dom = NULL;
virMemoryParameterPtr params = NULL;
int i, nparams;
unsigned int flags;
int rv = -1;
if (!conn) {
......@@ -2583,312 +2358,15 @@ remoteDispatchDomainReboot(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
nparams = args->params.params_len;
flags = args->flags;
if (virDomainReboot(dom, args->flags) < 0)
if (nparams > REMOTE_DOMAIN_MEMORY_PARAMETERS_MAX) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
static int
remoteDispatchDomainRestore(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_restore_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (virDomainRestore(conn, args->from) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
return rv;
}
static int
remoteDispatchDomainResume(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_resume_args *args,
void *ret ATTRIBUTE_UNUSED)
{
virDomainPtr dom = NULL;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainResume(dom) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
static int
remoteDispatchDomainSave(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_save_args *args,
void *ret ATTRIBUTE_UNUSED)
{
virDomainPtr dom = NULL;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainSave(dom, args->to) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
static int
remoteDispatchDomainCoreDump(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_core_dump_args *args,
void *ret ATTRIBUTE_UNUSED)
{
virDomainPtr dom = NULL;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainCoreDump(dom, args->to, args->flags) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
static int
remoteDispatchDomainSetAutostart(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_set_autostart_args *args,
void *ret ATTRIBUTE_UNUSED)
{
virDomainPtr dom = NULL;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainSetAutostart(dom, args->autostart) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
static int
remoteDispatchDomainSetMaxMemory(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_set_max_memory_args *args,
void *ret ATTRIBUTE_UNUSED)
{
virDomainPtr dom = NULL;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainSetMaxMemory(dom, args->memory) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
static int
remoteDispatchDomainSetMemory(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_set_memory_args *args,
void *ret ATTRIBUTE_UNUSED)
{
virDomainPtr dom = NULL;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainSetMemory(dom, args->memory) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
static int
remoteDispatchDomainSetMemoryFlags(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_set_memory_flags_args *args,
void *ret ATTRIBUTE_UNUSED)
{
virDomainPtr dom = NULL;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainSetMemoryFlags(dom, args->memory, args->flags) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
static int
remoteDispatchDomainSetMemoryParameters(struct qemud_server *server
ATTRIBUTE_UNUSED,
struct qemud_client *client
ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *
hdr ATTRIBUTE_UNUSED,
remote_error * rerr,
remote_domain_set_memory_parameters_args
* args, void *ret ATTRIBUTE_UNUSED)
{
virDomainPtr dom = NULL;
virMemoryParameterPtr params = NULL;
int i, nparams;
unsigned int flags;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
nparams = args->params.params_len;
flags = args->flags;
if (nparams > REMOTE_DOMAIN_MEMORY_PARAMETERS_MAX) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
goto cleanup;
}
if (VIR_ALLOC_N(params, nparams) < 0) {
virReportOOMError();
}
if (VIR_ALLOC_N(params, nparams) < 0) {
virReportOOMError();
goto cleanup;
}
......@@ -3293,171 +2771,6 @@ no_memory:
goto cleanup;
}
static int
remoteDispatchDomainSetVcpus(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_set_vcpus_args *args,
void *ret ATTRIBUTE_UNUSED)
{
virDomainPtr dom = NULL;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainSetVcpus(dom, args->nvcpus) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
static int
remoteDispatchDomainSetVcpusFlags(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_set_vcpus_flags_args *args,
void *ret ATTRIBUTE_UNUSED)
{
virDomainPtr dom = NULL;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainSetVcpusFlags(dom, args->nvcpus, args->flags) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
static int
remoteDispatchDomainShutdown(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_shutdown_args *args,
void *ret ATTRIBUTE_UNUSED)
{
virDomainPtr dom = NULL;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainShutdown(dom) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
static int
remoteDispatchDomainSuspend(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_suspend_args *args,
void *ret ATTRIBUTE_UNUSED)
{
virDomainPtr dom = NULL;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainSuspend(dom) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
static int
remoteDispatchDomainUndefine(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_undefine_args *args,
void *ret ATTRIBUTE_UNUSED)
{
virDomainPtr dom = NULL;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainUndefine(dom) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
static int
remoteDispatchListDefinedNetworks(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
......@@ -3548,39 +2861,6 @@ cleanup:
return rv;
}
static int
remoteDispatchDomainManagedSave(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_managed_save_args *args,
void *ret ATTRIBUTE_UNUSED)
{
virDomainPtr dom = NULL;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainManagedSave(dom, args->flags) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
static int
remoteDispatchDomainHasManagedSaveImage(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
......@@ -3614,39 +2894,6 @@ cleanup:
return rv;
}
static int
remoteDispatchDomainManagedSaveRemove(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_managed_save_remove_args *args,
void *ret ATTRIBUTE_UNUSED)
{
virDomainPtr dom = NULL;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainManagedSaveRemove(dom, args->flags) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
static int
remoteDispatchListNetworks(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
......@@ -3692,39 +2939,6 @@ cleanup:
return rv;
}
static int
remoteDispatchNetworkCreate(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_network_create_args *args,
void *ret ATTRIBUTE_UNUSED)
{
virNetworkPtr net = NULL;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(net = get_nonnull_network(conn, args->net)))
goto cleanup;
if (virNetworkCreate(net) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (net)
virNetworkFree(net);
return rv;
}
static int
remoteDispatchNetworkCreateXml(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
......@@ -3789,39 +3003,6 @@ cleanup:
return rv;
}
static int
remoteDispatchNetworkDestroy(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_network_destroy_args *args,
void *ret ATTRIBUTE_UNUSED)
{
virNetworkPtr net = NULL;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(net = get_nonnull_network(conn, args->net)))
goto cleanup;
if (virNetworkDestroy(net) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (net)
virNetworkFree(net);
return rv;
}
static int
remoteDispatchNetworkDumpXml(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
......@@ -3955,79 +3136,14 @@ cleanup:
return rv;
}
static int
remoteDispatchNetworkLookupByUuid(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_network_lookup_by_uuid_args *args,
remote_network_lookup_by_uuid_ret *ret)
{
virNetworkPtr net = NULL;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(net = virNetworkLookupByUUID(conn, (unsigned char *) args->uuid)))
goto cleanup;
make_nonnull_network(&ret->net, net);
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (net)
virNetworkFree(net);
return rv;
}
static int
remoteDispatchNetworkSetAutostart(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_network_set_autostart_args *args,
void *ret ATTRIBUTE_UNUSED)
{
virNetworkPtr net = NULL;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(net = get_nonnull_network(conn, args->net)))
goto cleanup;
if (virNetworkSetAutostart(net, args->autostart) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (net)
virNetworkFree(net);
return rv;
}
static int
remoteDispatchNetworkUndefine(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_network_undefine_args *args,
void *ret ATTRIBUTE_UNUSED)
static int
remoteDispatchNetworkLookupByUuid(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_network_lookup_by_uuid_args *args,
remote_network_lookup_by_uuid_ret *ret)
{
virNetworkPtr net = NULL;
int rv = -1;
......@@ -4037,11 +3153,10 @@ remoteDispatchNetworkUndefine(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
if (!(net = get_nonnull_network(conn, args->net)))
if (!(net = virNetworkLookupByUUID(conn, (unsigned char *) args->uuid)))
goto cleanup;
if (virNetworkUndefine(net) < 0)
goto cleanup;
make_nonnull_network(&ret->net, net);
rv = 0;
......@@ -4416,105 +3531,6 @@ cleanup:
return rv;
}
static int
remoteDispatchInterfaceUndefine(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_interface_undefine_args *args,
void *ret ATTRIBUTE_UNUSED)
{
virInterfacePtr iface = NULL;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(iface = get_nonnull_interface(conn, args->iface)))
goto cleanup;
if (virInterfaceUndefine(iface) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (iface)
virInterfaceFree(iface);
return rv;
}
static int
remoteDispatchInterfaceCreate(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_interface_create_args *args,
void *ret ATTRIBUTE_UNUSED)
{
virInterfacePtr iface = NULL;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(iface = get_nonnull_interface(conn, args->iface)))
goto cleanup;
if (virInterfaceCreate(iface, args->flags) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (iface)
virInterfaceFree(iface);
return rv;
}
static int
remoteDispatchInterfaceDestroy(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_interface_destroy_args *args,
void *ret ATTRIBUTE_UNUSED)
{
virInterfacePtr iface = NULL;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(iface = get_nonnull_interface(conn, args->iface)))
goto cleanup;
if (virInterfaceDestroy(iface, args->flags) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (iface)
virInterfaceFree(iface);
return rv;
}
/*-------------------------------------------------------------*/
static int
......@@ -5441,40 +4457,6 @@ cleanup:
return rv;
}
static int
remoteDispatchStoragePoolCreate(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_storage_pool_create_args *args,
void *ret ATTRIBUTE_UNUSED)
{
virStoragePoolPtr pool = NULL;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
goto cleanup;
if (virStoragePoolCreate(pool, args->flags) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (pool)
virStoragePoolFree(pool);
return rv;
}
static int
remoteDispatchStoragePoolCreateXml(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
......@@ -5508,145 +4490,13 @@ cleanup:
}
static int
remoteDispatchStoragePoolDefineXml(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_storage_pool_define_xml_args *args,
remote_storage_pool_define_xml_ret *ret)
{
virStoragePoolPtr pool = NULL;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(pool = virStoragePoolDefineXML(conn, args->xml, args->flags)))
goto cleanup;
make_nonnull_storage_pool(&ret->pool, pool);
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (pool)
virStoragePoolFree(pool);
return rv;
}
static int
remoteDispatchStoragePoolBuild(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_storage_pool_build_args *args,
void *ret ATTRIBUTE_UNUSED)
{
virStoragePoolPtr pool = NULL;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
goto cleanup;
if (virStoragePoolBuild(pool, args->flags) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (pool)
virStoragePoolFree(pool);
return rv;
}
static int
remoteDispatchStoragePoolDestroy(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_storage_pool_destroy_args *args,
void *ret ATTRIBUTE_UNUSED)
{
virStoragePoolPtr pool = NULL;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
goto cleanup;
if (virStoragePoolDestroy(pool) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (pool)
virStoragePoolFree(pool);
return rv;
}
static int
remoteDispatchStoragePoolDelete(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_storage_pool_delete_args *args,
void *ret ATTRIBUTE_UNUSED)
{
virStoragePoolPtr pool = NULL;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
goto cleanup;
if (virStoragePoolDelete(pool, args->flags) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (pool)
virStoragePoolFree(pool);
return rv;
}
static int
remoteDispatchStoragePoolRefresh(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_storage_pool_refresh_args *args,
void *ret ATTRIBUTE_UNUSED)
remoteDispatchStoragePoolDefineXml(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_storage_pool_define_xml_args *args,
remote_storage_pool_define_xml_ret *ret)
{
virStoragePoolPtr pool = NULL;
int rv = -1;
......@@ -5656,11 +4506,10 @@ remoteDispatchStoragePoolRefresh(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
if (!(pool = virStoragePoolDefineXML(conn, args->xml, args->flags)))
goto cleanup;
if (virStoragePoolRefresh(pool, args->flags) < 0)
goto cleanup;
make_nonnull_storage_pool(&ret->pool, pool);
rv = 0;
......@@ -5881,72 +4730,6 @@ cleanup:
return rv;
}
static int
remoteDispatchStoragePoolSetAutostart(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_storage_pool_set_autostart_args *args,
void *ret ATTRIBUTE_UNUSED)
{
virStoragePoolPtr pool = NULL;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
goto cleanup;
if (virStoragePoolSetAutostart(pool, args->autostart) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (pool)
virStoragePoolFree(pool);
return rv;
}
static int
remoteDispatchStoragePoolUndefine(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_storage_pool_undefine_args *args,
void *ret ATTRIBUTE_UNUSED)
{
virStoragePoolPtr pool = NULL;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
goto cleanup;
if (virStoragePoolUndefine(pool) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (pool)
virStoragePoolFree(pool);
return rv;
}
static int
remoteDispatchNumOfStoragePools(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
......@@ -6174,72 +4957,6 @@ cleanup:
return rv;
}
static int
remoteDispatchStorageVolDelete(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_storage_vol_delete_args *args,
void *ret ATTRIBUTE_UNUSED)
{
virStorageVolPtr vol = NULL;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(vol = get_nonnull_storage_vol(conn, args->vol)))
goto cleanup;
if (virStorageVolDelete(vol, args->flags) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (vol)
virStorageVolFree(vol);
return rv;
}
static int
remoteDispatchStorageVolWipe(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_storage_vol_wipe_args *args,
void *ret ATTRIBUTE_UNUSED)
{
virStorageVolPtr vol = NULL;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(vol = get_nonnull_storage_vol(conn, args->vol)))
goto cleanup;
if (virStorageVolWipe(vol, args->flags) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (vol)
virStorageVolFree(vol);
return rv;
}
static int
remoteDispatchStorageVolGetInfo(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
......@@ -6737,150 +5454,14 @@ cleanup:
return rv;
}
static int
remoteDispatchNodeDeviceDettach(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_node_device_dettach_args *args,
void *ret ATTRIBUTE_UNUSED)
{
virNodeDevicePtr dev = NULL;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dev = virNodeDeviceLookupByName(conn, args->name)))
goto cleanup;
if (virNodeDeviceDettach(dev) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dev)
virNodeDeviceFree(dev);
return rv;
}
static int
remoteDispatchNodeDeviceReAttach(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_node_device_re_attach_args *args,
void *ret ATTRIBUTE_UNUSED)
{
virNodeDevicePtr dev = NULL;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dev = virNodeDeviceLookupByName(conn, args->name)))
goto cleanup;
if (virNodeDeviceReAttach(dev) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dev)
virNodeDeviceFree(dev);
return rv;
}
static int
remoteDispatchNodeDeviceReset(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_node_device_reset_args *args,
void *ret ATTRIBUTE_UNUSED)
{
virNodeDevicePtr dev = NULL;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dev = virNodeDeviceLookupByName(conn, args->name)))
goto cleanup;
if (virNodeDeviceReset(dev) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dev)
virNodeDeviceFree(dev);
return rv;
}
static int
remoteDispatchNodeDeviceCreateXml(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_node_device_create_xml_args *args,
remote_node_device_create_xml_ret *ret)
{
virNodeDevicePtr dev = NULL;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dev = virNodeDeviceCreateXML(conn, args->xml_desc, args->flags)))
goto cleanup;
make_nonnull_node_device(&ret->dev, dev);
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dev)
virNodeDeviceFree(dev);
return rv;
}
static int
remoteDispatchNodeDeviceDestroy(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_node_device_destroy_args *args,
void *ret ATTRIBUTE_UNUSED)
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_node_device_create_xml_args *args,
remote_node_device_create_xml_ret *ret)
{
virNodeDevicePtr dev = NULL;
int rv = -1;
......@@ -6890,11 +5471,10 @@ remoteDispatchNodeDeviceDestroy(struct qemud_server *server ATTRIBUTE_UNUSED,
goto cleanup;
}
if (!(dev = virNodeDeviceLookupByName(conn, args->name)))
if (!(dev = virNodeDeviceCreateXML(conn, args->xml_desc, args->flags)))
goto cleanup;
if (virNodeDeviceDestroy(dev) < 0)
goto cleanup;
make_nonnull_node_device(&ret->dev, dev);
rv = 0;
......@@ -7341,71 +5921,6 @@ cleanup:
return rv;
}
static int
remoteDispatchSecretSetValue(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_secret_set_value_args *args,
void *ret ATTRIBUTE_UNUSED)
{
virSecretPtr secret = NULL;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(secret = get_nonnull_secret(conn, args->secret)))
goto cleanup;
if (virSecretSetValue(secret, (const unsigned char *)args->value.value_val,
args->value.value_len, args->flags) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (secret)
virSecretFree(secret);
return rv;
}
static int
remoteDispatchSecretUndefine(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_secret_undefine_args *args,
void *ret ATTRIBUTE_UNUSED)
{
virSecretPtr secret = NULL;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(secret = get_nonnull_secret(conn, args->secret)))
goto cleanup;
if (virSecretUndefine(secret) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (secret)
virSecretFree(secret);
return rv;
}
static int
remoteDispatchSecretLookupByUsage(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
......@@ -7834,107 +6349,6 @@ cleanup:
return rv;
}
static int
remoteDispatchDomainAbortJob(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_abort_job_args *args,
void *ret ATTRIBUTE_UNUSED)
{
virDomainPtr dom = NULL;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainAbortJob(dom) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
static int
remoteDispatchDomainMigrateSetMaxDowntime(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_migrate_set_max_downtime_args *args,
void *ret ATTRIBUTE_UNUSED)
{
virDomainPtr dom = NULL;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainMigrateSetMaxDowntime(dom, args->downtime, args->flags) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
static int
remoteDispatchDomainMigrateSetMaxSpeed(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_migrate_set_max_speed_args *args,
void *ret ATTRIBUTE_UNUSED)
{
virDomainPtr dom = NULL;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainMigrateSetMaxSpeed(dom, args->bandwidth, args->flags) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
static int
remoteDispatchDomainSnapshotCreateXml(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
......@@ -8212,85 +6626,6 @@ cleanup:
return rv;
}
static int
remoteDispatchDomainRevertToSnapshot(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_revert_to_snapshot_args *args,
void *ret ATTRIBUTE_UNUSED)
{
virDomainPtr dom = NULL;
virDomainSnapshotPtr snapshot = NULL;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->snap.domain)))
goto cleanup;
if (!(snapshot = get_nonnull_domain_snapshot(dom, args->snap)))
goto cleanup;
if (virDomainRevertToSnapshot(snapshot, args->flags) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (snapshot)
virDomainSnapshotFree(snapshot);
if (dom)
virDomainFree(dom);
return rv;
}
static int
remoteDispatchDomainSnapshotDelete(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_snapshot_delete_args *args,
void *ret ATTRIBUTE_UNUSED)
{
virDomainPtr dom = NULL;
virDomainSnapshotPtr snapshot = NULL;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->snap.domain)))
goto cleanup;
if (!(snapshot = get_nonnull_domain_snapshot(dom, args->snap)))
goto cleanup;
if (virDomainSnapshotDelete(snapshot, args->flags) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (snapshot)
virDomainSnapshotFree(snapshot);
if (dom)
virDomainFree(dom);
return rv;
}
static int
remoteDispatchDomainEventsRegisterAny(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
......@@ -8380,7 +6715,7 @@ cleanup:
static int
remoteDispatchNwfilterLookupByName(struct qemud_server *server ATTRIBUTE_UNUSED,
remoteDispatchNWFilterLookupByName(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
......@@ -8412,7 +6747,7 @@ cleanup:
}
static int
remoteDispatchNwfilterLookupByUuid(struct qemud_server *server ATTRIBUTE_UNUSED,
remoteDispatchNWFilterLookupByUuid(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
......@@ -8445,7 +6780,7 @@ cleanup:
static int
remoteDispatchNwfilterDefineXml(struct qemud_server *server ATTRIBUTE_UNUSED,
remoteDispatchNWFilterDefineXml(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
......@@ -8476,40 +6811,6 @@ cleanup:
return rv;
}
static int
remoteDispatchNwfilterUndefine(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_nwfilter_undefine_args *args,
void *ret ATTRIBUTE_UNUSED)
{
virNWFilterPtr nwfilter = NULL;
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(nwfilter = get_nonnull_nwfilter(conn, args->nwfilter)))
goto cleanup;
if (virNWFilterUndefine(nwfilter) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (nwfilter)
virNWFilterFree(nwfilter);
return rv;
}
static int
remoteDispatchListNwfilters(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
......@@ -8557,7 +6858,7 @@ cleanup:
static int
remoteDispatchNwfilterGetXmlDesc(struct qemud_server *server ATTRIBUTE_UNUSED,
remoteDispatchNWFilterGetXmlDesc(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
......@@ -8741,6 +7042,9 @@ cleanup:
return rv;
}
#include "remote_dispatch_bodies.c"
#include "qemu_dispatch_bodies.c"
/*----- Helpers. -----*/
......
/* Automatically generated by remote_generator.pl.
* Do not edit this file. Any changes you make will be lost.
*/
/* remoteDispatchAuthList has to be implemented manually */
/* remoteDispatchAuthPolkit has to be implemented manually */
/* remoteDispatchAuthSaslInit has to be implemented manually */
/* remoteDispatchAuthSaslStart has to be implemented manually */
/* remoteDispatchAuthSaslStep has to be implemented manually */
/* remoteDispatchClose has to be implemented manually */
/* remoteDispatchCpuBaseline has to be implemented manually */
/* remoteDispatchCpuCompare has to be implemented manually */
static int
remoteDispatchDomainAbortJob(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_abort_job_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virDomainPtr dom = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainAbortJob(dom) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
static int
remoteDispatchDomainAttachDevice(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_attach_device_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virDomainPtr dom = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainAttachDevice(dom, args->xml) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
static int
remoteDispatchDomainAttachDeviceFlags(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_attach_device_flags_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virDomainPtr dom = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainAttachDeviceFlags(dom, args->xml, args->flags) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
/* remoteDispatchDomainBlockPeek has to be implemented manually */
/* remoteDispatchDomainBlockStats has to be implemented manually */
static int
remoteDispatchDomainCoreDump(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_core_dump_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virDomainPtr dom = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainCoreDump(dom, args->to, args->flags) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
static int
remoteDispatchDomainCreate(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_create_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virDomainPtr dom = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainCreate(dom) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
/* remoteDispatchDomainCreateWithFlags has to be implemented manually */
/* remoteDispatchDomainCreateXml has to be implemented manually */
/* remoteDispatchDomainDefineXml has to be implemented manually */
static int
remoteDispatchDomainDestroy(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_destroy_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virDomainPtr dom = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainDestroy(dom) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
static int
remoteDispatchDomainDetachDevice(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_detach_device_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virDomainPtr dom = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainDetachDevice(dom, args->xml) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
static int
remoteDispatchDomainDetachDeviceFlags(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_detach_device_flags_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virDomainPtr dom = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainDetachDeviceFlags(dom, args->xml, args->flags) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
/* remoteDispatchDomainDumpXml has to be implemented manually */
/* remoteDispatchDomainEventsDeregister has to be implemented manually */
/* remoteDispatchDomainEventsDeregisterAny has to be implemented manually */
/* remoteDispatchDomainEventsRegister has to be implemented manually */
/* remoteDispatchDomainEventsRegisterAny has to be implemented manually */
/* remoteDispatchDomainGetAutostart has to be implemented manually */
/* remoteDispatchDomainGetBlkioParameters has to be implemented manually */
/* remoteDispatchDomainGetBlockInfo has to be implemented manually */
/* remoteDispatchDomainGetInfo has to be implemented manually */
/* remoteDispatchDomainGetJobInfo has to be implemented manually */
/* remoteDispatchDomainGetMaxMemory has to be implemented manually */
/* remoteDispatchDomainGetMaxVcpus has to be implemented manually */
/* remoteDispatchDomainGetMemoryParameters has to be implemented manually */
/* remoteDispatchDomainGetOsType has to be implemented manually */
/* remoteDispatchDomainGetSchedulerParameters has to be implemented manually */
/* remoteDispatchDomainGetSchedulerType has to be implemented manually */
/* remoteDispatchDomainGetSecurityLabel has to be implemented manually */
/* remoteDispatchDomainGetVcpus has to be implemented manually */
/* remoteDispatchDomainGetVcpusFlags has to be implemented manually */
/* remoteDispatchDomainHasCurrentSnapshot has to be implemented manually */
/* remoteDispatchDomainHasManagedSaveImage has to be implemented manually */
/* remoteDispatchDomainInterfaceStats has to be implemented manually */
/* remoteDispatchDomainIsActive has to be implemented manually */
/* remoteDispatchDomainIsPersistent has to be implemented manually */
/* remoteDispatchDomainIsUpdated has to be implemented manually */
/* remoteDispatchDomainLookupById has to be implemented manually */
/* remoteDispatchDomainLookupByName has to be implemented manually */
/* remoteDispatchDomainLookupByUuid has to be implemented manually */
static int
remoteDispatchDomainManagedSave(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_managed_save_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virDomainPtr dom = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainManagedSave(dom, args->flags) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
static int
remoteDispatchDomainManagedSaveRemove(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_managed_save_remove_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virDomainPtr dom = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainManagedSaveRemove(dom, args->flags) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
/* remoteDispatchDomainMemoryPeek has to be implemented manually */
/* remoteDispatchDomainMemoryStats has to be implemented manually */
/* remoteDispatchDomainMigrateFinish has to be implemented manually */
/* remoteDispatchDomainMigrateFinish2 has to be implemented manually */
/* remoteDispatchDomainMigratePerform has to be implemented manually */
/* remoteDispatchDomainMigratePrepare has to be implemented manually */
/* remoteDispatchDomainMigratePrepare2 has to be implemented manually */
/* remoteDispatchDomainMigratePrepareTunnel has to be implemented manually */
static int
remoteDispatchDomainMigrateSetMaxDowntime(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_migrate_set_max_downtime_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virDomainPtr dom = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainMigrateSetMaxDowntime(dom, args->downtime, args->flags) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
static int
remoteDispatchDomainMigrateSetMaxSpeed(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_migrate_set_max_speed_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virDomainPtr dom = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainMigrateSetMaxSpeed(dom, args->bandwidth, args->flags) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
/* remoteDispatchDomainOpenConsole has to be implemented manually */
/* remoteDispatchDomainPinVcpu has to be implemented manually */
static int
remoteDispatchDomainReboot(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_reboot_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virDomainPtr dom = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainReboot(dom, args->flags) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
static int
remoteDispatchDomainRestore(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_restore_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (virDomainRestore(conn, args->from) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
return rv;
}
static int
remoteDispatchDomainResume(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_resume_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virDomainPtr dom = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainResume(dom) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
static int
remoteDispatchDomainRevertToSnapshot(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_revert_to_snapshot_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virDomainPtr dom = NULL;
virDomainSnapshotPtr snapshot = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->snap.domain)))
goto cleanup;
if (!(snapshot = get_nonnull_domain_snapshot(dom, args->snap)))
goto cleanup;
if (virDomainRevertToSnapshot(snapshot, args->flags) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (snapshot)
virDomainSnapshotFree(snapshot);
if (dom)
virDomainFree(dom);
return rv;
}
static int
remoteDispatchDomainSave(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_save_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virDomainPtr dom = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainSave(dom, args->to) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
static int
remoteDispatchDomainSetAutostart(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_set_autostart_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virDomainPtr dom = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainSetAutostart(dom, args->autostart) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
/* remoteDispatchDomainSetBlkioParameters has to be implemented manually */
static int
remoteDispatchDomainSetMaxMemory(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_set_max_memory_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virDomainPtr dom = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainSetMaxMemory(dom, args->memory) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
static int
remoteDispatchDomainSetMemory(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_set_memory_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virDomainPtr dom = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainSetMemory(dom, args->memory) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
static int
remoteDispatchDomainSetMemoryFlags(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_set_memory_flags_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virDomainPtr dom = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainSetMemoryFlags(dom, args->memory, args->flags) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
/* remoteDispatchDomainSetMemoryParameters has to be implemented manually */
/* remoteDispatchDomainSetSchedulerParameters has to be implemented manually */
static int
remoteDispatchDomainSetVcpus(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_set_vcpus_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virDomainPtr dom = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainSetVcpus(dom, args->nvcpus) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
static int
remoteDispatchDomainSetVcpusFlags(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_set_vcpus_flags_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virDomainPtr dom = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainSetVcpusFlags(dom, args->nvcpus, args->flags) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
static int
remoteDispatchDomainShutdown(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_shutdown_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virDomainPtr dom = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainShutdown(dom) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
/* remoteDispatchDomainSnapshotCreateXml has to be implemented manually */
/* remoteDispatchDomainSnapshotCurrent has to be implemented manually */
static int
remoteDispatchDomainSnapshotDelete(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_snapshot_delete_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virDomainPtr dom = NULL;
virDomainSnapshotPtr snapshot = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->snap.domain)))
goto cleanup;
if (!(snapshot = get_nonnull_domain_snapshot(dom, args->snap)))
goto cleanup;
if (virDomainSnapshotDelete(snapshot, args->flags) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (snapshot)
virDomainSnapshotFree(snapshot);
if (dom)
virDomainFree(dom);
return rv;
}
/* remoteDispatchDomainSnapshotDumpXml has to be implemented manually */
/* remoteDispatchDomainSnapshotListNames has to be implemented manually */
/* remoteDispatchDomainSnapshotLookupByName has to be implemented manually */
/* remoteDispatchDomainSnapshotNum has to be implemented manually */
static int
remoteDispatchDomainSuspend(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_suspend_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virDomainPtr dom = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainSuspend(dom) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
static int
remoteDispatchDomainUndefine(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_undefine_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virDomainPtr dom = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainUndefine(dom) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
static int
remoteDispatchDomainUpdateDeviceFlags(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_domain_update_device_flags_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virDomainPtr dom = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dom = get_nonnull_domain(conn, args->dom)))
goto cleanup;
if (virDomainUpdateDeviceFlags(dom, args->xml, args->flags) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dom)
virDomainFree(dom);
return rv;
}
/* remoteDispatchDomainXmlFromNative has to be implemented manually */
/* remoteDispatchDomainXmlToNative has to be implemented manually */
/* remoteDispatchFindStoragePoolSources has to be implemented manually */
/* remoteDispatchGetCapabilities has to be implemented manually */
/* remoteDispatchGetHostname has to be implemented manually */
/* remoteDispatchGetLibVersion has to be implemented manually */
/* remoteDispatchGetMaxVcpus has to be implemented manually */
/* remoteDispatchGetSysinfo has to be implemented manually */
/* remoteDispatchGetType has to be implemented manually */
/* remoteDispatchGetUri has to be implemented manually */
/* remoteDispatchGetVersion has to be implemented manually */
static int
remoteDispatchInterfaceCreate(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_interface_create_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virInterfacePtr iface = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(iface = get_nonnull_interface(conn, args->iface)))
goto cleanup;
if (virInterfaceCreate(iface, args->flags) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (iface)
virInterfaceFree(iface);
return rv;
}
/* remoteDispatchInterfaceDefineXml has to be implemented manually */
static int
remoteDispatchInterfaceDestroy(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_interface_destroy_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virInterfacePtr iface = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(iface = get_nonnull_interface(conn, args->iface)))
goto cleanup;
if (virInterfaceDestroy(iface, args->flags) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (iface)
virInterfaceFree(iface);
return rv;
}
/* remoteDispatchInterfaceGetXmlDesc has to be implemented manually */
/* remoteDispatchInterfaceIsActive has to be implemented manually */
/* remoteDispatchInterfaceLookupByMacString has to be implemented manually */
/* remoteDispatchInterfaceLookupByName has to be implemented manually */
static int
remoteDispatchInterfaceUndefine(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_interface_undefine_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virInterfacePtr iface = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(iface = get_nonnull_interface(conn, args->iface)))
goto cleanup;
if (virInterfaceUndefine(iface) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (iface)
virInterfaceFree(iface);
return rv;
}
/* remoteDispatchIsSecure has to be implemented manually */
/* remoteDispatchListDefinedDomains has to be implemented manually */
/* remoteDispatchListDefinedInterfaces has to be implemented manually */
/* remoteDispatchListDefinedNetworks has to be implemented manually */
/* remoteDispatchListDefinedStoragePools has to be implemented manually */
/* remoteDispatchListDomains has to be implemented manually */
/* remoteDispatchListInterfaces has to be implemented manually */
/* remoteDispatchListNetworks has to be implemented manually */
/* remoteDispatchListNwfilters has to be implemented manually */
/* remoteDispatchListSecrets has to be implemented manually */
/* remoteDispatchListStoragePools has to be implemented manually */
static int
remoteDispatchNetworkCreate(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_network_create_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virNetworkPtr net = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(net = get_nonnull_network(conn, args->net)))
goto cleanup;
if (virNetworkCreate(net) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (net)
virNetworkFree(net);
return rv;
}
/* remoteDispatchNetworkCreateXml has to be implemented manually */
/* remoteDispatchNetworkDefineXml has to be implemented manually */
static int
remoteDispatchNetworkDestroy(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_network_destroy_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virNetworkPtr net = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(net = get_nonnull_network(conn, args->net)))
goto cleanup;
if (virNetworkDestroy(net) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (net)
virNetworkFree(net);
return rv;
}
/* remoteDispatchNetworkDumpXml has to be implemented manually */
/* remoteDispatchNetworkGetAutostart has to be implemented manually */
/* remoteDispatchNetworkGetBridgeName has to be implemented manually */
/* remoteDispatchNetworkIsActive has to be implemented manually */
/* remoteDispatchNetworkIsPersistent has to be implemented manually */
/* remoteDispatchNetworkLookupByName has to be implemented manually */
/* remoteDispatchNetworkLookupByUuid has to be implemented manually */
static int
remoteDispatchNetworkSetAutostart(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_network_set_autostart_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virNetworkPtr net = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(net = get_nonnull_network(conn, args->net)))
goto cleanup;
if (virNetworkSetAutostart(net, args->autostart) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (net)
virNetworkFree(net);
return rv;
}
static int
remoteDispatchNetworkUndefine(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_network_undefine_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virNetworkPtr net = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(net = get_nonnull_network(conn, args->net)))
goto cleanup;
if (virNetworkUndefine(net) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (net)
virNetworkFree(net);
return rv;
}
/* remoteDispatchNodeDeviceCreateXml has to be implemented manually */
static int
remoteDispatchNodeDeviceDestroy(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_node_device_destroy_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virNodeDevicePtr dev = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dev = virNodeDeviceLookupByName(conn, args->name)))
goto cleanup;
if (virNodeDeviceDestroy(dev) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dev)
virNodeDeviceFree(dev);
return rv;
}
static int
remoteDispatchNodeDeviceDettach(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_node_device_dettach_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virNodeDevicePtr dev = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dev = virNodeDeviceLookupByName(conn, args->name)))
goto cleanup;
if (virNodeDeviceDettach(dev) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dev)
virNodeDeviceFree(dev);
return rv;
}
/* remoteDispatchNodeDeviceDumpXml has to be implemented manually */
/* remoteDispatchNodeDeviceGetParent has to be implemented manually */
/* remoteDispatchNodeDeviceListCaps has to be implemented manually */
/* remoteDispatchNodeDeviceLookupByName has to be implemented manually */
/* remoteDispatchNodeDeviceNumOfCaps has to be implemented manually */
static int
remoteDispatchNodeDeviceReAttach(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_node_device_re_attach_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virNodeDevicePtr dev = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dev = virNodeDeviceLookupByName(conn, args->name)))
goto cleanup;
if (virNodeDeviceReAttach(dev) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dev)
virNodeDeviceFree(dev);
return rv;
}
static int
remoteDispatchNodeDeviceReset(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_node_device_reset_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virNodeDevicePtr dev = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(dev = virNodeDeviceLookupByName(conn, args->name)))
goto cleanup;
if (virNodeDeviceReset(dev) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (dev)
virNodeDeviceFree(dev);
return rv;
}
/* remoteDispatchNodeGetCellsFreeMemory has to be implemented manually */
/* remoteDispatchNodeGetFreeMemory has to be implemented manually */
/* remoteDispatchNodeGetInfo has to be implemented manually */
/* remoteDispatchNodeGetSecurityModel has to be implemented manually */
/* remoteDispatchNodeListDevices has to be implemented manually */
/* remoteDispatchNodeNumOfDevices has to be implemented manually */
/* remoteDispatchNumOfDefinedDomains has to be implemented manually */
/* remoteDispatchNumOfDefinedInterfaces has to be implemented manually */
/* remoteDispatchNumOfDefinedNetworks has to be implemented manually */
/* remoteDispatchNumOfDefinedStoragePools has to be implemented manually */
/* remoteDispatchNumOfDomains has to be implemented manually */
/* remoteDispatchNumOfInterfaces has to be implemented manually */
/* remoteDispatchNumOfNetworks has to be implemented manually */
/* remoteDispatchNumOfNwfilters has to be implemented manually */
/* remoteDispatchNumOfSecrets has to be implemented manually */
/* remoteDispatchNumOfStoragePools has to be implemented manually */
/* remoteDispatchNWFilterDefineXml has to be implemented manually */
/* remoteDispatchNWFilterGetXmlDesc has to be implemented manually */
/* remoteDispatchNWFilterLookupByName has to be implemented manually */
/* remoteDispatchNWFilterLookupByUuid has to be implemented manually */
static int
remoteDispatchNWFilterUndefine(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_nwfilter_undefine_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virNWFilterPtr nwfilter = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(nwfilter = get_nonnull_nwfilter(conn, args->nwfilter)))
goto cleanup;
if (virNWFilterUndefine(nwfilter) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (nwfilter)
virNWFilterFree(nwfilter);
return rv;
}
/* remoteDispatchOpen has to be implemented manually */
/* remoteDispatchSecretDefineXml has to be implemented manually */
/* remoteDispatchSecretGetValue has to be implemented manually */
/* remoteDispatchSecretGetXmlDesc has to be implemented manually */
/* remoteDispatchSecretLookupByUsage has to be implemented manually */
/* remoteDispatchSecretLookupByUuid has to be implemented manually */
static int
remoteDispatchSecretSetValue(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_secret_set_value_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virSecretPtr secret = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(secret = get_nonnull_secret(conn, args->secret)))
goto cleanup;
if (virSecretSetValue(secret, (const unsigned char *)args->value.value_val, args->value.value_len, args->flags) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (secret)
virSecretFree(secret);
return rv;
}
static int
remoteDispatchSecretUndefine(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_secret_undefine_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virSecretPtr secret = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(secret = get_nonnull_secret(conn, args->secret)))
goto cleanup;
if (virSecretUndefine(secret) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (secret)
virSecretFree(secret);
return rv;
}
static int
remoteDispatchStoragePoolBuild(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_storage_pool_build_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virStoragePoolPtr pool = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
goto cleanup;
if (virStoragePoolBuild(pool, args->flags) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (pool)
virStoragePoolFree(pool);
return rv;
}
static int
remoteDispatchStoragePoolCreate(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_storage_pool_create_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virStoragePoolPtr pool = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
goto cleanup;
if (virStoragePoolCreate(pool, args->flags) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (pool)
virStoragePoolFree(pool);
return rv;
}
/* remoteDispatchStoragePoolCreateXml has to be implemented manually */
/* remoteDispatchStoragePoolDefineXml has to be implemented manually */
static int
remoteDispatchStoragePoolDelete(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_storage_pool_delete_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virStoragePoolPtr pool = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
goto cleanup;
if (virStoragePoolDelete(pool, args->flags) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (pool)
virStoragePoolFree(pool);
return rv;
}
static int
remoteDispatchStoragePoolDestroy(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_storage_pool_destroy_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virStoragePoolPtr pool = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
goto cleanup;
if (virStoragePoolDestroy(pool) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (pool)
virStoragePoolFree(pool);
return rv;
}
/* remoteDispatchStoragePoolDumpXml has to be implemented manually */
/* remoteDispatchStoragePoolGetAutostart has to be implemented manually */
/* remoteDispatchStoragePoolGetInfo has to be implemented manually */
/* remoteDispatchStoragePoolIsActive has to be implemented manually */
/* remoteDispatchStoragePoolIsPersistent has to be implemented manually */
/* remoteDispatchStoragePoolListVolumes has to be implemented manually */
/* remoteDispatchStoragePoolLookupByName has to be implemented manually */
/* remoteDispatchStoragePoolLookupByUuid has to be implemented manually */
/* remoteDispatchStoragePoolLookupByVolume has to be implemented manually */
/* remoteDispatchStoragePoolNumOfVolumes has to be implemented manually */
static int
remoteDispatchStoragePoolRefresh(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_storage_pool_refresh_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virStoragePoolPtr pool = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
goto cleanup;
if (virStoragePoolRefresh(pool, args->flags) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (pool)
virStoragePoolFree(pool);
return rv;
}
static int
remoteDispatchStoragePoolSetAutostart(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_storage_pool_set_autostart_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virStoragePoolPtr pool = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
goto cleanup;
if (virStoragePoolSetAutostart(pool, args->autostart) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (pool)
virStoragePoolFree(pool);
return rv;
}
static int
remoteDispatchStoragePoolUndefine(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_storage_pool_undefine_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virStoragePoolPtr pool = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(pool = get_nonnull_storage_pool(conn, args->pool)))
goto cleanup;
if (virStoragePoolUndefine(pool) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (pool)
virStoragePoolFree(pool);
return rv;
}
/* remoteDispatchStorageVolCreateXml has to be implemented manually */
/* remoteDispatchStorageVolCreateXmlFrom has to be implemented manually */
static int
remoteDispatchStorageVolDelete(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_storage_vol_delete_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virStorageVolPtr vol = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(vol = get_nonnull_storage_vol(conn, args->vol)))
goto cleanup;
if (virStorageVolDelete(vol, args->flags) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (vol)
virStorageVolFree(vol);
return rv;
}
/* remoteDispatchStorageVolDownload has to be implemented manually */
/* remoteDispatchStorageVolDumpXml has to be implemented manually */
/* remoteDispatchStorageVolGetInfo has to be implemented manually */
/* remoteDispatchStorageVolGetPath has to be implemented manually */
/* remoteDispatchStorageVolLookupByKey has to be implemented manually */
/* remoteDispatchStorageVolLookupByName has to be implemented manually */
/* remoteDispatchStorageVolLookupByPath has to be implemented manually */
/* remoteDispatchStorageVolUpload has to be implemented manually */
static int
remoteDispatchStorageVolWipe(
struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
virConnectPtr conn,
remote_message_header *hdr ATTRIBUTE_UNUSED,
remote_error *rerr,
remote_storage_vol_wipe_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int rv = -1;
virStorageVolPtr vol = NULL;
if (!conn) {
virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
goto cleanup;
}
if (!(vol = get_nonnull_storage_vol(conn, args->vol)))
goto cleanup;
if (virStorageVolWipe(vol, args->flags) < 0)
goto cleanup;
rv = 0;
cleanup:
if (rv < 0)
remoteDispatchError(rerr);
if (vol)
virStorageVolFree(vol);
return rv;
}
/* remoteDispatchSupportsFeature has to be implemented manually */
......@@ -1258,7 +1258,7 @@ static int remoteDispatchNumOfStoragePools(
remote_error *rerr,
void *args,
remote_num_of_storage_pools_ret *ret);
static int remoteDispatchNwfilterDefineXml(
static int remoteDispatchNWFilterDefineXml(
struct qemud_server *server,
struct qemud_client *client,
virConnectPtr conn,
......@@ -1266,7 +1266,7 @@ static int remoteDispatchNwfilterDefineXml(
remote_error *rerr,
remote_nwfilter_define_xml_args *args,
remote_nwfilter_define_xml_ret *ret);
static int remoteDispatchNwfilterGetXmlDesc(
static int remoteDispatchNWFilterGetXmlDesc(
struct qemud_server *server,
struct qemud_client *client,
virConnectPtr conn,
......@@ -1274,7 +1274,7 @@ static int remoteDispatchNwfilterGetXmlDesc(
remote_error *rerr,
remote_nwfilter_get_xml_desc_args *args,
remote_nwfilter_get_xml_desc_ret *ret);
static int remoteDispatchNwfilterLookupByName(
static int remoteDispatchNWFilterLookupByName(
struct qemud_server *server,
struct qemud_client *client,
virConnectPtr conn,
......@@ -1282,7 +1282,7 @@ static int remoteDispatchNwfilterLookupByName(
remote_error *rerr,
remote_nwfilter_lookup_by_name_args *args,
remote_nwfilter_lookup_by_name_ret *ret);
static int remoteDispatchNwfilterLookupByUuid(
static int remoteDispatchNWFilterLookupByUuid(
struct qemud_server *server,
struct qemud_client *client,
virConnectPtr conn,
......@@ -1290,7 +1290,7 @@ static int remoteDispatchNwfilterLookupByUuid(
remote_error *rerr,
remote_nwfilter_lookup_by_uuid_args *args,
remote_nwfilter_lookup_by_uuid_ret *ret);
static int remoteDispatchNwfilterUndefine(
static int remoteDispatchNWFilterUndefine(
struct qemud_server *server,
struct qemud_client *client,
virConnectPtr conn,
......
......@@ -877,18 +877,18 @@
.args_filter = (xdrproc_t) xdr_remote_domain_update_device_flags_args,
.ret_filter = (xdrproc_t) xdr_void,
},
{ /* NwfilterLookupByName => 175 */
.fn = (dispatch_fn) remoteDispatchNwfilterLookupByName,
{ /* NWFilterLookupByName => 175 */
.fn = (dispatch_fn) remoteDispatchNWFilterLookupByName,
.args_filter = (xdrproc_t) xdr_remote_nwfilter_lookup_by_name_args,
.ret_filter = (xdrproc_t) xdr_remote_nwfilter_lookup_by_name_ret,
},
{ /* NwfilterLookupByUuid => 176 */
.fn = (dispatch_fn) remoteDispatchNwfilterLookupByUuid,
{ /* NWFilterLookupByUuid => 176 */
.fn = (dispatch_fn) remoteDispatchNWFilterLookupByUuid,
.args_filter = (xdrproc_t) xdr_remote_nwfilter_lookup_by_uuid_args,
.ret_filter = (xdrproc_t) xdr_remote_nwfilter_lookup_by_uuid_ret,
},
{ /* NwfilterGetXmlDesc => 177 */
.fn = (dispatch_fn) remoteDispatchNwfilterGetXmlDesc,
{ /* NWFilterGetXmlDesc => 177 */
.fn = (dispatch_fn) remoteDispatchNWFilterGetXmlDesc,
.args_filter = (xdrproc_t) xdr_remote_nwfilter_get_xml_desc_args,
.ret_filter = (xdrproc_t) xdr_remote_nwfilter_get_xml_desc_ret,
},
......@@ -902,13 +902,13 @@
.args_filter = (xdrproc_t) xdr_remote_list_nwfilters_args,
.ret_filter = (xdrproc_t) xdr_remote_list_nwfilters_ret,
},
{ /* NwfilterDefineXml => 180 */
.fn = (dispatch_fn) remoteDispatchNwfilterDefineXml,
{ /* NWFilterDefineXml => 180 */
.fn = (dispatch_fn) remoteDispatchNWFilterDefineXml,
.args_filter = (xdrproc_t) xdr_remote_nwfilter_define_xml_args,
.ret_filter = (xdrproc_t) xdr_remote_nwfilter_define_xml_ret,
},
{ /* NwfilterUndefine => 181 */
.fn = (dispatch_fn) remoteDispatchNwfilterUndefine,
{ /* NWFilterUndefine => 181 */
.fn = (dispatch_fn) remoteDispatchNWFilterUndefine,
.args_filter = (xdrproc_t) xdr_remote_nwfilter_undefine_args,
.ret_filter = (xdrproc_t) xdr_void,
},
......
......@@ -13,14 +13,15 @@
# remote_generator.pl -t qemu ../src/remote/qemu_protocol.x
#
# By Richard Jones <rjones@redhat.com>
# Extended by Matthias Bolte <matthias.bolte@googlemail.com>
use strict;
use Getopt::Std;
# Command line options.
our ($opt_p, $opt_t, $opt_a, $opt_r, $opt_d, $opt_c);
getopts ('ptardc');
our ($opt_p, $opt_t, $opt_a, $opt_r, $opt_d, $opt_c, $opt_b);
getopts ('ptardcb');
my $structprefix = $ARGV[0];
my $procprefix = uc $structprefix;
......@@ -31,6 +32,7 @@ sub name_to_ProcName {
my $name = shift;
my @elems = split /_/, $name;
@elems = map ucfirst, @elems;
@elems = map { $_ eq "Nwfilter" ? "NWFilter" : $_ } @elems;
join "", @elems
}
......@@ -50,8 +52,17 @@ if ($opt_c) {
};
}
my $collect_args_members = 0;
my $last_name;
while (<>) {
if (/^struct ${structprefix}_(.*)_args/) {
if ($collect_args_members) {
if (/^};/) {
$collect_args_members = 0;
} elsif ($_ =~ m/^\s*(.*\S)\s*$/) {
push(@{$calls{$name}->{args_members}}, $1);
}
} elsif (/^struct ${structprefix}_(.*)_args/) {
$name = $1;
$ProcName = name_to_ProcName ($name);
......@@ -63,9 +74,12 @@ while (<>) {
ProcName => $ProcName,
UC_NAME => uc $name,
args => "${structprefix}_${name}_args",
ret => "void",
args_members => [],
ret => "void"
};
$collect_args_members = 1;
$last_name = $name;
} elsif (/^struct ${structprefix}_(.*)_ret/) {
$name = $1;
$ProcName = name_to_ProcName ($name);
......@@ -81,6 +95,8 @@ while (<>) {
ret => "${structprefix}_${name}_ret"
}
}
$collect_args_members = 0;
} elsif (/^struct ${structprefix}_(.*)_msg/) {
$name = $1;
$ProcName = name_to_ProcName ($name);
......@@ -90,13 +106,19 @@ while (<>) {
ProcName => $ProcName,
UC_NAME => uc $name,
msg => "${structprefix}_${name}_msg"
}
};
$collect_args_members = 0;
} elsif (/^\s*${procprefix}_PROC_(.*?)\s+=\s+(\d+),?$/) {
$name = lc $1;
$id = $2;
$ProcName = name_to_ProcName ($name);
$calls[$id] = $calls{$name};
$collect_args_members = 0;
} else {
$collect_args_members = 0;
}
}
......@@ -193,3 +215,225 @@ elsif ($opt_t) {
}
}
}
# Bodies for dispatch functions ("remote_dispatch_bodies.c").
elsif ($opt_b) {
# list of functions that currently are not generatable
my @ungeneratable;
if ($structprefix eq "remote") {
@ungeneratable = ("Close",
"DomainEventsDeregisterAny",
"DomainEventsRegisterAny",
"DomainMigratePerform",
"DomainMigratePrepareTunnel",
"DomainOpenConsole",
"DomainPinVcpu",
"DomainSetSchedulerParameters",
"DomainSetMemoryParameters",
"DomainSetBlkioParameters",
"Open",
"StorageVolUpload",
"StorageVolDownload");
} elsif ($structprefix eq "qemu") {
@ungeneratable = ("MonitorCommand");
}
my %ug = map { $_ => 1 } @ungeneratable;
my @keys = sort (keys %calls);
foreach (@keys) {
# skip things which are REMOTE_MESSAGE
next if $calls{$_}->{msg};
# FIXME: skip functions with explicit return value for now
if ($calls{$_}->{ret} ne "void" or exists($ug{$calls{$_}->{ProcName}})) {
print "\n/* ${structprefix}Dispatch$calls{$_}->{ProcName} has to be implemented manually */\n";
next;
}
print "\n";
print "static int\n";
print "${structprefix}Dispatch$calls{$_}->{ProcName}(\n";
print " struct qemud_server *server ATTRIBUTE_UNUSED,\n";
print " struct qemud_client *client ATTRIBUTE_UNUSED,\n";
print " virConnectPtr conn,\n";
print " remote_message_header *hdr ATTRIBUTE_UNUSED,\n";
print " remote_error *rerr,\n";
print " $calls{$_}->{args} *args";
if ($calls{$_}->{args} eq "void") {
print " ATTRIBUTE_UNUSED"
}
print ",\n";
print " $calls{$_}->{ret} *ret";
if ($calls{$_}->{ret} eq "void") {
print " ATTRIBUTE_UNUSED"
}
print ")\n";
print "{\n";
print " int rv = -1;\n";
my $has_node_device = 0;
my @vars_list = ();
my @getters_list = ();
my @args_list = ();
my @free_list = ();
if ($calls{$_}->{args} ne "void") {
# node device is special, as it's identified by name
if ($calls{$_}->{args} =~ m/^remote_node_device/) {
$has_node_device = 1;
push(@vars_list, "virNodeDevicePtr dev = NULL");
push(@getters_list,
" if (!(dev = virNodeDeviceLookupByName(conn, args->name)))\n" .
" goto cleanup;\n");
push(@args_list, "dev");
push(@free_list,
" if (dev)\n" .
" virNodeDeviceFree(dev);");
}
foreach my $args_member (@{$calls{$_}->{args_members}}) {
if ($args_member =~ m/^remote_nonnull_string name;/ and $has_node_device) {
# ignore the name arg for node devices
next
} elsif ($args_member =~ m/^remote_nonnull_domain /) {
push(@vars_list, "virDomainPtr dom = NULL");
push(@getters_list,
" if (!(dom = get_nonnull_domain(conn, args->dom)))\n" .
" goto cleanup;\n");
push(@args_list, "dom");
push(@free_list,
" if (dom)\n" .
" virDomainFree(dom);");
} elsif ($args_member =~ m/^remote_nonnull_network /) {
push(@vars_list, "virNetworkPtr net = NULL");
push(@getters_list,
" if (!(net = get_nonnull_network(conn, args->net)))\n" .
" goto cleanup;\n");
push(@args_list, "net");
push(@free_list,
" if (net)\n" .
" virNetworkFree(net);");
} elsif ($args_member =~ m/^remote_nonnull_storage_pool /) {
push(@vars_list, "virStoragePoolPtr pool = NULL");
push(@getters_list,
" if (!(pool = get_nonnull_storage_pool(conn, args->pool)))\n" .
" goto cleanup;\n");
push(@args_list, "pool");
push(@free_list,
" if (pool)\n" .
" virStoragePoolFree(pool);");
} elsif ($args_member =~ m/^remote_nonnull_storage_vol /) {
push(@vars_list, "virStorageVolPtr vol = NULL");
push(@getters_list,
" if (!(vol = get_nonnull_storage_vol(conn, args->vol)))\n" .
" goto cleanup;\n");
push(@args_list, "vol");
push(@free_list,
" if (vol)\n" .
" virStorageVolFree(vol);");
} elsif ($args_member =~ m/^remote_nonnull_interface /) {
push(@vars_list, "virInterfacePtr iface = NULL");
push(@getters_list,
" if (!(iface = get_nonnull_interface(conn, args->iface)))\n" .
" goto cleanup;\n");
push(@args_list, "iface");
push(@free_list,
" if (iface)\n" .
" virInterfaceFree(iface);");
} elsif ($args_member =~ m/^remote_nonnull_secret /) {
push(@vars_list, "virSecretPtr secret = NULL");
push(@getters_list,
" if (!(secret = get_nonnull_secret(conn, args->secret)))\n" .
" goto cleanup;\n");
push(@args_list, "secret");
push(@free_list,
" if (secret)\n" .
" virSecretFree(secret);");
} elsif ($args_member =~ m/^remote_nonnull_nwfilter /) {
push(@vars_list, "virNWFilterPtr nwfilter = NULL");
push(@getters_list,
" if (!(nwfilter = get_nonnull_nwfilter(conn, args->nwfilter)))\n" .
" goto cleanup;\n");
push(@args_list, "nwfilter");
push(@free_list,
" if (nwfilter)\n" .
" virNWFilterFree(nwfilter);");
} elsif ($args_member =~ m/^remote_nonnull_domain_snapshot /) {
push(@vars_list, "virDomainPtr dom = NULL");
push(@vars_list, "virDomainSnapshotPtr snapshot = NULL");
push(@getters_list,
" if (!(dom = get_nonnull_domain(conn, args->snap.domain)))\n" .
" goto cleanup;\n" .
"\n" .
" if (!(snapshot = get_nonnull_domain_snapshot(dom, args->snap)))\n" .
" goto cleanup;\n");
push(@args_list, "snapshot");
push(@free_list,
" if (snapshot)\n" .
" virDomainSnapshotFree(snapshot);\n" .
" if (dom)\n" .
" virDomainFree(dom);");
} elsif ($args_member =~ m/(\S+)<\S+>;/) {
if (! @args_list) {
push(@args_list, "conn");
}
if ($calls{$_}->{ProcName} eq "SecretSetValue") {
push(@args_list, "(const unsigned char *)args->$1.$1_val");
} else {
push(@args_list, "args->$1.$1_val");
}
push(@args_list, "args->$1.$1_len");
} elsif ($args_member =~ m/.* (\S+);/) {
if (! @args_list) {
push(@args_list, "conn");
}
push(@args_list, "args->$1");
}
}
}
foreach my $var (@vars_list) {
print " $var;\n";
}
print "\n";
print " if (!conn) {\n";
print " virNetError(VIR_ERR_INTERNAL_ERROR, \"%s\", _(\"connection not open\"));\n";
print " goto cleanup;\n";
print " }\n";
print "\n";
print join("\n", @getters_list);
print "\n";
if ($calls{$_}->{ret} eq "void") {
print " if (vir$calls{$_}->{ProcName}(";
print join(', ', @args_list);
print ") < 0)\n";
print " goto cleanup;\n";
print "\n";
}
print " rv = 0;\n";
print "\n";
print "cleanup:\n";
print " if (rv < 0)\n";
print " remoteDispatchError(rerr);\n";
print join("\n", @free_list);
print "\n";
print " return rv;\n";
print "}\n";
}
}
......@@ -2,6 +2,7 @@ daemon/dispatch.c
daemon/libvirtd.c
daemon/remote.c
daemon/stream.c
daemon/remote_dispatch_bodies.c
src/conf/cpu_conf.c
src/conf/domain_conf.c
src/conf/domain_event.c
......
......@@ -540,9 +540,9 @@ struct remote_domain_interface_stats_ret {
};
struct remote_domain_memory_stats_args {
remote_nonnull_domain dom;
u_int maxStats;
u_int flags;
remote_nonnull_domain dom;
u_int maxStats;
u_int flags;
};
struct remote_domain_memory_stat {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册