mirror of https://gitee.com/openkylin/libvirt.git
Move QEMU driver into main libvirt.so and use single daemon for all drivers
This commit is contained in:
parent
8c90a88818
commit
a78a6602df
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
Tue Jun 26 19:35:00 EST 2007 Daniel P. Berrange <berrange@redhat.com>
|
||||
|
||||
* qemud/libvirtd.sysconf, qemud/libvirtd.init.in: Added config
|
||||
to turn on/off remote support in daemon
|
||||
* qemud/conf.c, qemud/conf.h, qemud/driver.c, qemud/driver.h
|
||||
Finally switch over to be an internal driver.
|
||||
* qemud/dispatch.c, qemud/dispatch.h: Remove obsolete files
|
||||
* qemud/protocol.*: Remove all except packet header.
|
||||
* src/xml.c: Don't compile virXMLError for libvirt_proxy
|
||||
* src/remote_internal.c: Pick up QEMU uris too
|
||||
|
||||
Tue Jun 26 19:05:00 EST 2007 Daniel P. Berrange <berrange@redhat.com>
|
||||
|
||||
* src/remote_internal.c: Fix typo in checking for read only
|
||||
|
|
|
@ -3,5 +3,5 @@ Makefile.in
|
|||
Makefile
|
||||
.deps
|
||||
.libs
|
||||
suspend
|
||||
info1
|
||||
suspend
|
||||
|
|
|
@ -18,24 +18,24 @@ install-data-local:
|
|||
|
||||
EXTRA_DIST=examples.xsl index.py examples.xml
|
||||
|
||||
noinst_PROGRAMS=suspend info1
|
||||
|
||||
suspend_SOURCES=suspend.c
|
||||
suspend_LDFLAGS=
|
||||
suspend_DEPENDENCIES= $(DEPS)
|
||||
suspend_LDADD= $(LDADDS)
|
||||
noinst_PROGRAMS=info1 suspend
|
||||
|
||||
info1_SOURCES=info1.c
|
||||
info1_LDFLAGS=
|
||||
info1_DEPENDENCIES= $(DEPS)
|
||||
info1_LDADD= $(LDADDS)
|
||||
|
||||
suspend_SOURCES=suspend.c
|
||||
suspend_LDFLAGS=
|
||||
suspend_DEPENDENCIES= $(DEPS)
|
||||
suspend_LDADD= $(LDADDS)
|
||||
|
||||
valgrind:
|
||||
$(MAKE) CHECKER='valgrind' tests
|
||||
|
||||
tests: $(noinst_PROGRAMS)
|
||||
@(echo '## examples regression tests')
|
||||
@($(CHECKER) ./suspend)
|
||||
@($(CHECKER) ./info1)
|
||||
@($(CHECKER) ./suspend)
|
||||
|
||||
|
||||
|
|
|
@ -124,10 +124,7 @@ fi
|
|||
%dir %attr(0700, root, root) %{_sysconfdir}/libvirt/qemu/networks/
|
||||
%dir %attr(0700, root, root) %{_sysconfdir}/libvirt/qemu/networks/autostart
|
||||
%{_sysconfdir}/rc.d/init.d/libvirtd
|
||||
%dir %{_sysconfdir}/libvirt
|
||||
%dir %{_sysconfdir}/libvirt/qemu
|
||||
%dir %{_sysconfdir}/libvirt/qemu/networks
|
||||
%dir %{_sysconfdir}/libvirt/qemu/networks/autostart
|
||||
%config(noreplace) %{_sysconfdir}/sysconfig/libvirtd
|
||||
%dir %{_datadir}/libvirt/
|
||||
%dir %{_datadir}/libvirt/networks/
|
||||
%{_datadir}/libvirt/networks/default.xml
|
||||
|
|
959
po/bn_IN.po
959
po/bn_IN.po
File diff suppressed because it is too large
Load Diff
911
po/en_GB.po
911
po/en_GB.po
File diff suppressed because it is too large
Load Diff
960
po/eu_ES.po
960
po/eu_ES.po
File diff suppressed because it is too large
Load Diff
892
po/libvirt.pot
892
po/libvirt.pot
File diff suppressed because it is too large
Load Diff
912
po/pt_BR.po
912
po/pt_BR.po
File diff suppressed because it is too large
Load Diff
909
po/sr@Latn.po
909
po/sr@Latn.po
File diff suppressed because it is too large
Load Diff
957
po/zh_CN.po
957
po/zh_CN.po
File diff suppressed because it is too large
Load Diff
959
po/zh_TW.po
959
po/zh_TW.po
File diff suppressed because it is too large
Load Diff
|
@ -7,17 +7,9 @@ sbin_PROGRAMS = libvirtd
|
|||
|
||||
libvirtd_SOURCES = \
|
||||
qemud.c internal.h \
|
||||
driver.c driver.h \
|
||||
dispatch.c dispatch.h \
|
||||
conf.c conf.h \
|
||||
bridge.c bridge.h \
|
||||
iptables.c iptables.h \
|
||||
uuid.c uuid.h \
|
||||
../src/buf.c \
|
||||
protocol.h protocol.c \
|
||||
remote_protocol.h remote_protocol.c \
|
||||
remote.c \
|
||||
../src/virterror.c \
|
||||
event.c event.h
|
||||
#-D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_POSIX_C_SOURCE=199506L
|
||||
libvirtd_CFLAGS = \
|
||||
|
@ -52,14 +44,19 @@ uninstall-local: uninstall-init
|
|||
|
||||
# Distribute the generated files so that rpcgen isn't required on the
|
||||
# target machine (although almost any Unix machine will have it).
|
||||
EXTRA_DIST = libvirtd.init.in default-network.xml \
|
||||
EXTRA_DIST = libvirtd.init.in libvirtd.sysconf default-network.xml \
|
||||
protocol.x remote_protocol.x \
|
||||
protocol.c protocol.h \
|
||||
remote_protocol.c remote_protocol.h \
|
||||
remote_generate_stubs.pl rpcgen_fix.pl \
|
||||
remote_dispatch_prototypes.h \
|
||||
remote_dispatch_localvars.h \
|
||||
remote_dispatch_proc_switch.h
|
||||
remote_dispatch_proc_switch.h \
|
||||
driver.c driver.h \
|
||||
conf.c conf.h \
|
||||
iptables.c iptables.h \
|
||||
bridge.c bridge.h \
|
||||
uuid.c uuid.h
|
||||
|
||||
.x.c:
|
||||
rm -f $@
|
||||
|
@ -91,6 +88,8 @@ if LIBVIRT_INIT_SCRIPTS_RED_HAT
|
|||
install-init: libvirtd.init
|
||||
mkdir -p $(DESTDIR)$(sysconfdir)/rc.d/init.d
|
||||
$(INSTALL_SCRIPT) $(srcdir)/libvirtd.init $(DESTDIR)$(sysconfdir)/rc.d/init.d/libvirtd
|
||||
mkdir -p $(DESTDIR)$(sysconfdir)/sysconfig
|
||||
$(INSTALL_SCRIPT) $(srcdir)/libvirtd.sysconf $(DESTDIR)$(sysconfdir)/sysconfig/libvirtd
|
||||
|
||||
uninstall-init:
|
||||
rm -f $(DESTDIR)$(sysconfdir)/rc.d/init.d/libvirtd
|
||||
|
|
18
qemud/conf.c
18
qemud/conf.c
|
@ -42,11 +42,12 @@
|
|||
|
||||
#include <libvirt/virterror.h>
|
||||
|
||||
#include "internal.h"
|
||||
#include "conf.h"
|
||||
#include "uuid.h"
|
||||
#include "../src/buf.h"
|
||||
|
||||
#define qemudLog(level, msg...) fprintf(stderr, msg)
|
||||
|
||||
void qemudReportError(virConnectPtr conn,
|
||||
virDomainPtr dom,
|
||||
virNetworkPtr net,
|
||||
|
@ -61,7 +62,6 @@ void qemudReportError(virConnectPtr conn,
|
|||
} else {
|
||||
errorMessage[0] = '\0';
|
||||
}
|
||||
|
||||
__virRaiseError(conn, dom, net, VIR_FROM_QEMU, code, VIR_ERR_ERROR,
|
||||
NULL, NULL, NULL, -1, -1, errorMessage);
|
||||
}
|
||||
|
@ -266,7 +266,7 @@ static const char *qemudDefaultBinaryForArch(const char *arch) {
|
|||
}
|
||||
|
||||
/* Find the fully qualified path to the binary for an architecture */
|
||||
static char *qemudLocateBinaryForArch(struct qemud_driver *driver,
|
||||
static char *qemudLocateBinaryForArch(struct qemud_driver *driver ATTRIBUTE_UNUSED,
|
||||
int virtType, const char *arch) {
|
||||
const char *name;
|
||||
char *path;
|
||||
|
@ -415,7 +415,7 @@ int qemudExtractVersion(struct qemud_driver *driver) {
|
|||
|
||||
|
||||
/* Parse the XML definition for a disk */
|
||||
static struct qemud_vm_disk_def *qemudParseDiskXML(struct qemud_driver *driver,
|
||||
static struct qemud_vm_disk_def *qemudParseDiskXML(struct qemud_driver *driver ATTRIBUTE_UNUSED,
|
||||
xmlNodePtr node) {
|
||||
struct qemud_vm_disk_def *disk = calloc(1, sizeof(struct qemud_vm_disk_def));
|
||||
xmlNodePtr cur;
|
||||
|
@ -552,7 +552,7 @@ static void qemudRandomMAC(struct qemud_vm_net_def *net) {
|
|||
|
||||
|
||||
/* Parse the XML definition for a network interface */
|
||||
static struct qemud_vm_net_def *qemudParseInterfaceXML(struct qemud_driver *driver,
|
||||
static struct qemud_vm_net_def *qemudParseInterfaceXML(struct qemud_driver *driver ATTRIBUTE_UNUSED,
|
||||
xmlNodePtr node) {
|
||||
struct qemud_vm_net_def *net = calloc(1, sizeof(struct qemud_vm_net_def));
|
||||
xmlNodePtr cur;
|
||||
|
@ -1842,7 +1842,7 @@ static int qemudParseBridgeXML(struct qemud_driver *driver ATTRIBUTE_UNUSED,
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int qemudParseDhcpRangesXML(struct qemud_driver *driver,
|
||||
static int qemudParseDhcpRangesXML(struct qemud_driver *driver ATTRIBUTE_UNUSED,
|
||||
struct qemud_network_def *def,
|
||||
xmlNodePtr node) {
|
||||
|
||||
|
@ -2494,7 +2494,7 @@ int qemudScanConfigs(struct qemud_driver *driver) {
|
|||
}
|
||||
|
||||
/* Generate an XML document describing the guest's configuration */
|
||||
char *qemudGenerateXML(struct qemud_driver *driver,
|
||||
char *qemudGenerateXML(struct qemud_driver *driver ATTRIBUTE_UNUSED,
|
||||
struct qemud_vm *vm,
|
||||
struct qemud_vm_def *def,
|
||||
int live) {
|
||||
|
@ -2772,7 +2772,7 @@ char *qemudGenerateXML(struct qemud_driver *driver,
|
|||
}
|
||||
|
||||
|
||||
char *qemudGenerateNetworkXML(struct qemud_driver *driver,
|
||||
char *qemudGenerateNetworkXML(struct qemud_driver *driver ATTRIBUTE_UNUSED,
|
||||
struct qemud_network *network,
|
||||
struct qemud_network_def *def) {
|
||||
virBufferPtr buf = 0;
|
||||
|
@ -2863,7 +2863,7 @@ char *qemudGenerateNetworkXML(struct qemud_driver *driver,
|
|||
}
|
||||
|
||||
|
||||
int qemudDeleteConfig(struct qemud_driver *driver,
|
||||
int qemudDeleteConfig(struct qemud_driver *driver ATTRIBUTE_UNUSED,
|
||||
const char *configFile,
|
||||
const char *name) {
|
||||
if (!configFile[0]) {
|
||||
|
|
11
qemud/conf.h
11
qemud/conf.h
|
@ -25,6 +25,11 @@
|
|||
#define __QEMUD_CONF_H
|
||||
|
||||
#include "../src/internal.h"
|
||||
#include "bridge.h"
|
||||
#include "iptables.h"
|
||||
#include <netinet/in.h>
|
||||
|
||||
#define qemudDebug(fmt, ...) do {} while(0)
|
||||
|
||||
/* Different types of QEMU acceleration possible */
|
||||
enum qemud_vm_virt_type {
|
||||
|
@ -33,7 +38,6 @@ enum qemud_vm_virt_type {
|
|||
QEMUD_VIRT_KVM,
|
||||
};
|
||||
|
||||
|
||||
/* Two types of disk backends */
|
||||
enum qemud_vm_disk_type {
|
||||
QEMUD_DISK_BLOCK,
|
||||
|
@ -74,6 +78,11 @@ enum qemud_vm_net_type {
|
|||
QEMUD_NET_BRIDGE,
|
||||
};
|
||||
|
||||
#define QEMUD_UUID_RAW_LEN 16
|
||||
#define QEMUD_MAX_NAME_LEN 50
|
||||
#define QEMUD_MAX_XML_LEN 4096
|
||||
#define QEMUD_MAX_ERROR_LEN 1024
|
||||
|
||||
/* Stores the virtual network interface configuration */
|
||||
struct qemud_vm_net_def {
|
||||
int type;
|
||||
|
|
936
qemud/dispatch.c
936
qemud/dispatch.c
|
@ -1,936 +0,0 @@
|
|||
/*
|
||||
* dispatch.c: (De-)marshall wire messages to driver functions.
|
||||
*
|
||||
* Copyright (C) 2006, 2007 Red Hat, Inc.
|
||||
* Copyright (C) 2006 Daniel P. Berrange
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Daniel P. Berrange <berrange@redhat.com>
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <libvirt/virterror.h>
|
||||
|
||||
#include "internal.h"
|
||||
#include "../src/internal.h"
|
||||
#include "driver.h"
|
||||
#include "dispatch.h"
|
||||
#include "conf.h"
|
||||
extern struct qemud_driver *qemu_driver;
|
||||
|
||||
|
||||
static virConnect conn;
|
||||
|
||||
static int qemudDispatchFailure(struct qemud_packet_server_data *out) {
|
||||
virErrorPtr err = virGetLastError();
|
||||
if (!err)
|
||||
err = virConnGetLastError(&conn);
|
||||
|
||||
out->type = QEMUD_SERVER_PKT_FAILURE;
|
||||
|
||||
if (err) {
|
||||
out->qemud_packet_server_data_u.failureReply.code = err->code;
|
||||
strncpy(out->qemud_packet_server_data_u.failureReply.message,
|
||||
err->message, QEMUD_MAX_ERROR_LEN-1);
|
||||
out->qemud_packet_server_data_u.failureReply.message[QEMUD_MAX_ERROR_LEN-1] = '\0';
|
||||
} else {
|
||||
out->qemud_packet_server_data_u.failureReply.code = VIR_ERR_INTERNAL_ERROR;
|
||||
strcpy(out->qemud_packet_server_data_u.failureReply.message,
|
||||
"Unknown error");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int qemudDispatchGetVersion(struct qemud_packet_client_data *in ATTRIBUTE_UNUSED, struct qemud_packet_server_data *out) {
|
||||
int ret;
|
||||
unsigned long version;
|
||||
ret = qemudGetVersion(&conn, &version);
|
||||
if (ret < 0) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
} else {
|
||||
out->type = QEMUD_SERVER_PKT_GET_VERSION;
|
||||
out->qemud_packet_server_data_u.getVersionReply.versionNum = version;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int qemudDispatchGetNodeInfo(struct qemud_packet_client_data *in ATTRIBUTE_UNUSED, struct qemud_packet_server_data *out) {
|
||||
virNodeInfo info;
|
||||
if (qemudGetNodeInfo(&conn,
|
||||
&info) < 0) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
out->qemud_packet_server_data_u.getNodeInfoReply.memory = info.memory;
|
||||
out->qemud_packet_server_data_u.getNodeInfoReply.cpus = info.cpus;
|
||||
out->qemud_packet_server_data_u.getNodeInfoReply.mhz = info.mhz;
|
||||
out->qemud_packet_server_data_u.getNodeInfoReply.nodes = info.nodes;
|
||||
out->qemud_packet_server_data_u.getNodeInfoReply.sockets = info.sockets;
|
||||
out->qemud_packet_server_data_u.getNodeInfoReply.cores = info.cores;
|
||||
out->qemud_packet_server_data_u.getNodeInfoReply.threads = info.threads;
|
||||
|
||||
out->type = QEMUD_SERVER_PKT_GET_NODEINFO;
|
||||
strncpy(out->qemud_packet_server_data_u.getNodeInfoReply.model, info.model,
|
||||
sizeof(out->qemud_packet_server_data_u.getNodeInfoReply.model)-1);
|
||||
out->qemud_packet_server_data_u.getNodeInfoReply.model[sizeof(out->qemud_packet_server_data_u.getNodeInfoReply.model)-1] = '\0';
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
qemudDispatchGetCapabilities (struct qemud_packet_client_data *in ATTRIBUTE_UNUSED,
|
||||
struct qemud_packet_server_data *out)
|
||||
{
|
||||
char *xml = qemudGetCapabilities(&conn);
|
||||
|
||||
out->type = QEMUD_SERVER_PKT_GET_CAPABILITIES;
|
||||
strncpy (out->qemud_packet_server_data_u.getCapabilitiesReply.xml, xml,
|
||||
QEMUD_MAX_XML_LEN-1);
|
||||
out->qemud_packet_server_data_u.getCapabilitiesReply.xml[QEMUD_MAX_XML_LEN-1] = '\0';
|
||||
free(xml);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int qemudDispatchListDomains(struct qemud_packet_client_data *in ATTRIBUTE_UNUSED, struct qemud_packet_server_data *out) {
|
||||
int i, ndomains, domains[QEMUD_MAX_NUM_DOMAINS];
|
||||
|
||||
ndomains = qemudListDomains(&conn,
|
||||
domains,
|
||||
QEMUD_MAX_NUM_DOMAINS);
|
||||
if (ndomains < 0) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
} else {
|
||||
out->type = QEMUD_SERVER_PKT_LIST_DOMAINS;
|
||||
for (i = 0 ; i < ndomains ; i++) {
|
||||
out->qemud_packet_server_data_u.listDomainsReply.domains[i] = domains[i];
|
||||
}
|
||||
out->qemud_packet_server_data_u.listDomainsReply.numDomains = ndomains;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int qemudDispatchNumDomains(struct qemud_packet_client_data *in ATTRIBUTE_UNUSED, struct qemud_packet_server_data *out) {
|
||||
int ndomains = qemudNumDomains(&conn);
|
||||
if (ndomains < 0) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
} else {
|
||||
out->type = QEMUD_SERVER_PKT_NUM_DOMAINS;
|
||||
out->qemud_packet_server_data_u.numDomainsReply.numDomains = ndomains;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int qemudDispatchDomainCreate(struct qemud_packet_client_data *in, struct qemud_packet_server_data *out) {
|
||||
in->qemud_packet_client_data_u.domainCreateRequest.xml[QEMUD_MAX_XML_LEN-1] ='\0';
|
||||
|
||||
virDomainPtr dom = qemudDomainCreate(&conn, in->qemud_packet_client_data_u.domainCreateRequest.xml, 0);
|
||||
if (!dom) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
} else {
|
||||
out->type = QEMUD_SERVER_PKT_DOMAIN_CREATE;
|
||||
out->qemud_packet_server_data_u.domainCreateReply.id = dom->id;
|
||||
memcpy(out->qemud_packet_server_data_u.domainCreateReply.uuid, dom->uuid, QEMUD_UUID_RAW_LEN);
|
||||
strncpy(out->qemud_packet_server_data_u.domainCreateReply.name, dom->name, QEMUD_MAX_NAME_LEN-1);
|
||||
out->qemud_packet_server_data_u.domainCreateReply.name[QEMUD_MAX_NAME_LEN-1] = '\0';
|
||||
free(dom);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int qemudDispatchDomainLookupByID(struct qemud_packet_client_data *in, struct qemud_packet_server_data *out) {
|
||||
virDomainPtr dom = qemudDomainLookupByID(&conn, in->qemud_packet_client_data_u.domainLookupByIDRequest.id);
|
||||
if (!dom) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
} else {
|
||||
out->type = QEMUD_SERVER_PKT_DOMAIN_LOOKUP_BY_ID;
|
||||
memcpy(out->qemud_packet_server_data_u.domainLookupByIDReply.uuid, dom->uuid, QEMUD_UUID_RAW_LEN);
|
||||
strncpy(out->qemud_packet_server_data_u.domainLookupByIDReply.name, dom->name, QEMUD_MAX_NAME_LEN-1);
|
||||
out->qemud_packet_server_data_u.domainLookupByIDReply.name[QEMUD_MAX_NAME_LEN-1] = '\0';
|
||||
free(dom);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int qemudDispatchDomainLookupByUUID(struct qemud_packet_client_data *in, struct qemud_packet_server_data *out) {
|
||||
virDomainPtr dom = qemudDomainLookupByUUID(&conn, in->qemud_packet_client_data_u.domainLookupByUUIDRequest.uuid);
|
||||
if (!dom) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
} else {
|
||||
out->type = QEMUD_SERVER_PKT_DOMAIN_LOOKUP_BY_UUID;
|
||||
out->qemud_packet_server_data_u.domainLookupByUUIDReply.id = dom->id;
|
||||
strncpy(out->qemud_packet_server_data_u.domainLookupByUUIDReply.name, dom->name, QEMUD_MAX_NAME_LEN-1);
|
||||
out->qemud_packet_server_data_u.domainLookupByUUIDReply.name[QEMUD_MAX_NAME_LEN-1] = '\0';
|
||||
free(dom);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int qemudDispatchDomainLookupByName(struct qemud_packet_client_data *in, struct qemud_packet_server_data *out) {
|
||||
/* Paranoia NULL termination */
|
||||
in->qemud_packet_client_data_u.domainLookupByNameRequest.name[QEMUD_MAX_NAME_LEN-1] = '\0';
|
||||
virDomainPtr dom = qemudDomainLookupByName(&conn, in->qemud_packet_client_data_u.domainLookupByNameRequest.name);
|
||||
if (!dom) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
} else {
|
||||
out->type = QEMUD_SERVER_PKT_DOMAIN_LOOKUP_BY_NAME;
|
||||
out->qemud_packet_server_data_u.domainLookupByNameReply.id = dom->id;
|
||||
memcpy(out->qemud_packet_server_data_u.domainLookupByNameReply.uuid, dom->uuid, QEMUD_UUID_RAW_LEN);
|
||||
free(dom);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int qemudDispatchDomainSuspend(struct qemud_packet_client_data *in, struct qemud_packet_server_data *out) {
|
||||
virDomainPtr dom = qemudDomainLookupByID(&conn, in->qemud_packet_client_data_u.domainSuspendRequest.id);
|
||||
int ret;
|
||||
if (!dom) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = qemudDomainSuspend(dom);
|
||||
free(dom);
|
||||
if (ret < 0) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
} else {
|
||||
out->type = QEMUD_SERVER_PKT_DOMAIN_SUSPEND;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int qemudDispatchDomainResume(struct qemud_packet_client_data *in, struct qemud_packet_server_data *out) {
|
||||
virDomainPtr dom = qemudDomainLookupByID(&conn, in->qemud_packet_client_data_u.domainResumeRequest.id);
|
||||
int ret;
|
||||
if (!dom) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = qemudDomainResume(dom);
|
||||
free(dom);
|
||||
if (ret < 0) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
} else {
|
||||
out->type = QEMUD_SERVER_PKT_DOMAIN_RESUME;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int qemudDispatchDomainDestroy(struct qemud_packet_client_data *in, struct qemud_packet_server_data *out) {
|
||||
virDomainPtr dom = qemudDomainLookupByID(&conn, in->qemud_packet_client_data_u.domainDestroyRequest.id);
|
||||
int ret;
|
||||
if (!dom) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = qemudDomainDestroy(dom);
|
||||
free(dom);
|
||||
if (ret < 0) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
} else {
|
||||
out->type = QEMUD_SERVER_PKT_DOMAIN_DESTROY;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int qemudDispatchDomainGetInfo(struct qemud_packet_client_data *in, struct qemud_packet_server_data *out) {
|
||||
virDomainInfo info;
|
||||
virDomainPtr dom = qemudDomainLookupByUUID(&conn, in->qemud_packet_client_data_u.domainGetInfoRequest.uuid);
|
||||
|
||||
if (!dom) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (qemudDomainGetInfo(dom, &info) < 0) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
} else {
|
||||
out->type = QEMUD_SERVER_PKT_DOMAIN_GET_INFO;
|
||||
out->qemud_packet_server_data_u.domainGetInfoReply.runstate = info.state;
|
||||
out->qemud_packet_server_data_u.domainGetInfoReply.cpuTime = info.cpuTime;
|
||||
out->qemud_packet_server_data_u.domainGetInfoReply.maxmem = info.maxMem;
|
||||
out->qemud_packet_server_data_u.domainGetInfoReply.memory = info.memory;
|
||||
out->qemud_packet_server_data_u.domainGetInfoReply.nrVirtCpu = info.nrVirtCpu;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int qemudDispatchDomainSave(struct qemud_packet_client_data *in, struct qemud_packet_server_data *out) {
|
||||
virDomainPtr dom = qemudDomainLookupByID(&conn, in->qemud_packet_client_data_u.domainSaveRequest.id);
|
||||
int ret;
|
||||
if (!dom) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Paranoia NULL termination */
|
||||
in->qemud_packet_client_data_u.domainSaveRequest.file[PATH_MAX-1] ='\0';
|
||||
|
||||
ret = qemudDomainSave(dom,
|
||||
in->qemud_packet_client_data_u.domainSaveRequest.file);
|
||||
free(dom);
|
||||
if (ret < 0) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
} else {
|
||||
out->type = QEMUD_SERVER_PKT_DOMAIN_SAVE;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int qemudDispatchDomainRestore(struct qemud_packet_client_data *in, struct qemud_packet_server_data *out) {
|
||||
int ret;
|
||||
|
||||
/* Paranoia null termination */
|
||||
in->qemud_packet_client_data_u.domainRestoreRequest.file[PATH_MAX-1] ='\0';
|
||||
|
||||
ret = qemudDomainRestore(&conn, in->qemud_packet_client_data_u.domainRestoreRequest.file);
|
||||
if (ret < 0) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
} else {
|
||||
out->type = QEMUD_SERVER_PKT_DOMAIN_RESTORE;
|
||||
out->qemud_packet_server_data_u.domainRestoreReply.id = ret;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int qemudDispatchDumpXML(struct qemud_packet_client_data *in, struct qemud_packet_server_data *out) {
|
||||
virDomainPtr dom = qemudDomainLookupByUUID(&conn, in->qemud_packet_client_data_u.domainDumpXMLRequest.uuid);
|
||||
char *ret;
|
||||
if (!dom) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = qemudDomainDumpXML(dom, 0);
|
||||
free(dom);
|
||||
if (!ret) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
} else {
|
||||
out->type = QEMUD_SERVER_PKT_DUMP_XML;
|
||||
strncpy(out->qemud_packet_server_data_u.domainDumpXMLReply.xml,
|
||||
ret, QEMUD_MAX_XML_LEN-1);
|
||||
out->qemud_packet_server_data_u.domainDumpXMLReply.xml[QEMUD_MAX_XML_LEN-1] = '\0';
|
||||
free(ret);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int qemudDispatchListDefinedDomains(struct qemud_packet_client_data *in ATTRIBUTE_UNUSED, struct qemud_packet_server_data *out) {
|
||||
char **names;
|
||||
int i, ndomains;
|
||||
|
||||
if (!(names = malloc(sizeof(char *)*QEMUD_MAX_NUM_DOMAINS)))
|
||||
return -1;
|
||||
|
||||
ndomains = qemudListDefinedDomains(&conn,
|
||||
names,
|
||||
QEMUD_MAX_NUM_DOMAINS);
|
||||
for (i = 0 ; i < ndomains ; i++) {
|
||||
strncpy(&out->qemud_packet_server_data_u.listDefinedDomainsReply.domains[i*QEMUD_MAX_NAME_LEN],
|
||||
names[i],
|
||||
QEMUD_MAX_NAME_LEN);
|
||||
free(names[i]);
|
||||
}
|
||||
|
||||
free(names);
|
||||
if (ndomains < 0) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
} else {
|
||||
out->type = QEMUD_SERVER_PKT_LIST_DEFINED_DOMAINS;
|
||||
out->qemud_packet_server_data_u.listDefinedDomainsReply.numDomains = ndomains;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int qemudDispatchNumDefinedDomains(struct qemud_packet_client_data *in ATTRIBUTE_UNUSED, struct qemud_packet_server_data *out) {
|
||||
int ndomains = qemudNumDefinedDomains(&conn);
|
||||
if (ndomains < 0) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
} else {
|
||||
out->type = QEMUD_SERVER_PKT_NUM_DEFINED_DOMAINS;
|
||||
out->qemud_packet_server_data_u.numDefinedDomainsReply.numDomains = ndomains;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int qemudDispatchDomainStart(struct qemud_packet_client_data *in, struct qemud_packet_server_data *out) {
|
||||
virDomainPtr dom = qemudDomainLookupByUUID(&conn, in->qemud_packet_client_data_u.domainStartRequest.uuid);
|
||||
int ret;
|
||||
if (!dom) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = qemudDomainStart(dom);
|
||||
free(dom);
|
||||
if (ret < 0) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
} else {
|
||||
out->type = QEMUD_SERVER_PKT_DOMAIN_START;
|
||||
out->qemud_packet_server_data_u.domainStartReply.id = dom->id;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int qemudDispatchDomainDefine(struct qemud_packet_client_data *in, struct qemud_packet_server_data *out) {
|
||||
in->qemud_packet_client_data_u.domainDefineRequest.xml[QEMUD_MAX_XML_LEN-1] ='\0';
|
||||
|
||||
virDomainPtr dom = qemudDomainDefine(&conn, in->qemud_packet_client_data_u.domainDefineRequest.xml);
|
||||
if (!dom) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
} else {
|
||||
out->type = QEMUD_SERVER_PKT_DOMAIN_DEFINE;
|
||||
memcpy(out->qemud_packet_server_data_u.domainDefineReply.uuid, dom->uuid, QEMUD_UUID_RAW_LEN);
|
||||
strncpy(out->qemud_packet_server_data_u.domainDefineReply.name, dom->name, QEMUD_MAX_NAME_LEN-1);
|
||||
out->qemud_packet_server_data_u.domainDefineReply.name[QEMUD_MAX_NAME_LEN-1] = '\0';
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int qemudDispatchDomainUndefine(struct qemud_packet_client_data *in, struct qemud_packet_server_data *out) {
|
||||
virDomainPtr dom = qemudDomainLookupByUUID(&conn, in->qemud_packet_client_data_u.domainUndefineRequest.uuid);
|
||||
int ret;
|
||||
if (!dom) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
ret = qemudDomainUndefine(dom);
|
||||
free(dom);
|
||||
if (ret < 0) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
} else {
|
||||
out->type = QEMUD_SERVER_PKT_DOMAIN_UNDEFINE;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int qemudDispatchNumNetworks(struct qemud_packet_client_data *in ATTRIBUTE_UNUSED, struct qemud_packet_server_data *out) {
|
||||
int nnetworks = qemudNumNetworks(&conn);
|
||||
if (nnetworks < 0) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
} else {
|
||||
out->type = QEMUD_SERVER_PKT_NUM_NETWORKS;
|
||||
out->qemud_packet_server_data_u.numNetworksReply.numNetworks = nnetworks;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int qemudDispatchListNetworks(struct qemud_packet_client_data *in ATTRIBUTE_UNUSED, struct qemud_packet_server_data *out) {
|
||||
char **names;
|
||||
int i;
|
||||
|
||||
if (!(names = malloc(sizeof(char *)*QEMUD_MAX_NUM_NETWORKS)))
|
||||
return -1;
|
||||
|
||||
int nnetworks = qemudListNetworks(&conn,
|
||||
names,
|
||||
QEMUD_MAX_NUM_NETWORKS);
|
||||
for (i = 0 ; i < nnetworks ; i++) {
|
||||
strncpy(&out->qemud_packet_server_data_u.listNetworksReply.networks[i*QEMUD_MAX_NAME_LEN],
|
||||
names[i],
|
||||
QEMUD_MAX_NAME_LEN);
|
||||
free(names[i]);
|
||||
}
|
||||
free(names);
|
||||
if (nnetworks < 0) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
} else {
|
||||
out->type = QEMUD_SERVER_PKT_LIST_NETWORKS;
|
||||
out->qemud_packet_server_data_u.listNetworksReply.numNetworks = nnetworks;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int qemudDispatchNumDefinedNetworks(struct qemud_packet_client_data *in ATTRIBUTE_UNUSED, struct qemud_packet_server_data *out) {
|
||||
int nnetworks = qemudNumDefinedNetworks(&conn);
|
||||
if (nnetworks < 0) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
} else {
|
||||
out->type = QEMUD_SERVER_PKT_NUM_DEFINED_NETWORKS;
|
||||
out->qemud_packet_server_data_u.numDefinedNetworksReply.numNetworks = nnetworks;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int qemudDispatchListDefinedNetworks(struct qemud_packet_client_data *in ATTRIBUTE_UNUSED, struct qemud_packet_server_data *out) {
|
||||
char **names;
|
||||
int i;
|
||||
|
||||
if (!(names = malloc(sizeof(char *)*QEMUD_MAX_NUM_NETWORKS)))
|
||||
return -1;
|
||||
|
||||
int nnetworks = qemudListDefinedNetworks(&conn,
|
||||
names,
|
||||
QEMUD_MAX_NUM_NETWORKS);
|
||||
|
||||
for (i = 0 ; i < nnetworks ; i++) {
|
||||
strncpy(&out->qemud_packet_server_data_u.listDefinedNetworksReply.networks[i*QEMUD_MAX_NAME_LEN],
|
||||
names[i],
|
||||
QEMUD_MAX_NAME_LEN);
|
||||
free(names[i]);
|
||||
}
|
||||
free(names);
|
||||
if (nnetworks < 0) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
} else {
|
||||
out->type = QEMUD_SERVER_PKT_LIST_DEFINED_NETWORKS;
|
||||
out->qemud_packet_server_data_u.listDefinedNetworksReply.numNetworks = nnetworks;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int qemudDispatchNetworkLookupByName(struct qemud_packet_client_data *in, struct qemud_packet_server_data *out) {
|
||||
/* Paranoia NULL termination */
|
||||
in->qemud_packet_client_data_u.networkLookupByNameRequest.name[QEMUD_MAX_NAME_LEN-1] = '\0';
|
||||
struct qemud_network *network = qemudFindNetworkByName(qemu_driver, in->qemud_packet_client_data_u.networkLookupByNameRequest.name);
|
||||
if (!network) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
} else {
|
||||
out->type = QEMUD_SERVER_PKT_NETWORK_LOOKUP_BY_NAME;
|
||||
memcpy(out->qemud_packet_server_data_u.networkLookupByNameReply.uuid, network->def->uuid, QEMUD_UUID_RAW_LEN);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int qemudDispatchNetworkLookupByUUID(struct qemud_packet_client_data *in, struct qemud_packet_server_data *out) {
|
||||
struct qemud_network *network = qemudFindNetworkByUUID(qemu_driver, in->qemud_packet_client_data_u.networkLookupByUUIDRequest.uuid);
|
||||
if (!network) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
} else {
|
||||
out->type = QEMUD_SERVER_PKT_NETWORK_LOOKUP_BY_UUID;
|
||||
strncpy(out->qemud_packet_server_data_u.networkLookupByUUIDReply.name, network->def->name, QEMUD_MAX_NAME_LEN-1);
|
||||
out->qemud_packet_server_data_u.networkLookupByUUIDReply.name[QEMUD_MAX_NAME_LEN-1] = '\0';
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int qemudDispatchNetworkCreate(struct qemud_packet_client_data *in, struct qemud_packet_server_data *out) {
|
||||
in->qemud_packet_client_data_u.networkCreateRequest.xml[QEMUD_MAX_XML_LEN-1] ='\0';
|
||||
|
||||
virNetworkPtr net = qemudNetworkCreate(&conn, in->qemud_packet_client_data_u.networkCreateRequest.xml);
|
||||
if (!net) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
} else {
|
||||
out->type = QEMUD_SERVER_PKT_NETWORK_CREATE;
|
||||
memcpy(out->qemud_packet_server_data_u.networkCreateReply.uuid, net->uuid, QEMUD_UUID_RAW_LEN);
|
||||
strncpy(out->qemud_packet_server_data_u.networkCreateReply.name, net->name, QEMUD_MAX_NAME_LEN-1);
|
||||
out->qemud_packet_server_data_u.networkCreateReply.name[QEMUD_MAX_NAME_LEN-1] = '\0';
|
||||
free(net);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int qemudDispatchNetworkDefine(struct qemud_packet_client_data *in, struct qemud_packet_server_data *out) {
|
||||
in->qemud_packet_client_data_u.networkDefineRequest.xml[QEMUD_MAX_XML_LEN-1] ='\0';
|
||||
|
||||
virNetworkPtr net = qemudNetworkDefine(&conn, in->qemud_packet_client_data_u.networkDefineRequest.xml);
|
||||
if (!net) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
} else {
|
||||
out->type = QEMUD_SERVER_PKT_NETWORK_DEFINE;
|
||||
memcpy(out->qemud_packet_server_data_u.networkDefineReply.uuid, net->uuid, QEMUD_UUID_RAW_LEN);
|
||||
strncpy(out->qemud_packet_server_data_u.networkDefineReply.name, net->name, QEMUD_MAX_NAME_LEN-1);
|
||||
out->qemud_packet_server_data_u.networkDefineReply.name[QEMUD_MAX_NAME_LEN-1] = '\0';
|
||||
free(net);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int qemudDispatchNetworkUndefine(struct qemud_packet_client_data *in, struct qemud_packet_server_data *out) {
|
||||
virNetworkPtr net = qemudNetworkLookupByUUID(&conn, in->qemud_packet_client_data_u.networkUndefineRequest.uuid);
|
||||
int ret;
|
||||
if (!net) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = qemudNetworkUndefine(net);
|
||||
free(net);
|
||||
if (ret < 0) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
} else {
|
||||
out->type = QEMUD_SERVER_PKT_NETWORK_UNDEFINE;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int qemudDispatchNetworkStart(struct qemud_packet_client_data *in, struct qemud_packet_server_data *out) {
|
||||
virNetworkPtr net = qemudNetworkLookupByUUID(&conn, in->qemud_packet_client_data_u.networkStartRequest.uuid);
|
||||
int ret;
|
||||
if (!net) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = qemudNetworkStart(net);
|
||||
free(net);
|
||||
if (ret < 0) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
} else {
|
||||
out->type = QEMUD_SERVER_PKT_NETWORK_START;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int qemudDispatchNetworkDestroy(struct qemud_packet_client_data *in, struct qemud_packet_server_data *out) {
|
||||
virNetworkPtr net = qemudNetworkLookupByUUID(&conn, in->qemud_packet_client_data_u.networkDestroyRequest.uuid);
|
||||
int ret;
|
||||
if (!net) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = qemudNetworkDestroy(net);
|
||||
free(net);
|
||||
if (ret < 0) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
} else {
|
||||
out->type = QEMUD_SERVER_PKT_NETWORK_DESTROY;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int qemudDispatchNetworkDumpXML(struct qemud_packet_client_data *in, struct qemud_packet_server_data *out) {
|
||||
virNetworkPtr net = qemudNetworkLookupByUUID(&conn, in->qemud_packet_client_data_u.networkDumpXMLRequest.uuid);
|
||||
char *ret;
|
||||
if (!net) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = qemudNetworkDumpXML(net, 0);
|
||||
free(net);
|
||||
if (!ret) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
} else {
|
||||
out->type = QEMUD_SERVER_PKT_NETWORK_DUMP_XML;
|
||||
strncpy(out->qemud_packet_server_data_u.networkDumpXMLReply.xml, ret, QEMUD_MAX_XML_LEN-1);
|
||||
out->qemud_packet_server_data_u.networkDumpXMLReply.xml[QEMUD_MAX_XML_LEN-1] = '\0';
|
||||
free(ret);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int qemudDispatchNetworkGetBridgeName(struct qemud_packet_client_data *in, struct qemud_packet_server_data *out) {
|
||||
virNetworkPtr net = qemudNetworkLookupByUUID(&conn, in->qemud_packet_client_data_u.networkDumpXMLRequest.uuid);
|
||||
char *ret;
|
||||
if (!net) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = qemudNetworkGetBridgeName(net);
|
||||
free(net);
|
||||
if (!ret) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
} else {
|
||||
out->type = QEMUD_SERVER_PKT_NETWORK_GET_BRIDGE_NAME;
|
||||
strncpy(out->qemud_packet_server_data_u.networkGetBridgeNameReply.ifname, ret, QEMUD_MAX_IFNAME_LEN-1);
|
||||
out->qemud_packet_server_data_u.networkGetBridgeNameReply.ifname[QEMUD_MAX_IFNAME_LEN-1] = '\0';
|
||||
free(ret);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int qemudDispatchDomainGetAutostart(struct qemud_packet_client_data *in, struct qemud_packet_server_data *out) {
|
||||
virDomainPtr dom = qemudDomainLookupByUUID(&conn, in->qemud_packet_client_data_u.domainGetAutostartRequest.uuid);
|
||||
int ret;
|
||||
int autostart;
|
||||
if (!dom) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
autostart = 0;
|
||||
|
||||
ret = qemudDomainGetAutostart(dom,
|
||||
&autostart);
|
||||
free(dom);
|
||||
if (ret < 0) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
} else {
|
||||
out->type = QEMUD_SERVER_PKT_DOMAIN_GET_AUTOSTART;
|
||||
out->qemud_packet_server_data_u.networkGetAutostartReply.autostart = (autostart != 0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int qemudDispatchDomainSetAutostart(struct qemud_packet_client_data *in, struct qemud_packet_server_data *out) {
|
||||
virDomainPtr dom = qemudDomainLookupByUUID(&conn, in->qemud_packet_client_data_u.domainSetAutostartRequest.uuid);
|
||||
int ret;
|
||||
if (!dom) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = qemudDomainSetAutostart(dom,
|
||||
in->qemud_packet_client_data_u.domainSetAutostartRequest.autostart);
|
||||
free(dom);
|
||||
if (ret < 0) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
} else {
|
||||
out->type = QEMUD_SERVER_PKT_DOMAIN_SET_AUTOSTART;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int qemudDispatchNetworkGetAutostart(struct qemud_packet_client_data *in, struct qemud_packet_server_data *out) {
|
||||
virNetworkPtr net = qemudNetworkLookupByUUID(&conn, in->qemud_packet_client_data_u.networkGetAutostartRequest.uuid);
|
||||
int ret;
|
||||
int autostart;
|
||||
if (!net) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
autostart = 0;
|
||||
|
||||
ret = qemudNetworkGetAutostart(net,
|
||||
&autostart);
|
||||
free(net);
|
||||
if (ret < 0) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
} else {
|
||||
out->type = QEMUD_SERVER_PKT_NETWORK_GET_AUTOSTART;
|
||||
out->qemud_packet_server_data_u.networkGetAutostartReply.autostart = (autostart != 0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int qemudDispatchNetworkSetAutostart(struct qemud_packet_client_data *in, struct qemud_packet_server_data *out) {
|
||||
virNetworkPtr net = qemudNetworkLookupByUUID(&conn, in->qemud_packet_client_data_u.networkGetAutostartRequest.uuid);
|
||||
int ret;
|
||||
if (!net) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = qemudNetworkSetAutostart(net,
|
||||
in->qemud_packet_client_data_u.networkSetAutostartRequest.autostart);
|
||||
free(net);
|
||||
if (ret < 0) {
|
||||
if (qemudDispatchFailure(out) < 0)
|
||||
return -1;
|
||||
} else {
|
||||
out->type = QEMUD_SERVER_PKT_NETWORK_SET_AUTOSTART;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
typedef int (*clientFunc)(struct qemud_packet_client_data *in, struct qemud_packet_server_data *out);
|
||||
|
||||
|
||||
/* One per message type recorded in qemud_packet_type enum */
|
||||
|
||||
clientFunc funcsTransmitRW[QEMUD_CLIENT_PKT_MAX] = {
|
||||
qemudDispatchGetVersion,
|
||||
qemudDispatchGetNodeInfo,
|
||||
qemudDispatchListDomains,
|
||||
qemudDispatchNumDomains,
|
||||
qemudDispatchDomainCreate,
|
||||
qemudDispatchDomainLookupByID,
|
||||
qemudDispatchDomainLookupByUUID,
|
||||
qemudDispatchDomainLookupByName,
|
||||
qemudDispatchDomainSuspend,
|
||||
qemudDispatchDomainResume,
|
||||
qemudDispatchDomainDestroy,
|
||||
qemudDispatchDomainGetInfo,
|
||||
qemudDispatchDomainSave,
|
||||
qemudDispatchDomainRestore,
|
||||
qemudDispatchDumpXML,
|
||||
qemudDispatchListDefinedDomains,
|
||||
qemudDispatchNumDefinedDomains,
|
||||
qemudDispatchDomainStart,
|
||||
qemudDispatchDomainDefine,
|
||||
qemudDispatchDomainUndefine,
|
||||
qemudDispatchNumNetworks,
|
||||
qemudDispatchListNetworks,
|
||||
qemudDispatchNumDefinedNetworks,
|
||||
qemudDispatchListDefinedNetworks,
|
||||
qemudDispatchNetworkLookupByUUID,
|
||||
qemudDispatchNetworkLookupByName,
|
||||
qemudDispatchNetworkCreate,
|
||||
qemudDispatchNetworkDefine,
|
||||
qemudDispatchNetworkUndefine,
|
||||
qemudDispatchNetworkStart,
|
||||
qemudDispatchNetworkDestroy,
|
||||
qemudDispatchNetworkDumpXML,
|
||||
qemudDispatchNetworkGetBridgeName,
|
||||
qemudDispatchDomainGetAutostart,
|
||||
qemudDispatchDomainSetAutostart,
|
||||
qemudDispatchNetworkGetAutostart,
|
||||
qemudDispatchNetworkSetAutostart,
|
||||
qemudDispatchGetCapabilities,
|
||||
};
|
||||
|
||||
clientFunc funcsTransmitRO[QEMUD_CLIENT_PKT_MAX] = {
|
||||
qemudDispatchGetVersion,
|
||||
qemudDispatchGetNodeInfo,
|
||||
qemudDispatchListDomains,
|
||||
qemudDispatchNumDomains,
|
||||
NULL,
|
||||
qemudDispatchDomainLookupByID,
|
||||
qemudDispatchDomainLookupByUUID,
|
||||
qemudDispatchDomainLookupByName,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
qemudDispatchDomainGetInfo,
|
||||
NULL,
|
||||
NULL,
|
||||
qemudDispatchDumpXML,
|
||||
qemudDispatchListDefinedDomains,
|
||||
qemudDispatchNumDefinedDomains,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
qemudDispatchNumNetworks,
|
||||
qemudDispatchListNetworks,
|
||||
qemudDispatchNumDefinedNetworks,
|
||||
qemudDispatchListDefinedNetworks,
|
||||
qemudDispatchNetworkLookupByUUID,
|
||||
qemudDispatchNetworkLookupByName,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
qemudDispatchNetworkDumpXML,
|
||||
qemudDispatchNetworkGetBridgeName,
|
||||
qemudDispatchDomainGetAutostart,
|
||||
NULL,
|
||||
qemudDispatchNetworkGetAutostart,
|
||||
NULL,
|
||||
};
|
||||
|
||||
/*
|
||||
* Returns -1 if message processing failed - eg, illegal header sizes,
|
||||
* a memory error dealing with stuff, or any other bad stuff which
|
||||
* should trigger immediate client disconnect
|
||||
*
|
||||
* Return 0 if message processing succeeded. NB, this does not mean
|
||||
* the operation itself succeeded - success/failure of the operation
|
||||
* is recorded by the return message type - either it matches the
|
||||
* incoming type, or is QEMUD_PKT_FAILURE
|
||||
*/
|
||||
|
||||
int qemudDispatch(struct qemud_server *server ATTRIBUTE_UNUSED,
|
||||
struct qemud_client *client,
|
||||
qemud_packet_client_data *in, qemud_packet_server_data *out) {
|
||||
clientFunc *funcs;
|
||||
unsigned int type = in->type;
|
||||
qemudDebug("> Dispatching request type %d, readonly ? %d",
|
||||
in->type, client->readonly);
|
||||
|
||||
if (!conn.magic) {
|
||||
qemudOpen(&conn, "qemu:///session", 0);
|
||||
conn.magic = 1;
|
||||
}
|
||||
virResetLastError();
|
||||
virConnResetLastError(&conn);
|
||||
|
||||
memset(out, 0, sizeof(*out));
|
||||
|
||||
if (type >= QEMUD_CLIENT_PKT_MAX) {
|
||||
qemudDebug("Illegal request type");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (client->readonly)
|
||||
funcs = funcsTransmitRO;
|
||||
else
|
||||
funcs = funcsTransmitRW;
|
||||
|
||||
if (!funcs[type]) {
|
||||
qemudDebug("Illegal operation requested");
|
||||
__virRaiseError(&conn, NULL, NULL, VIR_FROM_QEMU, VIR_ERR_OPERATION_DENIED, VIR_ERR_ERROR,
|
||||
NULL, NULL, NULL, -1, -1, "Illegal operation requested");
|
||||
qemudDispatchFailure(out);
|
||||
} else {
|
||||
if ((funcs[type])(in, out) < 0) {
|
||||
qemudDebug("Dispatch failed");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
qemudDebug("< Returning reply %d", out->type);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* indent-tabs-mode: nil
|
||||
* c-indent-level: 4
|
||||
* c-basic-offset: 4
|
||||
* tab-width: 4
|
||||
* End:
|
||||
*/
|
|
@ -1,43 +0,0 @@
|
|||
/*
|
||||
* dispatch.h: (De-)marshall wire messages to driver functions.
|
||||
*
|
||||
* Copyright (C) 2006, 2007 Red Hat, Inc.
|
||||
* Copyright (C) 2006 Daniel P. Berrange
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Daniel P. Berrange <berrange@redhat.com>
|
||||
*/
|
||||
|
||||
|
||||
#ifndef QEMUD_DISPATCH_H
|
||||
#define QEMUD_DISPATCH_H
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
|
||||
int qemudDispatch(struct qemud_server *server, struct qemud_client *client,
|
||||
struct qemud_packet_client_data *in, struct qemud_packet_server_data *out);
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* indent-tabs-mode: nil
|
||||
* c-indent-level: 4
|
||||
* c-basic-offset: 4
|
||||
* tab-width: 4
|
||||
* End:
|
||||
*/
|
|
@ -53,6 +53,8 @@
|
|||
#include "driver.h"
|
||||
#include "conf.h"
|
||||
|
||||
#define qemudLog(level, msg...) fprintf(stderr, msg)
|
||||
|
||||
static int qemudSetCloseExec(int fd) {
|
||||
int flags;
|
||||
if ((flags = fcntl(fd, F_GETFD)) < 0)
|
||||
|
@ -81,10 +83,6 @@ static int qemudSetNonBlock(int fd) {
|
|||
}
|
||||
|
||||
|
||||
#define virEventAddHandle(fd, events, cb, opaque) virEventAddHandleImpl(fd, events, cb, opaque)
|
||||
#define virEventRemoveHandle(fd) virEventRemoveHandleImpl(fd)
|
||||
|
||||
|
||||
static void qemudDispatchVMEvent(int fd, int events, void *opaque);
|
||||
int qemudStartVMDaemon(struct qemud_driver *driver,
|
||||
struct qemud_vm *vm);
|
||||
|
@ -1712,7 +1710,7 @@ static int qemudGetProcessInfo(unsigned long long *cpuTime, int pid) {
|
|||
}
|
||||
|
||||
|
||||
virDomainPtr qemudDomainLookupByID(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
virDomainPtr qemudDomainLookupByID(virConnectPtr conn,
|
||||
int id) {
|
||||
struct qemud_driver *driver = (struct qemud_driver *)conn->privateData;
|
||||
struct qemud_vm *vm = qemudFindVMByID(driver, id);
|
||||
|
@ -1723,19 +1721,16 @@ virDomainPtr qemudDomainLookupByID(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
dom = calloc(1, sizeof(struct _virDomain));
|
||||
dom = virGetDomain(conn, vm->def->name, vm->def->uuid);
|
||||
if (!dom) {
|
||||
qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY, "virDomainPtr");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dom->conn = conn;
|
||||
dom->id = vm->id;
|
||||
dom->name = vm->def->name;
|
||||
memcpy(dom->uuid, vm->def->uuid, sizeof(dom->uuid));
|
||||
return dom;
|
||||
}
|
||||
virDomainPtr qemudDomainLookupByUUID(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
virDomainPtr qemudDomainLookupByUUID(virConnectPtr conn,
|
||||
const unsigned char *uuid) {
|
||||
struct qemud_driver *driver = (struct qemud_driver *)conn->privateData;
|
||||
struct qemud_vm *vm = qemudFindVMByUUID(driver, uuid);
|
||||
|
@ -1746,19 +1741,16 @@ virDomainPtr qemudDomainLookupByUUID(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
dom = calloc(1, sizeof(struct _virDomain));
|
||||
dom = virGetDomain(conn, vm->def->name, vm->def->uuid);
|
||||
if (!dom) {
|
||||
qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY, "virDomainPtr");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dom->conn = conn;
|
||||
dom->id = vm->id;
|
||||
dom->name = vm->def->name;
|
||||
memcpy(dom->uuid, vm->def->uuid, sizeof(dom->uuid));
|
||||
return dom;
|
||||
}
|
||||
virDomainPtr qemudDomainLookupByName(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
virDomainPtr qemudDomainLookupByName(virConnectPtr conn,
|
||||
const char *name) {
|
||||
struct qemud_driver *driver = (struct qemud_driver *)conn->privateData;
|
||||
struct qemud_vm *vm = qemudFindVMByName(driver, name);
|
||||
|
@ -1769,16 +1761,13 @@ virDomainPtr qemudDomainLookupByName(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
dom = calloc(1, sizeof(struct _virDomain));
|
||||
dom = virGetDomain(conn, vm->def->name, vm->def->uuid);
|
||||
if (!dom) {
|
||||
qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY, "virDomainPtr");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dom->conn = conn;
|
||||
dom->id = vm->id;
|
||||
dom->name = vm->def->name;
|
||||
memcpy(dom->uuid, vm->def->uuid, sizeof(dom->uuid));
|
||||
return dom;
|
||||
}
|
||||
|
||||
|
@ -1828,17 +1817,13 @@ virDomainPtr qemudDomainCreate(virConnectPtr conn, const char *xml,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
dom = calloc(1, sizeof(struct _virDomain));
|
||||
dom = virGetDomain(conn, vm->def->name, vm->def->uuid);
|
||||
if (!dom) {
|
||||
qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY, "virDomainPtr");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dom->conn = conn;
|
||||
dom->id = vm->id;
|
||||
dom->name = vm->def->name;
|
||||
memcpy(dom->uuid, vm->def->uuid, sizeof(dom->uuid));
|
||||
|
||||
return dom;
|
||||
}
|
||||
|
||||
|
@ -2057,16 +2042,13 @@ virDomainPtr qemudDomainDefine(virConnectPtr conn, const char *xml) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
dom = calloc(1, sizeof(struct _virDomain));
|
||||
dom = virGetDomain(conn, vm->def->name, vm->def->uuid);
|
||||
if (!dom) {
|
||||
qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY, "virDomainPtr");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dom->conn = conn;
|
||||
dom->id = vm->id;
|
||||
dom->name = vm->def->name;
|
||||
memcpy(dom->uuid, vm->def->uuid, sizeof(dom->uuid));
|
||||
return dom;
|
||||
}
|
||||
|
||||
|
@ -2170,15 +2152,11 @@ virNetworkPtr qemudNetworkLookupByUUID(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
net = calloc(1, sizeof(struct _virNetwork));
|
||||
net = virGetNetwork(conn, network->def->name, network->def->uuid);
|
||||
if (!net) {
|
||||
qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY, "virNetworkPtr");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
net->conn = conn;
|
||||
net->name = network->def->name;
|
||||
memcpy(net->uuid, network->def->uuid, sizeof(net->uuid));
|
||||
return net;
|
||||
}
|
||||
virNetworkPtr qemudNetworkLookupByName(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
|
@ -2192,15 +2170,11 @@ virNetworkPtr qemudNetworkLookupByName(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
net = calloc(1, sizeof(struct _virNetwork));
|
||||
net = virGetNetwork(conn, network->def->name, network->def->uuid);
|
||||
if (!net) {
|
||||
qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY, "virNetworkPtr");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
net->conn = conn;
|
||||
net->name = network->def->name;
|
||||
memcpy(net->uuid, network->def->uuid, sizeof(net->uuid));
|
||||
return net;
|
||||
}
|
||||
|
||||
|
@ -2292,16 +2266,11 @@ virNetworkPtr qemudNetworkCreate(virConnectPtr conn, const char *xml) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
net = calloc(1, sizeof(struct _virNetwork));
|
||||
net = virGetNetwork(conn, network->def->name, network->def->uuid);
|
||||
if (!net) {
|
||||
qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY, "virNetworkPtr");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
net->conn = conn;
|
||||
net->name = network->def->name;
|
||||
memcpy(net->uuid, network->def->uuid, sizeof(net->uuid));
|
||||
|
||||
return net;
|
||||
}
|
||||
|
||||
|
@ -2324,16 +2293,11 @@ virNetworkPtr qemudNetworkDefine(virConnectPtr conn, const char *xml) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
net = calloc(1, sizeof(struct _virNetwork));
|
||||
net = virGetNetwork(conn, network->def->name, network->def->uuid);
|
||||
if (!net) {
|
||||
qemudReportError(conn, NULL, NULL, VIR_ERR_NO_MEMORY, "virNetworkPtr");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
net->conn = conn;
|
||||
net->name = network->def->name;
|
||||
memcpy(net->uuid, network->def->uuid, sizeof(net->uuid));
|
||||
|
||||
return net;
|
||||
}
|
||||
|
||||
|
@ -2555,6 +2519,13 @@ static virStateDriver qemuStateDriver = {
|
|||
qemudActive,
|
||||
};
|
||||
|
||||
int qemudRegister(void) {
|
||||
virRegisterDriver(&qemuDriver);
|
||||
virRegisterNetworkDriver(&qemuNetworkDriver);
|
||||
virRegisterStateDriver(&qemuStateDriver);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* indent-tabs-mode: nil
|
||||
|
|
|
@ -25,14 +25,13 @@
|
|||
#ifndef QEMUD_DRIVER_H
|
||||
#define QEMUD_DRIVER_H
|
||||
|
||||
#include "internal.h"
|
||||
#include "../src/internal.h"
|
||||
|
||||
int qemudStartup(void);
|
||||
int qemudReload(void);
|
||||
int qemudShutdown(void);
|
||||
int qemudActive(void);
|
||||
|
||||
int qemudRegister(void);
|
||||
|
||||
virDrvOpenStatus qemudOpen(virConnectPtr conn,
|
||||
const char *name,
|
||||
|
|
|
@ -25,8 +25,6 @@
|
|||
#ifndef QEMUD_INTERNAL_H__
|
||||
#define QEMUD_INTERNAL_H__
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <gnutls/gnutls.h>
|
||||
#include <gnutls/x509.h>
|
||||
|
||||
|
|
|
@ -38,6 +38,8 @@
|
|||
|
||||
#include "internal.h"
|
||||
|
||||
#define qemudLog(level, msg...) fprintf(stderr, msg)
|
||||
|
||||
enum {
|
||||
ADD = 0,
|
||||
REMOVE
|
||||
|
|
|
@ -20,12 +20,22 @@
|
|||
SERVICE=libvirtd
|
||||
PROCESS=libvirtd
|
||||
|
||||
LIBVIRTD_CONFIG=
|
||||
LIBVIRTD_ARGS=
|
||||
|
||||
test -f @sysconfdir@/sysconfig/libvirtd && . @sysconfdir@/sysconfig/libvirtd
|
||||
|
||||
LIBVIRTD_CONFIG_ARGS=
|
||||
if [ -n "$LIBVIRTD_CONFIG" ]
|
||||
then
|
||||
LIBVIRTD_CONFIG_ARGS="--config $LIBVIRTD_CONFIG"
|
||||
fi
|
||||
|
||||
RETVAL=0
|
||||
|
||||
start() {
|
||||
echo -n $"Starting $SERVICE daemon: "
|
||||
daemon --check $SERVICE $PROCESS --system --daemon
|
||||
daemon --check $SERVICE $PROCESS --daemon $LIBVIRTD_CONFIG_ARGS $LIBVIRTD_ARGS
|
||||
RETVAL=$?
|
||||
echo
|
||||
[ $RETVAL -eq 0 ] && touch @localstatedir@/lock/subsys/$SERVICE
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
# Override the default config file
|
||||
#LIBVIRTD_CONFIG=/etc/libvirt/libvirtd.conf
|
||||
|
||||
# Listen for TCP/IP connections
|
||||
# NB. must setup TLS/SSL keys prior to using this
|
||||
#LIBVIRTD_ARGS="--listen"
|
952
qemud/protocol.c
952
qemud/protocol.c
|
@ -5,958 +5,6 @@
|
|||
|
||||
#include "protocol.h"
|
||||
|
||||
bool_t
|
||||
xdr_qemud_domain_runstate (XDR *xdrs, qemud_domain_runstate *objp)
|
||||
{
|
||||
|
||||
if (!xdr_enum (xdrs, (enum_t *) objp))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_client_data_type (XDR *xdrs, qemud_packet_client_data_type *objp)
|
||||
{
|
||||
|
||||
if (!xdr_enum (xdrs, (enum_t *) objp))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_server_data_type (XDR *xdrs, qemud_packet_server_data_type *objp)
|
||||
{
|
||||
|
||||
if (!xdr_enum (xdrs, (enum_t *) objp))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_failure_reply (XDR *xdrs, qemud_packet_failure_reply *objp)
|
||||
{
|
||||
|
||||
if (!xdr_uint32_t (xdrs, &objp->code))
|
||||
return FALSE;
|
||||
if (!xdr_vector (xdrs, (char *)objp->message, QEMUD_MAX_ERROR_LEN,
|
||||
sizeof (char), (xdrproc_t) xdr_char))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_get_version_reply (XDR *xdrs, qemud_packet_get_version_reply *objp)
|
||||
{
|
||||
|
||||
if (!xdr_uint32_t (xdrs, &objp->versionNum))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_get_node_info_reply (XDR *xdrs, qemud_packet_get_node_info_reply *objp)
|
||||
{
|
||||
|
||||
if (!xdr_vector (xdrs, (char *)objp->model, 32,
|
||||
sizeof (char), (xdrproc_t) xdr_char))
|
||||
return FALSE;
|
||||
if (!xdr_uint32_t (xdrs, &objp->memory))
|
||||
return FALSE;
|
||||
if (!xdr_uint32_t (xdrs, &objp->cpus))
|
||||
return FALSE;
|
||||
if (!xdr_uint32_t (xdrs, &objp->mhz))
|
||||
return FALSE;
|
||||
if (!xdr_uint32_t (xdrs, &objp->nodes))
|
||||
return FALSE;
|
||||
if (!xdr_uint32_t (xdrs, &objp->sockets))
|
||||
return FALSE;
|
||||
if (!xdr_uint32_t (xdrs, &objp->cores))
|
||||
return FALSE;
|
||||
if (!xdr_uint32_t (xdrs, &objp->threads))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_get_capabilities_reply (XDR *xdrs, qemud_packet_get_capabilities_reply *objp)
|
||||
{
|
||||
|
||||
if (!xdr_vector (xdrs, (char *)objp->xml, QEMUD_MAX_XML_LEN,
|
||||
sizeof (char), (xdrproc_t) xdr_char))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_list_domains_reply (XDR *xdrs, qemud_packet_list_domains_reply *objp)
|
||||
{
|
||||
|
||||
if (!xdr_int32_t (xdrs, &objp->numDomains))
|
||||
return FALSE;
|
||||
if (!xdr_vector (xdrs, (char *)objp->domains, QEMUD_MAX_NUM_DOMAINS,
|
||||
sizeof (int32_t), (xdrproc_t) xdr_int32_t))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_num_domains_reply (XDR *xdrs, qemud_packet_num_domains_reply *objp)
|
||||
{
|
||||
|
||||
if (!xdr_int32_t (xdrs, &objp->numDomains))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_domain_create_request (XDR *xdrs, qemud_packet_domain_create_request *objp)
|
||||
{
|
||||
|
||||
if (!xdr_vector (xdrs, (char *)objp->xml, QEMUD_MAX_XML_LEN,
|
||||
sizeof (char), (xdrproc_t) xdr_char))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_domain_create_reply (XDR *xdrs, qemud_packet_domain_create_reply *objp)
|
||||
{
|
||||
|
||||
if (!xdr_int32_t (xdrs, &objp->id))
|
||||
return FALSE;
|
||||
if (!xdr_vector (xdrs, (char *)objp->uuid, QEMUD_UUID_RAW_LEN,
|
||||
sizeof (u_char), (xdrproc_t) xdr_u_char))
|
||||
return FALSE;
|
||||
if (!xdr_vector (xdrs, (char *)objp->name, QEMUD_MAX_NAME_LEN,
|
||||
sizeof (char), (xdrproc_t) xdr_char))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_domain_lookup_by_id_request (XDR *xdrs, qemud_packet_domain_lookup_by_id_request *objp)
|
||||
{
|
||||
|
||||
if (!xdr_int32_t (xdrs, &objp->id))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_domain_lookup_by_id_reply (XDR *xdrs, qemud_packet_domain_lookup_by_id_reply *objp)
|
||||
{
|
||||
|
||||
if (!xdr_vector (xdrs, (char *)objp->uuid, QEMUD_UUID_RAW_LEN,
|
||||
sizeof (u_char), (xdrproc_t) xdr_u_char))
|
||||
return FALSE;
|
||||
if (!xdr_vector (xdrs, (char *)objp->name, QEMUD_MAX_NAME_LEN,
|
||||
sizeof (char), (xdrproc_t) xdr_char))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_domain_lookup_by_name_request (XDR *xdrs, qemud_packet_domain_lookup_by_name_request *objp)
|
||||
{
|
||||
|
||||
if (!xdr_vector (xdrs, (char *)objp->name, QEMUD_MAX_NAME_LEN,
|
||||
sizeof (char), (xdrproc_t) xdr_char))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_domain_lookup_by_name_reply (XDR *xdrs, qemud_packet_domain_lookup_by_name_reply *objp)
|
||||
{
|
||||
|
||||
if (!xdr_int32_t (xdrs, &objp->id))
|
||||
return FALSE;
|
||||
if (!xdr_vector (xdrs, (char *)objp->uuid, QEMUD_UUID_RAW_LEN,
|
||||
sizeof (u_char), (xdrproc_t) xdr_u_char))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_domain_lookup_by_uuid_request (XDR *xdrs, qemud_packet_domain_lookup_by_uuid_request *objp)
|
||||
{
|
||||
|
||||
if (!xdr_vector (xdrs, (char *)objp->uuid, QEMUD_UUID_RAW_LEN,
|
||||
sizeof (u_char), (xdrproc_t) xdr_u_char))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_domain_lookup_by_uuid_reply (XDR *xdrs, qemud_packet_domain_lookup_by_uuid_reply *objp)
|
||||
{
|
||||
|
||||
if (!xdr_int32_t (xdrs, &objp->id))
|
||||
return FALSE;
|
||||
if (!xdr_vector (xdrs, (char *)objp->name, QEMUD_MAX_NAME_LEN,
|
||||
sizeof (char), (xdrproc_t) xdr_char))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_domain_suspend_request (XDR *xdrs, qemud_packet_domain_suspend_request *objp)
|
||||
{
|
||||
|
||||
if (!xdr_int32_t (xdrs, &objp->id))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_domain_resume_request (XDR *xdrs, qemud_packet_domain_resume_request *objp)
|
||||
{
|
||||
|
||||
if (!xdr_int32_t (xdrs, &objp->id))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_domain_destroy_request (XDR *xdrs, qemud_packet_domain_destroy_request *objp)
|
||||
{
|
||||
|
||||
if (!xdr_int32_t (xdrs, &objp->id))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_domain_get_info_request (XDR *xdrs, qemud_packet_domain_get_info_request *objp)
|
||||
{
|
||||
|
||||
if (!xdr_vector (xdrs, (char *)objp->uuid, QEMUD_UUID_RAW_LEN,
|
||||
sizeof (u_char), (xdrproc_t) xdr_u_char))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_domain_get_info_reply (XDR *xdrs, qemud_packet_domain_get_info_reply *objp)
|
||||
{
|
||||
|
||||
if (!xdr_uint64_t (xdrs, &objp->cpuTime))
|
||||
return FALSE;
|
||||
if (!xdr_uint32_t (xdrs, &objp->runstate))
|
||||
return FALSE;
|
||||
if (!xdr_uint32_t (xdrs, &objp->memory))
|
||||
return FALSE;
|
||||
if (!xdr_uint32_t (xdrs, &objp->maxmem))
|
||||
return FALSE;
|
||||
if (!xdr_uint32_t (xdrs, &objp->nrVirtCpu))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_domain_save_request (XDR *xdrs, qemud_packet_domain_save_request *objp)
|
||||
{
|
||||
|
||||
if (!xdr_int32_t (xdrs, &objp->id))
|
||||
return FALSE;
|
||||
if (!xdr_vector (xdrs, (char *)objp->file, PATH_MAX,
|
||||
sizeof (char), (xdrproc_t) xdr_char))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_domain_restore_request (XDR *xdrs, qemud_packet_domain_restore_request *objp)
|
||||
{
|
||||
|
||||
if (!xdr_vector (xdrs, (char *)objp->file, PATH_MAX,
|
||||
sizeof (char), (xdrproc_t) xdr_char))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_domain_restore_reply (XDR *xdrs, qemud_packet_domain_restore_reply *objp)
|
||||
{
|
||||
|
||||
if (!xdr_int32_t (xdrs, &objp->id))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_domain_dump_xml_request (XDR *xdrs, qemud_packet_domain_dump_xml_request *objp)
|
||||
{
|
||||
|
||||
if (!xdr_vector (xdrs, (char *)objp->uuid, QEMUD_UUID_RAW_LEN,
|
||||
sizeof (u_char), (xdrproc_t) xdr_u_char))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_domain_dump_xml_reply (XDR *xdrs, qemud_packet_domain_dump_xml_reply *objp)
|
||||
{
|
||||
|
||||
if (!xdr_vector (xdrs, (char *)objp->xml, QEMUD_MAX_XML_LEN,
|
||||
sizeof (char), (xdrproc_t) xdr_char))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_list_defined_domains_reply (XDR *xdrs, qemud_packet_list_defined_domains_reply *objp)
|
||||
{
|
||||
|
||||
if (!xdr_uint32_t (xdrs, &objp->numDomains))
|
||||
return FALSE;
|
||||
if (!xdr_vector (xdrs, (char *)objp->domains, QEMUD_MAX_DOMAINS_NAME_BUF,
|
||||
sizeof (char), (xdrproc_t) xdr_char))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_num_defined_domains_reply (XDR *xdrs, qemud_packet_num_defined_domains_reply *objp)
|
||||
{
|
||||
|
||||
if (!xdr_uint32_t (xdrs, &objp->numDomains))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_domain_start_request (XDR *xdrs, qemud_packet_domain_start_request *objp)
|
||||
{
|
||||
|
||||
if (!xdr_vector (xdrs, (char *)objp->uuid, QEMUD_UUID_RAW_LEN,
|
||||
sizeof (u_char), (xdrproc_t) xdr_u_char))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_domain_start_reply (XDR *xdrs, qemud_packet_domain_start_reply *objp)
|
||||
{
|
||||
|
||||
if (!xdr_int32_t (xdrs, &objp->id))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_domain_define_request (XDR *xdrs, qemud_packet_domain_define_request *objp)
|
||||
{
|
||||
|
||||
if (!xdr_vector (xdrs, (char *)objp->xml, QEMUD_MAX_XML_LEN,
|
||||
sizeof (char), (xdrproc_t) xdr_char))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_domain_define_reply (XDR *xdrs, qemud_packet_domain_define_reply *objp)
|
||||
{
|
||||
|
||||
if (!xdr_vector (xdrs, (char *)objp->uuid, QEMUD_UUID_RAW_LEN,
|
||||
sizeof (u_char), (xdrproc_t) xdr_u_char))
|
||||
return FALSE;
|
||||
if (!xdr_vector (xdrs, (char *)objp->name, QEMUD_MAX_NAME_LEN,
|
||||
sizeof (char), (xdrproc_t) xdr_char))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_domain_undefine_request (XDR *xdrs, qemud_packet_domain_undefine_request *objp)
|
||||
{
|
||||
|
||||
if (!xdr_vector (xdrs, (char *)objp->uuid, QEMUD_UUID_RAW_LEN,
|
||||
sizeof (u_char), (xdrproc_t) xdr_u_char))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_num_networks_reply (XDR *xdrs, qemud_packet_num_networks_reply *objp)
|
||||
{
|
||||
|
||||
if (!xdr_uint32_t (xdrs, &objp->numNetworks))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_list_networks_reply (XDR *xdrs, qemud_packet_list_networks_reply *objp)
|
||||
{
|
||||
|
||||
if (!xdr_uint32_t (xdrs, &objp->numNetworks))
|
||||
return FALSE;
|
||||
if (!xdr_vector (xdrs, (char *)objp->networks, QEMUD_MAX_NETWORKS_NAME_BUF,
|
||||
sizeof (char), (xdrproc_t) xdr_char))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_num_defined_networks_reply (XDR *xdrs, qemud_packet_num_defined_networks_reply *objp)
|
||||
{
|
||||
|
||||
if (!xdr_uint32_t (xdrs, &objp->numNetworks))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_list_defined_networks_reply (XDR *xdrs, qemud_packet_list_defined_networks_reply *objp)
|
||||
{
|
||||
|
||||
if (!xdr_uint32_t (xdrs, &objp->numNetworks))
|
||||
return FALSE;
|
||||
if (!xdr_vector (xdrs, (char *)objp->networks, QEMUD_MAX_NETWORKS_NAME_BUF,
|
||||
sizeof (char), (xdrproc_t) xdr_char))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_network_lookup_by_name_request (XDR *xdrs, qemud_packet_network_lookup_by_name_request *objp)
|
||||
{
|
||||
|
||||
if (!xdr_vector (xdrs, (char *)objp->name, QEMUD_MAX_NAME_LEN,
|
||||
sizeof (char), (xdrproc_t) xdr_char))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_network_lookup_by_name_reply (XDR *xdrs, qemud_packet_network_lookup_by_name_reply *objp)
|
||||
{
|
||||
|
||||
if (!xdr_int32_t (xdrs, &objp->id))
|
||||
return FALSE;
|
||||
if (!xdr_vector (xdrs, (char *)objp->uuid, QEMUD_UUID_RAW_LEN,
|
||||
sizeof (u_char), (xdrproc_t) xdr_u_char))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_network_lookup_by_uuid_request (XDR *xdrs, qemud_packet_network_lookup_by_uuid_request *objp)
|
||||
{
|
||||
|
||||
if (!xdr_vector (xdrs, (char *)objp->uuid, QEMUD_UUID_RAW_LEN,
|
||||
sizeof (u_char), (xdrproc_t) xdr_u_char))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_network_lookup_by_uuid_reply (XDR *xdrs, qemud_packet_network_lookup_by_uuid_reply *objp)
|
||||
{
|
||||
|
||||
if (!xdr_int32_t (xdrs, &objp->id))
|
||||
return FALSE;
|
||||
if (!xdr_vector (xdrs, (char *)objp->name, QEMUD_MAX_NAME_LEN,
|
||||
sizeof (char), (xdrproc_t) xdr_char))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_network_create_request (XDR *xdrs, qemud_packet_network_create_request *objp)
|
||||
{
|
||||
|
||||
if (!xdr_vector (xdrs, (char *)objp->xml, QEMUD_MAX_XML_LEN,
|
||||
sizeof (char), (xdrproc_t) xdr_char))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_network_create_reply (XDR *xdrs, qemud_packet_network_create_reply *objp)
|
||||
{
|
||||
|
||||
if (!xdr_vector (xdrs, (char *)objp->uuid, QEMUD_UUID_RAW_LEN,
|
||||
sizeof (u_char), (xdrproc_t) xdr_u_char))
|
||||
return FALSE;
|
||||
if (!xdr_vector (xdrs, (char *)objp->name, QEMUD_MAX_NAME_LEN,
|
||||
sizeof (char), (xdrproc_t) xdr_char))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_network_define_request (XDR *xdrs, qemud_packet_network_define_request *objp)
|
||||
{
|
||||
|
||||
if (!xdr_vector (xdrs, (char *)objp->xml, QEMUD_MAX_XML_LEN,
|
||||
sizeof (char), (xdrproc_t) xdr_char))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_network_define_reply (XDR *xdrs, qemud_packet_network_define_reply *objp)
|
||||
{
|
||||
|
||||
if (!xdr_vector (xdrs, (char *)objp->uuid, QEMUD_UUID_RAW_LEN,
|
||||
sizeof (u_char), (xdrproc_t) xdr_u_char))
|
||||
return FALSE;
|
||||
if (!xdr_vector (xdrs, (char *)objp->name, QEMUD_MAX_NAME_LEN,
|
||||
sizeof (char), (xdrproc_t) xdr_char))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_network_undefine_request (XDR *xdrs, qemud_packet_network_undefine_request *objp)
|
||||
{
|
||||
|
||||
if (!xdr_vector (xdrs, (char *)objp->uuid, QEMUD_UUID_RAW_LEN,
|
||||
sizeof (u_char), (xdrproc_t) xdr_u_char))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_network_start_request (XDR *xdrs, qemud_packet_network_start_request *objp)
|
||||
{
|
||||
|
||||
if (!xdr_vector (xdrs, (char *)objp->uuid, QEMUD_UUID_RAW_LEN,
|
||||
sizeof (u_char), (xdrproc_t) xdr_u_char))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_network_destroy_request (XDR *xdrs, qemud_packet_network_destroy_request *objp)
|
||||
{
|
||||
|
||||
if (!xdr_vector (xdrs, (char *)objp->uuid, QEMUD_UUID_RAW_LEN,
|
||||
sizeof (u_char), (xdrproc_t) xdr_u_char))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_network_dump_xml_request (XDR *xdrs, qemud_packet_network_dump_xml_request *objp)
|
||||
{
|
||||
|
||||
if (!xdr_vector (xdrs, (char *)objp->uuid, QEMUD_UUID_RAW_LEN,
|
||||
sizeof (u_char), (xdrproc_t) xdr_u_char))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_network_dump_xml_reply (XDR *xdrs, qemud_packet_network_dump_xml_reply *objp)
|
||||
{
|
||||
|
||||
if (!xdr_vector (xdrs, (char *)objp->xml, QEMUD_MAX_XML_LEN,
|
||||
sizeof (char), (xdrproc_t) xdr_char))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_network_get_bridge_name_request (XDR *xdrs, qemud_packet_network_get_bridge_name_request *objp)
|
||||
{
|
||||
|
||||
if (!xdr_vector (xdrs, (char *)objp->uuid, QEMUD_UUID_RAW_LEN,
|
||||
sizeof (u_char), (xdrproc_t) xdr_u_char))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_network_get_bridge_name_reply (XDR *xdrs, qemud_packet_network_get_bridge_name_reply *objp)
|
||||
{
|
||||
|
||||
if (!xdr_vector (xdrs, (char *)objp->ifname, QEMUD_MAX_IFNAME_LEN,
|
||||
sizeof (char), (xdrproc_t) xdr_char))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_domain_get_autostart_request (XDR *xdrs, qemud_packet_domain_get_autostart_request *objp)
|
||||
{
|
||||
|
||||
if (!xdr_vector (xdrs, (char *)objp->uuid, QEMUD_UUID_RAW_LEN,
|
||||
sizeof (u_char), (xdrproc_t) xdr_u_char))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_domain_get_autostart_reply (XDR *xdrs, qemud_packet_domain_get_autostart_reply *objp)
|
||||
{
|
||||
|
||||
if (!xdr_uint32_t (xdrs, &objp->autostart))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_domain_set_autostart_request (XDR *xdrs, qemud_packet_domain_set_autostart_request *objp)
|
||||
{
|
||||
|
||||
if (!xdr_vector (xdrs, (char *)objp->uuid, QEMUD_UUID_RAW_LEN,
|
||||
sizeof (u_char), (xdrproc_t) xdr_u_char))
|
||||
return FALSE;
|
||||
if (!xdr_uint32_t (xdrs, &objp->autostart))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_network_get_autostart_request (XDR *xdrs, qemud_packet_network_get_autostart_request *objp)
|
||||
{
|
||||
|
||||
if (!xdr_vector (xdrs, (char *)objp->uuid, QEMUD_UUID_RAW_LEN,
|
||||
sizeof (u_char), (xdrproc_t) xdr_u_char))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_network_get_autostart_reply (XDR *xdrs, qemud_packet_network_get_autostart_reply *objp)
|
||||
{
|
||||
|
||||
if (!xdr_uint32_t (xdrs, &objp->autostart))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_network_set_autostart_request (XDR *xdrs, qemud_packet_network_set_autostart_request *objp)
|
||||
{
|
||||
|
||||
if (!xdr_vector (xdrs, (char *)objp->uuid, QEMUD_UUID_RAW_LEN,
|
||||
sizeof (u_char), (xdrproc_t) xdr_u_char))
|
||||
return FALSE;
|
||||
if (!xdr_uint32_t (xdrs, &objp->autostart))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_client_data (XDR *xdrs, qemud_packet_client_data *objp)
|
||||
{
|
||||
|
||||
if (!xdr_qemud_packet_client_data_type (xdrs, &objp->type))
|
||||
return FALSE;
|
||||
switch (objp->type) {
|
||||
case QEMUD_CLIENT_PKT_GET_VERSION:
|
||||
break;
|
||||
case QEMUD_CLIENT_PKT_GET_NODEINFO:
|
||||
break;
|
||||
case QEMUD_CLIENT_PKT_LIST_DOMAINS:
|
||||
break;
|
||||
case QEMUD_CLIENT_PKT_NUM_DOMAINS:
|
||||
break;
|
||||
case QEMUD_CLIENT_PKT_DOMAIN_CREATE:
|
||||
if (!xdr_qemud_packet_domain_create_request (xdrs, &objp->qemud_packet_client_data_u.domainCreateRequest))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_CLIENT_PKT_DOMAIN_LOOKUP_BY_ID:
|
||||
if (!xdr_qemud_packet_domain_lookup_by_id_request (xdrs, &objp->qemud_packet_client_data_u.domainLookupByIDRequest))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_CLIENT_PKT_DOMAIN_LOOKUP_BY_UUID:
|
||||
if (!xdr_qemud_packet_domain_lookup_by_uuid_request (xdrs, &objp->qemud_packet_client_data_u.domainLookupByUUIDRequest))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_CLIENT_PKT_DOMAIN_LOOKUP_BY_NAME:
|
||||
if (!xdr_qemud_packet_domain_lookup_by_name_request (xdrs, &objp->qemud_packet_client_data_u.domainLookupByNameRequest))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_CLIENT_PKT_DOMAIN_SUSPEND:
|
||||
if (!xdr_qemud_packet_domain_suspend_request (xdrs, &objp->qemud_packet_client_data_u.domainSuspendRequest))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_CLIENT_PKT_DOMAIN_RESUME:
|
||||
if (!xdr_qemud_packet_domain_resume_request (xdrs, &objp->qemud_packet_client_data_u.domainResumeRequest))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_CLIENT_PKT_DOMAIN_DESTROY:
|
||||
if (!xdr_qemud_packet_domain_destroy_request (xdrs, &objp->qemud_packet_client_data_u.domainDestroyRequest))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_CLIENT_PKT_DOMAIN_GET_INFO:
|
||||
if (!xdr_qemud_packet_domain_get_info_request (xdrs, &objp->qemud_packet_client_data_u.domainGetInfoRequest))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_CLIENT_PKT_DOMAIN_SAVE:
|
||||
if (!xdr_qemud_packet_domain_save_request (xdrs, &objp->qemud_packet_client_data_u.domainSaveRequest))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_CLIENT_PKT_DOMAIN_RESTORE:
|
||||
if (!xdr_qemud_packet_domain_restore_request (xdrs, &objp->qemud_packet_client_data_u.domainRestoreRequest))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_CLIENT_PKT_DUMP_XML:
|
||||
if (!xdr_qemud_packet_domain_dump_xml_request (xdrs, &objp->qemud_packet_client_data_u.domainDumpXMLRequest))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_CLIENT_PKT_LIST_DEFINED_DOMAINS:
|
||||
break;
|
||||
case QEMUD_CLIENT_PKT_NUM_DEFINED_DOMAINS:
|
||||
break;
|
||||
case QEMUD_CLIENT_PKT_DOMAIN_START:
|
||||
if (!xdr_qemud_packet_domain_start_request (xdrs, &objp->qemud_packet_client_data_u.domainStartRequest))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_CLIENT_PKT_DOMAIN_DEFINE:
|
||||
if (!xdr_qemud_packet_domain_define_request (xdrs, &objp->qemud_packet_client_data_u.domainDefineRequest))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_CLIENT_PKT_DOMAIN_UNDEFINE:
|
||||
if (!xdr_qemud_packet_domain_undefine_request (xdrs, &objp->qemud_packet_client_data_u.domainUndefineRequest))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_CLIENT_PKT_NUM_NETWORKS:
|
||||
break;
|
||||
case QEMUD_CLIENT_PKT_LIST_NETWORKS:
|
||||
break;
|
||||
case QEMUD_CLIENT_PKT_NUM_DEFINED_NETWORKS:
|
||||
break;
|
||||
case QEMUD_CLIENT_PKT_LIST_DEFINED_NETWORKS:
|
||||
break;
|
||||
case QEMUD_CLIENT_PKT_NETWORK_LOOKUP_BY_UUID:
|
||||
if (!xdr_qemud_packet_network_lookup_by_uuid_request (xdrs, &objp->qemud_packet_client_data_u.networkLookupByUUIDRequest))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_CLIENT_PKT_NETWORK_LOOKUP_BY_NAME:
|
||||
if (!xdr_qemud_packet_network_lookup_by_name_request (xdrs, &objp->qemud_packet_client_data_u.networkLookupByNameRequest))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_CLIENT_PKT_NETWORK_CREATE:
|
||||
if (!xdr_qemud_packet_network_create_request (xdrs, &objp->qemud_packet_client_data_u.networkCreateRequest))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_CLIENT_PKT_NETWORK_DEFINE:
|
||||
if (!xdr_qemud_packet_network_define_request (xdrs, &objp->qemud_packet_client_data_u.networkDefineRequest))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_CLIENT_PKT_NETWORK_UNDEFINE:
|
||||
if (!xdr_qemud_packet_network_undefine_request (xdrs, &objp->qemud_packet_client_data_u.networkUndefineRequest))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_CLIENT_PKT_NETWORK_START:
|
||||
if (!xdr_qemud_packet_network_start_request (xdrs, &objp->qemud_packet_client_data_u.networkStartRequest))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_CLIENT_PKT_NETWORK_DESTROY:
|
||||
if (!xdr_qemud_packet_network_destroy_request (xdrs, &objp->qemud_packet_client_data_u.networkDestroyRequest))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_CLIENT_PKT_NETWORK_DUMP_XML:
|
||||
if (!xdr_qemud_packet_network_dump_xml_request (xdrs, &objp->qemud_packet_client_data_u.networkDumpXMLRequest))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_CLIENT_PKT_NETWORK_GET_BRIDGE_NAME:
|
||||
if (!xdr_qemud_packet_network_get_bridge_name_request (xdrs, &objp->qemud_packet_client_data_u.networkGetBridgeNameRequest))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_CLIENT_PKT_DOMAIN_GET_AUTOSTART:
|
||||
if (!xdr_qemud_packet_domain_get_autostart_request (xdrs, &objp->qemud_packet_client_data_u.domainGetAutostartRequest))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_CLIENT_PKT_DOMAIN_SET_AUTOSTART:
|
||||
if (!xdr_qemud_packet_domain_set_autostart_request (xdrs, &objp->qemud_packet_client_data_u.domainSetAutostartRequest))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_CLIENT_PKT_NETWORK_GET_AUTOSTART:
|
||||
if (!xdr_qemud_packet_network_get_autostart_request (xdrs, &objp->qemud_packet_client_data_u.networkGetAutostartRequest))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_CLIENT_PKT_NETWORK_SET_AUTOSTART:
|
||||
if (!xdr_qemud_packet_network_set_autostart_request (xdrs, &objp->qemud_packet_client_data_u.networkSetAutostartRequest))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_CLIENT_PKT_GET_CAPABILITIES:
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_server_data (XDR *xdrs, qemud_packet_server_data *objp)
|
||||
{
|
||||
|
||||
if (!xdr_qemud_packet_server_data_type (xdrs, &objp->type))
|
||||
return FALSE;
|
||||
switch (objp->type) {
|
||||
case QEMUD_SERVER_PKT_FAILURE:
|
||||
if (!xdr_qemud_packet_failure_reply (xdrs, &objp->qemud_packet_server_data_u.failureReply))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_SERVER_PKT_GET_VERSION:
|
||||
if (!xdr_qemud_packet_get_version_reply (xdrs, &objp->qemud_packet_server_data_u.getVersionReply))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_SERVER_PKT_GET_NODEINFO:
|
||||
if (!xdr_qemud_packet_get_node_info_reply (xdrs, &objp->qemud_packet_server_data_u.getNodeInfoReply))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_SERVER_PKT_LIST_DOMAINS:
|
||||
if (!xdr_qemud_packet_list_domains_reply (xdrs, &objp->qemud_packet_server_data_u.listDomainsReply))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_SERVER_PKT_NUM_DOMAINS:
|
||||
if (!xdr_qemud_packet_num_domains_reply (xdrs, &objp->qemud_packet_server_data_u.numDomainsReply))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_SERVER_PKT_DOMAIN_CREATE:
|
||||
if (!xdr_qemud_packet_domain_create_reply (xdrs, &objp->qemud_packet_server_data_u.domainCreateReply))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_SERVER_PKT_DOMAIN_LOOKUP_BY_ID:
|
||||
if (!xdr_qemud_packet_domain_lookup_by_id_reply (xdrs, &objp->qemud_packet_server_data_u.domainLookupByIDReply))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_SERVER_PKT_DOMAIN_LOOKUP_BY_UUID:
|
||||
if (!xdr_qemud_packet_domain_lookup_by_uuid_reply (xdrs, &objp->qemud_packet_server_data_u.domainLookupByUUIDReply))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_SERVER_PKT_DOMAIN_LOOKUP_BY_NAME:
|
||||
if (!xdr_qemud_packet_domain_lookup_by_name_reply (xdrs, &objp->qemud_packet_server_data_u.domainLookupByNameReply))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_SERVER_PKT_DOMAIN_SUSPEND:
|
||||
break;
|
||||
case QEMUD_SERVER_PKT_DOMAIN_RESUME:
|
||||
break;
|
||||
case QEMUD_SERVER_PKT_DOMAIN_DESTROY:
|
||||
break;
|
||||
case QEMUD_SERVER_PKT_DOMAIN_GET_INFO:
|
||||
if (!xdr_qemud_packet_domain_get_info_reply (xdrs, &objp->qemud_packet_server_data_u.domainGetInfoReply))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_SERVER_PKT_DOMAIN_SAVE:
|
||||
break;
|
||||
case QEMUD_SERVER_PKT_DOMAIN_RESTORE:
|
||||
if (!xdr_qemud_packet_domain_restore_reply (xdrs, &objp->qemud_packet_server_data_u.domainRestoreReply))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_SERVER_PKT_DUMP_XML:
|
||||
if (!xdr_qemud_packet_domain_dump_xml_reply (xdrs, &objp->qemud_packet_server_data_u.domainDumpXMLReply))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_SERVER_PKT_LIST_DEFINED_DOMAINS:
|
||||
if (!xdr_qemud_packet_list_defined_domains_reply (xdrs, &objp->qemud_packet_server_data_u.listDefinedDomainsReply))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_SERVER_PKT_NUM_DEFINED_DOMAINS:
|
||||
if (!xdr_qemud_packet_num_defined_domains_reply (xdrs, &objp->qemud_packet_server_data_u.numDefinedDomainsReply))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_SERVER_PKT_DOMAIN_START:
|
||||
if (!xdr_qemud_packet_domain_start_reply (xdrs, &objp->qemud_packet_server_data_u.domainStartReply))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_SERVER_PKT_DOMAIN_DEFINE:
|
||||
if (!xdr_qemud_packet_domain_define_reply (xdrs, &objp->qemud_packet_server_data_u.domainDefineReply))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_SERVER_PKT_DOMAIN_UNDEFINE:
|
||||
break;
|
||||
case QEMUD_SERVER_PKT_NUM_NETWORKS:
|
||||
if (!xdr_qemud_packet_num_networks_reply (xdrs, &objp->qemud_packet_server_data_u.numNetworksReply))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_SERVER_PKT_LIST_NETWORKS:
|
||||
if (!xdr_qemud_packet_list_networks_reply (xdrs, &objp->qemud_packet_server_data_u.listNetworksReply))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_SERVER_PKT_NUM_DEFINED_NETWORKS:
|
||||
if (!xdr_qemud_packet_num_defined_networks_reply (xdrs, &objp->qemud_packet_server_data_u.numDefinedNetworksReply))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_SERVER_PKT_LIST_DEFINED_NETWORKS:
|
||||
if (!xdr_qemud_packet_list_defined_networks_reply (xdrs, &objp->qemud_packet_server_data_u.listDefinedNetworksReply))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_SERVER_PKT_NETWORK_LOOKUP_BY_UUID:
|
||||
if (!xdr_qemud_packet_network_lookup_by_uuid_reply (xdrs, &objp->qemud_packet_server_data_u.networkLookupByUUIDReply))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_SERVER_PKT_NETWORK_LOOKUP_BY_NAME:
|
||||
if (!xdr_qemud_packet_network_lookup_by_name_reply (xdrs, &objp->qemud_packet_server_data_u.networkLookupByNameReply))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_SERVER_PKT_NETWORK_CREATE:
|
||||
if (!xdr_qemud_packet_network_create_reply (xdrs, &objp->qemud_packet_server_data_u.networkCreateReply))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_SERVER_PKT_NETWORK_DEFINE:
|
||||
if (!xdr_qemud_packet_network_define_reply (xdrs, &objp->qemud_packet_server_data_u.networkDefineReply))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_SERVER_PKT_NETWORK_UNDEFINE:
|
||||
break;
|
||||
case QEMUD_SERVER_PKT_NETWORK_START:
|
||||
break;
|
||||
case QEMUD_SERVER_PKT_NETWORK_DESTROY:
|
||||
break;
|
||||
case QEMUD_SERVER_PKT_NETWORK_DUMP_XML:
|
||||
if (!xdr_qemud_packet_network_dump_xml_reply (xdrs, &objp->qemud_packet_server_data_u.networkDumpXMLReply))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_SERVER_PKT_NETWORK_GET_BRIDGE_NAME:
|
||||
if (!xdr_qemud_packet_network_get_bridge_name_reply (xdrs, &objp->qemud_packet_server_data_u.networkGetBridgeNameReply))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_SERVER_PKT_DOMAIN_GET_AUTOSTART:
|
||||
if (!xdr_qemud_packet_domain_get_autostart_reply (xdrs, &objp->qemud_packet_server_data_u.domainGetAutostartReply))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_SERVER_PKT_DOMAIN_SET_AUTOSTART:
|
||||
break;
|
||||
case QEMUD_SERVER_PKT_NETWORK_GET_AUTOSTART:
|
||||
if (!xdr_qemud_packet_network_get_autostart_reply (xdrs, &objp->qemud_packet_server_data_u.networkGetAutostartReply))
|
||||
return FALSE;
|
||||
break;
|
||||
case QEMUD_SERVER_PKT_NETWORK_SET_AUTOSTART:
|
||||
break;
|
||||
case QEMUD_SERVER_PKT_GET_CAPABILITIES:
|
||||
if (!xdr_qemud_packet_get_capabilities_reply (xdrs, &objp->qemud_packet_server_data_u.getCapabilitiesReply))
|
||||
return FALSE;
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_client (XDR *xdrs, qemud_packet_client *objp)
|
||||
{
|
||||
|
||||
if (!xdr_uint32_t (xdrs, &objp->serial))
|
||||
return FALSE;
|
||||
if (!xdr_qemud_packet_client_data (xdrs, &objp->data))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_server (XDR *xdrs, qemud_packet_server *objp)
|
||||
{
|
||||
|
||||
if (!xdr_uint32_t (xdrs, &objp->serial))
|
||||
return FALSE;
|
||||
if (!xdr_uint32_t (xdrs, &objp->inReplyTo))
|
||||
return FALSE;
|
||||
if (!xdr_qemud_packet_server_data (xdrs, &objp->data))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t
|
||||
xdr_qemud_packet_header (XDR *xdrs, qemud_packet_header *objp)
|
||||
{
|
||||
|
|
621
qemud/protocol.h
621
qemud/protocol.h
|
@ -13,501 +13,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define QEMUD_UUID_RAW_LEN 16
|
||||
#define QEMUD_MAX_NAME_LEN 50
|
||||
#define QEMUD_MAX_XML_LEN 4096
|
||||
#define QEMUD_MAX_IFNAME_LEN 50
|
||||
#define QEMUD_MAX_NUM_DOMAINS 100
|
||||
#define QEMUD_MAX_NUM_NETWORKS 100
|
||||
#define QEMUD_MAX_DOMAINS_NAME_BUF 5000
|
||||
#define QEMUD_MAX_NETWORKS_NAME_BUF 5000
|
||||
#define QEMUD_MAX_ERROR_LEN 1024
|
||||
|
||||
enum qemud_domain_runstate {
|
||||
QEMUD_STATE_RUNNING = 1,
|
||||
QEMUD_STATE_PAUSED = 1 + 1,
|
||||
QEMUD_STATE_STOPPED = 1 + 2,
|
||||
};
|
||||
typedef enum qemud_domain_runstate qemud_domain_runstate;
|
||||
|
||||
enum qemud_packet_client_data_type {
|
||||
QEMUD_CLIENT_PKT_GET_VERSION = 0,
|
||||
QEMUD_CLIENT_PKT_GET_NODEINFO = 1,
|
||||
QEMUD_CLIENT_PKT_LIST_DOMAINS = 2,
|
||||
QEMUD_CLIENT_PKT_NUM_DOMAINS = 3,
|
||||
QEMUD_CLIENT_PKT_DOMAIN_CREATE = 4,
|
||||
QEMUD_CLIENT_PKT_DOMAIN_LOOKUP_BY_ID = 5,
|
||||
QEMUD_CLIENT_PKT_DOMAIN_LOOKUP_BY_UUID = 6,
|
||||
QEMUD_CLIENT_PKT_DOMAIN_LOOKUP_BY_NAME = 7,
|
||||
QEMUD_CLIENT_PKT_DOMAIN_SUSPEND = 8,
|
||||
QEMUD_CLIENT_PKT_DOMAIN_RESUME = 9,
|
||||
QEMUD_CLIENT_PKT_DOMAIN_DESTROY = 10,
|
||||
QEMUD_CLIENT_PKT_DOMAIN_GET_INFO = 11,
|
||||
QEMUD_CLIENT_PKT_DOMAIN_SAVE = 12,
|
||||
QEMUD_CLIENT_PKT_DOMAIN_RESTORE = 13,
|
||||
QEMUD_CLIENT_PKT_DUMP_XML = 14,
|
||||
QEMUD_CLIENT_PKT_LIST_DEFINED_DOMAINS = 15,
|
||||
QEMUD_CLIENT_PKT_NUM_DEFINED_DOMAINS = 16,
|
||||
QEMUD_CLIENT_PKT_DOMAIN_START = 17,
|
||||
QEMUD_CLIENT_PKT_DOMAIN_DEFINE = 18,
|
||||
QEMUD_CLIENT_PKT_DOMAIN_UNDEFINE = 19,
|
||||
QEMUD_CLIENT_PKT_NUM_NETWORKS = 20,
|
||||
QEMUD_CLIENT_PKT_LIST_NETWORKS = 21,
|
||||
QEMUD_CLIENT_PKT_NUM_DEFINED_NETWORKS = 22,
|
||||
QEMUD_CLIENT_PKT_LIST_DEFINED_NETWORKS = 23,
|
||||
QEMUD_CLIENT_PKT_NETWORK_LOOKUP_BY_UUID = 24,
|
||||
QEMUD_CLIENT_PKT_NETWORK_LOOKUP_BY_NAME = 25,
|
||||
QEMUD_CLIENT_PKT_NETWORK_CREATE = 26,
|
||||
QEMUD_CLIENT_PKT_NETWORK_DEFINE = 27,
|
||||
QEMUD_CLIENT_PKT_NETWORK_UNDEFINE = 28,
|
||||
QEMUD_CLIENT_PKT_NETWORK_START = 29,
|
||||
QEMUD_CLIENT_PKT_NETWORK_DESTROY = 30,
|
||||
QEMUD_CLIENT_PKT_NETWORK_DUMP_XML = 31,
|
||||
QEMUD_CLIENT_PKT_NETWORK_GET_BRIDGE_NAME = 32,
|
||||
QEMUD_CLIENT_PKT_DOMAIN_GET_AUTOSTART = 33,
|
||||
QEMUD_CLIENT_PKT_DOMAIN_SET_AUTOSTART = 34,
|
||||
QEMUD_CLIENT_PKT_NETWORK_GET_AUTOSTART = 35,
|
||||
QEMUD_CLIENT_PKT_NETWORK_SET_AUTOSTART = 36,
|
||||
QEMUD_CLIENT_PKT_GET_CAPABILITIES = 37,
|
||||
QEMUD_CLIENT_PKT_MAX = 38,
|
||||
};
|
||||
typedef enum qemud_packet_client_data_type qemud_packet_client_data_type;
|
||||
|
||||
enum qemud_packet_server_data_type {
|
||||
QEMUD_SERVER_PKT_FAILURE = 0,
|
||||
QEMUD_SERVER_PKT_GET_VERSION = 0 + 1,
|
||||
QEMUD_SERVER_PKT_GET_NODEINFO = 0 + 2,
|
||||
QEMUD_SERVER_PKT_LIST_DOMAINS = 0 + 3,
|
||||
QEMUD_SERVER_PKT_NUM_DOMAINS = 0 + 4,
|
||||
QEMUD_SERVER_PKT_DOMAIN_CREATE = 0 + 5,
|
||||
QEMUD_SERVER_PKT_DOMAIN_LOOKUP_BY_ID = 0 + 6,
|
||||
QEMUD_SERVER_PKT_DOMAIN_LOOKUP_BY_UUID = 0 + 7,
|
||||
QEMUD_SERVER_PKT_DOMAIN_LOOKUP_BY_NAME = 0 + 8,
|
||||
QEMUD_SERVER_PKT_DOMAIN_SUSPEND = 0 + 9,
|
||||
QEMUD_SERVER_PKT_DOMAIN_RESUME = 0 + 10,
|
||||
QEMUD_SERVER_PKT_DOMAIN_DESTROY = 0 + 11,
|
||||
QEMUD_SERVER_PKT_DOMAIN_GET_INFO = 0 + 12,
|
||||
QEMUD_SERVER_PKT_DOMAIN_SAVE = 0 + 13,
|
||||
QEMUD_SERVER_PKT_DOMAIN_RESTORE = 0 + 14,
|
||||
QEMUD_SERVER_PKT_DUMP_XML = 0 + 15,
|
||||
QEMUD_SERVER_PKT_LIST_DEFINED_DOMAINS = 0 + 16,
|
||||
QEMUD_SERVER_PKT_NUM_DEFINED_DOMAINS = 0 + 17,
|
||||
QEMUD_SERVER_PKT_DOMAIN_START = 0 + 18,
|
||||
QEMUD_SERVER_PKT_DOMAIN_DEFINE = 0 + 19,
|
||||
QEMUD_SERVER_PKT_DOMAIN_UNDEFINE = 0 + 20,
|
||||
QEMUD_SERVER_PKT_NUM_NETWORKS = 0 + 21,
|
||||
QEMUD_SERVER_PKT_LIST_NETWORKS = 0 + 22,
|
||||
QEMUD_SERVER_PKT_NUM_DEFINED_NETWORKS = 0 + 23,
|
||||
QEMUD_SERVER_PKT_LIST_DEFINED_NETWORKS = 0 + 24,
|
||||
QEMUD_SERVER_PKT_NETWORK_LOOKUP_BY_UUID = 0 + 25,
|
||||
QEMUD_SERVER_PKT_NETWORK_LOOKUP_BY_NAME = 0 + 26,
|
||||
QEMUD_SERVER_PKT_NETWORK_CREATE = 0 + 27,
|
||||
QEMUD_SERVER_PKT_NETWORK_DEFINE = 0 + 28,
|
||||
QEMUD_SERVER_PKT_NETWORK_UNDEFINE = 0 + 29,
|
||||
QEMUD_SERVER_PKT_NETWORK_START = 0 + 30,
|
||||
QEMUD_SERVER_PKT_NETWORK_DESTROY = 0 + 31,
|
||||
QEMUD_SERVER_PKT_NETWORK_DUMP_XML = 0 + 32,
|
||||
QEMUD_SERVER_PKT_NETWORK_GET_BRIDGE_NAME = 0 + 33,
|
||||
QEMUD_SERVER_PKT_DOMAIN_GET_AUTOSTART = 0 + 34,
|
||||
QEMUD_SERVER_PKT_DOMAIN_SET_AUTOSTART = 0 + 35,
|
||||
QEMUD_SERVER_PKT_NETWORK_GET_AUTOSTART = 0 + 36,
|
||||
QEMUD_SERVER_PKT_NETWORK_SET_AUTOSTART = 0 + 37,
|
||||
QEMUD_SERVER_PKT_GET_CAPABILITIES = 0 + 38,
|
||||
QEMUD_SERVER_PKT_MAX = 0 + 39,
|
||||
};
|
||||
typedef enum qemud_packet_server_data_type qemud_packet_server_data_type;
|
||||
|
||||
struct qemud_packet_failure_reply {
|
||||
uint32_t code;
|
||||
char message[QEMUD_MAX_ERROR_LEN];
|
||||
};
|
||||
typedef struct qemud_packet_failure_reply qemud_packet_failure_reply;
|
||||
|
||||
struct qemud_packet_get_version_reply {
|
||||
uint32_t versionNum;
|
||||
};
|
||||
typedef struct qemud_packet_get_version_reply qemud_packet_get_version_reply;
|
||||
|
||||
struct qemud_packet_get_node_info_reply {
|
||||
char model[32];
|
||||
uint32_t memory;
|
||||
uint32_t cpus;
|
||||
uint32_t mhz;
|
||||
uint32_t nodes;
|
||||
uint32_t sockets;
|
||||
uint32_t cores;
|
||||
uint32_t threads;
|
||||
};
|
||||
typedef struct qemud_packet_get_node_info_reply qemud_packet_get_node_info_reply;
|
||||
|
||||
struct qemud_packet_get_capabilities_reply {
|
||||
char xml[QEMUD_MAX_XML_LEN];
|
||||
};
|
||||
typedef struct qemud_packet_get_capabilities_reply qemud_packet_get_capabilities_reply;
|
||||
|
||||
struct qemud_packet_list_domains_reply {
|
||||
int32_t numDomains;
|
||||
int32_t domains[QEMUD_MAX_NUM_DOMAINS];
|
||||
};
|
||||
typedef struct qemud_packet_list_domains_reply qemud_packet_list_domains_reply;
|
||||
|
||||
struct qemud_packet_num_domains_reply {
|
||||
int32_t numDomains;
|
||||
};
|
||||
typedef struct qemud_packet_num_domains_reply qemud_packet_num_domains_reply;
|
||||
|
||||
struct qemud_packet_domain_create_request {
|
||||
char xml[QEMUD_MAX_XML_LEN];
|
||||
};
|
||||
typedef struct qemud_packet_domain_create_request qemud_packet_domain_create_request;
|
||||
|
||||
struct qemud_packet_domain_create_reply {
|
||||
int32_t id;
|
||||
u_char uuid[QEMUD_UUID_RAW_LEN];
|
||||
char name[QEMUD_MAX_NAME_LEN];
|
||||
};
|
||||
typedef struct qemud_packet_domain_create_reply qemud_packet_domain_create_reply;
|
||||
|
||||
struct qemud_packet_domain_lookup_by_id_request {
|
||||
int32_t id;
|
||||
};
|
||||
typedef struct qemud_packet_domain_lookup_by_id_request qemud_packet_domain_lookup_by_id_request;
|
||||
|
||||
struct qemud_packet_domain_lookup_by_id_reply {
|
||||
u_char uuid[QEMUD_UUID_RAW_LEN];
|
||||
char name[QEMUD_MAX_NAME_LEN];
|
||||
};
|
||||
typedef struct qemud_packet_domain_lookup_by_id_reply qemud_packet_domain_lookup_by_id_reply;
|
||||
|
||||
struct qemud_packet_domain_lookup_by_name_request {
|
||||
char name[QEMUD_MAX_NAME_LEN];
|
||||
};
|
||||
typedef struct qemud_packet_domain_lookup_by_name_request qemud_packet_domain_lookup_by_name_request;
|
||||
|
||||
struct qemud_packet_domain_lookup_by_name_reply {
|
||||
int32_t id;
|
||||
u_char uuid[QEMUD_UUID_RAW_LEN];
|
||||
};
|
||||
typedef struct qemud_packet_domain_lookup_by_name_reply qemud_packet_domain_lookup_by_name_reply;
|
||||
|
||||
struct qemud_packet_domain_lookup_by_uuid_request {
|
||||
u_char uuid[QEMUD_UUID_RAW_LEN];
|
||||
};
|
||||
typedef struct qemud_packet_domain_lookup_by_uuid_request qemud_packet_domain_lookup_by_uuid_request;
|
||||
|
||||
struct qemud_packet_domain_lookup_by_uuid_reply {
|
||||
int32_t id;
|
||||
char name[QEMUD_MAX_NAME_LEN];
|
||||
};
|
||||
typedef struct qemud_packet_domain_lookup_by_uuid_reply qemud_packet_domain_lookup_by_uuid_reply;
|
||||
|
||||
struct qemud_packet_domain_suspend_request {
|
||||
int32_t id;
|
||||
};
|
||||
typedef struct qemud_packet_domain_suspend_request qemud_packet_domain_suspend_request;
|
||||
|
||||
struct qemud_packet_domain_resume_request {
|
||||
int32_t id;
|
||||
};
|
||||
typedef struct qemud_packet_domain_resume_request qemud_packet_domain_resume_request;
|
||||
|
||||
struct qemud_packet_domain_destroy_request {
|
||||
int32_t id;
|
||||
};
|
||||
typedef struct qemud_packet_domain_destroy_request qemud_packet_domain_destroy_request;
|
||||
|
||||
struct qemud_packet_domain_get_info_request {
|
||||
u_char uuid[QEMUD_UUID_RAW_LEN];
|
||||
};
|
||||
typedef struct qemud_packet_domain_get_info_request qemud_packet_domain_get_info_request;
|
||||
|
||||
struct qemud_packet_domain_get_info_reply {
|
||||
uint64_t cpuTime;
|
||||
uint32_t runstate;
|
||||
uint32_t memory;
|
||||
uint32_t maxmem;
|
||||
uint32_t nrVirtCpu;
|
||||
};
|
||||
typedef struct qemud_packet_domain_get_info_reply qemud_packet_domain_get_info_reply;
|
||||
|
||||
struct qemud_packet_domain_save_request {
|
||||
int32_t id;
|
||||
char file[PATH_MAX];
|
||||
};
|
||||
typedef struct qemud_packet_domain_save_request qemud_packet_domain_save_request;
|
||||
|
||||
struct qemud_packet_domain_restore_request {
|
||||
char file[PATH_MAX];
|
||||
};
|
||||
typedef struct qemud_packet_domain_restore_request qemud_packet_domain_restore_request;
|
||||
|
||||
struct qemud_packet_domain_restore_reply {
|
||||
int32_t id;
|
||||
};
|
||||
typedef struct qemud_packet_domain_restore_reply qemud_packet_domain_restore_reply;
|
||||
|
||||
struct qemud_packet_domain_dump_xml_request {
|
||||
u_char uuid[QEMUD_UUID_RAW_LEN];
|
||||
};
|
||||
typedef struct qemud_packet_domain_dump_xml_request qemud_packet_domain_dump_xml_request;
|
||||
|
||||
struct qemud_packet_domain_dump_xml_reply {
|
||||
char xml[QEMUD_MAX_XML_LEN];
|
||||
};
|
||||
typedef struct qemud_packet_domain_dump_xml_reply qemud_packet_domain_dump_xml_reply;
|
||||
|
||||
struct qemud_packet_list_defined_domains_reply {
|
||||
uint32_t numDomains;
|
||||
char domains[QEMUD_MAX_DOMAINS_NAME_BUF];
|
||||
};
|
||||
typedef struct qemud_packet_list_defined_domains_reply qemud_packet_list_defined_domains_reply;
|
||||
|
||||
struct qemud_packet_num_defined_domains_reply {
|
||||
uint32_t numDomains;
|
||||
};
|
||||
typedef struct qemud_packet_num_defined_domains_reply qemud_packet_num_defined_domains_reply;
|
||||
|
||||
struct qemud_packet_domain_start_request {
|
||||
u_char uuid[QEMUD_UUID_RAW_LEN];
|
||||
};
|
||||
typedef struct qemud_packet_domain_start_request qemud_packet_domain_start_request;
|
||||
|
||||
struct qemud_packet_domain_start_reply {
|
||||
int32_t id;
|
||||
};
|
||||
typedef struct qemud_packet_domain_start_reply qemud_packet_domain_start_reply;
|
||||
|
||||
struct qemud_packet_domain_define_request {
|
||||
char xml[QEMUD_MAX_XML_LEN];
|
||||
};
|
||||
typedef struct qemud_packet_domain_define_request qemud_packet_domain_define_request;
|
||||
|
||||
struct qemud_packet_domain_define_reply {
|
||||
u_char uuid[QEMUD_UUID_RAW_LEN];
|
||||
char name[QEMUD_MAX_NAME_LEN];
|
||||
};
|
||||
typedef struct qemud_packet_domain_define_reply qemud_packet_domain_define_reply;
|
||||
|
||||
struct qemud_packet_domain_undefine_request {
|
||||
u_char uuid[QEMUD_UUID_RAW_LEN];
|
||||
};
|
||||
typedef struct qemud_packet_domain_undefine_request qemud_packet_domain_undefine_request;
|
||||
|
||||
struct qemud_packet_num_networks_reply {
|
||||
uint32_t numNetworks;
|
||||
};
|
||||
typedef struct qemud_packet_num_networks_reply qemud_packet_num_networks_reply;
|
||||
|
||||
struct qemud_packet_list_networks_reply {
|
||||
uint32_t numNetworks;
|
||||
char networks[QEMUD_MAX_NETWORKS_NAME_BUF];
|
||||
};
|
||||
typedef struct qemud_packet_list_networks_reply qemud_packet_list_networks_reply;
|
||||
|
||||
struct qemud_packet_num_defined_networks_reply {
|
||||
uint32_t numNetworks;
|
||||
};
|
||||
typedef struct qemud_packet_num_defined_networks_reply qemud_packet_num_defined_networks_reply;
|
||||
|
||||
struct qemud_packet_list_defined_networks_reply {
|
||||
uint32_t numNetworks;
|
||||
char networks[QEMUD_MAX_NETWORKS_NAME_BUF];
|
||||
};
|
||||
typedef struct qemud_packet_list_defined_networks_reply qemud_packet_list_defined_networks_reply;
|
||||
|
||||
struct qemud_packet_network_lookup_by_name_request {
|
||||
char name[QEMUD_MAX_NAME_LEN];
|
||||
};
|
||||
typedef struct qemud_packet_network_lookup_by_name_request qemud_packet_network_lookup_by_name_request;
|
||||
|
||||
struct qemud_packet_network_lookup_by_name_reply {
|
||||
int32_t id;
|
||||
u_char uuid[QEMUD_UUID_RAW_LEN];
|
||||
};
|
||||
typedef struct qemud_packet_network_lookup_by_name_reply qemud_packet_network_lookup_by_name_reply;
|
||||
|
||||
struct qemud_packet_network_lookup_by_uuid_request {
|
||||
u_char uuid[QEMUD_UUID_RAW_LEN];
|
||||
};
|
||||
typedef struct qemud_packet_network_lookup_by_uuid_request qemud_packet_network_lookup_by_uuid_request;
|
||||
|
||||
struct qemud_packet_network_lookup_by_uuid_reply {
|
||||
int32_t id;
|
||||
char name[QEMUD_MAX_NAME_LEN];
|
||||
};
|
||||
typedef struct qemud_packet_network_lookup_by_uuid_reply qemud_packet_network_lookup_by_uuid_reply;
|
||||
|
||||
struct qemud_packet_network_create_request {
|
||||
char xml[QEMUD_MAX_XML_LEN];
|
||||
};
|
||||
typedef struct qemud_packet_network_create_request qemud_packet_network_create_request;
|
||||
|
||||
struct qemud_packet_network_create_reply {
|
||||
u_char uuid[QEMUD_UUID_RAW_LEN];
|
||||
char name[QEMUD_MAX_NAME_LEN];
|
||||
};
|
||||
typedef struct qemud_packet_network_create_reply qemud_packet_network_create_reply;
|
||||
|
||||
struct qemud_packet_network_define_request {
|
||||
char xml[QEMUD_MAX_XML_LEN];
|
||||
};
|
||||
typedef struct qemud_packet_network_define_request qemud_packet_network_define_request;
|
||||
|
||||
struct qemud_packet_network_define_reply {
|
||||
u_char uuid[QEMUD_UUID_RAW_LEN];
|
||||
char name[QEMUD_MAX_NAME_LEN];
|
||||
};
|
||||
typedef struct qemud_packet_network_define_reply qemud_packet_network_define_reply;
|
||||
|
||||
struct qemud_packet_network_undefine_request {
|
||||
u_char uuid[QEMUD_UUID_RAW_LEN];
|
||||
};
|
||||
typedef struct qemud_packet_network_undefine_request qemud_packet_network_undefine_request;
|
||||
|
||||
struct qemud_packet_network_start_request {
|
||||
u_char uuid[QEMUD_UUID_RAW_LEN];
|
||||
};
|
||||
typedef struct qemud_packet_network_start_request qemud_packet_network_start_request;
|
||||
|
||||
struct qemud_packet_network_destroy_request {
|
||||
u_char uuid[QEMUD_UUID_RAW_LEN];
|
||||
};
|
||||
typedef struct qemud_packet_network_destroy_request qemud_packet_network_destroy_request;
|
||||
|
||||
struct qemud_packet_network_dump_xml_request {
|
||||
u_char uuid[QEMUD_UUID_RAW_LEN];
|
||||
};
|
||||
typedef struct qemud_packet_network_dump_xml_request qemud_packet_network_dump_xml_request;
|
||||
|
||||
struct qemud_packet_network_dump_xml_reply {
|
||||
char xml[QEMUD_MAX_XML_LEN];
|
||||
};
|
||||
typedef struct qemud_packet_network_dump_xml_reply qemud_packet_network_dump_xml_reply;
|
||||
|
||||
struct qemud_packet_network_get_bridge_name_request {
|
||||
u_char uuid[QEMUD_UUID_RAW_LEN];
|
||||
};
|
||||
typedef struct qemud_packet_network_get_bridge_name_request qemud_packet_network_get_bridge_name_request;
|
||||
|
||||
struct qemud_packet_network_get_bridge_name_reply {
|
||||
char ifname[QEMUD_MAX_IFNAME_LEN];
|
||||
};
|
||||
typedef struct qemud_packet_network_get_bridge_name_reply qemud_packet_network_get_bridge_name_reply;
|
||||
|
||||
struct qemud_packet_domain_get_autostart_request {
|
||||
u_char uuid[QEMUD_UUID_RAW_LEN];
|
||||
};
|
||||
typedef struct qemud_packet_domain_get_autostart_request qemud_packet_domain_get_autostart_request;
|
||||
|
||||
struct qemud_packet_domain_get_autostart_reply {
|
||||
uint32_t autostart;
|
||||
};
|
||||
typedef struct qemud_packet_domain_get_autostart_reply qemud_packet_domain_get_autostart_reply;
|
||||
|
||||
struct qemud_packet_domain_set_autostart_request {
|
||||
u_char uuid[QEMUD_UUID_RAW_LEN];
|
||||
uint32_t autostart;
|
||||
};
|
||||
typedef struct qemud_packet_domain_set_autostart_request qemud_packet_domain_set_autostart_request;
|
||||
|
||||
struct qemud_packet_network_get_autostart_request {
|
||||
u_char uuid[QEMUD_UUID_RAW_LEN];
|
||||
};
|
||||
typedef struct qemud_packet_network_get_autostart_request qemud_packet_network_get_autostart_request;
|
||||
|
||||
struct qemud_packet_network_get_autostart_reply {
|
||||
uint32_t autostart;
|
||||
};
|
||||
typedef struct qemud_packet_network_get_autostart_reply qemud_packet_network_get_autostart_reply;
|
||||
|
||||
struct qemud_packet_network_set_autostart_request {
|
||||
u_char uuid[QEMUD_UUID_RAW_LEN];
|
||||
uint32_t autostart;
|
||||
};
|
||||
typedef struct qemud_packet_network_set_autostart_request qemud_packet_network_set_autostart_request;
|
||||
|
||||
struct qemud_packet_client_data {
|
||||
qemud_packet_client_data_type type;
|
||||
union {
|
||||
qemud_packet_domain_create_request domainCreateRequest;
|
||||
qemud_packet_domain_lookup_by_id_request domainLookupByIDRequest;
|
||||
qemud_packet_domain_lookup_by_uuid_request domainLookupByUUIDRequest;
|
||||
qemud_packet_domain_lookup_by_name_request domainLookupByNameRequest;
|
||||
qemud_packet_domain_suspend_request domainSuspendRequest;
|
||||
qemud_packet_domain_resume_request domainResumeRequest;
|
||||
qemud_packet_domain_destroy_request domainDestroyRequest;
|
||||
qemud_packet_domain_get_info_request domainGetInfoRequest;
|
||||
qemud_packet_domain_save_request domainSaveRequest;
|
||||
qemud_packet_domain_restore_request domainRestoreRequest;
|
||||
qemud_packet_domain_dump_xml_request domainDumpXMLRequest;
|
||||
qemud_packet_domain_start_request domainStartRequest;
|
||||
qemud_packet_domain_define_request domainDefineRequest;
|
||||
qemud_packet_domain_undefine_request domainUndefineRequest;
|
||||
qemud_packet_network_lookup_by_uuid_request networkLookupByUUIDRequest;
|
||||
qemud_packet_network_lookup_by_name_request networkLookupByNameRequest;
|
||||
qemud_packet_network_create_request networkCreateRequest;
|
||||
qemud_packet_network_define_request networkDefineRequest;
|
||||
qemud_packet_network_undefine_request networkUndefineRequest;
|
||||
qemud_packet_network_start_request networkStartRequest;
|
||||
qemud_packet_network_destroy_request networkDestroyRequest;
|
||||
qemud_packet_network_dump_xml_request networkDumpXMLRequest;
|
||||
qemud_packet_network_get_bridge_name_request networkGetBridgeNameRequest;
|
||||
qemud_packet_domain_get_autostart_request domainGetAutostartRequest;
|
||||
qemud_packet_domain_set_autostart_request domainSetAutostartRequest;
|
||||
qemud_packet_network_get_autostart_request networkGetAutostartRequest;
|
||||
qemud_packet_network_set_autostart_request networkSetAutostartRequest;
|
||||
} qemud_packet_client_data_u;
|
||||
};
|
||||
typedef struct qemud_packet_client_data qemud_packet_client_data;
|
||||
|
||||
struct qemud_packet_server_data {
|
||||
qemud_packet_server_data_type type;
|
||||
union {
|
||||
qemud_packet_failure_reply failureReply;
|
||||
qemud_packet_get_version_reply getVersionReply;
|
||||
qemud_packet_get_node_info_reply getNodeInfoReply;
|
||||
qemud_packet_list_domains_reply listDomainsReply;
|
||||
qemud_packet_num_domains_reply numDomainsReply;
|
||||
qemud_packet_domain_create_reply domainCreateReply;
|
||||
qemud_packet_domain_lookup_by_id_reply domainLookupByIDReply;
|
||||
qemud_packet_domain_lookup_by_uuid_reply domainLookupByUUIDReply;
|
||||
qemud_packet_domain_lookup_by_name_reply domainLookupByNameReply;
|
||||
qemud_packet_domain_get_info_reply domainGetInfoReply;
|
||||
qemud_packet_domain_restore_reply domainRestoreReply;
|
||||
qemud_packet_domain_dump_xml_reply domainDumpXMLReply;
|
||||
qemud_packet_list_defined_domains_reply listDefinedDomainsReply;
|
||||
qemud_packet_num_defined_domains_reply numDefinedDomainsReply;
|
||||
qemud_packet_domain_start_reply domainStartReply;
|
||||
qemud_packet_domain_define_reply domainDefineReply;
|
||||
qemud_packet_num_networks_reply numNetworksReply;
|
||||
qemud_packet_list_networks_reply listNetworksReply;
|
||||
qemud_packet_num_defined_networks_reply numDefinedNetworksReply;
|
||||
qemud_packet_list_defined_networks_reply listDefinedNetworksReply;
|
||||
qemud_packet_network_lookup_by_uuid_reply networkLookupByUUIDReply;
|
||||
qemud_packet_network_lookup_by_name_reply networkLookupByNameReply;
|
||||
qemud_packet_network_create_reply networkCreateReply;
|
||||
qemud_packet_network_define_reply networkDefineReply;
|
||||
qemud_packet_network_dump_xml_reply networkDumpXMLReply;
|
||||
qemud_packet_network_get_bridge_name_reply networkGetBridgeNameReply;
|
||||
qemud_packet_domain_get_autostart_reply domainGetAutostartReply;
|
||||
qemud_packet_network_get_autostart_reply networkGetAutostartReply;
|
||||
qemud_packet_get_capabilities_reply getCapabilitiesReply;
|
||||
} qemud_packet_server_data_u;
|
||||
};
|
||||
typedef struct qemud_packet_server_data qemud_packet_server_data;
|
||||
|
||||
struct qemud_packet_client {
|
||||
uint32_t serial;
|
||||
struct qemud_packet_client_data data;
|
||||
};
|
||||
typedef struct qemud_packet_client qemud_packet_client;
|
||||
|
||||
struct qemud_packet_server {
|
||||
uint32_t serial;
|
||||
uint32_t inReplyTo;
|
||||
struct qemud_packet_server_data data;
|
||||
};
|
||||
typedef struct qemud_packet_server qemud_packet_server;
|
||||
#define QEMUD_PROGRAM 0x20001A64
|
||||
#define QEMUD_PKT_HEADER_XDR_LEN 8
|
||||
|
||||
|
@ -520,135 +25,9 @@ typedef struct qemud_packet_header qemud_packet_header;
|
|||
/* the xdr functions */
|
||||
|
||||
#if defined(__STDC__) || defined(__cplusplus)
|
||||
extern bool_t xdr_qemud_domain_runstate (XDR *, qemud_domain_runstate*);
|
||||
extern bool_t xdr_qemud_packet_client_data_type (XDR *, qemud_packet_client_data_type*);
|
||||
extern bool_t xdr_qemud_packet_server_data_type (XDR *, qemud_packet_server_data_type*);
|
||||
extern bool_t xdr_qemud_packet_failure_reply (XDR *, qemud_packet_failure_reply*);
|
||||
extern bool_t xdr_qemud_packet_get_version_reply (XDR *, qemud_packet_get_version_reply*);
|
||||
extern bool_t xdr_qemud_packet_get_node_info_reply (XDR *, qemud_packet_get_node_info_reply*);
|
||||
extern bool_t xdr_qemud_packet_get_capabilities_reply (XDR *, qemud_packet_get_capabilities_reply*);
|
||||
extern bool_t xdr_qemud_packet_list_domains_reply (XDR *, qemud_packet_list_domains_reply*);
|
||||
extern bool_t xdr_qemud_packet_num_domains_reply (XDR *, qemud_packet_num_domains_reply*);
|
||||
extern bool_t xdr_qemud_packet_domain_create_request (XDR *, qemud_packet_domain_create_request*);
|
||||
extern bool_t xdr_qemud_packet_domain_create_reply (XDR *, qemud_packet_domain_create_reply*);
|
||||
extern bool_t xdr_qemud_packet_domain_lookup_by_id_request (XDR *, qemud_packet_domain_lookup_by_id_request*);
|
||||
extern bool_t xdr_qemud_packet_domain_lookup_by_id_reply (XDR *, qemud_packet_domain_lookup_by_id_reply*);
|
||||
extern bool_t xdr_qemud_packet_domain_lookup_by_name_request (XDR *, qemud_packet_domain_lookup_by_name_request*);
|
||||
extern bool_t xdr_qemud_packet_domain_lookup_by_name_reply (XDR *, qemud_packet_domain_lookup_by_name_reply*);
|
||||
extern bool_t xdr_qemud_packet_domain_lookup_by_uuid_request (XDR *, qemud_packet_domain_lookup_by_uuid_request*);
|
||||
extern bool_t xdr_qemud_packet_domain_lookup_by_uuid_reply (XDR *, qemud_packet_domain_lookup_by_uuid_reply*);
|
||||
extern bool_t xdr_qemud_packet_domain_suspend_request (XDR *, qemud_packet_domain_suspend_request*);
|
||||
extern bool_t xdr_qemud_packet_domain_resume_request (XDR *, qemud_packet_domain_resume_request*);
|
||||
extern bool_t xdr_qemud_packet_domain_destroy_request (XDR *, qemud_packet_domain_destroy_request*);
|
||||
extern bool_t xdr_qemud_packet_domain_get_info_request (XDR *, qemud_packet_domain_get_info_request*);
|
||||
extern bool_t xdr_qemud_packet_domain_get_info_reply (XDR *, qemud_packet_domain_get_info_reply*);
|
||||
extern bool_t xdr_qemud_packet_domain_save_request (XDR *, qemud_packet_domain_save_request*);
|
||||
extern bool_t xdr_qemud_packet_domain_restore_request (XDR *, qemud_packet_domain_restore_request*);
|
||||
extern bool_t xdr_qemud_packet_domain_restore_reply (XDR *, qemud_packet_domain_restore_reply*);
|
||||
extern bool_t xdr_qemud_packet_domain_dump_xml_request (XDR *, qemud_packet_domain_dump_xml_request*);
|
||||
extern bool_t xdr_qemud_packet_domain_dump_xml_reply (XDR *, qemud_packet_domain_dump_xml_reply*);
|
||||
extern bool_t xdr_qemud_packet_list_defined_domains_reply (XDR *, qemud_packet_list_defined_domains_reply*);
|
||||
extern bool_t xdr_qemud_packet_num_defined_domains_reply (XDR *, qemud_packet_num_defined_domains_reply*);
|
||||
extern bool_t xdr_qemud_packet_domain_start_request (XDR *, qemud_packet_domain_start_request*);
|
||||
extern bool_t xdr_qemud_packet_domain_start_reply (XDR *, qemud_packet_domain_start_reply*);
|
||||
extern bool_t xdr_qemud_packet_domain_define_request (XDR *, qemud_packet_domain_define_request*);
|
||||
extern bool_t xdr_qemud_packet_domain_define_reply (XDR *, qemud_packet_domain_define_reply*);
|
||||
extern bool_t xdr_qemud_packet_domain_undefine_request (XDR *, qemud_packet_domain_undefine_request*);
|
||||
extern bool_t xdr_qemud_packet_num_networks_reply (XDR *, qemud_packet_num_networks_reply*);
|
||||
extern bool_t xdr_qemud_packet_list_networks_reply (XDR *, qemud_packet_list_networks_reply*);
|
||||
extern bool_t xdr_qemud_packet_num_defined_networks_reply (XDR *, qemud_packet_num_defined_networks_reply*);
|
||||
extern bool_t xdr_qemud_packet_list_defined_networks_reply (XDR *, qemud_packet_list_defined_networks_reply*);
|
||||
extern bool_t xdr_qemud_packet_network_lookup_by_name_request (XDR *, qemud_packet_network_lookup_by_name_request*);
|
||||
extern bool_t xdr_qemud_packet_network_lookup_by_name_reply (XDR *, qemud_packet_network_lookup_by_name_reply*);
|
||||
extern bool_t xdr_qemud_packet_network_lookup_by_uuid_request (XDR *, qemud_packet_network_lookup_by_uuid_request*);
|
||||
extern bool_t xdr_qemud_packet_network_lookup_by_uuid_reply (XDR *, qemud_packet_network_lookup_by_uuid_reply*);
|
||||
extern bool_t xdr_qemud_packet_network_create_request (XDR *, qemud_packet_network_create_request*);
|
||||
extern bool_t xdr_qemud_packet_network_create_reply (XDR *, qemud_packet_network_create_reply*);
|
||||
extern bool_t xdr_qemud_packet_network_define_request (XDR *, qemud_packet_network_define_request*);
|
||||
extern bool_t xdr_qemud_packet_network_define_reply (XDR *, qemud_packet_network_define_reply*);
|
||||
extern bool_t xdr_qemud_packet_network_undefine_request (XDR *, qemud_packet_network_undefine_request*);
|
||||
extern bool_t xdr_qemud_packet_network_start_request (XDR *, qemud_packet_network_start_request*);
|
||||
extern bool_t xdr_qemud_packet_network_destroy_request (XDR *, qemud_packet_network_destroy_request*);
|
||||
extern bool_t xdr_qemud_packet_network_dump_xml_request (XDR *, qemud_packet_network_dump_xml_request*);
|
||||
extern bool_t xdr_qemud_packet_network_dump_xml_reply (XDR *, qemud_packet_network_dump_xml_reply*);
|
||||
extern bool_t xdr_qemud_packet_network_get_bridge_name_request (XDR *, qemud_packet_network_get_bridge_name_request*);
|
||||
extern bool_t xdr_qemud_packet_network_get_bridge_name_reply (XDR *, qemud_packet_network_get_bridge_name_reply*);
|
||||
extern bool_t xdr_qemud_packet_domain_get_autostart_request (XDR *, qemud_packet_domain_get_autostart_request*);
|
||||
extern bool_t xdr_qemud_packet_domain_get_autostart_reply (XDR *, qemud_packet_domain_get_autostart_reply*);
|
||||
extern bool_t xdr_qemud_packet_domain_set_autostart_request (XDR *, qemud_packet_domain_set_autostart_request*);
|
||||
extern bool_t xdr_qemud_packet_network_get_autostart_request (XDR *, qemud_packet_network_get_autostart_request*);
|
||||
extern bool_t xdr_qemud_packet_network_get_autostart_reply (XDR *, qemud_packet_network_get_autostart_reply*);
|
||||
extern bool_t xdr_qemud_packet_network_set_autostart_request (XDR *, qemud_packet_network_set_autostart_request*);
|
||||
extern bool_t xdr_qemud_packet_client_data (XDR *, qemud_packet_client_data*);
|
||||
extern bool_t xdr_qemud_packet_server_data (XDR *, qemud_packet_server_data*);
|
||||
extern bool_t xdr_qemud_packet_client (XDR *, qemud_packet_client*);
|
||||
extern bool_t xdr_qemud_packet_server (XDR *, qemud_packet_server*);
|
||||
extern bool_t xdr_qemud_packet_header (XDR *, qemud_packet_header*);
|
||||
|
||||
#else /* K&R C */
|
||||
extern bool_t xdr_qemud_domain_runstate ();
|
||||
extern bool_t xdr_qemud_packet_client_data_type ();
|
||||
extern bool_t xdr_qemud_packet_server_data_type ();
|
||||
extern bool_t xdr_qemud_packet_failure_reply ();
|
||||
extern bool_t xdr_qemud_packet_get_version_reply ();
|
||||
extern bool_t xdr_qemud_packet_get_node_info_reply ();
|
||||
extern bool_t xdr_qemud_packet_get_capabilities_reply ();
|
||||
extern bool_t xdr_qemud_packet_list_domains_reply ();
|
||||
extern bool_t xdr_qemud_packet_num_domains_reply ();
|
||||
extern bool_t xdr_qemud_packet_domain_create_request ();
|
||||
extern bool_t xdr_qemud_packet_domain_create_reply ();
|
||||
extern bool_t xdr_qemud_packet_domain_lookup_by_id_request ();
|
||||
extern bool_t xdr_qemud_packet_domain_lookup_by_id_reply ();
|
||||
extern bool_t xdr_qemud_packet_domain_lookup_by_name_request ();
|
||||
extern bool_t xdr_qemud_packet_domain_lookup_by_name_reply ();
|
||||
extern bool_t xdr_qemud_packet_domain_lookup_by_uuid_request ();
|
||||
extern bool_t xdr_qemud_packet_domain_lookup_by_uuid_reply ();
|
||||
extern bool_t xdr_qemud_packet_domain_suspend_request ();
|
||||
extern bool_t xdr_qemud_packet_domain_resume_request ();
|
||||
extern bool_t xdr_qemud_packet_domain_destroy_request ();
|
||||
extern bool_t xdr_qemud_packet_domain_get_info_request ();
|
||||
extern bool_t xdr_qemud_packet_domain_get_info_reply ();
|
||||
extern bool_t xdr_qemud_packet_domain_save_request ();
|
||||
extern bool_t xdr_qemud_packet_domain_restore_request ();
|
||||
extern bool_t xdr_qemud_packet_domain_restore_reply ();
|
||||
extern bool_t xdr_qemud_packet_domain_dump_xml_request ();
|
||||
extern bool_t xdr_qemud_packet_domain_dump_xml_reply ();
|
||||
extern bool_t xdr_qemud_packet_list_defined_domains_reply ();
|
||||
extern bool_t xdr_qemud_packet_num_defined_domains_reply ();
|
||||
extern bool_t xdr_qemud_packet_domain_start_request ();
|
||||
extern bool_t xdr_qemud_packet_domain_start_reply ();
|
||||
extern bool_t xdr_qemud_packet_domain_define_request ();
|
||||
extern bool_t xdr_qemud_packet_domain_define_reply ();
|
||||
extern bool_t xdr_qemud_packet_domain_undefine_request ();
|
||||
extern bool_t xdr_qemud_packet_num_networks_reply ();
|
||||
extern bool_t xdr_qemud_packet_list_networks_reply ();
|
||||
extern bool_t xdr_qemud_packet_num_defined_networks_reply ();
|
||||
extern bool_t xdr_qemud_packet_list_defined_networks_reply ();
|
||||
extern bool_t xdr_qemud_packet_network_lookup_by_name_request ();
|
||||
extern bool_t xdr_qemud_packet_network_lookup_by_name_reply ();
|
||||
extern bool_t xdr_qemud_packet_network_lookup_by_uuid_request ();
|
||||
extern bool_t xdr_qemud_packet_network_lookup_by_uuid_reply ();
|
||||
extern bool_t xdr_qemud_packet_network_create_request ();
|
||||
extern bool_t xdr_qemud_packet_network_create_reply ();
|
||||
extern bool_t xdr_qemud_packet_network_define_request ();
|
||||
extern bool_t xdr_qemud_packet_network_define_reply ();
|
||||
extern bool_t xdr_qemud_packet_network_undefine_request ();
|
||||
extern bool_t xdr_qemud_packet_network_start_request ();
|
||||
extern bool_t xdr_qemud_packet_network_destroy_request ();
|
||||
extern bool_t xdr_qemud_packet_network_dump_xml_request ();
|
||||
extern bool_t xdr_qemud_packet_network_dump_xml_reply ();
|
||||
extern bool_t xdr_qemud_packet_network_get_bridge_name_request ();
|
||||
extern bool_t xdr_qemud_packet_network_get_bridge_name_reply ();
|
||||
extern bool_t xdr_qemud_packet_domain_get_autostart_request ();
|
||||
extern bool_t xdr_qemud_packet_domain_get_autostart_reply ();
|
||||
extern bool_t xdr_qemud_packet_domain_set_autostart_request ();
|
||||
extern bool_t xdr_qemud_packet_network_get_autostart_request ();
|
||||
extern bool_t xdr_qemud_packet_network_get_autostart_reply ();
|
||||
extern bool_t xdr_qemud_packet_network_set_autostart_request ();
|
||||
extern bool_t xdr_qemud_packet_client_data ();
|
||||
extern bool_t xdr_qemud_packet_server_data ();
|
||||
extern bool_t xdr_qemud_packet_client ();
|
||||
extern bool_t xdr_qemud_packet_server ();
|
||||
extern bool_t xdr_qemud_packet_header ();
|
||||
|
||||
#endif /* K&R C */
|
||||
|
|
574
qemud/protocol.x
574
qemud/protocol.x
|
@ -21,580 +21,6 @@
|
|||
* Author: Daniel P. Berrange <berrange@redhat.com>
|
||||
*/
|
||||
|
||||
const QEMUD_UUID_RAW_LEN = 16;
|
||||
const QEMUD_MAX_NAME_LEN = 50;
|
||||
const QEMUD_MAX_XML_LEN = 4096;
|
||||
/*#define QEMUD_MAX_IFNAME_LEN IF_NAMESIZE */
|
||||
const QEMUD_MAX_IFNAME_LEN = 50;
|
||||
|
||||
const QEMUD_MAX_NUM_DOMAINS = 100;
|
||||
const QEMUD_MAX_NUM_NETWORKS = 100;
|
||||
|
||||
/*
|
||||
* Damn, we can't do multiplcation when declaring
|
||||
* constants with XDR !
|
||||
* These two should be QEMUD_MAX_NUM_DOMAIN * QEMUD_MAX_NAME_LEN
|
||||
*/
|
||||
const QEMUD_MAX_DOMAINS_NAME_BUF = 5000;
|
||||
const QEMUD_MAX_NETWORKS_NAME_BUF = 5000;
|
||||
|
||||
const QEMUD_MAX_ERROR_LEN = 1024;
|
||||
|
||||
/* Possible guest VM states */
|
||||
enum qemud_domain_runstate {
|
||||
QEMUD_STATE_RUNNING = 1,
|
||||
QEMUD_STATE_PAUSED,
|
||||
QEMUD_STATE_STOPPED
|
||||
};
|
||||
|
||||
/* Message sent by a client */
|
||||
enum qemud_packet_client_data_type {
|
||||
QEMUD_CLIENT_PKT_GET_VERSION,
|
||||
QEMUD_CLIENT_PKT_GET_NODEINFO,
|
||||
QEMUD_CLIENT_PKT_LIST_DOMAINS,
|
||||
QEMUD_CLIENT_PKT_NUM_DOMAINS,
|
||||
QEMUD_CLIENT_PKT_DOMAIN_CREATE,
|
||||
QEMUD_CLIENT_PKT_DOMAIN_LOOKUP_BY_ID,
|
||||
QEMUD_CLIENT_PKT_DOMAIN_LOOKUP_BY_UUID,
|
||||
QEMUD_CLIENT_PKT_DOMAIN_LOOKUP_BY_NAME,
|
||||
QEMUD_CLIENT_PKT_DOMAIN_SUSPEND,
|
||||
QEMUD_CLIENT_PKT_DOMAIN_RESUME,
|
||||
QEMUD_CLIENT_PKT_DOMAIN_DESTROY,
|
||||
QEMUD_CLIENT_PKT_DOMAIN_GET_INFO,
|
||||
QEMUD_CLIENT_PKT_DOMAIN_SAVE,
|
||||
QEMUD_CLIENT_PKT_DOMAIN_RESTORE,
|
||||
QEMUD_CLIENT_PKT_DUMP_XML,
|
||||
QEMUD_CLIENT_PKT_LIST_DEFINED_DOMAINS,
|
||||
QEMUD_CLIENT_PKT_NUM_DEFINED_DOMAINS,
|
||||
QEMUD_CLIENT_PKT_DOMAIN_START,
|
||||
QEMUD_CLIENT_PKT_DOMAIN_DEFINE,
|
||||
QEMUD_CLIENT_PKT_DOMAIN_UNDEFINE,
|
||||
QEMUD_CLIENT_PKT_NUM_NETWORKS,
|
||||
QEMUD_CLIENT_PKT_LIST_NETWORKS,
|
||||
QEMUD_CLIENT_PKT_NUM_DEFINED_NETWORKS,
|
||||
QEMUD_CLIENT_PKT_LIST_DEFINED_NETWORKS,
|
||||
QEMUD_CLIENT_PKT_NETWORK_LOOKUP_BY_UUID,
|
||||
QEMUD_CLIENT_PKT_NETWORK_LOOKUP_BY_NAME,
|
||||
QEMUD_CLIENT_PKT_NETWORK_CREATE,
|
||||
QEMUD_CLIENT_PKT_NETWORK_DEFINE,
|
||||
QEMUD_CLIENT_PKT_NETWORK_UNDEFINE,
|
||||
QEMUD_CLIENT_PKT_NETWORK_START,
|
||||
QEMUD_CLIENT_PKT_NETWORK_DESTROY,
|
||||
QEMUD_CLIENT_PKT_NETWORK_DUMP_XML,
|
||||
QEMUD_CLIENT_PKT_NETWORK_GET_BRIDGE_NAME,
|
||||
QEMUD_CLIENT_PKT_DOMAIN_GET_AUTOSTART,
|
||||
QEMUD_CLIENT_PKT_DOMAIN_SET_AUTOSTART,
|
||||
QEMUD_CLIENT_PKT_NETWORK_GET_AUTOSTART,
|
||||
QEMUD_CLIENT_PKT_NETWORK_SET_AUTOSTART,
|
||||
QEMUD_CLIENT_PKT_GET_CAPABILITIES,
|
||||
|
||||
QEMUD_CLIENT_PKT_MAX
|
||||
};
|
||||
|
||||
/* Messages sent by a server */
|
||||
enum qemud_packet_server_data_type {
|
||||
QEMUD_SERVER_PKT_FAILURE = 0,
|
||||
QEMUD_SERVER_PKT_GET_VERSION,
|
||||
QEMUD_SERVER_PKT_GET_NODEINFO,
|
||||
QEMUD_SERVER_PKT_LIST_DOMAINS,
|
||||
QEMUD_SERVER_PKT_NUM_DOMAINS,
|
||||
QEMUD_SERVER_PKT_DOMAIN_CREATE,
|
||||
QEMUD_SERVER_PKT_DOMAIN_LOOKUP_BY_ID,
|
||||
QEMUD_SERVER_PKT_DOMAIN_LOOKUP_BY_UUID,
|
||||
QEMUD_SERVER_PKT_DOMAIN_LOOKUP_BY_NAME,
|
||||
QEMUD_SERVER_PKT_DOMAIN_SUSPEND,
|
||||
QEMUD_SERVER_PKT_DOMAIN_RESUME,
|
||||
QEMUD_SERVER_PKT_DOMAIN_DESTROY,
|
||||
QEMUD_SERVER_PKT_DOMAIN_GET_INFO,
|
||||
QEMUD_SERVER_PKT_DOMAIN_SAVE,
|
||||
QEMUD_SERVER_PKT_DOMAIN_RESTORE,
|
||||
QEMUD_SERVER_PKT_DUMP_XML,
|
||||
QEMUD_SERVER_PKT_LIST_DEFINED_DOMAINS,
|
||||
QEMUD_SERVER_PKT_NUM_DEFINED_DOMAINS,
|
||||
QEMUD_SERVER_PKT_DOMAIN_START,
|
||||
QEMUD_SERVER_PKT_DOMAIN_DEFINE,
|
||||
QEMUD_SERVER_PKT_DOMAIN_UNDEFINE,
|
||||
QEMUD_SERVER_PKT_NUM_NETWORKS,
|
||||
QEMUD_SERVER_PKT_LIST_NETWORKS,
|
||||
QEMUD_SERVER_PKT_NUM_DEFINED_NETWORKS,
|
||||
QEMUD_SERVER_PKT_LIST_DEFINED_NETWORKS,
|
||||
QEMUD_SERVER_PKT_NETWORK_LOOKUP_BY_UUID,
|
||||
QEMUD_SERVER_PKT_NETWORK_LOOKUP_BY_NAME,
|
||||
QEMUD_SERVER_PKT_NETWORK_CREATE,
|
||||
QEMUD_SERVER_PKT_NETWORK_DEFINE,
|
||||
QEMUD_SERVER_PKT_NETWORK_UNDEFINE,
|
||||
QEMUD_SERVER_PKT_NETWORK_START,
|
||||
QEMUD_SERVER_PKT_NETWORK_DESTROY,
|
||||
QEMUD_SERVER_PKT_NETWORK_DUMP_XML,
|
||||
QEMUD_SERVER_PKT_NETWORK_GET_BRIDGE_NAME,
|
||||
QEMUD_SERVER_PKT_DOMAIN_GET_AUTOSTART,
|
||||
QEMUD_SERVER_PKT_DOMAIN_SET_AUTOSTART,
|
||||
QEMUD_SERVER_PKT_NETWORK_GET_AUTOSTART,
|
||||
QEMUD_SERVER_PKT_NETWORK_SET_AUTOSTART,
|
||||
QEMUD_SERVER_PKT_GET_CAPABILITIES,
|
||||
|
||||
QEMUD_SERVER_PKT_MAX
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct qemud_packet_failure_reply {
|
||||
uint32_t code;
|
||||
char message[QEMUD_MAX_ERROR_LEN];
|
||||
};
|
||||
|
||||
struct qemud_packet_get_version_reply {
|
||||
uint32_t versionNum;
|
||||
};
|
||||
|
||||
struct qemud_packet_get_node_info_reply {
|
||||
char model[32];
|
||||
uint32_t memory;
|
||||
uint32_t cpus;
|
||||
uint32_t mhz;
|
||||
uint32_t nodes;
|
||||
uint32_t sockets;
|
||||
uint32_t cores;
|
||||
uint32_t threads;
|
||||
};
|
||||
|
||||
struct qemud_packet_get_capabilities_reply {
|
||||
char xml[QEMUD_MAX_XML_LEN];
|
||||
};
|
||||
|
||||
struct qemud_packet_list_domains_reply {
|
||||
int32_t numDomains;
|
||||
int32_t domains[QEMUD_MAX_NUM_DOMAINS];
|
||||
};
|
||||
|
||||
struct qemud_packet_num_domains_reply{
|
||||
int32_t numDomains;
|
||||
};
|
||||
|
||||
struct qemud_packet_domain_create_request {
|
||||
char xml[QEMUD_MAX_XML_LEN];
|
||||
};
|
||||
struct qemud_packet_domain_create_reply {
|
||||
int32_t id;
|
||||
unsigned char uuid[QEMUD_UUID_RAW_LEN];
|
||||
char name[QEMUD_MAX_NAME_LEN];
|
||||
};
|
||||
struct qemud_packet_domain_lookup_by_id_request {
|
||||
int32_t id;
|
||||
};
|
||||
|
||||
struct qemud_packet_domain_lookup_by_id_reply {
|
||||
unsigned char uuid[QEMUD_UUID_RAW_LEN];
|
||||
char name[QEMUD_MAX_NAME_LEN];
|
||||
};
|
||||
|
||||
struct qemud_packet_domain_lookup_by_name_request {
|
||||
char name[QEMUD_MAX_NAME_LEN];
|
||||
};
|
||||
struct qemud_packet_domain_lookup_by_name_reply {
|
||||
int32_t id;
|
||||
unsigned char uuid[QEMUD_UUID_RAW_LEN];
|
||||
};
|
||||
struct qemud_packet_domain_lookup_by_uuid_request {
|
||||
unsigned char uuid[QEMUD_UUID_RAW_LEN];
|
||||
};
|
||||
|
||||
struct qemud_packet_domain_lookup_by_uuid_reply {
|
||||
int32_t id;
|
||||
char name[QEMUD_MAX_NAME_LEN];
|
||||
};
|
||||
struct qemud_packet_domain_suspend_request {
|
||||
int32_t id;
|
||||
};
|
||||
struct qemud_packet_domain_resume_request {
|
||||
int32_t id;
|
||||
};
|
||||
struct qemud_packet_domain_destroy_request {
|
||||
int32_t id;
|
||||
};
|
||||
struct qemud_packet_domain_get_info_request {
|
||||
unsigned char uuid[QEMUD_UUID_RAW_LEN];
|
||||
};
|
||||
struct qemud_packet_domain_get_info_reply {
|
||||
uint64_t cpuTime;
|
||||
uint32_t runstate;
|
||||
uint32_t memory;
|
||||
uint32_t maxmem;
|
||||
uint32_t nrVirtCpu;
|
||||
};
|
||||
struct qemud_packet_domain_save_request {
|
||||
int32_t id;
|
||||
char file[PATH_MAX];
|
||||
};
|
||||
struct qemud_packet_domain_restore_request {
|
||||
char file[PATH_MAX];
|
||||
};
|
||||
struct qemud_packet_domain_restore_reply {
|
||||
int32_t id;
|
||||
};
|
||||
struct qemud_packet_domain_dump_xml_request {
|
||||
unsigned char uuid[QEMUD_UUID_RAW_LEN];
|
||||
};
|
||||
struct qemud_packet_domain_dump_xml_reply {
|
||||
char xml[QEMUD_MAX_XML_LEN];
|
||||
};
|
||||
struct qemud_packet_list_defined_domains_reply{
|
||||
uint32_t numDomains;
|
||||
char domains[QEMUD_MAX_DOMAINS_NAME_BUF];
|
||||
};
|
||||
struct qemud_packet_num_defined_domains_reply{
|
||||
uint32_t numDomains;
|
||||
};
|
||||
struct qemud_packet_domain_start_request {
|
||||
unsigned char uuid[QEMUD_UUID_RAW_LEN];
|
||||
};
|
||||
struct qemud_packet_domain_start_reply {
|
||||
int32_t id;
|
||||
};
|
||||
struct qemud_packet_domain_define_request {
|
||||
char xml[QEMUD_MAX_XML_LEN];
|
||||
};
|
||||
struct qemud_packet_domain_define_reply {
|
||||
unsigned char uuid[QEMUD_UUID_RAW_LEN];
|
||||
char name[QEMUD_MAX_NAME_LEN];
|
||||
};
|
||||
struct qemud_packet_domain_undefine_request {
|
||||
unsigned char uuid[QEMUD_UUID_RAW_LEN];
|
||||
};
|
||||
struct qemud_packet_num_networks_reply {
|
||||
uint32_t numNetworks;
|
||||
};
|
||||
|
||||
struct qemud_packet_list_networks_reply {
|
||||
uint32_t numNetworks;
|
||||
char networks[QEMUD_MAX_NETWORKS_NAME_BUF];
|
||||
};
|
||||
|
||||
struct qemud_packet_num_defined_networks_reply {
|
||||
uint32_t numNetworks;
|
||||
};
|
||||
|
||||
struct qemud_packet_list_defined_networks_reply {
|
||||
uint32_t numNetworks;
|
||||
char networks[QEMUD_MAX_NETWORKS_NAME_BUF];
|
||||
};
|
||||
struct qemud_packet_network_lookup_by_name_request {
|
||||
char name[QEMUD_MAX_NAME_LEN];
|
||||
};
|
||||
struct qemud_packet_network_lookup_by_name_reply {
|
||||
int32_t id;
|
||||
unsigned char uuid[QEMUD_UUID_RAW_LEN];
|
||||
};
|
||||
struct qemud_packet_network_lookup_by_uuid_request {
|
||||
unsigned char uuid[QEMUD_UUID_RAW_LEN];
|
||||
};
|
||||
struct qemud_packet_network_lookup_by_uuid_reply {
|
||||
int32_t id;
|
||||
char name[QEMUD_MAX_NAME_LEN];
|
||||
};
|
||||
struct qemud_packet_network_create_request {
|
||||
char xml[QEMUD_MAX_XML_LEN];
|
||||
};
|
||||
struct qemud_packet_network_create_reply {
|
||||
unsigned char uuid[QEMUD_UUID_RAW_LEN];
|
||||
char name[QEMUD_MAX_NAME_LEN];
|
||||
};
|
||||
struct qemud_packet_network_define_request {
|
||||
char xml[QEMUD_MAX_XML_LEN];
|
||||
};
|
||||
struct qemud_packet_network_define_reply {
|
||||
unsigned char uuid[QEMUD_UUID_RAW_LEN];
|
||||
char name[QEMUD_MAX_NAME_LEN];
|
||||
};
|
||||
struct qemud_packet_network_undefine_request {
|
||||
unsigned char uuid[QEMUD_UUID_RAW_LEN];
|
||||
};
|
||||
struct qemud_packet_network_start_request {
|
||||
unsigned char uuid[QEMUD_UUID_RAW_LEN];
|
||||
};
|
||||
struct qemud_packet_network_destroy_request {
|
||||
unsigned char uuid[QEMUD_UUID_RAW_LEN];
|
||||
};
|
||||
struct qemud_packet_network_dump_xml_request {
|
||||
unsigned char uuid[QEMUD_UUID_RAW_LEN];
|
||||
};
|
||||
struct qemud_packet_network_dump_xml_reply {
|
||||
char xml[QEMUD_MAX_XML_LEN];
|
||||
};
|
||||
struct qemud_packet_network_get_bridge_name_request {
|
||||
unsigned char uuid[QEMUD_UUID_RAW_LEN];
|
||||
};
|
||||
struct qemud_packet_network_get_bridge_name_reply {
|
||||
char ifname[QEMUD_MAX_IFNAME_LEN];
|
||||
};
|
||||
struct qemud_packet_domain_get_autostart_request{
|
||||
unsigned char uuid[QEMUD_UUID_RAW_LEN];
|
||||
};
|
||||
struct qemud_packet_domain_get_autostart_reply {
|
||||
uint32_t autostart;
|
||||
};
|
||||
struct qemud_packet_domain_set_autostart_request {
|
||||
unsigned char uuid[QEMUD_UUID_RAW_LEN];
|
||||
uint32_t autostart;
|
||||
};
|
||||
|
||||
struct qemud_packet_network_get_autostart_request {
|
||||
unsigned char uuid[QEMUD_UUID_RAW_LEN];
|
||||
};
|
||||
struct qemud_packet_network_get_autostart_reply {
|
||||
uint32_t autostart;
|
||||
};
|
||||
struct qemud_packet_network_set_autostart_request {
|
||||
unsigned char uuid[QEMUD_UUID_RAW_LEN];
|
||||
uint32_t autostart;
|
||||
};
|
||||
|
||||
union qemud_packet_client_data switch (qemud_packet_client_data_type type) {
|
||||
case QEMUD_CLIENT_PKT_GET_VERSION:
|
||||
void;
|
||||
|
||||
case QEMUD_CLIENT_PKT_GET_NODEINFO:
|
||||
void;
|
||||
|
||||
case QEMUD_CLIENT_PKT_LIST_DOMAINS:
|
||||
void;
|
||||
|
||||
case QEMUD_CLIENT_PKT_NUM_DOMAINS:
|
||||
void;
|
||||
|
||||
case QEMUD_CLIENT_PKT_DOMAIN_CREATE:
|
||||
qemud_packet_domain_create_request domainCreateRequest;
|
||||
|
||||
case QEMUD_CLIENT_PKT_DOMAIN_LOOKUP_BY_ID:
|
||||
qemud_packet_domain_lookup_by_id_request domainLookupByIDRequest;
|
||||
|
||||
case QEMUD_CLIENT_PKT_DOMAIN_LOOKUP_BY_UUID:
|
||||
qemud_packet_domain_lookup_by_uuid_request domainLookupByUUIDRequest;
|
||||
|
||||
case QEMUD_CLIENT_PKT_DOMAIN_LOOKUP_BY_NAME:
|
||||
qemud_packet_domain_lookup_by_name_request domainLookupByNameRequest;
|
||||
|
||||
case QEMUD_CLIENT_PKT_DOMAIN_SUSPEND:
|
||||
qemud_packet_domain_suspend_request domainSuspendRequest;
|
||||
|
||||
case QEMUD_CLIENT_PKT_DOMAIN_RESUME:
|
||||
qemud_packet_domain_resume_request domainResumeRequest;
|
||||
|
||||
case QEMUD_CLIENT_PKT_DOMAIN_DESTROY:
|
||||
qemud_packet_domain_destroy_request domainDestroyRequest;
|
||||
|
||||
case QEMUD_CLIENT_PKT_DOMAIN_GET_INFO:
|
||||
qemud_packet_domain_get_info_request domainGetInfoRequest;
|
||||
|
||||
case QEMUD_CLIENT_PKT_DOMAIN_SAVE:
|
||||
qemud_packet_domain_save_request domainSaveRequest;
|
||||
|
||||
case QEMUD_CLIENT_PKT_DOMAIN_RESTORE:
|
||||
qemud_packet_domain_restore_request domainRestoreRequest;
|
||||
|
||||
case QEMUD_CLIENT_PKT_DUMP_XML:
|
||||
qemud_packet_domain_dump_xml_request domainDumpXMLRequest;
|
||||
|
||||
case QEMUD_CLIENT_PKT_LIST_DEFINED_DOMAINS:
|
||||
void;
|
||||
|
||||
case QEMUD_CLIENT_PKT_NUM_DEFINED_DOMAINS:
|
||||
void;
|
||||
|
||||
case QEMUD_CLIENT_PKT_DOMAIN_START:
|
||||
qemud_packet_domain_start_request domainStartRequest;
|
||||
|
||||
case QEMUD_CLIENT_PKT_DOMAIN_DEFINE:
|
||||
qemud_packet_domain_define_request domainDefineRequest;
|
||||
|
||||
case QEMUD_CLIENT_PKT_DOMAIN_UNDEFINE:
|
||||
qemud_packet_domain_undefine_request domainUndefineRequest;
|
||||
|
||||
case QEMUD_CLIENT_PKT_NUM_NETWORKS:
|
||||
void;
|
||||
|
||||
case QEMUD_CLIENT_PKT_LIST_NETWORKS:
|
||||
void;
|
||||
|
||||
case QEMUD_CLIENT_PKT_NUM_DEFINED_NETWORKS:
|
||||
void;
|
||||
|
||||
case QEMUD_CLIENT_PKT_LIST_DEFINED_NETWORKS:
|
||||
void;
|
||||
|
||||
case QEMUD_CLIENT_PKT_NETWORK_LOOKUP_BY_UUID:
|
||||
qemud_packet_network_lookup_by_uuid_request networkLookupByUUIDRequest;
|
||||
|
||||
case QEMUD_CLIENT_PKT_NETWORK_LOOKUP_BY_NAME:
|
||||
qemud_packet_network_lookup_by_name_request networkLookupByNameRequest;
|
||||
|
||||
case QEMUD_CLIENT_PKT_NETWORK_CREATE:
|
||||
qemud_packet_network_create_request networkCreateRequest;
|
||||
|
||||
case QEMUD_CLIENT_PKT_NETWORK_DEFINE:
|
||||
qemud_packet_network_define_request networkDefineRequest;
|
||||
|
||||
case QEMUD_CLIENT_PKT_NETWORK_UNDEFINE:
|
||||
qemud_packet_network_undefine_request networkUndefineRequest;
|
||||
|
||||
case QEMUD_CLIENT_PKT_NETWORK_START:
|
||||
qemud_packet_network_start_request networkStartRequest;
|
||||
|
||||
case QEMUD_CLIENT_PKT_NETWORK_DESTROY:
|
||||
qemud_packet_network_destroy_request networkDestroyRequest;
|
||||
|
||||
case QEMUD_CLIENT_PKT_NETWORK_DUMP_XML:
|
||||
qemud_packet_network_dump_xml_request networkDumpXMLRequest;
|
||||
|
||||
case QEMUD_CLIENT_PKT_NETWORK_GET_BRIDGE_NAME:
|
||||
qemud_packet_network_get_bridge_name_request networkGetBridgeNameRequest;
|
||||
|
||||
case QEMUD_CLIENT_PKT_DOMAIN_GET_AUTOSTART:
|
||||
qemud_packet_domain_get_autostart_request domainGetAutostartRequest;
|
||||
|
||||
case QEMUD_CLIENT_PKT_DOMAIN_SET_AUTOSTART:
|
||||
qemud_packet_domain_set_autostart_request domainSetAutostartRequest;
|
||||
|
||||
case QEMUD_CLIENT_PKT_NETWORK_GET_AUTOSTART:
|
||||
qemud_packet_network_get_autostart_request networkGetAutostartRequest;
|
||||
|
||||
case QEMUD_CLIENT_PKT_NETWORK_SET_AUTOSTART:
|
||||
qemud_packet_network_set_autostart_request networkSetAutostartRequest;
|
||||
|
||||
case QEMUD_CLIENT_PKT_GET_CAPABILITIES:
|
||||
void;
|
||||
|
||||
};
|
||||
|
||||
union qemud_packet_server_data switch (qemud_packet_server_data_type type) {
|
||||
case QEMUD_SERVER_PKT_FAILURE:
|
||||
qemud_packet_failure_reply failureReply;
|
||||
|
||||
case QEMUD_SERVER_PKT_GET_VERSION:
|
||||
qemud_packet_get_version_reply getVersionReply;
|
||||
|
||||
case QEMUD_SERVER_PKT_GET_NODEINFO:
|
||||
qemud_packet_get_node_info_reply getNodeInfoReply;
|
||||
|
||||
case QEMUD_SERVER_PKT_LIST_DOMAINS:
|
||||
qemud_packet_list_domains_reply listDomainsReply;
|
||||
|
||||
case QEMUD_SERVER_PKT_NUM_DOMAINS:
|
||||
qemud_packet_num_domains_reply numDomainsReply;
|
||||
|
||||
case QEMUD_SERVER_PKT_DOMAIN_CREATE:
|
||||
qemud_packet_domain_create_reply domainCreateReply;
|
||||
|
||||
case QEMUD_SERVER_PKT_DOMAIN_LOOKUP_BY_ID:
|
||||
qemud_packet_domain_lookup_by_id_reply domainLookupByIDReply;
|
||||
|
||||
case QEMUD_SERVER_PKT_DOMAIN_LOOKUP_BY_UUID:
|
||||
qemud_packet_domain_lookup_by_uuid_reply domainLookupByUUIDReply;
|
||||
|
||||
case QEMUD_SERVER_PKT_DOMAIN_LOOKUP_BY_NAME:
|
||||
qemud_packet_domain_lookup_by_name_reply domainLookupByNameReply;
|
||||
|
||||
case QEMUD_SERVER_PKT_DOMAIN_SUSPEND:
|
||||
void;
|
||||
|
||||
case QEMUD_SERVER_PKT_DOMAIN_RESUME:
|
||||
void;
|
||||
|
||||
case QEMUD_SERVER_PKT_DOMAIN_DESTROY:
|
||||
void;
|
||||
|
||||
case QEMUD_SERVER_PKT_DOMAIN_GET_INFO:
|
||||
qemud_packet_domain_get_info_reply domainGetInfoReply;
|
||||
|
||||
case QEMUD_SERVER_PKT_DOMAIN_SAVE:
|
||||
void;
|
||||
|
||||
case QEMUD_SERVER_PKT_DOMAIN_RESTORE:
|
||||
qemud_packet_domain_restore_reply domainRestoreReply;
|
||||
|
||||
case QEMUD_SERVER_PKT_DUMP_XML:
|
||||
qemud_packet_domain_dump_xml_reply domainDumpXMLReply;
|
||||
|
||||
case QEMUD_SERVER_PKT_LIST_DEFINED_DOMAINS:
|
||||
qemud_packet_list_defined_domains_reply listDefinedDomainsReply;
|
||||
|
||||
case QEMUD_SERVER_PKT_NUM_DEFINED_DOMAINS:
|
||||
qemud_packet_num_defined_domains_reply numDefinedDomainsReply;
|
||||
|
||||
case QEMUD_SERVER_PKT_DOMAIN_START:
|
||||
qemud_packet_domain_start_reply domainStartReply;
|
||||
|
||||
case QEMUD_SERVER_PKT_DOMAIN_DEFINE:
|
||||
qemud_packet_domain_define_reply domainDefineReply;
|
||||
|
||||
case QEMUD_SERVER_PKT_DOMAIN_UNDEFINE:
|
||||
void;
|
||||
|
||||
case QEMUD_SERVER_PKT_NUM_NETWORKS:
|
||||
qemud_packet_num_networks_reply numNetworksReply;
|
||||
|
||||
case QEMUD_SERVER_PKT_LIST_NETWORKS:
|
||||
qemud_packet_list_networks_reply listNetworksReply;
|
||||
|
||||
case QEMUD_SERVER_PKT_NUM_DEFINED_NETWORKS:
|
||||
qemud_packet_num_defined_networks_reply numDefinedNetworksReply;
|
||||
|
||||
case QEMUD_SERVER_PKT_LIST_DEFINED_NETWORKS:
|
||||
qemud_packet_list_defined_networks_reply listDefinedNetworksReply;
|
||||
|
||||
case QEMUD_SERVER_PKT_NETWORK_LOOKUP_BY_UUID:
|
||||
qemud_packet_network_lookup_by_uuid_reply networkLookupByUUIDReply;
|
||||
|
||||
case QEMUD_SERVER_PKT_NETWORK_LOOKUP_BY_NAME:
|
||||
qemud_packet_network_lookup_by_name_reply networkLookupByNameReply;
|
||||
|
||||
case QEMUD_SERVER_PKT_NETWORK_CREATE:
|
||||
qemud_packet_network_create_reply networkCreateReply;
|
||||
|
||||
case QEMUD_SERVER_PKT_NETWORK_DEFINE:
|
||||
qemud_packet_network_define_reply networkDefineReply;
|
||||
|
||||
case QEMUD_SERVER_PKT_NETWORK_UNDEFINE:
|
||||
void;
|
||||
|
||||
case QEMUD_SERVER_PKT_NETWORK_START:
|
||||
void;
|
||||
|
||||
case QEMUD_SERVER_PKT_NETWORK_DESTROY:
|
||||
void;
|
||||
|
||||
case QEMUD_SERVER_PKT_NETWORK_DUMP_XML:
|
||||
qemud_packet_network_dump_xml_reply networkDumpXMLReply;
|
||||
|
||||
case QEMUD_SERVER_PKT_NETWORK_GET_BRIDGE_NAME:
|
||||
qemud_packet_network_get_bridge_name_reply networkGetBridgeNameReply;
|
||||
|
||||
case QEMUD_SERVER_PKT_DOMAIN_GET_AUTOSTART:
|
||||
qemud_packet_domain_get_autostart_reply domainGetAutostartReply;
|
||||
|
||||
case QEMUD_SERVER_PKT_DOMAIN_SET_AUTOSTART:
|
||||
void;
|
||||
|
||||
case QEMUD_SERVER_PKT_NETWORK_GET_AUTOSTART:
|
||||
qemud_packet_network_get_autostart_reply networkGetAutostartReply;
|
||||
|
||||
case QEMUD_SERVER_PKT_NETWORK_SET_AUTOSTART:
|
||||
void;
|
||||
|
||||
case QEMUD_SERVER_PKT_GET_CAPABILITIES:
|
||||
qemud_packet_get_capabilities_reply getCapabilitiesReply;
|
||||
};
|
||||
|
||||
struct qemud_packet_client {
|
||||
uint32_t serial;
|
||||
struct qemud_packet_client_data data;
|
||||
};
|
||||
|
||||
struct qemud_packet_server {
|
||||
uint32_t serial;
|
||||
uint32_t inReplyTo;
|
||||
struct qemud_packet_server_data data;
|
||||
};
|
||||
|
||||
/* The first two words in the messages are length and program number
|
||||
* (previously called "magic"). This makes the protocol compatible
|
||||
|
|
272
qemud/qemud.c
272
qemud/qemud.c
|
@ -57,18 +57,15 @@
|
|||
#include "../src/internal.h"
|
||||
#include "../src/remote_internal.h"
|
||||
#include "../src/conf.h"
|
||||
#include "dispatch.h"
|
||||
#include "driver.h"
|
||||
#include "event.h"
|
||||
|
||||
static int godaemon = 0; /* -d: Be a daemon */
|
||||
static int verbose = 0; /* -v: Verbose mode */
|
||||
static int remote = 0; /* -r: Remote mode */
|
||||
static int sys = 0; /* -s: (QEMUD only) system mode */
|
||||
static int timeout = -1; /* -t: (QEMUD only) timeout */
|
||||
static int timeout = -1; /* -t: Shutdown timeout */
|
||||
static int sigwrite = -1; /* Signal handler pipe */
|
||||
static int ipsock = 0; /* -l Listen for TCP/IP */
|
||||
|
||||
/* Defaults for configuration file elements (remote only). */
|
||||
/* Defaults for configuration file elements */
|
||||
static int listen_tls = 1;
|
||||
static int listen_tcp = 0;
|
||||
static const char *tls_port = LIBVIRTD_TLS_PORT;
|
||||
|
@ -209,21 +206,12 @@ static void qemudDispatchSignalEvent(int fd ATTRIBUTE_UNUSED,
|
|||
qemudLog(QEMUD_INFO, "Reloading configuration on SIGHUP");
|
||||
if (virStateReload() < 0)
|
||||
qemudLog(QEMUD_WARN, "Error while reloading drivers");
|
||||
|
||||
if (!remote) {
|
||||
qemudReload();
|
||||
}
|
||||
break;
|
||||
|
||||
case SIGINT:
|
||||
case SIGQUIT:
|
||||
case SIGTERM:
|
||||
qemudLog(QEMUD_WARN, "Shutting down on signal %d", sigc);
|
||||
|
||||
if (!remote) {
|
||||
qemudShutdown();
|
||||
}
|
||||
|
||||
server->shutdown = 1;
|
||||
break;
|
||||
|
||||
|
@ -606,12 +594,10 @@ static int qemudInitPaths(struct qemud_server *server,
|
|||
char *roSockname,
|
||||
int maxlen) {
|
||||
char *base = 0;
|
||||
uid_t uid = geteuid();
|
||||
|
||||
if (remote) { /* Remote daemon */
|
||||
/* I'm not sure if it's meaningful to have a "session remote daemon"
|
||||
* so currently this code ignores the --system flag. - RWMJ.
|
||||
*/
|
||||
|
||||
|
||||
if (!uid) {
|
||||
if (snprintf (sockname, maxlen, "%s/run/libvirt/libvirt-sock",
|
||||
LOCAL_STATE_DIR) >= maxlen)
|
||||
goto snprintf_error;
|
||||
|
@ -624,48 +610,26 @@ static int qemudInitPaths(struct qemud_server *server,
|
|||
|
||||
unlink(roSockname);
|
||||
|
||||
if (snprintf(server->logDir, PATH_MAX, "%s/log/libvirt/qemu", LOCAL_STATE_DIR) >= PATH_MAX)
|
||||
if (snprintf(server->logDir, PATH_MAX, "%s/log/libvirt/", LOCAL_STATE_DIR) >= PATH_MAX)
|
||||
goto snprintf_error;
|
||||
} else {
|
||||
uid_t uid = geteuid();
|
||||
struct passwd *pw;
|
||||
|
||||
if (sys) { /* QEMUD, system */
|
||||
if (uid != 0) {
|
||||
qemudLog (QEMUD_ERR,
|
||||
"You must run the daemon as root to use system mode");
|
||||
return -1;
|
||||
}
|
||||
if (!(pw = getpwuid(uid))) {
|
||||
qemudLog(QEMUD_ERR, "Failed to find user record for uid '%d': %s",
|
||||
uid, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (snprintf(sockname, maxlen, "%s/run/libvirt/qemud-sock", LOCAL_STATE_DIR) >= maxlen)
|
||||
goto snprintf_error;
|
||||
if (snprintf(sockname, maxlen, "@%s/.libvirt/libvirt-sock", pw->pw_dir) >= maxlen)
|
||||
goto snprintf_error;
|
||||
|
||||
unlink(sockname);
|
||||
if (snprintf(server->logDir, PATH_MAX, "%s/.libvirt/log", pw->pw_dir) >= PATH_MAX)
|
||||
goto snprintf_error;
|
||||
|
||||
if (snprintf(roSockname, maxlen, "%s/run/libvirt/qemud-sock-ro", LOCAL_STATE_DIR) >= maxlen)
|
||||
goto snprintf_error;
|
||||
|
||||
unlink(roSockname);
|
||||
|
||||
if ((base = strdup (SYSCONF_DIR "/libvirt/qemu")) == NULL)
|
||||
goto out_of_memory;
|
||||
} else { /* QEMUD, session */
|
||||
if (!(pw = getpwuid(uid))) {
|
||||
qemudLog(QEMUD_ERR, "Failed to find user record for uid '%d': %s",
|
||||
uid, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (snprintf(sockname, maxlen, "@%s/.libvirt/qemud-sock", pw->pw_dir) >= maxlen)
|
||||
goto snprintf_error;
|
||||
|
||||
if (snprintf(server->logDir, PATH_MAX, "%s/.libvirt/qemu/log", pw->pw_dir) >= PATH_MAX)
|
||||
goto snprintf_error;
|
||||
|
||||
if (asprintf (&base, "%s/.libvirt/qemu", pw->pw_dir) == -1) {
|
||||
qemudLog (QEMUD_ERR, "out of memory in asprintf");
|
||||
return -1;
|
||||
}
|
||||
if (asprintf (&base, "%s/.libvirt", pw->pw_dir) == -1) {
|
||||
qemudLog (QEMUD_ERR, "out of memory in asprintf");
|
||||
return -1;
|
||||
}
|
||||
|
||||
} /* !remote */
|
||||
|
@ -677,11 +641,6 @@ static int qemudInitPaths(struct qemud_server *server,
|
|||
snprintf_error:
|
||||
qemudLog(QEMUD_ERR, "Resulting path to long for buffer in qemudInitPaths()");
|
||||
return -1;
|
||||
|
||||
out_of_memory:
|
||||
qemudLog (QEMUD_ERR, "qemudInitPaths: out of memory");
|
||||
if (base) free (base);
|
||||
return -1;
|
||||
}
|
||||
|
||||
static struct qemud_server *qemudInitialize(int sigread) {
|
||||
|
@ -708,13 +667,14 @@ static struct qemud_server *qemudInitialize(int sigread) {
|
|||
if (roSockname[0] != '\0' && qemudListenUnix(server, roSockname, 1) < 0)
|
||||
goto cleanup;
|
||||
|
||||
__virEventRegisterImpl(virEventAddHandleImpl,
|
||||
virEventRemoveHandleImpl,
|
||||
virEventAddTimeoutImpl,
|
||||
virEventRemoveTimeoutImpl);
|
||||
|
||||
virStateInitialize();
|
||||
|
||||
if (!remote) /* qemud only */ {
|
||||
if (qemudStartup() < 0) {
|
||||
goto cleanup;
|
||||
}
|
||||
} else /* remote only */ {
|
||||
if (ipsock) {
|
||||
if (listen_tcp && remoteListenTCP (server, tcp_port, 0) < 0)
|
||||
goto cleanup;
|
||||
|
||||
|
@ -730,7 +690,6 @@ static struct qemud_server *qemudInitialize(int sigread) {
|
|||
return server;
|
||||
|
||||
cleanup:
|
||||
qemudShutdown();
|
||||
if (server) {
|
||||
struct qemud_socket *sock = server->sockets;
|
||||
while (sock) {
|
||||
|
@ -1070,70 +1029,6 @@ static void qemudDispatchClientFailure(struct qemud_server *server, struct qemud
|
|||
}
|
||||
|
||||
|
||||
static void qemudDispatchClientRequest(struct qemud_server *server,
|
||||
struct qemud_client *client,
|
||||
qemud_packet_client *req) {
|
||||
qemud_packet_server res;
|
||||
qemud_packet_header h;
|
||||
XDR x;
|
||||
|
||||
assert (client->magic == QEMUD_CLIENT_MAGIC);
|
||||
|
||||
if (req->serial != ++client->incomingSerial) {
|
||||
qemudDebug("Invalid serial number. Got %d expect %d",
|
||||
req->serial, client->incomingSerial);
|
||||
qemudDispatchClientFailure(server, client);
|
||||
return;
|
||||
}
|
||||
|
||||
if (qemudDispatch(server,
|
||||
client,
|
||||
&req->data,
|
||||
&res.data) < 0) {
|
||||
qemudDispatchClientFailure(server, client);
|
||||
return;
|
||||
}
|
||||
|
||||
res.serial = ++client->outgoingSerial;
|
||||
res.inReplyTo = req->serial;
|
||||
|
||||
xdrmem_create(&x, client->buffer, sizeof client->buffer,
|
||||
XDR_ENCODE);
|
||||
|
||||
/* Encode a dummy header. We'll come back to encode the real header. */
|
||||
if (!xdr_qemud_packet_header (&x, &h)) {
|
||||
qemudDebug ("failed to encode dummy header");
|
||||
qemudDispatchClientFailure (server, client);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Real payload. */
|
||||
if (!xdr_qemud_packet_server(&x, &res)) {
|
||||
qemudDebug("Failed to XDR encode reply payload");
|
||||
qemudDispatchClientFailure(server, client);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Go back and encode the real header. */
|
||||
h.length = xdr_getpos (&x);
|
||||
h.prog = QEMUD_PROGRAM;
|
||||
|
||||
if (xdr_setpos (&x, 0) == 0) {
|
||||
qemudDebug("xdr_setpos failed");
|
||||
qemudDispatchClientFailure(server, client);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!xdr_qemud_packet_header(&x, &h)) {
|
||||
qemudDebug("Failed to XDR encode reply header");
|
||||
qemudDispatchClientFailure(server, client);
|
||||
return;
|
||||
}
|
||||
|
||||
client->mode = QEMUD_MODE_TX_PACKET;
|
||||
client->bufferLength = h.length;
|
||||
client->bufferOffset = 0;
|
||||
}
|
||||
|
||||
static int qemudClientRead(struct qemud_server *server,
|
||||
struct qemud_client *client) {
|
||||
|
@ -1198,11 +1093,7 @@ static void qemudDispatchClientRead(struct qemud_server *server, struct qemud_cl
|
|||
return;
|
||||
}
|
||||
|
||||
/* We're expecting either QEMUD_PROGRAM or REMOTE_PROGRAM,
|
||||
* corresponding to qemud or remote calls respectively.
|
||||
*/
|
||||
if ((!remote && h.prog != QEMUD_PROGRAM)
|
||||
|| (remote && h.prog != REMOTE_PROGRAM)) {
|
||||
if (h.prog != REMOTE_PROGRAM) {
|
||||
qemudDebug("Header magic %x mismatch", h.prog);
|
||||
qemudDispatchClientFailure(server, client);
|
||||
return;
|
||||
|
@ -1251,26 +1142,13 @@ static void qemudDispatchClientRead(struct qemud_server *server, struct qemud_cl
|
|||
return;
|
||||
}
|
||||
|
||||
if (remote && h.prog == REMOTE_PROGRAM) {
|
||||
if (h.prog == REMOTE_PROGRAM) {
|
||||
remoteDispatchClientRequest (server, client);
|
||||
if (qemudRegisterClientEvent(server, client, 1) < 0)
|
||||
qemudDispatchClientFailure(server, client);
|
||||
} else if (!remote && h.prog == QEMUD_PROGRAM) {
|
||||
qemud_packet_client p;
|
||||
|
||||
if (!xdr_qemud_packet_client(&x, &p)) {
|
||||
qemudDebug("Failed to decode client packet");
|
||||
qemudDispatchClientFailure(server, client);
|
||||
return;
|
||||
}
|
||||
|
||||
qemudDispatchClientRequest(server, client, &p);
|
||||
|
||||
if (qemudRegisterClientEvent(server, client, 1) < 0)
|
||||
qemudDispatchClientFailure(server, client);
|
||||
} else {
|
||||
/* An internal error. */
|
||||
qemudDebug ("Not REMOTE_PROGRAM or QEMUD_PROGRAM");
|
||||
qemudDebug ("Not REMOTE_PROGRAM");
|
||||
qemudDispatchClientFailure(server, client);
|
||||
}
|
||||
|
||||
|
@ -1539,7 +1417,6 @@ static void qemudCleanup(struct qemud_server *server) {
|
|||
}
|
||||
|
||||
|
||||
qemudShutdown();
|
||||
virStateCleanup();
|
||||
|
||||
free(server);
|
||||
|
@ -1692,32 +1569,24 @@ Usage:\n\
|
|||
Options:\n\
|
||||
-v | --verbose Verbose messages.\n\
|
||||
-d | --daemon Run as a daemon & write PID file.\n\
|
||||
-r | --remote Act as remote server.\n\
|
||||
-s | --system Run as system daemon (QEMUD only).\n\
|
||||
-t | --timeout <secs> Exit after timeout period (QEMUD only).\n\
|
||||
-f | --config <file> Configuration file (remote only).\n\
|
||||
-l | --listen Listen for TCP/IP connections.\n\
|
||||
-t | --timeout <secs> Exit after timeout period.\n\
|
||||
-c | --config <file> Configuration file.\n\
|
||||
-p | --pid-file <file> Change name of PID file.\n\
|
||||
\n\
|
||||
Remote and QEMU/network management:\n\
|
||||
\n\
|
||||
The '--remote' flag selects between running as a remote server\n\
|
||||
for remote libvirt requests, versus running as a QEMU\n\
|
||||
and network management daemon.\n\
|
||||
\n\
|
||||
Normally you need to have one daemon of each type.\n\
|
||||
\n\
|
||||
See also http://libvirt.org/remote.html\n\
|
||||
\n\
|
||||
For remote daemon:\n\
|
||||
libvirt management daemon:\n\
|
||||
\n\
|
||||
Default paths:\n\
|
||||
\n\
|
||||
Configuration file (unless overridden by -f):\n\
|
||||
Configuration file (unless overridden by -c):\n\
|
||||
" SYSCONF_DIR "/libvirt/libvirtd.conf\n\
|
||||
\n\
|
||||
Sockets:\n\
|
||||
Sockets (as root):\n\
|
||||
" LOCAL_STATE_DIR "/run/libvirt/libvirt-sock\n\
|
||||
" LOCAL_STATE_DIR "/run/libvirt/libvirt-sock-ro\n\
|
||||
\n\
|
||||
Sockets (as non-root):\n\
|
||||
$HOME/.libvirt/libvirt-sock (in UNIX abstract namespace)\n\
|
||||
\n\
|
||||
TLS:\n\
|
||||
CA certificate: " LIBVIRT_CACERT "\n\
|
||||
|
@ -1726,44 +1595,10 @@ For remote daemon:\n\
|
|||
\n\
|
||||
PID file (unless overridden by --pid-file):\n\
|
||||
%s\n\
|
||||
\n\
|
||||
For QEMU and network management daemon:\n\
|
||||
\n\
|
||||
For '--system' option you must be running this daemon as root.\n\
|
||||
\n\
|
||||
The '--timeout' applies only when the daemon is not servicing\n\
|
||||
clients.\n\
|
||||
\n\
|
||||
Default paths:\n\
|
||||
\n\
|
||||
Configuration files (in system mode):\n\
|
||||
" SYSCONF_DIR "/libvirt/qemu\n\
|
||||
" SYSCONF_DIR "/libvirt/qemu/autostart\n\
|
||||
" SYSCONF_DIR "/libvirt/qemu/networkd\n\
|
||||
" SYSCONF_DIR "/libvirt/qemu/networks/autostart\n\
|
||||
\n\
|
||||
Configuration files (not in system mode):\n\
|
||||
$HOME/.libvirt/qemu\n\
|
||||
$HOME/.libvirt/qemu/autostart\n\
|
||||
$HOME/.libvirt/qemu/networks\n\
|
||||
$HOME/.libvirt/qemu/networks/autostart\n\
|
||||
\n\
|
||||
Sockets (in system mode):\n\
|
||||
" LOCAL_STATE_DIR "/run/libvirt/qemud-sock\n\
|
||||
" LOCAL_STATE_DIR "/run/libvirt/qemud-sock-ro\n\
|
||||
\n\
|
||||
Sockets (not in system mode):\n\
|
||||
$HOME/.libvirt/qemud-sock (in Unix abstract namespace)\n\
|
||||
\n\
|
||||
PID file (unless overridden by --pid-file):\n\
|
||||
%s\n\
|
||||
\n",
|
||||
argv0,
|
||||
REMOTE_PID_FILE[0] != '\0'
|
||||
? REMOTE_PID_FILE
|
||||
: "(disabled in ./configure)",
|
||||
QEMUD_PID_FILE[0] != '\0'
|
||||
? QEMUD_PID_FILE
|
||||
: "(disabled in ./configure)");
|
||||
}
|
||||
|
||||
|
@ -1779,9 +1614,8 @@ int main(int argc, char **argv) {
|
|||
struct option opts[] = {
|
||||
{ "verbose", no_argument, &verbose, 1},
|
||||
{ "daemon", no_argument, &godaemon, 1},
|
||||
{ "remote", no_argument, &remote, 1},
|
||||
{ "config", required_argument, NULL, 'f'},
|
||||
{ "system", no_argument, &sys, 1},
|
||||
{ "listen", no_argument, &ipsock, 1},
|
||||
{ "config", required_argument, NULL, 'c'},
|
||||
{ "timeout", required_argument, NULL, 't'},
|
||||
{ "pid-file", required_argument, NULL, 'p'},
|
||||
{ "help", no_argument, NULL, '?' },
|
||||
|
@ -1793,7 +1627,7 @@ int main(int argc, char **argv) {
|
|||
int c;
|
||||
char *tmp;
|
||||
|
||||
c = getopt_long(argc, argv, "dfp:s:t:v", opts, &optidx);
|
||||
c = getopt_long(argc, argv, "ldfp:t:v", opts, &optidx);
|
||||
|
||||
if (c == -1) {
|
||||
break;
|
||||
|
@ -1809,11 +1643,8 @@ int main(int argc, char **argv) {
|
|||
case 'd':
|
||||
godaemon = 1;
|
||||
break;
|
||||
case 'r':
|
||||
remote = 1;
|
||||
break;
|
||||
case 's':
|
||||
sys = 1;
|
||||
case 'l':
|
||||
ipsock = 1;
|
||||
break;
|
||||
|
||||
case 't':
|
||||
|
@ -1841,14 +1672,12 @@ int main(int argc, char **argv) {
|
|||
}
|
||||
}
|
||||
|
||||
/* In remote mode only, now read the config file (if it exists). */
|
||||
if (remote) {
|
||||
if (remoteReadConfigFile (remote_config_file) < 0)
|
||||
goto error1;
|
||||
}
|
||||
/* Read the config file (if it exists). */
|
||||
if (remoteReadConfigFile (remote_config_file) < 0)
|
||||
goto error1;
|
||||
|
||||
if (godaemon)
|
||||
openlog("libvirt-qemud", 0, 0);
|
||||
openlog("libvirtd", 0, 0);
|
||||
|
||||
if (pipe(sigpipe) < 0 ||
|
||||
qemudSetNonBlock(sigpipe[0]) < 0 ||
|
||||
|
@ -1885,13 +1714,8 @@ int main(int argc, char **argv) {
|
|||
|
||||
/* Choose the name of the PID file. */
|
||||
if (!pid_file) {
|
||||
if (remote) {
|
||||
if (REMOTE_PID_FILE[0] != '\0')
|
||||
pid_file = REMOTE_PID_FILE;
|
||||
} else {
|
||||
if (QEMUD_PID_FILE[0] != '\0')
|
||||
pid_file = QEMUD_PID_FILE;
|
||||
}
|
||||
if (REMOTE_PID_FILE[0] != '\0')
|
||||
pid_file = REMOTE_PID_FILE;
|
||||
}
|
||||
|
||||
if (pid_file && qemudWritePidFile (pid_file) < 0)
|
||||
|
|
|
@ -49,10 +49,6 @@
|
|||
|
||||
#include "internal.h"
|
||||
#include "../src/internal.h"
|
||||
#include "dispatch.h"
|
||||
#include "driver.h"
|
||||
#include "conf.h"
|
||||
#include "iptables.h"
|
||||
|
||||
#define DEBUG 0
|
||||
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
|
||||
#include "internal.h"
|
||||
|
||||
#define qemudLog(level, msg...) fprintf(stderr, msg)
|
||||
|
||||
static int
|
||||
virUUIDGenerateRandomBytes(unsigned char *buf,
|
||||
int buflen)
|
||||
|
|
|
@ -16,7 +16,8 @@ DEPS = libvirt.la
|
|||
LDADDS = @STATIC_BINARIES@ libvirt.la
|
||||
VIRSH_LIBS = @VIRSH_LIBS@
|
||||
|
||||
EXTRA_DIST = libvirt_sym.version
|
||||
EXTRA_DIST = libvirt_sym.version \
|
||||
qemu_internal.c qemu_internal.h
|
||||
|
||||
lib_LTLIBRARIES = libvirt.la
|
||||
libvirt_la_LIBADD = @LIBXML_LIBS@
|
||||
|
@ -42,10 +43,14 @@ CLIENT_SOURCES = \
|
|||
proxy_internal.c proxy_internal.h \
|
||||
conf.c conf.h \
|
||||
xm_internal.c xm_internal.h \
|
||||
qemu_internal.c qemu_internal.h \
|
||||
remote_internal.c remote_internal.h
|
||||
|
||||
SERVER_SOURCES = \
|
||||
../qemud/bridge.c ../qemud/bridge.h \
|
||||
../qemud/iptables.c ../qemud/iptables.h \
|
||||
../qemud/uuid.c ../qemud/uuid.h \
|
||||
../qemud/driver.c ../qemud/driver.h \
|
||||
../qemud/qemu_conf.c ../qemud/conf.h \
|
||||
../qemud/protocol.h ../qemud/protocol.c \
|
||||
../qemud/remote_protocol.c ../qemud/remote_protocol.h
|
||||
|
||||
|
@ -59,6 +64,9 @@ virsh_DEPENDENCIES = $(DEPS)
|
|||
virsh_LDADD = $(LDADDS) $(VIRSH_LIBS)
|
||||
virsh_CFLAGS = $(COVERAGE_CFLAGS)
|
||||
|
||||
../qemud/qemu_conf.c:
|
||||
ln -s conf.c $@
|
||||
|
||||
#
|
||||
# target to ease building test programs
|
||||
#
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
#include "xml.h"
|
||||
#include "test.h"
|
||||
#include "xen_unified.h"
|
||||
#include "qemu_internal.h"
|
||||
#include "remote_internal.h"
|
||||
#include "../qemud/driver.h"
|
||||
|
||||
/*
|
||||
* TODO:
|
||||
|
@ -71,7 +71,7 @@ virInitialize(void)
|
|||
if (testRegister() == -1) return -1;
|
||||
#endif
|
||||
#ifdef WITH_QEMU
|
||||
if (qemuRegister() == -1) return -1;
|
||||
if (qemudRegister() == -1) return -1;
|
||||
#endif
|
||||
#ifdef WITH_XEN
|
||||
if (xenUnifiedRegister () == -1) return -1;
|
||||
|
@ -273,6 +273,9 @@ virRegisterStateDriver(virStateDriverPtr driver)
|
|||
int __virStateInitialize(void) {
|
||||
int i, ret = 0;
|
||||
|
||||
if (virInitialize() < 0)
|
||||
return -1;
|
||||
|
||||
if (virInitialize() < 0)
|
||||
return -1;
|
||||
|
||||
|
@ -470,9 +473,9 @@ virConnectClose(virConnectPtr conn)
|
|||
if (!VIR_IS_CONNECT(conn))
|
||||
return (-1);
|
||||
|
||||
conn->driver->close (conn);
|
||||
if (conn->networkDriver)
|
||||
conn->networkDriver->close (conn);
|
||||
conn->driver->close (conn);
|
||||
|
||||
if (virFreeConnect(conn) < 0)
|
||||
return (-1);
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include <netdb.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <pwd.h>
|
||||
|
||||
#include <rpc/xdr.h>
|
||||
#include <gnutls/gnutls.h>
|
||||
|
@ -118,8 +119,6 @@ remoteOpen (virConnectPtr conn, const char *uri_str, int flags)
|
|||
return VIR_DRV_OPEN_DECLINED; /* Decline - not a URL. */
|
||||
|
||||
char *transport_str = get_transport_from_scheme (uri->scheme);
|
||||
if (!uri->server && !transport_str)
|
||||
return VIR_DRV_OPEN_DECLINED; /* Decline - not a remote URL. */
|
||||
|
||||
/* What transport? */
|
||||
enum {
|
||||
|
@ -147,6 +146,12 @@ remoteOpen (virConnectPtr conn, const char *uri_str, int flags)
|
|||
return VIR_DRV_OPEN_ERROR;
|
||||
}
|
||||
|
||||
if (!strcmp(uri_str, "qemu:///system") ||
|
||||
!strcmp(uri_str, "qemu:///session"))
|
||||
transport = trans_unix;
|
||||
else if (!uri->server && !transport_str)
|
||||
return VIR_DRV_OPEN_DECLINED; /* Decline - not a remote URL. */
|
||||
|
||||
/* Local variables which we will initialise. These can
|
||||
* get freed in the failed: path.
|
||||
*/
|
||||
|
@ -350,10 +355,27 @@ remoteOpen (virConnectPtr conn, const char *uri_str, int flags)
|
|||
|
||||
case trans_unix: {
|
||||
if (!sockname) {
|
||||
if (flags & VIR_DRV_OPEN_RO)
|
||||
sockname = strdup (LIBVIRTD_UNIX_SOCKET_RO);
|
||||
else
|
||||
sockname = strdup (LIBVIRTD_UNIX_SOCKET);
|
||||
if (!strcmp(uri->scheme, "qemu") &&
|
||||
uri->path &&
|
||||
!strcmp(uri->path, "/session")) {
|
||||
struct passwd *pw;
|
||||
uid_t uid = getuid();
|
||||
|
||||
if (!(pw = getpwuid(uid))) {
|
||||
error (NULL, VIR_ERR_SYSTEM_ERROR, strerror (errno));
|
||||
goto failed;
|
||||
}
|
||||
|
||||
if (asprintf (&sockname, "@%s" LIBVIRTD_USER_UNIX_SOCKET, pw->pw_dir) < 0) {
|
||||
error (NULL, VIR_ERR_SYSTEM_ERROR, strerror (errno));
|
||||
goto failed;
|
||||
}
|
||||
} else {
|
||||
if (flags & VIR_DRV_OPEN_RO)
|
||||
sockname = strdup (LIBVIRTD_PRIV_UNIX_SOCKET_RO);
|
||||
else
|
||||
sockname = strdup (LIBVIRTD_PRIV_UNIX_SOCKET);
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef UNIX_PATH_MAX
|
||||
|
@ -363,6 +385,8 @@ remoteOpen (virConnectPtr conn, const char *uri_str, int flags)
|
|||
memset (&addr, 0, sizeof addr);
|
||||
addr.sun_family = AF_UNIX;
|
||||
strncpy (addr.sun_path, sockname, UNIX_PATH_MAX (addr));
|
||||
if (addr.sun_path[0] == '@')
|
||||
addr.sun_path[0] = '\0';
|
||||
|
||||
priv.sock = socket (AF_UNIX, SOCK_STREAM, 0);
|
||||
if (priv.sock == -1) {
|
||||
|
@ -396,7 +420,7 @@ remoteOpen (virConnectPtr conn, const char *uri_str, int flags)
|
|||
cmd_argv[j++] = strdup (server);
|
||||
cmd_argv[j++] = strdup (netcat ? netcat : "nc");
|
||||
cmd_argv[j++] = strdup ("-U");
|
||||
cmd_argv[j++] = strdup (sockname ? sockname : LIBVIRTD_UNIX_SOCKET);
|
||||
cmd_argv[j++] = strdup (sockname ? sockname : LIBVIRTD_PRIV_UNIX_SOCKET);
|
||||
cmd_argv[j++] = 0;
|
||||
assert (j == nr_args);
|
||||
}
|
||||
|
|
|
@ -34,8 +34,9 @@ int remoteRegister (void);
|
|||
|
||||
#define LIBVIRTD_TLS_PORT "16514"
|
||||
#define LIBVIRTD_TCP_PORT "16509"
|
||||
#define LIBVIRTD_UNIX_SOCKET LOCAL_STATE_DIR "/run/libvirt/libvirt-sock"
|
||||
#define LIBVIRTD_UNIX_SOCKET_RO LOCAL_STATE_DIR "/run/libvirt/libvirt-sock-ro"
|
||||
#define LIBVIRTD_PRIV_UNIX_SOCKET LOCAL_STATE_DIR "/run/libvirt/libvirt-sock"
|
||||
#define LIBVIRTD_PRIV_UNIX_SOCKET_RO LOCAL_STATE_DIR "/run/libvirt/libvirt-sock-ro"
|
||||
#define LIBVIRTD_USER_UNIX_SOCKET "/.libvirt/libvirt-sock"
|
||||
#define LIBVIRTD_CONFIGURATION_FILE SYSCONF_DIR "/libvirtd.conf"
|
||||
|
||||
/* Defaults for PKI directory. */
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "buf.h"
|
||||
#include "xs_internal.h" /* for xenStoreDomainGetNetworkID */
|
||||
|
||||
#ifndef PROXY
|
||||
/**
|
||||
* virXMLError:
|
||||
* @conn: a connection if any
|
||||
|
@ -47,7 +48,6 @@ virXMLError(virConnectPtr conn, virErrorNumber error, const char *info, int valu
|
|||
errmsg, info, NULL, value, 0, errmsg, info, value);
|
||||
}
|
||||
|
||||
#ifndef PROXY
|
||||
/**
|
||||
* virXPathString:
|
||||
* @xpath: the XPath string to evaluate
|
||||
|
|
Loading…
Reference in New Issue