name = qemudDefaultBinaryForArch(arch);
if (!name) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "cannot determin binary for architecture %s", arch);
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "cannot determin binary for architecture %s", arch);
return NULL;
}
/* XXX lame. should actually use $PATH ... */
path = malloc(strlen(name) + strlen("/usr/bin/") + 1);
if (!path) {
- qemudReportError(server, VIR_ERR_NO_MEMORY, "path");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_MEMORY, "path");
return NULL;
}
strcpy(path, "/usr/bin/");
return -1;
if (stat(binary, &sb) < 0) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"Cannot find QEMU binary %s: %s", binary,
strerror(errno));
free(binary);
int typ = 0;
if (!disk) {
- qemudReportError(server, VIR_ERR_NO_MEMORY, "disk");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_MEMORY, "disk");
return NULL;
}
}
if (source == NULL) {
- qemudReportError(server, VIR_ERR_NO_SOURCE, target ? "%s" : NULL, target);
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_SOURCE, target ? "%s" : NULL, target);
goto error;
}
if (target == NULL) {
- qemudReportError(server, VIR_ERR_NO_TARGET, source ? "%s" : NULL, source);
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_TARGET, source ? "%s" : NULL, source);
goto error;
}
!strcmp((const char *)device, "floppy") &&
strcmp((const char *)target, "fda") &&
strcmp((const char *)target, "fdb")) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "Invalid floppy device name: %s", target);
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "Invalid floppy device name: %s", target);
goto error;
}
if (device &&
!strcmp((const char *)device, "cdrom") &&
strcmp((const char *)target, "hdc")) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "Invalid cdrom device name: %s", target);
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "Invalid cdrom device name: %s", target);
goto error;
}
strcmp((const char *)target, "hdb") &&
strcmp((const char *)target, "hdc") &&
strcmp((const char *)target, "hdd")) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "Invalid harddisk device name: %s", target);
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "Invalid harddisk device name: %s", target);
goto error;
}
else if (!strcmp((const char *)device, "floppy"))
disk->device = QEMUD_DISK_FLOPPY;
else {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "Invalid device type: %s", device);
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "Invalid device type: %s", device);
goto error;
}
xmlChar *port = NULL;
if (!net) {
- qemudReportError(server, VIR_ERR_NO_MEMORY, "net");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_MEMORY, "net");
return NULL;
}
int len;
if (network == NULL) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"No <source> 'network' attribute specified with <interface type='network'/>");
goto error;
} else if ((len = xmlStrlen(network)) >= (QEMUD_MAX_NAME_LEN-1)) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"Network name '%s' too long", network);
goto error;
} else {
if (ifname != NULL) {
if ((len = xmlStrlen(ifname)) >= (BR_IFNAME_MAXLEN-1)) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"TAP interface name '%s' is too long", ifname);
goto error;
} else {
if (script != NULL) {
if ((len = xmlStrlen(script)) >= (PATH_MAX-1)) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"TAP script path '%s' is too long", script);
goto error;
} else {
}
if (ifname != NULL) {
if ((len = xmlStrlen(ifname)) >= (BR_IFNAME_MAXLEN-1)) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"TAP interface name '%s' is too long", ifname);
goto error;
} else {
int len;
if (bridge == NULL) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"No <source> 'dev' attribute specified with <interface type='bridge'/>");
goto error;
} else if ((len = xmlStrlen(bridge)) >= (BR_IFNAME_MAXLEN-1)) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"TAP bridge path '%s' is too long", bridge);
goto error;
} else {
if (ifname != NULL) {
if ((len = xmlStrlen(ifname)) >= (BR_IFNAME_MAXLEN-1)) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"TAP interface name '%s' is too long", ifname);
goto error;
} else {
char *ret;
if (port == NULL) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"No <source> 'port' attribute specified with socket interface");
goto error;
}
if (!(net->dst.socket.port = strtol((char*)port, &ret, 10)) &&
ret == (char*)port) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"Cannot parse <source> 'port' attribute with socket interface");
goto error;
}
if (address == NULL) {
if (net->type == QEMUD_NET_CLIENT ||
net->type == QEMUD_NET_MCAST) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"No <source> 'address' attribute specified with socket interface");
goto error;
}
} else if ((len = xmlStrlen(address)) >= (BR_INET_ADDR_MAXLEN)) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"IP address '%s' is too long", address);
goto error;
}
struct qemud_vm_def *def;
if (!(def = calloc(1, sizeof(struct qemud_vm_def)))) {
- qemudReportError(server, VIR_ERR_NO_MEMORY, "xmlXPathContext");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_MEMORY, "xmlXPathContext");
return NULL;
}
/* Prepare parser / xpath context */
root = xmlDocGetRootElement(xml);
if ((root == NULL) || (!xmlStrEqual(root->name, BAD_CAST "domain"))) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "%s", "incorrect root element");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "incorrect root element");
goto error;
}
ctxt = xmlXPathNewContext(xml);
if (ctxt == NULL) {
- qemudReportError(server, VIR_ERR_NO_MEMORY, "xmlXPathContext");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_MEMORY, "xmlXPathContext");
goto error;
}
/* Find out what type of QEMU virtualization to use */
if (!(prop = xmlGetProp(root, BAD_CAST "type"))) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "%s", "missing domain type attribute");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "missing domain type attribute");
goto error;
}
else if (!strcmp((char *)prop, "kvm"))
def->virtType = QEMUD_VIRT_KVM;
else {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "%s", "invalid domain type attribute");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "invalid domain type attribute");
goto error;
}
free(prop);
obj = xmlXPathEval(BAD_CAST "string(/domain/name[1])", ctxt);
if ((obj == NULL) || (obj->type != XPATH_STRING) ||
(obj->stringval == NULL) || (obj->stringval[0] == 0)) {
- qemudReportError(server, VIR_ERR_NO_NAME, NULL);
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_NAME, NULL);
goto error;
}
if (strlen((const char *)obj->stringval) >= (QEMUD_MAX_NAME_LEN-1)) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "%s", "domain name length too long");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "domain name length too long");
goto error;
}
strcpy(def->name, (const char *)obj->stringval);
(obj->stringval == NULL) || (obj->stringval[0] == 0)) {
int err;
if ((err = qemudGenerateUUID(def->uuid))) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"Failed to generate UUID: %s", strerror(err));
goto error;
}
} else if (qemudParseUUID((const char *)obj->stringval, def->uuid) < 0) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "%s", "malformed uuid element");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "malformed uuid element");
goto error;
}
xmlXPathFreeObject(obj);
obj = xmlXPathEval(BAD_CAST "string(/domain/memory[1])", ctxt);
if ((obj == NULL) || (obj->type != XPATH_STRING) ||
(obj->stringval == NULL) || (obj->stringval[0] == 0)) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "%s", "missing memory element");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "missing memory element");
goto error;
} else {
conv = NULL;
def->maxmem = strtoll((const char*)obj->stringval, &conv, 10);
if (conv == (const char*)obj->stringval) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "%s", "malformed memory information");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "malformed memory information");
goto error;
}
}
if (def->memory > def->maxmem)
def->memory = def->maxmem;
if (conv == (const char*)obj->stringval) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "%s", "malformed memory information");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "malformed memory information");
goto error;
}
}
conv = NULL;
def->vcpus = strtoll((const char*)obj->stringval, &conv, 10);
if (conv == (const char*)obj->stringval) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "%s", "malformed vcpu information");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "malformed vcpu information");
goto error;
}
}
obj = xmlXPathEval(BAD_CAST "string(/domain/os/type[1])", ctxt);
if ((obj == NULL) || (obj->type != XPATH_STRING) ||
(obj->stringval == NULL) || (obj->stringval[0] == 0)) {
- qemudReportError(server, VIR_ERR_OS_TYPE, NULL);
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_OS_TYPE, NULL);
goto error;
}
if (strcmp((const char *)obj->stringval, "hvm")) {
- qemudReportError(server, VIR_ERR_OS_TYPE, "%s", obj->stringval);
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_OS_TYPE, "%s", obj->stringval);
goto error;
}
strcpy(def->os.type, (const char *)obj->stringval);
(obj->stringval == NULL) || (obj->stringval[0] == 0)) {
const char *defaultArch = qemudDefaultArch();
if (strlen(defaultArch) >= (QEMUD_OS_TYPE_MAX_LEN-1)) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "%s", "architecture type too long");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "architecture type too long");
goto error;
}
strcpy(def->os.arch, defaultArch);
} else {
if (strlen((const char *)obj->stringval) >= (QEMUD_OS_TYPE_MAX_LEN-1)) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "%s", "architecture type too long");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "architecture type too long");
goto error;
}
strcpy(def->os.arch, (const char *)obj->stringval);
(obj->stringval == NULL) || (obj->stringval[0] == 0)) {
const char *defaultMachine = qemudDefaultMachineForArch(def->os.arch);
if (strlen(defaultMachine) >= (QEMUD_OS_MACHINE_MAX_LEN-1)) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "%s", "machine type too long");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "machine type too long");
goto error;
}
strcpy(def->os.machine, defaultMachine);
} else {
if (strlen((const char *)obj->stringval) >= (QEMUD_OS_MACHINE_MAX_LEN-1)) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "%s", "architecture type too long");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "architecture type too long");
goto error;
}
strcpy(def->os.machine, (const char *)obj->stringval);
if ((obj != NULL) && (obj->type == XPATH_STRING) &&
(obj->stringval != NULL) && (obj->stringval[0] != 0)) {
if (strlen((const char *)obj->stringval) >= (PATH_MAX-1)) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "%s", "kernel path too long");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "kernel path too long");
goto error;
}
strcpy(def->os.kernel, (const char *)obj->stringval);
if ((obj != NULL) && (obj->type == XPATH_STRING) &&
(obj->stringval != NULL) && (obj->stringval[0] != 0)) {
if (strlen((const char *)obj->stringval) >= (PATH_MAX-1)) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "%s", "initrd path too long");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "initrd path too long");
goto error;
}
strcpy(def->os.initrd, (const char *)obj->stringval);
if ((obj != NULL) && (obj->type == XPATH_STRING) &&
(obj->stringval != NULL) && (obj->stringval[0] != 0)) {
if (strlen((const char *)obj->stringval) >= (PATH_MAX-1)) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "%s", "cmdline arguments too long");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "cmdline arguments too long");
goto error;
}
strcpy(def->os.cmdline, (const char *)obj->stringval);
free(tmp);
} else {
if (strlen((const char *)obj->stringval) >= (PATH_MAX-1)) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "%s", "emulator path too long");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "emulator path too long");
goto error;
}
strcpy(def->os.binary, (const char *)obj->stringval);
} else if (!strcmp((char *)prop, "sdl")) {
def->graphicsType = QEMUD_GRAPHICS_SDL;
} else {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "Unsupported graphics type %s", prop);
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "Unsupported graphics type %s", prop);
goto error;
}
xmlFree(prop);
if (net->type == QEMUD_NET_NETWORK) {
if (!(network = qemudFindNetworkByName(server, net->dst.network.name))) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"Network '%s' not found", net->dst.network.name);
goto error;
} else if (network->bridge[0] == '\0') {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"Network '%s' not active", net->dst.network.name);
goto error;
}
}
ifname = net->dst.bridge.ifname;
} else {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"Network type %d is not supported", net->type);
goto error;
}
if (!server->brctl && (err = brInit(&server->brctl))) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"cannot initialize bridge support: %s", strerror(err));
goto error;
}
if ((err = brAddTap(server->brctl, brname,
ifname, BR_IFNAME_MAXLEN, &tapfd))) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"Failed to add tap interface '%s' to bridge '%s' : %s",
ifname, brname, strerror(err));
goto error;
return retval;
no_memory:
- qemudReportError(server, VIR_ERR_NO_MEMORY, "tapfds");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_MEMORY, "tapfds");
error:
if (retval)
free(retval);
* in a sub-process so its hard to feed back a useful error
*/
if (stat(vm->def->os.binary, &sb) < 0) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"Cannot find QEMU binary %s: %s", vm->def->os.binary,
strerror(errno));
return -1;
return 0;
no_memory:
- qemudReportError(server, VIR_ERR_NO_MEMORY, "argv");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_MEMORY, "argv");
error:
if (vm->tapfds) {
for (i = 0; vm->tapfds[i] != -1; i++)
if ((fd = open(vm->configFile,
O_WRONLY | O_CREAT | O_TRUNC,
S_IRUSR | S_IWUSR )) < 0) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"cannot create config file %s: %s",
vm->configFile, strerror(errno));
goto cleanup;
towrite = strlen(xml);
if (write(fd, xml, towrite) != towrite) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"cannot write config file %s: %s",
vm->configFile, strerror(errno));
goto cleanup;
}
if (close(fd) < 0) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"cannot save config file %s: %s",
vm->configFile, strerror(errno));
goto cleanup;
if (!(xml = xmlReadDoc(BAD_CAST xmlStr, displayName ? displayName : "domain.xml", NULL,
XML_PARSE_NOENT | XML_PARSE_NONET |
XML_PARSE_NOERROR | XML_PARSE_NOWARNING))) {
- qemudReportError(server, VIR_ERR_XML_ERROR, NULL);
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_XML_ERROR, NULL);
return NULL;
}
}
if (!(vm = calloc(1, sizeof(struct qemud_vm)))) {
- qemudReportError(server, VIR_ERR_NO_MEMORY, "vm");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_MEMORY, "vm");
return NULL;
}
int err;
if ((err = qemudEnsureDir(server->configDir))) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"cannot create config directory %s: %s",
server->configDir, strerror(err));
return -1;
if (qemudMakeConfigPath(server->configDir, def->name, ".xml",
vm->configFile, PATH_MAX) < 0) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"cannot construct config file path");
return -1;
}
if (qemudMakeConfigPath(server->autostartDir, def->name, ".xml",
vm->autostartLink, PATH_MAX) < 0) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"cannot construct autostart link path");
vm->configFile[0] = '\0';
return -1;
}
if ((err = qemudEnsureDir(server->networkConfigDir))) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"cannot create config directory %s: %s",
server->networkConfigDir, strerror(err));
goto cleanup;
if ((fd = open(network->configFile,
O_WRONLY | O_CREAT | O_TRUNC,
S_IRUSR | S_IWUSR )) < 0) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"cannot create config file %s: %s",
network->configFile, strerror(errno));
goto cleanup;
towrite = strlen(xml);
if (write(fd, xml, towrite) != towrite) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"cannot write config file %s: %s",
network->configFile, strerror(errno));
goto cleanup;
}
if (close(fd) < 0) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"cannot save config file %s: %s",
network->configFile, strerror(errno));
goto cleanup;
}
if (!(range = calloc(1, sizeof(struct qemud_dhcp_range_def)))) {
- qemudReportError(server, VIR_ERR_NO_MEMORY, "range");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_MEMORY, "range");
return 0;
}
struct qemud_network_def *def;
if (!(def = calloc(1, sizeof(struct qemud_network_def)))) {
- qemudReportError(server, VIR_ERR_NO_MEMORY, "network_def");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_MEMORY, "network_def");
return NULL;
}
/* Prepare parser / xpath context */
root = xmlDocGetRootElement(xml);
if ((root == NULL) || (!xmlStrEqual(root->name, BAD_CAST "network"))) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "%s", "incorrect root element");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "incorrect root element");
goto error;
}
ctxt = xmlXPathNewContext(xml);
if (ctxt == NULL) {
- qemudReportError(server, VIR_ERR_NO_MEMORY, "xmlXPathContext");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_MEMORY, "xmlXPathContext");
goto error;
}
obj = xmlXPathEval(BAD_CAST "string(/network/name[1])", ctxt);
if ((obj == NULL) || (obj->type != XPATH_STRING) ||
(obj->stringval == NULL) || (obj->stringval[0] == 0)) {
- qemudReportError(server, VIR_ERR_NO_NAME, NULL);
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_NAME, NULL);
goto error;
}
if (strlen((const char *)obj->stringval) >= (QEMUD_MAX_NAME_LEN-1)) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "%s", "network name length too long");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "network name length too long");
goto error;
}
strcpy(def->name, (const char *)obj->stringval);
(obj->stringval == NULL) || (obj->stringval[0] == 0)) {
int err;
if ((err = qemudGenerateUUID(def->uuid))) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"Failed to generate UUID: %s", strerror(err));
goto error;
}
} else if (qemudParseUUID((const char *)obj->stringval, def->uuid) < 0) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "%s", "malformed uuid element");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "malformed uuid element");
goto error;
}
xmlXPathFreeObject(obj);
obj->boolval) {
if (!def->ipAddress[0] ||
!def->netmask[0]) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"Forwarding requested, but no IPv4 address/netmask provided");
goto error;
}
(tmp->stringval != NULL) && (tmp->stringval[0] != 0)) {
int len;
if ((len = xmlStrlen(tmp->stringval)) >= (BR_IFNAME_MAXLEN-1)) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"forward device name '%s' is too long",
(char*)tmp->stringval);
goto error;
if (!(xml = xmlReadDoc(BAD_CAST xmlStr, displayName ? displayName : "network.xml", NULL,
XML_PARSE_NOENT | XML_PARSE_NONET |
XML_PARSE_NOERROR | XML_PARSE_NOWARNING))) {
- qemudReportError(server, VIR_ERR_XML_ERROR, NULL);
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_XML_ERROR, NULL);
return NULL;
}
}
if (!(network = calloc(1, sizeof(struct qemud_network)))) {
- qemudReportError(server, VIR_ERR_NO_MEMORY, "network");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_MEMORY, "network");
return NULL;
}
int err;
if ((err = qemudEnsureDir(server->networkConfigDir))) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"cannot create config directory %s: %s",
server->networkConfigDir, strerror(err));
return -1;
if (qemudMakeConfigPath(server->networkConfigDir, def->name, ".xml",
network->configFile, PATH_MAX) < 0) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"cannot construct config file path");
return -1;
}
if (qemudMakeConfigPath(server->networkAutostartDir, def->name, ".xml",
network->autostartLink, PATH_MAX) < 0) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"cannot construct autostart link path");
network->configFile[0] = '\0';
return -1;
struct qemud_vm *vm;
if (!(def = qemudParseVMDef(server, xml, file))) {
+ virErrorPtr err = virGetLastError();
qemudLog(QEMUD_WARN, "Error parsing QEMU guest config '%s' : %s",
- path, server->errorMessage);
+ path, err->message);
return NULL;
}
struct qemud_network *network;
if (!(def = qemudParseNetworkDef(server, xml, file))) {
+ virErrorPtr err = virGetLastError();
qemudLog(QEMUD_WARN, "Error parsing network config '%s' : %s",
- path, server->errorMessage);
+ path, err->message);
return NULL;
}
if (network->autostart &&
!qemudIsActiveNetwork(network) &&
- qemudStartNetworkDaemon(server, network) < 0)
+ qemudStartNetworkDaemon(server, network) < 0) {
+ virErrorPtr err = virGetLastError();
qemudLog(QEMUD_ERR, "Failed to autostart network '%s': %s",
- network->def->name, server->errorMessage);
+ network->def->name, err->message);
+ }
network = next;
}
if (vm->autostart &&
!qemudIsActiveVM(vm) &&
- qemudStartVMDaemon(server, vm) < 0)
+ qemudStartVMDaemon(server, vm) < 0) {
+ virErrorPtr err = virGetLastError();
qemudLog(QEMUD_ERR, "Failed to autostart VM '%s': %s",
- vm->def->name, server->errorMessage);
+ vm->def->name, err->message);
+ }
vm = next;
}
break;
}
if (!type) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "unexpected domain type %d", def->virtType);
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "unexpected domain type %d", def->virtType);
goto cleanup;
}
return bufferContentAndFree (buf);
no_memory:
- qemudReportError(server, VIR_ERR_NO_MEMORY, "xml");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_MEMORY, "xml");
cleanup:
if (buf) bufferFree (buf);
return NULL;
return bufferContentAndFree (buf);
no_memory:
- qemudReportError(server, VIR_ERR_NO_MEMORY, "xml");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_MEMORY, "xml");
if (buf) bufferFree (buf);
return NULL;
}
const char *configFile,
const char *name) {
if (!configFile[0]) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "no config file for %s", name);
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "no config file for %s", name);
return -1;
}
if (unlink(configFile) < 0) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "cannot remove config for %s", name);
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "cannot remove config for %s", name);
return -1;
}
#include "driver.h"
#include "conf.h"
-void qemudReportError(struct qemud_server *server,
+extern void __virRaiseError(virConnectPtr conn,
+ virDomainPtr dom,
+ virNetworkPtr net,
+ int domain,
+ int code,
+ virErrorLevel level,
+ const char *str1,
+ const char *str2,
+ const char *str3,
+ int int1, int int2, const char *msg, ...)
+ ATTRIBUTE_FORMAT(printf, 12, 13);
+
+void qemudReportError(virConnectPtr conn,
+ virDomainPtr dom,
+ virNetworkPtr net,
int code, const char *fmt, ...) {
va_list args;
- server->errorCode = code;
+ char errorMessage[QEMUD_MAX_ERROR_LEN];
+
if (fmt) {
va_start(args, fmt);
- vsnprintf(server->errorMessage, QEMUD_MAX_ERROR_LEN-1, fmt, args);
+ vsnprintf(errorMessage, QEMUD_MAX_ERROR_LEN-1, fmt, args);
va_end(args);
} else {
- server->errorMessage[0] = '\0';
+ errorMessage[0] = '\0';
}
+
+ __virRaiseError(conn, dom, net, VIR_FROM_QEMU, code, VIR_ERR_ERROR,
+ NULL, NULL, NULL, -1, -1, errorMessage);
}
static void qemudDispatchVMEvent(int fd, int events, void *opaque);
int pipeerr[2] = {-1,-1};
if ((null = open(_PATH_DEVNULL, O_RDONLY)) < 0) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "cannot open %s : %s",
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "cannot open %s : %s",
_PATH_DEVNULL, strerror(errno));
goto cleanup;
}
if ((outfd != NULL && pipe(pipeout) < 0) ||
(errfd != NULL && pipe(pipeerr) < 0)) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "cannot create pipe : %s",
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "cannot create pipe : %s",
strerror(errno));
goto cleanup;
}
if ((pid = fork()) < 0) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "cannot fork child process : %s",
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "cannot fork child process : %s",
strerror(errno));
goto cleanup;
}
ret = read(fd, buf+got, buflen-got-1);
if (ret == 0) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"QEMU quit during %s startup\n%s", what, buf);
return -1;
}
continue;
if (errno != EAGAIN) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"Failure while reading %s startup output: %s",
what, strerror(errno));
return -1;
ret = poll(&pfd, 1, MONITOR_TIMEOUT);
if (ret == 0) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"Timed out while reading %s startup output", what);
return -1;
} else if (ret == -1) {
if (errno != EINTR) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"Failure while reading %s startup output: %s",
what, strerror(errno));
return -1;
if (pfd.revents & (POLLIN | POLLHUP))
continue;
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"Failure while reading %s startup output", what);
return -1;
}
}
}
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"Out of space while reading %s startup output", what);
return -1;
int ret = -1;
if (!(monfd = open(monitor, O_RDWR))) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"Unable to open monitor path %s", monitor);
return -1;
}
if (qemudSetCloseExec(monfd) < 0) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"Unable to set monitor close-on-exec flag");
goto error;
}
if (qemudSetNonBlock(monfd) < 0) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"Unable to put monitor into non-blocking mode");
goto error;
}
char logfile[PATH_MAX];
if (qemudIsActiveVM(vm)) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"VM is already active");
return -1;
}
if (vm->def->vncPort < 0) {
int port = qemudNextFreeVNCPort(server);
if (port < 0) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"Unable to find an unused VNC port");
return -1;
}
strlen(vm->def->name) + /* basename */
4 + /* suffix .log */
1 /* NULL */) > PATH_MAX) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"config file path too long: %s/%s.log",
server->logDir, vm->def->name);
return -1;
strcat(logfile, ".log");
if (qemudEnsureDir(server->logDir) < 0) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"cannot create log directory %s: %s",
server->logDir, strerror(errno));
return -1;
if ((vm->logfile = open(logfile, O_CREAT | O_TRUNC | O_WRONLY,
S_IRUSR | S_IWUSR)) < 0) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"failed to create logfile %s: %s",
logfile, strerror(errno));
return -1;
free((*argv)[i]);
free(*argv);
}
- qemudReportError(server, VIR_ERR_NO_MEMORY, "dnsmasq argv");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_MEMORY, "dnsmasq argv");
return -1;
}
int ret, i;
if (network->def->ipAddress[0] == '\0') {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"cannot start dhcp daemon without IP address for server");
return -1;
}
int err;
if (!server->iptables && !(server->iptables = iptablesContextNew())) {
- qemudReportError(server, VIR_ERR_NO_MEMORY, "iptables support");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_MEMORY, "iptables support");
return 1;
}
/* allow DHCP requests through to dnsmasq */
if ((err = iptablesAddTcpInput(server->iptables, network->bridge, 67))) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"failed to add iptables rule to allow DHCP requests from '%s' : %s\n",
network->bridge, strerror(err));
goto err1;
}
if ((err = iptablesAddUdpInput(server->iptables, network->bridge, 67))) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"failed to add iptables rule to allow DHCP requests from '%s' : %s\n",
network->bridge, strerror(err));
goto err2;
/* allow DNS requests through to dnsmasq */
if ((err = iptablesAddTcpInput(server->iptables, network->bridge, 53))) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"failed to add iptables rule to allow DNS requests from '%s' : %s\n",
network->bridge, strerror(err));
goto err3;
}
if ((err = iptablesAddUdpInput(server->iptables, network->bridge, 53))) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"failed to add iptables rule to allow DNS requests from '%s' : %s\n",
network->bridge, strerror(err));
goto err4;
/* Catch all rules to block forwarding to/from bridges */
if ((err = iptablesAddForwardRejectOut(server->iptables, network->bridge))) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"failed to add iptables rule to block outbound traffic from '%s' : %s\n",
network->bridge, strerror(err));
goto err5;
}
if ((err = iptablesAddForwardRejectIn(server->iptables, network->bridge))) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"failed to add iptables rule to block inbound traffic to '%s' : %s\n",
network->bridge, strerror(err));
goto err6;
/* Allow traffic between guests on the same bridge */
if ((err = iptablesAddForwardAllowCross(server->iptables, network->bridge))) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"failed to add iptables rule to allow cross bridge traffic on '%s' : %s\n",
network->bridge, strerror(err));
goto err7;
network->def->network,
network->bridge,
network->def->forwardDev))) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"failed to add iptables rule to allow forwarding from '%s' : %s\n",
network->bridge, strerror(err));
goto err8;
network->def->network,
network->bridge,
network->def->forwardDev))) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"failed to add iptables rule to allow forwarding to '%s' : %s\n",
network->bridge, strerror(err));
goto err9;
if ((err = iptablesAddForwardMasquerade(server->iptables,
network->def->network,
network->def->forwardDev))) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"failed to add iptables rule to enable masquerading : %s\n",
strerror(err));
goto err10;
int err;
if (qemudIsActiveNetwork(network)) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"network is already active");
return -1;
}
if (!server->brctl && (err = brInit(&server->brctl))) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"cannot initialize bridge support: %s", strerror(err));
return -1;
}
}
if ((err = brAddBridge(server->brctl, name, network->bridge, sizeof(network->bridge)))) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"cannot create bridge '%s' : %s", name, strerror(err));
return -1;
}
if (network->def->ipAddress[0] &&
(err = brSetInetAddress(server->brctl, network->bridge, network->def->ipAddress))) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"cannot set IP address on bridge '%s' to '%s' : %s\n",
network->bridge, network->def->ipAddress, strerror(err));
goto err_delbr;
if (network->def->netmask[0] &&
(err = brSetInetNetmask(server->brctl, network->bridge, network->def->netmask))) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"cannot set netmask on bridge '%s' to '%s' : %s\n",
network->bridge, network->def->netmask, strerror(err));
goto err_delbr;
if (network->def->ipAddress[0] &&
(err = brSetInterfaceUp(server->brctl, network->bridge, 1))) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"failed to bring the bridge '%s' up : %s\n",
network->bridge, strerror(err));
goto err_delbr;
if (network->def->forward &&
!qemudEnableIpForwarding()) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"failed to enable IP forwarding : %s\n", strerror(err));
goto err_delbr2;
}
/* Construct the XML. */
xml = bufferNew (1024);
if (!xml) {
- qemudReportError (server, VIR_ERR_NO_MEMORY, NULL);
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_MEMORY, NULL);
return NULL;
}
if (r == -1) {
vir_buffer_failed:
bufferFree (xml);
- qemudReportError (server, VIR_ERR_NO_MEMORY, NULL);
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_MEMORY, NULL);
return NULL;
}
char *info;
struct qemud_vm *vm = qemudFindVMByID(server, id);
if (!vm) {
- qemudReportError(server, VIR_ERR_INVALID_DOMAIN, "no domain with matching id %d", id);
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INVALID_DOMAIN, "no domain with matching id %d", id);
return -1;
}
if (!qemudIsActiveVM(vm)) {
- qemudReportError(server, VIR_ERR_OPERATION_FAILED, "domain is not running");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED, "domain is not running");
return -1;
}
if (vm->state == QEMUD_STATE_PAUSED)
return 0;
if (qemudMonitorCommand(server, vm, "stop\n", &info) < 0) {
- qemudReportError(server, VIR_ERR_OPERATION_FAILED, "suspend operation failed");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED, "suspend operation failed");
return -1;
}
vm->state = QEMUD_STATE_PAUSED;
char *info;
struct qemud_vm *vm = qemudFindVMByID(server, id);
if (!vm) {
- qemudReportError(server, VIR_ERR_INVALID_DOMAIN, "no domain with matching id %d", id);
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INVALID_DOMAIN, "no domain with matching id %d", id);
return -1;
}
if (!qemudIsActiveVM(vm)) {
- qemudReportError(server, VIR_ERR_OPERATION_FAILED, "domain is not running");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED, "domain is not running");
return -1;
}
if (vm->state == QEMUD_STATE_RUNNING)
return 0;
if (qemudMonitorCommand(server, vm, "cont\n", &info) < 0) {
- qemudReportError(server, VIR_ERR_OPERATION_FAILED, "resume operation failed");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED, "resume operation failed");
return -1;
}
vm->state = QEMUD_STATE_RUNNING;
struct qemud_vm *vm = qemudFindVMByID(server, id);
if (!vm) {
- qemudReportError(server, VIR_ERR_INVALID_DOMAIN,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INVALID_DOMAIN,
"no domain with matching id %d", id);
return -1;
}
unsigned int *nrVirtCpu) {
struct qemud_vm *vm = qemudFindVMByUUID(server, uuid);
if (!vm) {
- qemudReportError(server, VIR_ERR_INVALID_DOMAIN, "no domain with matching uuid");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INVALID_DOMAIN, "no domain with matching uuid");
return -1;
}
*cputime = 0;
} else {
if (qemudGetProcessInfo(cputime, vm->pid) < 0) {
- qemudReportError(server, VIR_ERR_OPERATION_FAILED, "cannot read cputime for domain");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED, "cannot read cputime for domain");
return -1;
}
}
const char *path ATTRIBUTE_UNUSED) {
struct qemud_vm *vm = qemudFindVMByID(server, id);
if (!vm) {
- qemudReportError(server, VIR_ERR_INVALID_DOMAIN, "no domain with matching id %d", id);
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INVALID_DOMAIN, "no domain with matching id %d", id);
return -1;
}
if (!qemudIsActiveVM(vm)) {
- qemudReportError(server, VIR_ERR_OPERATION_FAILED, "domain is not running");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED, "domain is not running");
return -1;
}
- qemudReportError(server, VIR_ERR_OPERATION_FAILED, "save is not supported");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED, "save is not supported");
return -1;
}
int qemudDomainRestore(struct qemud_server *server,
const char *path ATTRIBUTE_UNUSED) {
- qemudReportError(server, VIR_ERR_OPERATION_FAILED, "restore is not supported");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED, "restore is not supported");
return -1;
}
struct qemud_vm *vm = qemudFindVMByUUID(server, uuid);
char *vmxml;
if (!vm) {
- qemudReportError(server, VIR_ERR_INVALID_DOMAIN, "no domain with matching uuid");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INVALID_DOMAIN, "no domain with matching uuid");
return -1;
}
struct qemud_vm *vm = qemudFindVMByUUID(server, uuid);
if (!vm) {
- qemudReportError(server, VIR_ERR_INVALID_DOMAIN,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INVALID_DOMAIN,
"no domain with matching uuid");
return NULL;
}
struct qemud_vm *vm = qemudFindVMByUUID(server, uuid);
if (!vm) {
- qemudReportError(server, VIR_ERR_INVALID_DOMAIN, "no domain with matching uuid");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INVALID_DOMAIN, "no domain with matching uuid");
return -1;
}
if (qemudIsActiveVM(vm)) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "cannot delete active domain");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "cannot delete active domain");
return -1;
}
struct qemud_vm *vm = qemudFindVMByUUID(server, uuid);
if (!vm) {
- qemudReportError(server, VIR_ERR_INVALID_DOMAIN, "no domain with matching uuid");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INVALID_DOMAIN, "no domain with matching uuid");
return -1;
}
struct qemud_vm *vm = qemudFindVMByUUID(server, uuid);
if (!vm) {
- qemudReportError(server, VIR_ERR_INVALID_DOMAIN, "no domain with matching uuid");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INVALID_DOMAIN, "no domain with matching uuid");
return -1;
}
int err;
if ((err = qemudEnsureDir(server->autostartDir))) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"cannot create autostart directory %s: %s",
server->autostartDir, strerror(err));
return -1;
}
if (symlink(vm->configFile, vm->autostartLink) < 0) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"Failed to create symlink '%s' to '%s': %s",
vm->autostartLink, vm->configFile, strerror(errno));
return -1;
}
} else {
if (unlink(vm->autostartLink) < 0 && errno != ENOENT && errno != ENOTDIR) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"Failed to delete symlink '%s': %s",
vm->autostartLink, strerror(errno));
return -1;
struct qemud_network *network = qemudFindNetworkByUUID(server, uuid);
if (!network) {
- qemudReportError(server, VIR_ERR_INVALID_DOMAIN, "no network with matching uuid");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INVALID_DOMAIN, "no network with matching uuid");
return -1;
}
struct qemud_network *network = qemudFindNetworkByUUID(server, uuid);
if (!network) {
- qemudReportError(server, VIR_ERR_INVALID_NETWORK,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INVALID_NETWORK,
"no network with matching uuid");
return NULL;
}
struct qemud_network *network = qemudFindNetworkByUUID(server, uuid);
if (!network) {
- qemudReportError(server, VIR_ERR_INVALID_NETWORK,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INVALID_NETWORK,
"no network with matching uuid");
return -1;
}
struct qemud_network *network = qemudFindNetworkByUUID(server, uuid);
char *networkxml;
if (!network) {
- qemudReportError(server, VIR_ERR_INVALID_NETWORK, "no network with matching uuid");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INVALID_NETWORK, "no network with matching uuid");
return -1;
}
struct qemud_network *network = qemudFindNetworkByUUID(server, uuid);
if (!network) {
- qemudReportError(server, VIR_ERR_INVALID_NETWORK, "no network with matching id");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INVALID_NETWORK, "no network with matching id");
return -1;
}
struct qemud_network *network = qemudFindNetworkByUUID(server, uuid);
if (!network) {
- qemudReportError(server, VIR_ERR_INVALID_NETWORK, "no network with matching uuid");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INVALID_NETWORK, "no network with matching uuid");
return -1;
}
struct qemud_network *network = qemudFindNetworkByUUID(server, uuid);
if (!network) {
- qemudReportError(server, VIR_ERR_INVALID_NETWORK, "no network with matching uuid");
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INVALID_NETWORK, "no network with matching uuid");
return -1;
}
int err;
if ((err = qemudEnsureDir(server->networkAutostartDir))) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"cannot create autostart directory %s: %s",
server->networkAutostartDir, strerror(err));
return -1;
}
if (symlink(network->configFile, network->autostartLink) < 0) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"Failed to create symlink '%s' to '%s': %s",
network->autostartLink, network->configFile, strerror(errno));
return -1;
}
} else {
if (unlink(network->autostartLink) < 0 && errno != ENOENT && errno != ENOTDIR) {
- qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+ qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
"Failed to delete symlink '%s': %s",
network->autostartLink, strerror(errno));
return -1;