---
src/xen/xend_internal.c | 528 +++++++++++++++++++++--------------------------
src/xen/xend_internal.h | 24 +--
src/xen/xm_internal.c | 16 +-
3 files changed, 254 insertions(+), 314 deletions(-)
diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
index 691a940..c4e73b7 100644
--- a/src/xen/xend_internal.c
+++ b/src/xen/xend_internal.c
@@ -85,8 +85,7 @@ xenDaemonFormatSxprNet(virConnectPtr conn ATTRIBUTE_UNUSED,
int xendConfigVersion,
int isAttach);
static int
-xenDaemonFormatSxprOnePCI(virConnectPtr conn,
- virDomainHostdevDefPtr def,
+xenDaemonFormatSxprOnePCI(virDomainHostdevDefPtr def,
virBufferPtr buf,
int detach);
@@ -98,12 +97,12 @@ virDomainXMLDevID(virDomainPtr domain,
int ref_len);
#endif
-#define virXendError(conn, code, ...) \
- virReportErrorHelper(conn, VIR_FROM_XEND, code, __FILE__, \
+#define virXendError(code, ...) \
+ virReportErrorHelper(NULL, VIR_FROM_XEND, code, __FILE__, \
__FUNCTION__, __LINE__, __VA_ARGS__)
-#define virXendErrorInt(conn, code, ival) \
- virXendError(conn, code, "%d", ival)
+#define virXendErrorInt(code, ival) \
+ virXendError(code, "%d", ival)
/**
* do_connect:
@@ -123,7 +122,7 @@ do_connect(virConnectPtr xend)
s = socket(priv->addrfamily, SOCK_STREAM, priv->addrprotocol);
if (s == -1) {
- virXendError(xend, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("failed to create a socket"));
return -1;
}
@@ -146,7 +145,7 @@ do_connect(virConnectPtr xend)
* error
*/
if (xenHavePrivilege()) {
- virXendError(xend, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("failed to connect to xend"));
}
}
@@ -167,7 +166,7 @@ do_connect(virConnectPtr xend)
* Returns the number of bytes exchanged, or -1 in case of error
*/
static size_t
-wr_sync(virConnectPtr xend, int fd, void *buffer, size_t size, int do_read)
+wr_sync(int fd, void *buffer, size_t size, int do_read)
{
size_t offset = 0;
@@ -193,10 +192,10 @@ wr_sync(virConnectPtr xend, int fd, void *buffer, size_t size, int
do_read)
/* unrecoverable error */
if (len == -1) {
if (do_read)
- virXendError(xend, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("failed to read from Xen
Daemon"));
else
- virXendError(xend, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("failed to write to Xen
Daemon"));
return (-1);
@@ -210,7 +209,6 @@ wr_sync(virConnectPtr xend, int fd, void *buffer, size_t size, int
do_read)
/**
* sread:
- * @xend: the xend connection object
* @fd: the file descriptor
* @buffer: the I/O buffer
* @size: the size of the I/O
@@ -220,14 +218,13 @@ wr_sync(virConnectPtr xend, int fd, void *buffer, size_t size, int
do_read)
* Returns the number of bytes read, or -1 in case of error
*/
static ssize_t
-sread(virConnectPtr xend, int fd, void *buffer, size_t size)
+sread(int fd, void *buffer, size_t size)
{
- return wr_sync(xend, fd, buffer, size, 1);
+ return wr_sync(fd, buffer, size, 1);
}
/**
* swrite:
- * @xend: the xend connection object
* @fd: the file descriptor
* @buffer: the I/O buffer
* @size: the size of the I/O
@@ -237,14 +234,13 @@ sread(virConnectPtr xend, int fd, void *buffer, size_t size)
* Returns the number of bytes written, or -1 in case of error
*/
static ssize_t
-swrite(virConnectPtr xend, int fd, const void *buffer, size_t size)
+swrite(int fd, const void *buffer, size_t size)
{
- return wr_sync(xend, fd, (void *) buffer, size, 0);
+ return wr_sync(fd, (void *) buffer, size, 0);
}
/**
* swrites:
- * @xend: the xend connection object
* @fd: the file descriptor
* @string: the string to write
*
@@ -253,14 +249,13 @@ swrite(virConnectPtr xend, int fd, const void *buffer, size_t size)
* Returns the number of bytes written, or -1 in case of error
*/
static ssize_t
-swrites(virConnectPtr xend, int fd, const char *string)
+swrites(int fd, const char *string)
{
- return swrite(xend, fd, string, strlen(string));
+ return swrite(fd, string, strlen(string));
}
/**
* sreads:
- * @xend: the xend connection object
* @fd: the file descriptor
* @buffer: the I/O buffer
* @n_buffer: the size of the I/O buffer
@@ -270,7 +265,7 @@ swrites(virConnectPtr xend, int fd, const char *string)
* Returns the number of bytes read, or -1 in case of error
*/
static ssize_t
-sreads(virConnectPtr xend, int fd, char *buffer, size_t n_buffer)
+sreads(int fd, char *buffer, size_t n_buffer)
{
size_t offset;
@@ -280,7 +275,7 @@ sreads(virConnectPtr xend, int fd, char *buffer, size_t n_buffer)
for (offset = 0; offset < (n_buffer - 1); offset++) {
ssize_t ret;
- ret = sread(xend, fd, buffer + offset, 1);
+ ret = sread(fd, buffer + offset, 1);
if (ret == 0)
break;
else if (ret == -1)
@@ -305,7 +300,6 @@ istartswith(const char *haystack, const char *needle)
/**
* xend_req:
- * @xend: the xend connection object
* @fd: the file descriptor
* @content: the buffer to store the content
* @n_content: the size of the buffer
@@ -315,13 +309,13 @@ istartswith(const char *haystack, const char *needle)
* Returns the HTTP return code.
*/
static int
-xend_req(virConnectPtr xend, int fd, char *content, size_t n_content)
+xend_req(int fd, char *content, size_t n_content)
{
char buffer[4096];
int content_length = -1;
int retcode = 0;
- while (sreads(xend, fd, buffer, sizeof(buffer)) > 0) {
+ while (sreads(fd, buffer, sizeof(buffer)) > 0) {
if (STREQ(buffer, "\r\n"))
break;
@@ -337,7 +331,7 @@ xend_req(virConnectPtr xend, int fd, char *content, size_t n_content)
if ((unsigned int) content_length > (n_content + 1))
content_length = n_content - 1;
- ret = sread(xend, fd, content, content_length);
+ ret = sread(fd, content, content_length);
if (ret < 0)
return -1;
@@ -370,21 +364,21 @@ xend_get(virConnectPtr xend, const char *path,
if (s == -1)
return s;
- swrites(xend, s, "GET ");
- swrites(xend, s, path);
- swrites(xend, s, " HTTP/1.1\r\n");
+ swrites(s, "GET ");
+ swrites(s, path);
+ swrites(s, " HTTP/1.1\r\n");
- swrites(xend, s,
+ swrites(s,
"Host: localhost:8000\r\n"
"Accept-Encoding: identity\r\n"
"Content-Type: application/x-www-form-urlencoded\r\n"
"\r\n");
- ret = xend_req(xend, s, content, n_content);
+ ret = xend_req(s, content, n_content);
close(s);
if (((ret < 0) || (ret >= 300)) &&
((ret != 404) || (!STRPREFIX(path, "/xend/domain/")))) {
- virXendError(xend, VIR_ERR_GET_FAILED,
+ virXendError(VIR_ERR_GET_FAILED,
_("%d status from xen daemon: %s:%s"),
ret, path, content);
}
@@ -417,28 +411,28 @@ xend_post(virConnectPtr xend, const char *path, const char *ops,
if (s == -1)
return s;
- swrites(xend, s, "POST ");
- swrites(xend, s, path);
- swrites(xend, s, " HTTP/1.1\r\n");
+ swrites(s, "POST ");
+ swrites(s, path);
+ swrites(s, " HTTP/1.1\r\n");
- swrites(xend, s,
+ swrites(s,
"Host: localhost:8000\r\n"
"Accept-Encoding: identity\r\n"
"Content-Type: application/x-www-form-urlencoded\r\n"
"Content-Length: ");
snprintf(buffer, sizeof(buffer), "%d", (int) strlen(ops));
- swrites(xend ,s, buffer);
- swrites(xend, s, "\r\n\r\n");
- swrites(xend, s, ops);
+ swrites(s, buffer);
+ swrites(s, "\r\n\r\n");
+ swrites(s, ops);
- ret = xend_req(xend, s, content, n_content);
+ ret = xend_req(s, content, n_content);
close(s);
if ((ret < 0) || (ret >= 300)) {
- virXendError(xend, VIR_ERR_POST_FAILED,
+ virXendError(VIR_ERR_POST_FAILED,
_("xend_post: error from xen daemon: %s"), content);
} else if ((ret == 202) && (strstr(content, "failed") != NULL)) {
- virXendError(xend, VIR_ERR_POST_FAILED,
+ virXendError(VIR_ERR_POST_FAILED,
_("xend_post: error from xen daemon: %s"), content);
ret = -1;
} else if (((ret >= 200) && (ret <= 202)) && (strstr(content,
"xend.err") != NULL)) {
@@ -446,7 +440,7 @@ xend_post(virConnectPtr xend, const char *path, const char *ops,
* which returns a success code, but the word 'xend.err'
* in body to indicate error :-(
*/
- virXendError(xend, VIR_ERR_POST_FAILED,
+ virXendError(VIR_ERR_POST_FAILED,
_("xend_post: error from xen daemon: %s"), content);
ret = -1;
}
@@ -458,7 +452,6 @@ xend_post(virConnectPtr xend, const char *path, const char *ops,
/**
* http2unix:
- * @xend: the xend connection object
* @ret: the http return code
*
* Convert the HTTP return code to 0/-1 and set errno if needed
@@ -466,7 +459,7 @@ xend_post(virConnectPtr xend, const char *path, const char *ops,
* Return -1 in case of error code 0 otherwise
*/
static int
-http2unix(virConnectPtr xend, int ret)
+http2unix(int ret)
{
switch (ret) {
case -1:
@@ -482,7 +475,7 @@ http2unix(virConnectPtr xend, int ret)
errno = EIO;
break;
default:
- virXendErrorInt(xend, VIR_ERR_HTTP_ERROR, ret);
+ virXendErrorInt(VIR_ERR_HTTP_ERROR, ret);
errno = EINVAL;
break;
}
@@ -531,7 +524,7 @@ xend_op_ext(virConnectPtr xend, const char *path, char *error,
}
content = virBufferContentAndReset(&buf);
- ret = http2unix(xend, xend_post(xend, path, content, error, n_error));
+ ret = http2unix(xend_post(xend, path, content, error, n_error));
VIR_FREE(content);
return ret;
@@ -598,7 +591,7 @@ sexpr_get(virConnectPtr xend, const char *fmt, ...)
va_end(ap);
ret = xend_get(xend, path, buffer, sizeof(buffer));
- ret = http2unix(xend ,ret);
+ ret = http2unix(ret);
if (ret == -1)
return NULL;
@@ -807,7 +800,7 @@ xenDaemonOpen_tcp(virConnectPtr conn, const char *host, const char
*port)
ret = getaddrinfo (host, port, &hints, &res);
if (ret != 0) {
- virXendError(NULL, VIR_ERR_UNKNOWN_HOST,
+ virXendError(VIR_ERR_UNKNOWN_HOST,
_("unable to resolve hostname '%s': %s"),
host, gai_strerror (ret));
return -1;
@@ -962,7 +955,7 @@ xenDaemonDomainCreateXML(virConnectPtr xend, const char *sexpr)
ptr = urlencode(sexpr);
if (ptr == NULL) {
/* this should be caught at the interface but ... */
- virXendError(xend, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("failed to urlencode the create
S-Expr"));
return (-1);
}
@@ -1003,18 +996,18 @@ xenDaemonDomainLookupByName_ids(virConnectPtr xend, const char
*domname,
value = sexpr_node(root, "domain/domid");
if (value == NULL) {
- virXendError(xend, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("domain information incomplete, missing
domid"));
goto error;
}
ret = strtol(value, NULL, 0);
if ((ret == 0) && (value[0] != '0')) {
- virXendError(xend, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("domain information incorrect domid not
numeric"));
ret = -1;
} else if (uuid != NULL) {
if (sexpr_uuid(uuid, root, "domain/uuid") < 0) {
- virXendError(xend, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("domain information incomplete, missing
uuid"));
}
}
@@ -1053,7 +1046,7 @@ xenDaemonDomainLookupByID(virConnectPtr xend,
name = sexpr_node(root, "domain/name");
if (name == NULL) {
- virXendError(xend, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("domain information incomplete, missing
name"));
goto error;
}
@@ -1066,7 +1059,7 @@ xenDaemonDomainLookupByID(virConnectPtr xend,
}
if (sexpr_uuid(uuid, root, "domain/uuid") < 0) {
- virXendError(xend, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("domain information incomplete, missing
uuid"));
goto error;
}
@@ -1090,7 +1083,7 @@ xend_detect_config_version(virConnectPtr conn) {
xenUnifiedPrivatePtr priv;
if (!VIR_IS_CONNECT(conn)) {
- virXendError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_CONN, __FUNCTION__);
return (-1);
}
@@ -1123,7 +1116,6 @@ xend_detect_config_version(virConnectPtr conn) {
/**
* xenDaemonParseSxprOS
- * @xend: the xend connection object
* @node: the root of the parsed S-Expression
* @def: the domain config
* @hvm: true or 1 if no contains HVM S-Expression
@@ -1134,8 +1126,7 @@ xend_detect_config_version(virConnectPtr conn) {
* Returns 0 in case of success and -1 in case of error
*/
static int
-xenDaemonParseSxprOS(virConnectPtr xend,
- const struct sexpr *node,
+xenDaemonParseSxprOS(const struct sexpr *node,
virDomainDefPtr def,
int hvm)
{
@@ -1147,7 +1138,7 @@ xenDaemonParseSxprOS(virConnectPtr xend,
goto no_memory;
if (def->os.loader == NULL) {
- virXendError(xend, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("domain information incomplete,
missing HVM loader"));
return(-1);
}
@@ -1201,7 +1192,7 @@ xenDaemonParseSxprOS(virConnectPtr xend,
if (!hvm &&
!def->os.kernel &&
!def->os.bootloader) {
- virXendError(xend, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("domain information incomplete, missing
kernel & bootloader"));
return -1;
}
@@ -1215,8 +1206,7 @@ no_memory:
int
-xend_parse_sexp_desc_char(virConnectPtr conn,
- virBufferPtr buf,
+xend_parse_sexp_desc_char(virBufferPtr buf,
const char *devtype,
int portNum,
const char *value,
@@ -1265,7 +1255,7 @@ xend_parse_sexp_desc_char(virConnectPtr conn,
type = "unix";
value += sizeof("unix:")-1;
} else {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Unknown char device type"));
return -1;
}
@@ -1299,7 +1289,7 @@ xend_parse_sexp_desc_char(virConnectPtr conn,
const char *mode, *protocol;
if (offset == NULL) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("malformed char device string"));
goto error;
}
@@ -1339,7 +1329,7 @@ xend_parse_sexp_desc_char(virConnectPtr conn,
const char *offset2, *offset3;
if (offset == NULL) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("malformed char device string"));
goto error;
}
@@ -1355,7 +1345,7 @@ xend_parse_sexp_desc_char(virConnectPtr conn,
offset3 = strchr(offset2, ':');
if (offset3 == NULL) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("malformed char device
string"));
goto error;
}
@@ -1435,8 +1425,7 @@ error:
}
virDomainChrDefPtr
-xenDaemonParseSxprChar(virConnectPtr conn,
- const char *value,
+xenDaemonParseSxprChar(const char *value,
const char *tty)
{
const char *prefix;
@@ -1463,7 +1452,7 @@ xenDaemonParseSxprChar(virConnectPtr conn,
def->data.tcp.protocol = VIR_DOMAIN_CHR_TCP_PROTOCOL_TELNET;
} else {
if ((def->type = virDomainChrTypeFromString(prefix)) < 0) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("unknown chr device type '%s'"),
prefix);
goto error;
}
@@ -1490,7 +1479,7 @@ xenDaemonParseSxprChar(virConnectPtr conn,
const char *offset2;
if (offset == NULL) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("malformed char device string"));
goto error;
}
@@ -1518,7 +1507,7 @@ xenDaemonParseSxprChar(virConnectPtr conn,
const char *offset2, *offset3;
if (offset == NULL) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("malformed char device string"));
goto error;
}
@@ -1534,7 +1523,7 @@ xenDaemonParseSxprChar(virConnectPtr conn,
offset3 = strchr(offset2, ':');
if (offset3 == NULL) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("malformed char device
string"));
goto error;
}
@@ -1589,8 +1578,7 @@ error:
* Returns 0 if successful or -1 if failed.
*/
static int
-xenDaemonParseSxprDisks(virConnectPtr conn,
- virDomainDefPtr def,
+xenDaemonParseSxprDisks(virDomainDefPtr def,
const struct sexpr *root,
int hvm,
int xendConfigVersion)
@@ -1625,7 +1613,7 @@ xenDaemonParseSxprDisks(virConnectPtr conn,
goto no_memory;
if (dst == NULL) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("domain information incomplete, vbd
has no dev"));
goto error;
}
@@ -1636,7 +1624,7 @@ xenDaemonParseSxprDisks(virConnectPtr conn,
if (!offset ||
!hvm ||
STRNEQ(offset, ":cdrom")) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("domain information incomplete,
vbd has no src"));
goto error;
}
@@ -1645,7 +1633,7 @@ xenDaemonParseSxprDisks(virConnectPtr conn,
if (src != NULL) {
offset = strchr(src, ':');
if (!offset) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot parse vbd filename,
missing driver name"));
goto error;
}
@@ -1654,7 +1642,7 @@ xenDaemonParseSxprDisks(virConnectPtr conn,
goto no_memory;
if (virStrncpy(disk->driverName, src, offset-src,
(offset-src)+1) == NULL) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("Driver name %s too big for destination"),
src);
goto error;
@@ -1665,7 +1653,7 @@ xenDaemonParseSxprDisks(virConnectPtr conn,
if (STREQ (disk->driverName, "tap")) {
offset = strchr(src, ':');
if (!offset) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("cannot parse vbd filename,
missing driver type"));
goto error;
}
@@ -1674,7 +1662,7 @@ xenDaemonParseSxprDisks(virConnectPtr conn,
goto no_memory;
if (virStrncpy(disk->driverType, src, offset-src,
(offset-src)+1) == NULL) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("Driver type %s too big for
destination"),
src);
goto error;
@@ -1760,8 +1748,7 @@ error:
static int
-xenDaemonParseSxprNets(virConnectPtr conn,
- virDomainDefPtr def,
+xenDaemonParseSxprNets(virDomainDefPtr def,
const struct sexpr *root)
{
virDomainNetDefPtr net = NULL;
@@ -1820,7 +1807,7 @@ xenDaemonParseSxprNets(virConnectPtr conn,
tmp = sexpr_node(node, "device/vif/mac");
if (tmp) {
if (virParseMacAddr(tmp, net->mac) < 0) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("malformed mac address '%s'"),
tmp);
goto cleanup;
}
@@ -1854,8 +1841,7 @@ cleanup:
int
-xenDaemonParseSxprSound(virConnectPtr conn,
- virDomainDefPtr def,
+xenDaemonParseSxprSound(virDomainDefPtr def,
const char *str)
{
if (STREQ(str, "all")) {
@@ -1899,7 +1885,7 @@ xenDaemonParseSxprSound(virConnectPtr conn,
else
len = strlen(offset);
if (virStrncpy(model, offset, len, sizeof(model)) == NULL) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("Sound model %s too big for destination"),
offset);
goto error;
@@ -2098,7 +2084,7 @@ xenDaemonParseSxprGraphicsNew(virConnectPtr conn,
goto no_memory;
if ((graphics->type = virDomainGraphicsTypeFromString(tmp)) < 0) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("unknown graphics type '%s'"), tmp);
goto error;
}
@@ -2171,7 +2157,6 @@ error:
/**
* xenDaemonParseSxprPCI
- * @conn: connection
* @root: root sexpr
*
* This parses out block devices from the domain sexpr
@@ -2179,8 +2164,7 @@ error:
* Returns 0 if successful or -1 if failed.
*/
static int
-xenDaemonParseSxprPCI(virConnectPtr conn,
- virDomainDefPtr def,
+xenDaemonParseSxprPCI(virDomainDefPtr def,
const struct sexpr *root)
{
const struct sexpr *cur, *tmp = NULL, *node;
@@ -2225,43 +2209,43 @@ xenDaemonParseSxprPCI(virConnectPtr conn,
continue;
if (!(domain = sexpr_node(node, "dev/domain"))) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("missing PCI domain"));
goto error;
}
if (!(bus = sexpr_node(node, "dev/bus"))) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("missing PCI bus"));
goto error;
}
if (!(slot = sexpr_node(node, "dev/slot"))) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("missing PCI slot"));
goto error;
}
if (!(func = sexpr_node(node, "dev/func"))) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("missing PCI func"));
goto error;
}
if (virStrToLong_i(domain, NULL, 0, &domainID) < 0) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("cannot parse PCI domain '%s'"), domain);
goto error;
}
if (virStrToLong_i(bus, NULL, 0, &busID) < 0) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("cannot parse PCI bus '%s'"), bus);
goto error;
}
if (virStrToLong_i(slot, NULL, 0, &slotID) < 0) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("cannot parse PCI slot '%s'"), slot);
goto error;
}
if (virStrToLong_i(func, NULL, 0, &funcID) < 0) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("cannot parse PCI func '%s'"), func);
goto error;
}
@@ -2327,7 +2311,7 @@ xenDaemonParseSxpr(virConnectPtr conn,
tmp = sexpr_node(root, "domain/domid");
if (tmp == NULL && xendConfigVersion < 3) { /* Old XenD, domid was
mandatory */
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("domain information incomplete, missing
id"));
goto error;
}
@@ -2340,14 +2324,14 @@ xenDaemonParseSxpr(virConnectPtr conn,
if (sexpr_node_copy(root, "domain/name", &def->name) < 0)
goto no_memory;
if (def->name == NULL) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("domain information incomplete, missing
name"));
goto error;
}
tmp = sexpr_node(root, "domain/uuid");
if (tmp == NULL) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("domain information incomplete, missing
name"));
goto error;
}
@@ -2378,7 +2362,7 @@ xenDaemonParseSxpr(virConnectPtr conn,
if (def->id != 0) {
if (sexpr_lookup(root, "domain/image")) {
- if (xenDaemonParseSxprOS(conn, root, def, hvm) < 0)
+ if (xenDaemonParseSxprOS(root, def, hvm) < 0)
goto error;
}
}
@@ -2398,7 +2382,7 @@ xenDaemonParseSxpr(virConnectPtr conn,
if (virDomainCpuSetParse(&cpus,
0, def->cpumask,
def->cpumasklen) < 0) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("invalid CPU mask %s"), cpus);
goto error;
}
@@ -2409,7 +2393,7 @@ xenDaemonParseSxpr(virConnectPtr conn,
tmp = sexpr_node(root, "domain/on_poweroff");
if (tmp != NULL) {
if ((def->onPoweroff = virDomainLifecycleTypeFromString(tmp)) < 0) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("unknown lifecycle type %s"), tmp);
goto error;
}
@@ -2419,7 +2403,7 @@ xenDaemonParseSxpr(virConnectPtr conn,
tmp = sexpr_node(root, "domain/on_reboot");
if (tmp != NULL) {
if ((def->onReboot = virDomainLifecycleTypeFromString(tmp)) < 0) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("unknown lifecycle type %s"), tmp);
goto error;
}
@@ -2429,7 +2413,7 @@ xenDaemonParseSxpr(virConnectPtr conn,
tmp = sexpr_node(root, "domain/on_crash");
if (tmp != NULL) {
if ((def->onCrash = virDomainLifecycleTypeFromString(tmp)) < 0) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("unknown lifecycle type %s"), tmp);
goto error;
}
@@ -2461,13 +2445,13 @@ xenDaemonParseSxpr(virConnectPtr conn,
goto no_memory;
/* append block devices */
- if (xenDaemonParseSxprDisks(conn, def, root, hvm, xendConfigVersion) < 0)
+ if (xenDaemonParseSxprDisks(def, root, hvm, xendConfigVersion) < 0)
goto error;
- if (xenDaemonParseSxprNets(conn, def, root) < 0)
+ if (xenDaemonParseSxprNets(def, root) < 0)
goto error;
- if (xenDaemonParseSxprPCI(conn, def, root) < 0)
+ if (xenDaemonParseSxprPCI(def, root) < 0)
goto error;
/* New style graphics device config */
@@ -2562,7 +2546,7 @@ xenDaemonParseSxpr(virConnectPtr conn,
tmp = sexpr_node(root, "domain/image/hvm/serial");
if (tmp && STRNEQ(tmp, "none")) {
virDomainChrDefPtr chr;
- if ((chr = xenDaemonParseSxprChar(conn, tmp, tty)) == NULL)
+ if ((chr = xenDaemonParseSxprChar(tmp, tty)) == NULL)
goto error;
if (VIR_REALLOC_N(def->serials, def->nserials+1) < 0) {
virDomainChrDefFree(chr);
@@ -2575,7 +2559,7 @@ xenDaemonParseSxpr(virConnectPtr conn,
if (tmp && STRNEQ(tmp, "none")) {
virDomainChrDefPtr chr;
/* XXX does XenD stuff parallel port tty info into xenstore somewhere ? */
- if ((chr = xenDaemonParseSxprChar(conn, tmp, NULL)) == NULL)
+ if ((chr = xenDaemonParseSxprChar(tmp, NULL)) == NULL)
goto error;
if (VIR_REALLOC_N(def->parallels, def->nparallels+1) < 0) {
virDomainChrDefFree(chr);
@@ -2586,7 +2570,7 @@ xenDaemonParseSxpr(virConnectPtr conn,
}
} else {
/* Fake a paravirt console, since that's not in the sexpr */
- if (!(def->console = xenDaemonParseSxprChar(conn, "pty", tty)))
+ if (!(def->console = xenDaemonParseSxprChar("pty", tty)))
goto error;
def->console->targetType = VIR_DOMAIN_CHR_TARGET_TYPE_CONSOLE;
}
@@ -2597,7 +2581,7 @@ xenDaemonParseSxpr(virConnectPtr conn,
if (hvm &&
(tmp = sexpr_node(root, "domain/image/hvm/soundhw")) != NULL
&&
*tmp) {
- if (xenDaemonParseSxprSound(conn, def, tmp) < 0)
+ if (xenDaemonParseSxprSound(def, tmp) < 0)
goto error;
}
@@ -2749,8 +2733,7 @@ sexpr_to_xend_node_info(const struct sexpr *root, virNodeInfoPtr
info)
* Returns 0 in case of success, -1 in case of error
*/
static int
-sexpr_to_xend_topology(virConnectPtr conn,
- const struct sexpr *root,
+sexpr_to_xend_topology(const struct sexpr *root,
virCapsPtr caps)
{
const char *nodeToCpu;
@@ -2815,7 +2798,7 @@ sexpr_to_xend_topology(virConnectPtr conn,
return (0);
parse_error:
- virXendError(conn, VIR_ERR_XEN_CALL, "%s", _("topology syntax
error"));
+ virXendError(VIR_ERR_XEN_CALL, "%s", _("topology syntax
error"));
error:
VIR_FREE(cpuNums);
VIR_FREE(cpuset);
@@ -2878,7 +2861,7 @@ sexpr_to_domain(virConnectPtr conn, const struct sexpr *root)
return (ret);
error:
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("failed to parse Xend domain
information"));
if (ret != NULL)
virUnrefDomain(ret);
@@ -2922,7 +2905,7 @@ xenDaemonOpen(virConnectPtr conn,
if (conn->uri->scheme == NULL) {
/* It should be a file access */
if (conn->uri->path == NULL) {
- virXendError(NULL, VIR_ERR_NO_CONNECT, __FUNCTION__);
+ virXendError(VIR_ERR_NO_CONNECT, __FUNCTION__);
goto failed;
}
if (xenDaemonOpen_unix(conn, conn->uri->path) < 0 ||
@@ -2956,7 +2939,7 @@ xenDaemonOpen(virConnectPtr conn,
xend_detect_config_version(conn) == -1)
goto failed;
} else {
- virXendError(NULL, VIR_ERR_NO_CONNECT, __FUNCTION__);
+ virXendError(VIR_ERR_NO_CONNECT, __FUNCTION__);
goto failed;
}
@@ -2998,13 +2981,12 @@ int
xenDaemonDomainSuspend(virDomainPtr domain)
{
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
}
if (domain->id < 0) {
- virXendError(domain->conn, VIR_ERR_OPERATION_INVALID,
+ virXendError(VIR_ERR_OPERATION_INVALID,
_("Domain %s isn't running."), domain->name);
return(-1);
}
@@ -3025,13 +3007,12 @@ int
xenDaemonDomainResume(virDomainPtr domain)
{
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
}
if (domain->id < 0) {
- virXendError(domain->conn, VIR_ERR_OPERATION_INVALID,
+ virXendError(VIR_ERR_OPERATION_INVALID,
_("Domain %s isn't running."), domain->name);
return(-1);
}
@@ -3053,13 +3034,12 @@ int
xenDaemonDomainShutdown(virDomainPtr domain)
{
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
}
if (domain->id < 0) {
- virXendError(domain->conn, VIR_ERR_OPERATION_INVALID,
+ virXendError(VIR_ERR_OPERATION_INVALID,
_("Domain %s isn't running."), domain->name);
return(-1);
}
@@ -3082,13 +3062,12 @@ int
xenDaemonDomainReboot(virDomainPtr domain, unsigned int flags ATTRIBUTE_UNUSED)
{
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
}
if (domain->id < 0) {
- virXendError(domain->conn, VIR_ERR_OPERATION_INVALID,
+ virXendError(VIR_ERR_OPERATION_INVALID,
_("Domain %s isn't running."), domain->name);
return(-1);
}
@@ -3113,13 +3092,12 @@ int
xenDaemonDomainDestroy(virDomainPtr domain)
{
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
}
if (domain->id < 0) {
- virXendError(domain->conn, VIR_ERR_OPERATION_INVALID,
+ virXendError(VIR_ERR_OPERATION_INVALID,
_("Domain %s isn't running."), domain->name);
return(-1);
}
@@ -3144,8 +3122,7 @@ xenDaemonDomainGetOSType(virDomainPtr domain)
xenUnifiedPrivatePtr priv;
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(NULL);
}
@@ -3191,13 +3168,12 @@ xenDaemonDomainSave(virDomainPtr domain, const char *filename)
{
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL) ||
(filename == NULL)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
}
if (domain->id < 0) {
- virXendError(domain->conn, VIR_ERR_OPERATION_INVALID,
+ virXendError(VIR_ERR_OPERATION_INVALID,
_("Domain %s isn't running."), domain->name);
return(-1);
}
@@ -3228,13 +3204,12 @@ xenDaemonDomainCoreDump(virDomainPtr domain, const char
*filename,
{
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL) ||
(filename == NULL)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
}
if (domain->id < 0) {
- virXendError(domain->conn, VIR_ERR_OPERATION_INVALID,
+ virXendError(VIR_ERR_OPERATION_INVALID,
_("Domain %s isn't running."), domain->name);
return(-1);
}
@@ -3262,7 +3237,7 @@ xenDaemonDomainRestore(virConnectPtr conn, const char *filename)
{
if ((conn == NULL) || (filename == NULL)) {
/* this should be caught at the interface but ... */
- virXendError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
}
return xend_op(conn, "", "op", "restore",
"file", filename, NULL);
@@ -3285,8 +3260,7 @@ xenDaemonDomainGetMaxMemory(virDomainPtr domain)
xenUnifiedPrivatePtr priv;
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
}
@@ -3325,8 +3299,7 @@ xenDaemonDomainSetMaxMemory(virDomainPtr domain, unsigned long
memory)
xenUnifiedPrivatePtr priv;
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
}
@@ -3363,8 +3336,7 @@ xenDaemonDomainSetMemory(virDomainPtr domain, unsigned long memory)
xenUnifiedPrivatePtr priv;
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
}
@@ -3395,7 +3367,7 @@ xenDaemonDomainFetch(virConnectPtr conn,
else
root = sexpr_get(conn, "/xend/domain/%d?detail=1", domid);
if (root == NULL) {
- virXendError (conn, VIR_ERR_XEN_CALL,
+ virXendError(VIR_ERR_XEN_CALL,
"%s", _("xenDaemonDomainFetch failed to"
" find this domain"));
return (NULL);
@@ -3436,8 +3408,7 @@ xenDaemonDomainDumpXML(virDomainPtr domain, int flags, const char
*cpus)
char *xml;
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(NULL);
}
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
@@ -3480,8 +3451,7 @@ xenDaemonDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL) ||
(info == NULL)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
}
@@ -3518,7 +3488,7 @@ xenDaemonLookupByName(virConnectPtr conn, const char *domname)
virDomainPtr ret = NULL;
if ((conn == NULL) || (domname == NULL)) {
- virXendError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(NULL);
}
@@ -3549,11 +3519,11 @@ xenDaemonNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info) {
struct sexpr *root;
if (!VIR_IS_CONNECT(conn)) {
- virXendError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_CONN, __FUNCTION__);
return (-1);
}
if (info == NULL) {
- virXendError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
}
@@ -3582,12 +3552,12 @@ xenDaemonNodeGetTopology(virConnectPtr conn,
struct sexpr *root;
if (!VIR_IS_CONNECT(conn)) {
- virXendError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_CONN, __FUNCTION__);
return (-1);
}
if (caps == NULL) {
- virXendError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
}
@@ -3596,7 +3566,7 @@ xenDaemonNodeGetTopology(virConnectPtr conn,
return (-1);
}
- ret = sexpr_to_xend_topology(conn, root, caps);
+ ret = sexpr_to_xend_topology(root, caps);
sexpr_free(root);
return (ret);
}
@@ -3620,11 +3590,11 @@ xenDaemonGetVersion(virConnectPtr conn, unsigned long *hvVer)
unsigned long version;
if (!VIR_IS_CONNECT(conn)) {
- virXendError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_CONN, __FUNCTION__);
return (-1);
}
if (hvVer == NULL) {
- virXendError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
}
root = sexpr_get(conn, "/xend/node/");
@@ -3770,8 +3740,7 @@ xenDaemonDomainSetVcpus(virDomainPtr domain, unsigned int vcpus)
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)
|| (vcpus < 1)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
}
@@ -3811,8 +3780,7 @@ xenDaemonDomainPinVcpu(virDomainPtr domain, unsigned int vcpu,
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)
|| (cpumap == NULL) || (maplen < 1) || (maplen > (int)sizeof(cpumap_t))) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
}
@@ -3871,13 +3839,11 @@ xenDaemonDomainGetVcpus(virDomainPtr domain, virVcpuInfoPtr info,
int maxinfo,
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)
|| (info == NULL) || (maxinfo < 1)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
}
if (cpumaps != NULL && maplen < 1) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
}
@@ -4102,8 +4068,7 @@ xenDaemonAttachDeviceFlags(virDomainPtr domain, const char *xml,
char class[8], ref[80];
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return -1;
}
@@ -4112,14 +4077,14 @@ xenDaemonAttachDeviceFlags(virDomainPtr domain, const char *xml,
if (domain->id < 0) {
/* If xendConfigVersion < 3 only live config can be changed */
if (priv->xendConfigVersion < 3) {
- virXendError(domain->conn, VIR_ERR_OPERATION_INVALID, "%s",
+ virXendError(VIR_ERR_OPERATION_INVALID, "%s",
_("Xend version does not support modifying "
"persistent config"));
return -1;
}
/* Cannot modify live config if domain is inactive */
if (flags & VIR_DOMAIN_DEVICE_MODIFY_LIVE) {
- virXendError(domain->conn, VIR_ERR_OPERATION_INVALID, "%s",
+ virXendError(VIR_ERR_OPERATION_INVALID, "%s",
_("Cannot modify live config if domain is
inactive"));
return -1;
}
@@ -4128,7 +4093,7 @@ xenDaemonAttachDeviceFlags(virDomainPtr domain, const char *xml,
if (priv->xendConfigVersion < 3 &&
(flags != VIR_DOMAIN_DEVICE_MODIFY_CURRENT ||
flags != VIR_DOMAIN_DEVICE_MODIFY_LIVE)) {
- virXendError(domain->conn, VIR_ERR_OPERATION_INVALID, "%s",
+ virXendError(VIR_ERR_OPERATION_INVALID, "%s",
_("Xend version does not support modifying "
"persistent config"));
return -1;
@@ -4138,7 +4103,7 @@ xenDaemonAttachDeviceFlags(virDomainPtr domain, const char *xml,
*/
if (flags != (VIR_DOMAIN_DEVICE_MODIFY_LIVE |
VIR_DOMAIN_DEVICE_MODIFY_CONFIG)) {
- virXendError(domain->conn, VIR_ERR_OPERATION_INVALID, "%s",
+ virXendError(VIR_ERR_OPERATION_INVALID, "%s",
_("Xend only supports modifying both live and "
"persistent config"));
return -1;
@@ -4178,19 +4143,18 @@ xenDaemonAttachDeviceFlags(virDomainPtr domain, const char *xml,
case VIR_DOMAIN_DEVICE_HOSTDEV:
if (dev->data.hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
dev->data.hostdev->source.subsys.type ==
VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) {
- if (xenDaemonFormatSxprOnePCI(domain->conn,
- dev->data.hostdev,
+ if (xenDaemonFormatSxprOnePCI(dev->data.hostdev,
&buf, 0) < 0)
goto cleanup;
} else {
- virXendError(domain->conn, VIR_ERR_NO_SUPPORT, "%s",
+ virXendError(VIR_ERR_NO_SUPPORT, "%s",
_("unsupported device type"));
goto cleanup;
}
break;
default:
- virXendError(domain->conn, VIR_ERR_NO_SUPPORT, "%s",
+ virXendError(VIR_ERR_NO_SUPPORT, "%s",
_("unsupported device type"));
goto cleanup;
}
@@ -4239,8 +4203,7 @@ xenDaemonUpdateDeviceFlags(virDomainPtr domain, const char *xml,
char class[8], ref[80];
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return -1;
}
@@ -4249,14 +4212,14 @@ xenDaemonUpdateDeviceFlags(virDomainPtr domain, const char *xml,
if (domain->id < 0) {
/* If xendConfigVersion < 3 only live config can be changed */
if (priv->xendConfigVersion < 3) {
- virXendError(domain->conn, VIR_ERR_OPERATION_INVALID, "%s",
+ virXendError(VIR_ERR_OPERATION_INVALID, "%s",
_("Xend version does not support modifying "
"persistent config"));
return -1;
}
/* Cannot modify live config if domain is inactive */
if (flags & VIR_DOMAIN_DEVICE_MODIFY_LIVE) {
- virXendError(domain->conn, VIR_ERR_OPERATION_INVALID, "%s",
+ virXendError(VIR_ERR_OPERATION_INVALID, "%s",
_("Cannot modify live config if domain is
inactive"));
return -1;
}
@@ -4265,7 +4228,7 @@ xenDaemonUpdateDeviceFlags(virDomainPtr domain, const char *xml,
if (priv->xendConfigVersion < 3 &&
(flags != VIR_DOMAIN_DEVICE_MODIFY_CURRENT ||
flags != VIR_DOMAIN_DEVICE_MODIFY_LIVE)) {
- virXendError(domain->conn, VIR_ERR_OPERATION_INVALID, "%s",
+ virXendError(VIR_ERR_OPERATION_INVALID, "%s",
_("Xend version does not support modifying "
"persistent config"));
return -1;
@@ -4275,7 +4238,7 @@ xenDaemonUpdateDeviceFlags(virDomainPtr domain, const char *xml,
*/
if (flags != (VIR_DOMAIN_DEVICE_MODIFY_LIVE |
VIR_DOMAIN_DEVICE_MODIFY_CONFIG)) {
- virXendError(domain->conn, VIR_ERR_OPERATION_INVALID, "%s",
+ virXendError(VIR_ERR_OPERATION_INVALID, "%s",
_("Xend only supports modifying both live and "
"persistent config"));
return -1;
@@ -4304,7 +4267,7 @@ xenDaemonUpdateDeviceFlags(virDomainPtr domain, const char *xml,
break;
default:
- virXendError(domain->conn, VIR_ERR_NO_SUPPORT, "%s",
+ virXendError(VIR_ERR_NO_SUPPORT, "%s",
_("unsupported device type"));
goto cleanup;
}
@@ -4312,7 +4275,7 @@ xenDaemonUpdateDeviceFlags(virDomainPtr domain, const char *xml,
sexpr = virBufferContentAndReset(&buf);
if (virDomainXMLDevID(domain, dev, class, ref, sizeof(ref))) {
- virXendError(domain->conn, VIR_ERR_OPERATION_INVALID, "%s",
+ virXendError(VIR_ERR_OPERATION_INVALID, "%s",
_("requested device does not exist"));
goto cleanup;
} else {
@@ -4351,8 +4314,7 @@ xenDaemonDetachDeviceFlags(virDomainPtr domain, const char *xml,
virBuffer buf = VIR_BUFFER_INITIALIZER;
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
}
@@ -4361,14 +4323,14 @@ xenDaemonDetachDeviceFlags(virDomainPtr domain, const char *xml,
if (domain->id < 0) {
/* If xendConfigVersion < 3 only live config can be changed */
if (priv->xendConfigVersion < 3) {
- virXendError(domain->conn, VIR_ERR_OPERATION_INVALID, "%s",
+ virXendError(VIR_ERR_OPERATION_INVALID, "%s",
_("Xend version does not support modifying "
"persistent config"));
return -1;
}
/* Cannot modify live config if domain is inactive */
if (flags & VIR_DOMAIN_DEVICE_MODIFY_LIVE) {
- virXendError(domain->conn, VIR_ERR_OPERATION_INVALID, "%s",
+ virXendError(VIR_ERR_OPERATION_INVALID, "%s",
_("Cannot modify live config if domain is
inactive"));
return -1;
}
@@ -4377,7 +4339,7 @@ xenDaemonDetachDeviceFlags(virDomainPtr domain, const char *xml,
if (priv->xendConfigVersion < 3 &&
(flags != VIR_DOMAIN_DEVICE_MODIFY_CURRENT ||
flags != VIR_DOMAIN_DEVICE_MODIFY_LIVE)) {
- virXendError(domain->conn, VIR_ERR_OPERATION_INVALID, "%s",
+ virXendError(VIR_ERR_OPERATION_INVALID, "%s",
_("Xend version does not support modifying "
"persistent config"));
return -1;
@@ -4387,7 +4349,7 @@ xenDaemonDetachDeviceFlags(virDomainPtr domain, const char *xml,
*/
if (flags != (VIR_DOMAIN_DEVICE_MODIFY_LIVE |
VIR_DOMAIN_DEVICE_MODIFY_CONFIG)) {
- virXendError(domain->conn, VIR_ERR_OPERATION_INVALID, "%s",
+ virXendError(VIR_ERR_OPERATION_INVALID, "%s",
_("Xend only supports modifying both live and "
"persistent config"));
return -1;
@@ -4410,12 +4372,11 @@ xenDaemonDetachDeviceFlags(virDomainPtr domain, const char *xml,
if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV) {
if (dev->data.hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
dev->data.hostdev->source.subsys.type ==
VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) {
- if (xenDaemonFormatSxprOnePCI(domain->conn,
- dev->data.hostdev,
+ if (xenDaemonFormatSxprOnePCI(dev->data.hostdev,
&buf, 1) < 0)
goto cleanup;
} else {
- virXendError(domain->conn, VIR_ERR_NO_SUPPORT, "%s",
+ virXendError(VIR_ERR_NO_SUPPORT, "%s",
_("unsupported device type"));
goto cleanup;
}
@@ -4446,8 +4407,7 @@ xenDaemonDomainGetAutostart(virDomainPtr domain,
xenUnifiedPrivatePtr priv;
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
}
@@ -4460,7 +4420,7 @@ xenDaemonDomainGetAutostart(virDomainPtr domain,
root = sexpr_get(domain->conn, "/xend/domain/%s?detail=1",
domain->name);
if (root == NULL) {
- virXendError (domain->conn, VIR_ERR_XEN_CALL,
+ virXendError(VIR_ERR_XEN_CALL,
"%s", _("xenDaemonGetAutostart failed to find this
domain"));
return (-1);
}
@@ -4486,8 +4446,7 @@ xenDaemonDomainSetAutostart(virDomainPtr domain,
xenUnifiedPrivatePtr priv;
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INTERNAL_ERROR,
- __FUNCTION__);
+ virXendError(VIR_ERR_INTERNAL_ERROR, __FUNCTION__);
return (-1);
}
@@ -4500,7 +4459,7 @@ xenDaemonDomainSetAutostart(virDomainPtr domain,
root = sexpr_get(domain->conn, "/xend/domain/%s?detail=1",
domain->name);
if (root == NULL) {
- virXendError (domain->conn, VIR_ERR_XEN_CALL,
+ virXendError(VIR_ERR_XEN_CALL,
"%s", _("xenDaemonSetAutostart failed to find this
domain"));
return (-1);
}
@@ -4510,7 +4469,7 @@ xenDaemonDomainSetAutostart(virDomainPtr domain,
const char *val = (autonode->u.s.car->kind == SEXPR_VALUE
? autonode->u.s.car->u.value : NULL);
if (!val || (!STREQ(val, "ignore") && !STREQ(val,
"start"))) {
- virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("unexpected value from
on_xend_start"));
goto error;
}
@@ -4525,17 +4484,17 @@ xenDaemonDomainSetAutostart(virDomainPtr domain,
}
if (sexpr2string(root, buf, sizeof(buf)) == 0) {
- virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("sexpr2string failed"));
goto error;
}
if (xend_op(domain->conn, "", "op", "new",
"config", buf, NULL) != 0) {
- virXendError(domain->conn, VIR_ERR_XEN_CALL,
+ virXendError(VIR_ERR_XEN_CALL,
"%s", _("Failed to redefine sexpr"));
goto error;
}
} else {
- virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("on_xend_start not present in sexpr"));
goto error;
}
@@ -4579,7 +4538,6 @@ xenDaemonDomainMigratePerform (virDomainPtr domain,
unsigned long bandwidth)
{
/* Upper layers have already checked domain. */
- virConnectPtr conn = domain->conn;
/* NB: Passing port=0 to xend means it ignores
* the port. However this is somewhat specific to
* the internals of the xend Python code. (XXX).
@@ -4593,7 +4551,7 @@ xenDaemonDomainMigratePerform (virDomainPtr domain,
/* Xen doesn't support renaming domains during migration. */
if (dname) {
- virXendError (conn, VIR_ERR_NO_SUPPORT,
+ virXendError(VIR_ERR_NO_SUPPORT,
"%s", _("xenDaemonDomainMigrate: Xen does not
support"
" renaming domains during migration"));
return -1;
@@ -4603,7 +4561,7 @@ xenDaemonDomainMigratePerform (virDomainPtr domain,
* ignores it.
*/
if (bandwidth) {
- virXendError (conn, VIR_ERR_NO_SUPPORT,
+ virXendError(VIR_ERR_NO_SUPPORT,
"%s", _("xenDaemonDomainMigrate: Xen does not
support"
" bandwidth limits during migration"));
return -1;
@@ -4631,7 +4589,7 @@ xenDaemonDomainMigratePerform (virDomainPtr domain,
* a nice error message.
*/
if (flags & VIR_MIGRATE_PAUSED) {
- virXendError (conn, VIR_ERR_NO_SUPPORT,
+ virXendError(VIR_ERR_NO_SUPPORT,
"%s", _("xenDaemonDomainMigrate: xend cannot migrate
paused domains"));
return -1;
}
@@ -4639,7 +4597,7 @@ xenDaemonDomainMigratePerform (virDomainPtr domain,
/* XXX we could easily do tunnelled & peer2peer migration too
if we want to. support these... */
if (flags != 0) {
- virXendError (conn, VIR_ERR_NO_SUPPORT,
+ virXendError(VIR_ERR_NO_SUPPORT,
"%s", _("xenDaemonDomainMigrate: unsupported
flag"));
return -1;
}
@@ -4652,19 +4610,19 @@ xenDaemonDomainMigratePerform (virDomainPtr domain,
if (strstr (uri, "//")) { /* Full URI. */
xmlURIPtr uriptr = xmlParseURI (uri);
if (!uriptr) {
- virXendError (conn, VIR_ERR_INVALID_ARG,
+ virXendError(VIR_ERR_INVALID_ARG,
"%s", _("xenDaemonDomainMigrate: invalid
URI"));
return -1;
}
if (uriptr->scheme && STRCASENEQ (uriptr->scheme,
"xenmigr")) {
- virXendError (conn, VIR_ERR_INVALID_ARG,
+ virXendError(VIR_ERR_INVALID_ARG,
"%s", _("xenDaemonDomainMigrate: only
xenmigr://"
" migrations are supported by Xen"));
xmlFreeURI (uriptr);
return -1;
}
if (!uriptr->server) {
- virXendError (conn, VIR_ERR_INVALID_ARG,
+ virXendError(VIR_ERR_INVALID_ARG,
"%s", _("xenDaemonDomainMigrate: a hostname must
be"
" specified in the URI"));
xmlFreeURI (uriptr);
@@ -4684,7 +4642,7 @@ xenDaemonDomainMigratePerform (virDomainPtr domain,
int port_nr, n;
if (virStrToLong_i(p+1, NULL, 10, &port_nr) < 0) {
- virXendError (conn, VIR_ERR_INVALID_ARG,
+ virXendError(VIR_ERR_INVALID_ARG,
"%s", _("xenDaemonDomainMigrate: invalid port
number"));
return -1;
}
@@ -4749,13 +4707,13 @@ virDomainPtr xenDaemonDomainDefineXML(virConnectPtr conn, const
char *xmlDesc) {
if (!(def = virDomainDefParseString(priv->caps, xmlDesc,
VIR_DOMAIN_XML_INACTIVE))) {
- virXendError(conn, VIR_ERR_XML_ERROR,
+ virXendError(VIR_ERR_XML_ERROR,
"%s", _("failed to parse domain description"));
return (NULL);
}
if (!(sexpr = xenDaemonFormatSxpr(conn, def, priv->xendConfigVersion))) {
- virXendError(conn, VIR_ERR_XML_ERROR,
+ virXendError(VIR_ERR_XML_ERROR,
"%s", _("failed to build sexpr"));
goto error;
}
@@ -4765,7 +4723,7 @@ virDomainPtr xenDaemonDomainDefineXML(virConnectPtr conn, const char
*xmlDesc) {
ret = xend_op(conn, "", "op", "new",
"config", sexpr, NULL);
VIR_FREE(sexpr);
if (ret != 0) {
- virXendError(conn, VIR_ERR_XEN_CALL,
+ virXendError(VIR_ERR_XEN_CALL,
_("Failed to create inactive domain %s\n"),
def->name);
goto error;
}
@@ -4788,8 +4746,7 @@ int xenDaemonDomainCreate(virDomainPtr domain)
virDomainPtr tmp;
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
}
@@ -4816,8 +4773,7 @@ int xenDaemonDomainUndefine(virDomainPtr domain)
xenUnifiedPrivatePtr priv;
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
}
@@ -4937,15 +4893,14 @@ xenDaemonGetSchedulerType(virDomainPtr domain, int *nparams)
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)
|| (nparams == NULL)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return NULL;
}
/* Support only xendConfigVersion >=4 */
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
if (priv->xendConfigVersion < 4) {
- virXendError (domain->conn, VIR_ERR_NO_SUPPORT,
+ virXendError(VIR_ERR_NO_SUPPORT,
"%s", _("unsupported in xendConfigVersion <
4"));
return NULL;
}
@@ -4957,7 +4912,7 @@ xenDaemonGetSchedulerType(virDomainPtr domain, int *nparams)
/* get xen_scheduler from xend/node */
ret = sexpr_node(root, "node/xen_scheduler");
if (ret == NULL){
- virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("node information incomplete, missing
scheduler name"));
goto error;
}
@@ -4976,7 +4931,7 @@ xenDaemonGetSchedulerType(virDomainPtr domain, int *nparams)
}
*nparams = XEN_SCHED_SEDF_NPARAM;
} else {
- virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR, "%s",
_("Unknown scheduler"));
+ virXendError(VIR_ERR_INTERNAL_ERROR, "%s", _("Unknown
scheduler"));
goto error;
}
@@ -5013,15 +4968,14 @@ xenDaemonGetSchedulerParameters(virDomainPtr domain,
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)
|| (params == NULL) || (nparams == NULL)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
}
/* Support only xendConfigVersion >=4 */
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
if (priv->xendConfigVersion < 4) {
- virXendError (domain->conn, VIR_ERR_NO_SUPPORT,
+ virXendError(VIR_ERR_NO_SUPPORT,
"%s", _("unsupported in xendConfigVersion <
4"));
return (-1);
}
@@ -5034,7 +4988,7 @@ xenDaemonGetSchedulerParameters(virDomainPtr domain,
/* get the scheduler type */
sched_type = xenDaemonGetSchedulerType(domain, &sched_nparam);
if (sched_type == NULL) {
- virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Failed to get a scheduler name"));
goto error;
}
@@ -5047,18 +5001,18 @@ xenDaemonGetSchedulerParameters(virDomainPtr domain,
case XEN_SCHED_CRED_NPARAM:
/* get cpu_weight/cpu_cap from xend/domain */
if (sexpr_node(root, "domain/cpu_weight") == NULL) {
- virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("domain information incomplete, missing
cpu_weight"));
goto error;
}
if (sexpr_node(root, "domain/cpu_cap") == NULL) {
- virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("domain information incomplete, missing
cpu_cap"));
goto error;
}
if (virStrcpyStatic(params[0].field, str_weight) == NULL) {
- virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("Weight %s too big for destination"),
str_weight);
goto error;
@@ -5067,7 +5021,7 @@ xenDaemonGetSchedulerParameters(virDomainPtr domain,
params[0].value.ui = sexpr_int(root, "domain/cpu_weight");
if (virStrcpyStatic(params[1].field, str_cap) == NULL) {
- virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("Cap %s too big for destination"), str_cap);
goto error;
}
@@ -5077,7 +5031,7 @@ xenDaemonGetSchedulerParameters(virDomainPtr domain,
ret = 0;
break;
default:
- virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR, "%s",
_("Unknown scheduler"));
+ virXendError(VIR_ERR_INTERNAL_ERROR, "%s", _("Unknown
scheduler"));
goto error;
}
@@ -5110,15 +5064,14 @@ xenDaemonSetSchedulerParameters(virDomainPtr domain,
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)
|| (params == NULL)) {
- virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
- __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
}
/* Support only xendConfigVersion >=4 and active domains */
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
if (priv->xendConfigVersion < 4) {
- virXendError (domain->conn, VIR_ERR_NO_SUPPORT,
+ virXendError(VIR_ERR_NO_SUPPORT,
"%s", _("unsupported in xendConfigVersion <
4"));
return (-1);
}
@@ -5131,7 +5084,7 @@ xenDaemonSetSchedulerParameters(virDomainPtr domain,
/* get the scheduler type */
sched_type = xenDaemonGetSchedulerType(domain, &sched_nparam);
if (sched_type == NULL) {
- virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Failed to get a scheduler name"));
goto error;
}
@@ -5158,7 +5111,7 @@ xenDaemonSetSchedulerParameters(virDomainPtr domain,
params[i].type == VIR_DOMAIN_SCHED_FIELD_UINT) {
snprintf(buf_cap, sizeof(buf_cap), "%u",
params[i].value.ui);
} else {
- virXendError(domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
goto error;
}
}
@@ -5167,7 +5120,7 @@ xenDaemonSetSchedulerParameters(virDomainPtr domain,
if (strlen(buf_weight) == 0) {
weight = sexpr_node(root, "domain/cpu_weight");
if (weight == NULL) {
- virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("domain information incomplete,
missing cpu_weight"));
goto error;
}
@@ -5176,7 +5129,7 @@ xenDaemonSetSchedulerParameters(virDomainPtr domain,
if (strlen(buf_cap) == 0) {
cap = sexpr_node(root, "domain/cpu_cap");
if (cap == NULL) {
- virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("domain information incomplete,
missing cpu_cap"));
goto error;
}
@@ -5189,7 +5142,7 @@ xenDaemonSetSchedulerParameters(virDomainPtr domain,
break;
}
default:
- virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR, "%s",
_("Unknown scheduler"));
+ virXendError(VIR_ERR_INTERNAL_ERROR, "%s", _("Unknown
scheduler"));
goto error;
}
@@ -5234,13 +5187,13 @@ xenDaemonDomainBlockPeek (virDomainPtr domain, const char *path,
domain->name);
else {
/* This call always fails for dom0. */
- virXendError (domain->conn, VIR_ERR_NO_SUPPORT,
+ virXendError(VIR_ERR_NO_SUPPORT,
"%s", _("domainBlockPeek is not supported for
dom0"));
return -1;
}
if (!root) {
- virXendError (domain->conn, VIR_ERR_XEN_CALL, __FUNCTION__);
+ virXendError(VIR_ERR_XEN_CALL, __FUNCTION__);
return -1;
}
@@ -5255,7 +5208,7 @@ xenDaemonDomainBlockPeek (virDomainPtr domain, const char *path,
}
}
if (!found) {
- virXendError (domain->conn, VIR_ERR_INVALID_ARG,
+ virXendError(VIR_ERR_INVALID_ARG,
_("%s: invalid path"), path);
goto cleanup;
}
@@ -5352,13 +5305,12 @@ struct xenUnifiedDriver xenDaemonDriver = {
* Returns 0 in case of success, -1 in case of error
*/
static int
-xenDaemonFormatSxprGraphicsNew(virConnectPtr conn,
- virDomainGraphicsDefPtr def,
+xenDaemonFormatSxprGraphicsNew(virDomainGraphicsDefPtr def,
virBufferPtr buf)
{
if (def->type != VIR_DOMAIN_GRAPHICS_TYPE_SDL &&
def->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("unexpected graphics type %d"),
def->type);
return -1;
@@ -5397,14 +5349,13 @@ xenDaemonFormatSxprGraphicsNew(virConnectPtr conn,
static int
-xenDaemonFormatSxprGraphicsOld(virConnectPtr conn,
- virDomainGraphicsDefPtr def,
+xenDaemonFormatSxprGraphicsOld(virDomainGraphicsDefPtr def,
virBufferPtr buf,
int xendConfigVersion)
{
if (def->type != VIR_DOMAIN_GRAPHICS_TYPE_SDL &&
def->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("unexpected graphics type %d"),
def->type);
return -1;
@@ -5440,14 +5391,13 @@ xenDaemonFormatSxprGraphicsOld(virConnectPtr conn,
}
int
-xenDaemonFormatSxprChr(virConnectPtr conn,
- virDomainChrDefPtr def,
+xenDaemonFormatSxprChr(virDomainChrDefPtr def,
virBufferPtr buf)
{
const char *type = virDomainChrTypeToString(def->type);
if (!type) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("unexpected chr device type"));
return -1;
}
@@ -5530,7 +5480,7 @@ xenDaemonFormatSxprDisk(virConnectPtr conn ATTRIBUTE_UNUSED,
if (hvm &&
def->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) {
if (isAttach) {
- virXendError(conn, VIR_ERR_INVALID_ARG,
+ virXendError(VIR_ERR_INVALID_ARG,
_("Cannot directly attach floppy %s"), def->src);
return -1;
}
@@ -5542,7 +5492,7 @@ xenDaemonFormatSxprDisk(virConnectPtr conn ATTRIBUTE_UNUSED,
def->device == VIR_DOMAIN_DISK_DEVICE_CDROM &&
xendConfigVersion == 1) {
if (isAttach) {
- virXendError(conn, VIR_ERR_INVALID_ARG,
+ virXendError(VIR_ERR_INVALID_ARG,
_("Cannot directly attach CDROM %s"), def->src);
return -1;
}
@@ -5597,7 +5547,7 @@ xenDaemonFormatSxprDisk(virConnectPtr conn ATTRIBUTE_UNUSED,
else
virBufferVSprintf(buf, "(uname 'phy:/dev/%s')",
def->src);
} else {
- virXendError(conn, VIR_ERR_CONFIG_UNSUPPORTED,
+ virXendError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unsupported disk type %s"),
virDomainDiskTypeToString(def->type));
return -1;
@@ -5647,7 +5597,7 @@ xenDaemonFormatSxprNet(virConnectPtr conn,
if (def->type != VIR_DOMAIN_NET_TYPE_BRIDGE &&
def->type != VIR_DOMAIN_NET_TYPE_NETWORK &&
def->type != VIR_DOMAIN_NET_TYPE_ETHERNET) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("unsupported network type %d"), def->type);
return -1;
}
@@ -5680,7 +5630,7 @@ xenDaemonFormatSxprNet(virConnectPtr conn,
char *bridge;
if (!network) {
- virXendError(conn, VIR_ERR_NO_NETWORK, "%s",
+ virXendError(VIR_ERR_NO_NETWORK, "%s",
def->data.network.name);
return -1;
}
@@ -5688,7 +5638,7 @@ xenDaemonFormatSxprNet(virConnectPtr conn,
bridge = virNetworkGetBridgeName(network);
virNetworkFree(network);
if (!bridge) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("network %s is not active"),
def->data.network.name);
return -1;
@@ -5761,13 +5711,12 @@ xenDaemonFormatSxprPCI(virDomainHostdevDefPtr def,
}
static int
-xenDaemonFormatSxprOnePCI(virConnectPtr conn,
- virDomainHostdevDefPtr def,
+xenDaemonFormatSxprOnePCI(virDomainHostdevDefPtr def,
virBufferPtr buf,
int detach)
{
if (def->managed) {
- virXendError(conn, VIR_ERR_NO_SUPPORT, "%s",
+ virXendError(VIR_ERR_NO_SUPPORT, "%s",
_("managed PCI devices not supported with XenD"));
return -1;
}
@@ -5784,8 +5733,7 @@ xenDaemonFormatSxprOnePCI(virConnectPtr conn,
}
static int
-xenDaemonFormatSxprAllPCI(virConnectPtr conn,
- virDomainDefPtr def,
+xenDaemonFormatSxprAllPCI(virDomainDefPtr def,
virBufferPtr buf)
{
int hasPCI = 0;
@@ -5818,7 +5766,7 @@ xenDaemonFormatSxprAllPCI(virConnectPtr conn,
if (def->hostdevs[i]->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
def->hostdevs[i]->source.subsys.type ==
VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) {
if (def->hostdevs[i]->managed) {
- virXendError(conn, VIR_ERR_NO_SUPPORT, "%s",
+ virXendError(VIR_ERR_NO_SUPPORT, "%s",
_("managed PCI devices not supported with
XenD"));
return -1;
}
@@ -5832,8 +5780,7 @@ xenDaemonFormatSxprAllPCI(virConnectPtr conn,
}
int
-xenDaemonFormatSxprSound(virConnectPtr conn,
- virDomainDefPtr def,
+xenDaemonFormatSxprSound(virDomainDefPtr def,
virBufferPtr buf)
{
const char *str;
@@ -5841,7 +5788,7 @@ xenDaemonFormatSxprSound(virConnectPtr conn,
for (i = 0 ; i < def->nsounds ; i++) {
if (!(str = virDomainSoundModelTypeToString(def->sounds[i]->model))) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("unexpected sound model %d"),
def->sounds[i]->model);
return -1;
@@ -5859,8 +5806,7 @@ xenDaemonFormatSxprSound(virConnectPtr conn,
static int
-xenDaemonFormatSxprInput(virConnectPtr conn,
- virDomainInputDefPtr input,
+xenDaemonFormatSxprInput(virDomainInputDefPtr input,
virBufferPtr buf)
{
if (input->bus != VIR_DOMAIN_INPUT_BUS_USB)
@@ -5868,7 +5814,7 @@ xenDaemonFormatSxprInput(virConnectPtr conn,
if (input->type != VIR_DOMAIN_INPUT_TYPE_MOUSE &&
input->type != VIR_DOMAIN_INPUT_TYPE_TABLET) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("unexpected input type %d"), input->type);
return -1;
}
@@ -5933,21 +5879,21 @@ xenDaemonFormatSxpr(virConnectPtr conn,
}
if (!(tmp = virDomainLifecycleTypeToString(def->onPoweroff))) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("unexpected lifecycle value %d"), def->onPoweroff);
goto error;
}
virBufferVSprintf(&buf, "(on_poweroff '%s')", tmp);
if (!(tmp = virDomainLifecycleTypeToString(def->onReboot))) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("unexpected lifecycle value %d"), def->onReboot);
goto error;
}
virBufferVSprintf(&buf, "(on_reboot '%s')", tmp);
if (!(tmp = virDomainLifecycleTypeToString(def->onCrash))) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
_("unexpected lifecycle value %d"), def->onCrash);
goto error;
}
@@ -5956,14 +5902,14 @@ xenDaemonFormatSxpr(virConnectPtr conn,
/* Set localtime here for current XenD (both PV & HVM) */
if (def->clock.offset == VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME) {
if (def->clock.data.timezone) {
- virXendError(conn, VIR_ERR_CONFIG_UNSUPPORTED,
+ virXendError(VIR_ERR_CONFIG_UNSUPPORTED,
"%s", _("configurable timezones are not
supported"));
goto error;
}
virBufferAddLit(&buf, "(localtime 1)");
} else if (def->clock.offset != VIR_DOMAIN_CLOCK_OFFSET_UTC) {
- virXendError(conn, VIR_ERR_CONFIG_UNSUPPORTED,
+ virXendError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unsupported clock offset '%s'"),
virDomainClockOffsetTypeToString(def->clock.offset));
goto error;
@@ -5980,7 +5926,7 @@ xenDaemonFormatSxpr(virConnectPtr conn,
if (hvm &&
def->os.loader == NULL) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s",_("no HVM domain loader"));
goto error;
}
@@ -6064,12 +6010,12 @@ xenDaemonFormatSxpr(virConnectPtr conn,
virBufferAddLit(&buf, "(usb 1)");
for (i = 0 ; i < def->ninputs ; i++)
- if (xenDaemonFormatSxprInput(conn, def->inputs[i], &buf) < 0)
+ if (xenDaemonFormatSxprInput(def->inputs[i], &buf) < 0)
goto error;
if (def->parallels) {
virBufferAddLit(&buf, "(parallel ");
- if (xenDaemonFormatSxprChr(conn, def->parallels[0], &buf) < 0)
+ if (xenDaemonFormatSxprChr(def->parallels[0], &buf) < 0)
goto error;
virBufferAddLit(&buf, ")");
} else {
@@ -6077,7 +6023,7 @@ xenDaemonFormatSxpr(virConnectPtr conn,
}
if (def->serials) {
virBufferAddLit(&buf, "(serial ");
- if (xenDaemonFormatSxprChr(conn, def->serials[0], &buf) < 0)
+ if (xenDaemonFormatSxprChr(def->serials[0], &buf) < 0)
goto error;
virBufferAddLit(&buf, ")");
} else {
@@ -6090,7 +6036,7 @@ xenDaemonFormatSxpr(virConnectPtr conn,
if (def->sounds) {
virBufferAddLit(&buf, "(soundhw '");
- if (xenDaemonFormatSxprSound(conn, def, &buf) < 0)
+ if (xenDaemonFormatSxprSound(def, &buf) < 0)
goto error;
virBufferAddLit(&buf, "')");
}
@@ -6105,7 +6051,7 @@ xenDaemonFormatSxpr(virConnectPtr conn,
if ((!hvm && xendConfigVersion < XEND_CONFIG_MIN_VERS_PVFB_NEWCONF)
||
(hvm && xendConfigVersion < 4)) {
if ((def->ngraphics == 1) &&
- xenDaemonFormatSxprGraphicsOld(conn, def->graphics[0],
+ xenDaemonFormatSxprGraphicsOld(def->graphics[0],
&buf, xendConfigVersion) < 0)
goto error;
}
@@ -6123,7 +6069,7 @@ xenDaemonFormatSxpr(virConnectPtr conn,
&buf, hvm, xendConfigVersion, 0) < 0)
goto error;
- if (xenDaemonFormatSxprAllPCI(conn, def, &buf) < 0)
+ if (xenDaemonFormatSxprAllPCI(def, &buf) < 0)
goto error;
/* New style PV graphics config xen >= 3.0.4,
@@ -6131,7 +6077,7 @@ xenDaemonFormatSxpr(virConnectPtr conn,
if ((xendConfigVersion >= XEND_CONFIG_MIN_VERS_PVFB_NEWCONF && !hvm) ||
(xendConfigVersion >= 4 && hvm)) {
if ((def->ngraphics == 1) &&
- xenDaemonFormatSxprGraphicsNew(conn, def->graphics[0], &buf) < 0)
+ xenDaemonFormatSxprGraphicsNew(def->graphics[0], &buf) < 0)
goto error;
}
@@ -6246,7 +6192,7 @@ virDomainXMLDevID(virDomainPtr domain,
if (tmp == NULL)
return -1;
} else {
- virXendError(NULL, VIR_ERR_NO_SUPPORT,
+ virXendError(VIR_ERR_NO_SUPPORT,
"%s", _("hotplug of device type not
supported"));
return -1;
}
diff --git a/src/xen/xend_internal.h b/src/xen/xend_internal.h
index 028a293..25a5421 100644
--- a/src/xen/xend_internal.h
+++ b/src/xen/xend_internal.h
@@ -96,12 +96,11 @@ xenDaemonDomainFetch(virConnectPtr xend,
const char *name,
const char *cpus);
- int xend_parse_sexp_desc_char(virConnectPtr conn,
- virBufferPtr buf,
- const char *devtype,
- int portNum,
- const char *value,
- const char *tty);
+int xend_parse_sexp_desc_char(virBufferPtr buf,
+ const char *devtype,
+ int portNum,
+ const char *value,
+ const char *tty);
virDomainDefPtr
xenDaemonParseSxprString(virConnectPtr conn,
@@ -109,21 +108,18 @@ xenDaemonParseSxprString(virConnectPtr conn,
int xendConfigVersion);
int
-xenDaemonParseSxprSound(virConnectPtr conn,
- virDomainDefPtr def,
+xenDaemonParseSxprSound(virDomainDefPtr def,
const char *str);
+
virDomainChrDefPtr
-xenDaemonParseSxprChar(virConnectPtr conn,
- const char *value,
+xenDaemonParseSxprChar(const char *value,
const char *tty);
int
-xenDaemonFormatSxprChr(virConnectPtr conn,
- virDomainChrDefPtr def,
+xenDaemonFormatSxprChr(virDomainChrDefPtr def,
virBufferPtr buf);
int
-xenDaemonFormatSxprSound(virConnectPtr conn,
- virDomainDefPtr def,
+xenDaemonFormatSxprSound(virDomainDefPtr def,
virBufferPtr buf);
char *
diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
index 0d42b01..b4a8117 100644
--- a/src/xen/xm_internal.c
+++ b/src/xen/xm_internal.c
@@ -1415,7 +1415,7 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
if (xenXMConfigGetString(conn, conf, "parallel", &str, NULL) <
0)
goto cleanup;
if (str && STRNEQ(str, "none") &&
- !(chr = xenDaemonParseSxprChar(conn, str, NULL)))
+ !(chr = xenDaemonParseSxprChar(str, NULL)))
goto cleanup;
if (chr) {
@@ -1432,7 +1432,7 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
if (xenXMConfigGetString(conn, conf, "serial", &str, NULL) < 0)
goto cleanup;
if (str && STRNEQ(str, "none") &&
- !(chr = xenDaemonParseSxprChar(conn, str, NULL)))
+ !(chr = xenDaemonParseSxprChar(str, NULL)))
goto cleanup;
if (chr) {
@@ -1445,7 +1445,7 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
def->nserials++;
}
} else {
- if (!(def->console = xenDaemonParseSxprChar(conn, "pty", NULL)))
+ if (!(def->console = xenDaemonParseSxprChar("pty", NULL)))
goto cleanup;
def->console->targetType = VIR_DOMAIN_CHR_TARGET_TYPE_CONSOLE;
}
@@ -1455,7 +1455,7 @@ xenXMDomainConfigParse(virConnectPtr conn, virConfPtr conf) {
goto cleanup;
if (str &&
- xenDaemonParseSxprSound(conn, def, str) < 0)
+ xenDaemonParseSxprSound(def, str) < 0)
goto cleanup;
}
@@ -2572,7 +2572,7 @@ virConfPtr xenXMDomainConfigFormat(virConnectPtr conn,
char *str;
int ret;
- ret = xenDaemonFormatSxprChr(conn, def->parallels[0], &buf);
+ ret = xenDaemonFormatSxprChr(def->parallels[0], &buf);
str = virBufferContentAndReset(&buf);
if (ret == 0)
ret = xenXMConfigSetString(conf, "parallel", str);
@@ -2589,7 +2589,7 @@ virConfPtr xenXMDomainConfigFormat(virConnectPtr conn,
char *str;
int ret;
- ret = xenDaemonFormatSxprChr(conn, def->serials[0], &buf);
+ ret = xenDaemonFormatSxprChr(def->serials[0], &buf);
str = virBufferContentAndReset(&buf);
if (ret == 0)
ret = xenXMConfigSetString(conf, "serial", str);
@@ -2605,9 +2605,7 @@ virConfPtr xenXMDomainConfigFormat(virConnectPtr conn,
if (def->sounds) {
virBuffer buf = VIR_BUFFER_INITIALIZER;
char *str = NULL;
- int ret = xenDaemonFormatSxprSound(conn,
- def,
- &buf);
+ int ret = xenDaemonFormatSxprSound(def, &buf);
str = virBufferContentAndReset(&buf);
if (ret == 0)
ret = xenXMConfigSetString(conf, "soundhw", str);
--
1.6.3.3