int xendConfigVersion,
int isAttach);
static int
-xenDaemonFormatSxprOnePCI(virConnectPtr conn,
- virDomainHostdevDefPtr def,
+xenDaemonFormatSxprOnePCI(virDomainHostdevDefPtr def,
virBufferPtr buf,
int detach);
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:
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;
}
* error
*/
if (xenHavePrivilege()) {
- virXendError(xend, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("failed to connect to 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;
/* 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);
/**
* sread:
- * @xend: the xend connection object
* @fd: the file descriptor
* @buffer: the I/O buffer
* @size: the size of the I/O
* 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
* 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
*
* 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
* 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;
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)
/**
* 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
* 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;
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;
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);
}
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)) {
* 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;
}
/**
* http2unix:
- * @xend: the xend connection object
* @ret: the http return code
*
* Convert the HTTP return code to 0/-1 and set errno if needed
* Return -1 in case of error code 0 otherwise
*/
static int
-http2unix(virConnectPtr xend, int ret)
+http2unix(int ret)
{
switch (ret) {
case -1:
errno = EIO;
break;
default:
- virXendErrorInt(xend, VIR_ERR_HTTP_ERROR, ret);
+ virXendErrorInt(VIR_ERR_HTTP_ERROR, ret);
errno = EINVAL;
break;
}
}
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;
va_end(ap);
ret = xend_get(xend, path, buffer, sizeof(buffer));
- ret = http2unix(xend ,ret);
+ ret = http2unix(ret);
if (ret == -1)
return NULL;
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;
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);
}
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"));
}
}
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;
}
}
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;
}
xenUnifiedPrivatePtr priv;
if (!VIR_IS_CONNECT(conn)) {
- virXendError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_CONN, __FUNCTION__);
return (-1);
}
/**
* 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
* 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)
{
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);
}
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;
}
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,
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;
}
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;
}
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;
}
offset3 = strchr(offset2, ':');
if (offset3 == NULL) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("malformed char device string"));
goto error;
}
}
virDomainChrDefPtr
-xenDaemonParseSxprChar(virConnectPtr conn,
- const char *value,
+xenDaemonParseSxprChar(const char *value,
const char *tty)
{
const char *prefix;
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;
}
const char *offset2;
if (offset == NULL) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("malformed char device string"));
goto error;
}
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;
}
offset3 = strchr(offset2, ':');
if (offset3 == NULL) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("malformed char device string"));
goto 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)
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;
}
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;
}
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;
}
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;
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;
}
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;
static int
-xenDaemonParseSxprNets(virConnectPtr conn,
- virDomainDefPtr def,
+xenDaemonParseSxprNets(virDomainDefPtr def,
const struct sexpr *root)
{
virDomainNetDefPtr net = NULL;
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;
}
int
-xenDaemonParseSxprSound(virConnectPtr conn,
- virDomainDefPtr def,
+xenDaemonParseSxprSound(virDomainDefPtr def,
const char *str)
{
if (STREQ(str, "all")) {
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;
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;
}
/**
* xenDaemonParseSxprPCI
- * @conn: connection
* @root: root sexpr
*
* This parses out block devices from the domain sexpr
* 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;
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;
}
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;
}
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;
}
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;
}
}
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;
}
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;
}
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;
}
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;
}
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 */
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);
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);
}
} 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;
}
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;
}
* 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;
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);
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);
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 ||
xend_detect_config_version(conn) == -1)
goto failed;
} else {
- virXendError(NULL, VIR_ERR_NO_CONNECT, __FUNCTION__);
+ virXendError(VIR_ERR_NO_CONNECT, __FUNCTION__);
goto failed;
}
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);
}
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);
}
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);
}
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);
}
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);
}
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);
}
{
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);
}
{
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);
}
{
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);
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);
}
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);
}
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);
}
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);
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;
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);
}
virDomainPtr ret = NULL;
if ((conn == NULL) || (domname == NULL)) {
- virXendError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(NULL);
}
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);
}
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);
}
return (-1);
}
- ret = sexpr_to_xend_topology(conn, root, caps);
+ ret = sexpr_to_xend_topology(root, caps);
sexpr_free(root);
return (ret);
}
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/");
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);
}
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);
}
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);
}
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;
}
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;
}
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;
*/
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;
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;
}
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;
}
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;
}
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;
*/
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;
break;
default:
- virXendError(domain->conn, VIR_ERR_NO_SUPPORT, "%s",
+ virXendError(VIR_ERR_NO_SUPPORT, "%s",
_("unsupported device type"));
goto cleanup;
}
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 {
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);
}
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;
}
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;
*/
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;
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;
}
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);
}
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);
}
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);
}
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);
}
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;
}
}
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;
}
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).
/* 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;
* 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;
* 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;
}
/* 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;
}
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);
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;
}
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;
}
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;
}
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);
}
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);
}
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;
}
/* 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;
}
}
*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;
}
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);
}
/* 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;
}
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;
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;
}
ret = 0;
break;
default:
- virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR, "%s", _("Unknown scheduler"));
+ virXendError(VIR_ERR_INTERNAL_ERROR, "%s", _("Unknown scheduler"));
goto error;
}
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);
}
/* 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;
}
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;
}
}
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;
}
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;
}
break;
}
default:
- virXendError(domain->conn, VIR_ERR_INTERNAL_ERROR, "%s", _("Unknown scheduler"));
+ virXendError(VIR_ERR_INTERNAL_ERROR, "%s", _("Unknown scheduler"));
goto error;
}
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;
}
}
}
if (!found) {
- virXendError (domain->conn, VIR_ERR_INVALID_ARG,
+ virXendError(VIR_ERR_INVALID_ARG,
_("%s: invalid path"), path);
goto cleanup;
}
* 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;
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;
}
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;
}
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;
}
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;
}
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;
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;
}
char *bridge;
if (!network) {
- virXendError(conn, VIR_ERR_NO_NETWORK, "%s",
+ virXendError(VIR_ERR_NO_NETWORK, "%s",
def->data.network.name);
return -1;
}
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;
}
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;
}
}
static int
-xenDaemonFormatSxprAllPCI(virConnectPtr conn,
- virDomainDefPtr def,
+xenDaemonFormatSxprAllPCI(virDomainDefPtr def,
virBufferPtr buf)
{
int hasPCI = 0;
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;
}
}
int
-xenDaemonFormatSxprSound(virConnectPtr conn,
- virDomainDefPtr def,
+xenDaemonFormatSxprSound(virDomainDefPtr def,
virBufferPtr buf)
{
const char *str;
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;
static int
-xenDaemonFormatSxprInput(virConnectPtr conn,
- virDomainInputDefPtr input,
+xenDaemonFormatSxprInput(virDomainInputDefPtr input,
virBufferPtr buf)
{
if (input->bus != VIR_DOMAIN_INPUT_BUS_USB)
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;
}
}
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;
}
/* 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;
if (hvm &&
def->os.loader == NULL) {
- virXendError(conn, VIR_ERR_INTERNAL_ERROR,
+ virXendError(VIR_ERR_INTERNAL_ERROR,
"%s",_("no HVM domain loader"));
goto error;
}
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 {
}
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 {
if (def->sounds) {
virBufferAddLit(&buf, "(soundhw '");
- if (xenDaemonFormatSxprSound(conn, def, &buf) < 0)
+ if (xenDaemonFormatSxprSound(def, &buf) < 0)
goto error;
virBufferAddLit(&buf, "')");
}
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;
}
&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,
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;
}
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;
}