struct utsname utsname;
if (libxl_get_physinfo(&driver->ctx, &phy_info)) {
- libxlError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("libxl_get_physinfo_info failed"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("libxl_get_physinfo_info failed"));
return -1;
}
if ((ver_info = libxl_get_version_info(&driver->ctx)) == NULL) {
- libxlError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("libxl_get_version_info failed"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("libxl_get_version_info failed"));
return -1;
}
utsname.machine,
strlen(utsname.machine),
sizeof(info->model)) == NULL) {
- libxlError(VIR_ERR_INTERNAL_ERROR,
- _("machine type %s too big for destination"),
- utsname.machine);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("machine type %s too big for destination"),
+ utsname.machine);
return -1;
}
char *xml = NULL;
if ((fd = virFileOpenAs(from, O_RDONLY, 0, -1, -1, 0)) < 0) {
- libxlError(VIR_ERR_OPERATION_FAILED,
- "%s", _("cannot read domain image"));
+ virReportError(VIR_ERR_OPERATION_FAILED,
+ "%s", _("cannot read domain image"));
goto error;
}
if (saferead(fd, &hdr, sizeof(hdr)) != sizeof(hdr)) {
- libxlError(VIR_ERR_OPERATION_FAILED,
- "%s", _("failed to read libxl header"));
+ virReportError(VIR_ERR_OPERATION_FAILED,
+ "%s", _("failed to read libxl header"));
goto error;
}
if (memcmp(hdr.magic, LIBXL_SAVE_MAGIC, sizeof(hdr.magic))) {
- libxlError(VIR_ERR_INVALID_ARG, "%s", _("image magic is incorrect"));
+ virReportError(VIR_ERR_INVALID_ARG, "%s", _("image magic is incorrect"));
goto error;
}
if (hdr.version > LIBXL_SAVE_VERSION) {
- libxlError(VIR_ERR_OPERATION_FAILED,
- _("image version is not supported (%d > %d)"),
- hdr.version, LIBXL_SAVE_VERSION);
+ virReportError(VIR_ERR_OPERATION_FAILED,
+ _("image version is not supported (%d > %d)"),
+ hdr.version, LIBXL_SAVE_VERSION);
goto error;
}
if (hdr.xmlLen <= 0) {
- libxlError(VIR_ERR_OPERATION_FAILED,
- _("invalid XML length: %d"), hdr.xmlLen);
+ virReportError(VIR_ERR_OPERATION_FAILED,
+ _("invalid XML length: %d"), hdr.xmlLen);
goto error;
}
}
if (saferead(fd, xml, hdr.xmlLen) != hdr.xmlLen) {
- libxlError(VIR_ERR_OPERATION_FAILED, "%s", _("failed to read XML"));
+ virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("failed to read XML"));
goto error;
}
libxlDomainObjPrivatePtr priv = vm->privateData;
if (libxl_domain_destroy(&priv->ctx, vm->def->id, force) < 0) {
- libxlError(VIR_ERR_INTERNAL_ERROR,
- _("Unable to cleanup domain %d"), vm->def->id);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unable to cleanup domain %d"), vm->def->id);
return -1;
}
map.map = cpumap;
if (libxl_set_vcpuaffinity(&priv->ctx, def->id, vcpu, &map) != 0) {
- libxlError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to pin vcpu '%d' with libxenlight"), vcpu);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to pin vcpu '%d' with libxenlight"), vcpu);
goto cleanup;
}
char def_uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(vm->def->uuid, vm_uuidstr);
virUUIDFormat(def->uuid, def_uuidstr);
- libxlError(VIR_ERR_OPERATION_FAILED,
- _("cannot restore domain '%s' uuid %s from a file"
- " which belongs to domain '%s' uuid %s"),
- vm->def->name, vm_uuidstr, def->name, def_uuidstr);
+ virReportError(VIR_ERR_OPERATION_FAILED,
+ _("cannot restore domain '%s' uuid %s from a file"
+ " which belongs to domain '%s' uuid %s"),
+ vm->def->name, vm_uuidstr, def->name, def_uuidstr);
goto error;
}
return -1;
if (libxlFreeMem(priv, &d_config) < 0) {
- libxlError(VIR_ERR_INTERNAL_ERROR,
- _("libxenlight failed to get free memory for domain '%s'"),
- d_config.c_info.name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("libxenlight failed to get free memory for domain '%s'"),
+ d_config.c_info.name);
goto error;
}
if (ret) {
if (restore_fd < 0)
- libxlError(VIR_ERR_INTERNAL_ERROR,
- _("libxenlight failed to create new domain '%s'"),
- d_config.c_info.name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("libxenlight failed to create new domain '%s'"),
+ d_config.c_info.name);
else
- libxlError(VIR_ERR_INTERNAL_ERROR,
- _("libxenlight failed to restore domain '%s'"),
- d_config.c_info.name);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("libxenlight failed to restore domain '%s'"),
+ d_config.c_info.name);
goto error;
}
if (libxl_userdata_store(&priv->ctx, domid, "libvirt-xml",
(uint8_t *)dom_xml, strlen(dom_xml) + 1)) {
- libxlError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("libxenlight failed to store userdata"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("libxenlight failed to store userdata"));
goto error;
}
/* Error if xen or libxl scheme specified but driver not started. */
if (libxl_driver == NULL) {
- libxlError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("libxenlight state driver is not active"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("libxenlight state driver is not active"));
return VIR_DRV_OPEN_ERROR;
}
STRNEQ(conn->uri->path, "") &&
STRNEQ(conn->uri->path, "/") &&
STRNEQ(conn->uri->path, "/system")) {
- libxlError(VIR_ERR_INTERNAL_ERROR,
- _("unexpected Xen URI path '%s', try xen:///"),
- NULLSTR(conn->uri->path));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unexpected Xen URI path '%s', try xen:///"),
+ NULLSTR(conn->uri->path));
return VIR_DRV_OPEN_ERROR;
}
}
libxlDriverUnlock(driver);
if (!vm) {
- libxlError(VIR_ERR_NO_DOMAIN, NULL);
+ virReportError(VIR_ERR_NO_DOMAIN, NULL);
goto cleanup;
}
libxlDriverUnlock(driver);
if (!vm) {
- libxlError(VIR_ERR_NO_DOMAIN, NULL);
+ virReportError(VIR_ERR_NO_DOMAIN, NULL);
goto cleanup;
}
libxlDriverUnlock(driver);
if (!vm) {
- libxlError(VIR_ERR_NO_DOMAIN, NULL);
+ virReportError(VIR_ERR_NO_DOMAIN, NULL);
goto cleanup;
}
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- libxlError(VIR_ERR_NO_DOMAIN,
- _("No domain with matching uuid '%s'"), uuidstr);
+ virReportError(VIR_ERR_NO_DOMAIN,
+ _("No domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (!virDomainObjIsActive(vm)) {
- libxlError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running"));
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running"));
goto cleanup;
}
if (virDomainObjGetState(vm, NULL) != VIR_DOMAIN_PAUSED) {
if (libxl_domain_pause(&priv->ctx, dom->id) != 0) {
- libxlError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to suspend domain '%d' with libxenlight"),
- dom->id);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to suspend domain '%d' with libxenlight"),
+ dom->id);
goto cleanup;
}
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- libxlError(VIR_ERR_NO_DOMAIN,
- _("No domain with matching uuid '%s'"), uuidstr);
+ virReportError(VIR_ERR_NO_DOMAIN,
+ _("No domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (!virDomainObjIsActive(vm)) {
- libxlError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running"));
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running"));
goto cleanup;
}
if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED) {
if (libxl_domain_unpause(&priv->ctx, dom->id) != 0) {
- libxlError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to resume domain '%d' with libxenlight"),
- dom->id);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to resume domain '%d' with libxenlight"),
+ dom->id);
goto cleanup;
}
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- libxlError(VIR_ERR_NO_DOMAIN,
- _("No domain with matching uuid '%s'"), uuidstr);
+ virReportError(VIR_ERR_NO_DOMAIN,
+ _("No domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (!virDomainObjIsActive(vm)) {
- libxlError(VIR_ERR_OPERATION_INVALID,
- "%s", _("Domain is not running"));
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ "%s", _("Domain is not running"));
goto cleanup;
}
priv = vm->privateData;
if (libxl_domain_shutdown(&priv->ctx, dom->id, LIBXL_DOM_REQ_POWEROFF) != 0) {
- libxlError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to shutdown domain '%d' with libxenlight"),
- dom->id);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to shutdown domain '%d' with libxenlight"),
+ dom->id);
goto cleanup;
}
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- libxlError(VIR_ERR_NO_DOMAIN,
- _("No domain with matching uuid '%s'"), uuidstr);
+ virReportError(VIR_ERR_NO_DOMAIN,
+ _("No domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (!virDomainObjIsActive(vm)) {
- libxlError(VIR_ERR_OPERATION_INVALID,
- "%s", _("Domain is not running"));
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ "%s", _("Domain is not running"));
goto cleanup;
}
priv = vm->privateData;
if (libxl_domain_shutdown(&priv->ctx, dom->id, LIBXL_DOM_REQ_REBOOT) != 0) {
- libxlError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to reboot domain '%d' with libxenlight"),
- dom->id);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to reboot domain '%d' with libxenlight"),
+ dom->id);
goto cleanup;
}
ret = 0;
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- libxlError(VIR_ERR_NO_DOMAIN,
- _("No domain with matching uuid '%s'"), uuidstr);
+ virReportError(VIR_ERR_NO_DOMAIN,
+ _("No domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (!virDomainObjIsActive(vm)) {
- libxlError(VIR_ERR_OPERATION_INVALID,
- "%s", _("Domain is not running"));
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ "%s", _("Domain is not running"));
goto cleanup;
}
VIR_DOMAIN_EVENT_STOPPED_DESTROYED);
if (libxlVmReap(driver, vm, 1, VIR_DOMAIN_SHUTOFF_DESTROYED) != 0) {
- libxlError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to destroy domain '%d'"), dom->id);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to destroy domain '%d'"), dom->id);
goto cleanup;
}
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- libxlError(VIR_ERR_NO_DOMAIN,
- _("No domain with matching uuid '%s'"), uuidstr);
+ virReportError(VIR_ERR_NO_DOMAIN,
+ _("No domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
libxlDriverUnlock(driver);
if (!vm) {
- libxlError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid"));
+ virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid"));
goto cleanup;
}
ret = vm->def->mem.max_balloon;
libxlDriverUnlock(driver);
if (!vm) {
- libxlError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid"));
+ virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid"));
goto cleanup;
}
}
if (!isActive && (flags & VIR_DOMAIN_MEM_LIVE)) {
- libxlError(VIR_ERR_OPERATION_INVALID, "%s",
- _("cannot set memory on an inactive domain"));
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("cannot set memory on an inactive domain"));
goto cleanup;
}
if (flags & VIR_DOMAIN_MEM_CONFIG) {
if (!vm->persistent) {
- libxlError(VIR_ERR_OPERATION_INVALID, "%s",
- _("cannot change persistent config of a transient domain"));
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("cannot change persistent config of a transient domain"));
goto cleanup;
}
if (!(persistentDef = virDomainObjGetPersistentDef(driver->caps, vm)))
if (flags & VIR_DOMAIN_MEM_LIVE) {
priv = vm->privateData;
if (libxl_domain_setmaxmem(&priv->ctx, dom->id, newmem) < 0) {
- libxlError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to set maximum memory for domain '%d'"
- " with libxenlight"), dom->id);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to set maximum memory for domain '%d'"
+ " with libxenlight"), dom->id);
goto cleanup;
}
}
/* resize the current memory */
if (newmem > vm->def->mem.max_balloon) {
- libxlError(VIR_ERR_INVALID_ARG, "%s",
- _("cannot set memory higher than max memory"));
+ virReportError(VIR_ERR_INVALID_ARG, "%s",
+ _("cannot set memory higher than max memory"));
goto cleanup;
}
priv = vm->privateData;
if (libxl_set_memory_target(&priv->ctx, dom->id, newmem, 0,
/* force */ 1) < 0) {
- libxlError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to set memory for domain '%d'"
- " with libxenlight"), dom->id);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to set memory for domain '%d'"
+ " with libxenlight"), dom->id);
goto cleanup;
}
}
libxlDriverUnlock(driver);
if (!vm) {
- libxlError(VIR_ERR_NO_DOMAIN, "%s",
- _("no domain with matching uuid"));
+ virReportError(VIR_ERR_NO_DOMAIN, "%s",
+ _("no domain with matching uuid"));
goto cleanup;
}
info->maxMem = vm->def->mem.max_balloon;
} else {
if (libxl_domain_info(&driver->ctx, &d_info, dom->id) != 0) {
- libxlError(VIR_ERR_INTERNAL_ERROR,
- _("libxl_domain_info failed for domain '%d'"), dom->id);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("libxl_domain_info failed for domain '%d'"), dom->id);
goto cleanup;
}
info->cpuTime = d_info.cpu_time;
libxlDriverUnlock(driver);
if (!vm) {
- libxlError(VIR_ERR_NO_DOMAIN, "%s",
- _("no domain with matching uuid"));
+ virReportError(VIR_ERR_NO_DOMAIN, "%s",
+ _("no domain with matching uuid"));
goto cleanup;
}
int ret = -1;
if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED) {
- libxlError(VIR_ERR_OPERATION_INVALID,
- _("Domain '%d' has to be running because libxenlight will"
- " suspend it"), vm->def->id);
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ _("Domain '%d' has to be running because libxenlight will"
+ " suspend it"), vm->def->id);
goto cleanup;
}
hdr.xmlLen = xml_len;
if (safewrite(fd, &hdr, sizeof(hdr)) != sizeof(hdr)) {
- libxlError(VIR_ERR_OPERATION_FAILED, "%s",
- _("Failed to write save file header"));
+ virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("Failed to write save file header"));
goto cleanup;
}
if (safewrite(fd, xml, xml_len) != xml_len) {
- libxlError(VIR_ERR_OPERATION_FAILED, "%s",
- _("Failed to write xml description"));
+ virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+ _("Failed to write xml description"));
goto cleanup;
}
if (libxl_domain_suspend(&priv->ctx, NULL, vm->def->id, fd) != 0) {
- libxlError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to save domain '%d' with libxenlight"),
- vm->def->id);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to save domain '%d' with libxenlight"),
+ vm->def->id);
goto cleanup;
}
VIR_DOMAIN_EVENT_STOPPED_SAVED);
if (libxlVmReap(driver, vm, 1, VIR_DOMAIN_SHUTOFF_SAVED) != 0) {
- libxlError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to destroy domain '%d'"), vm->def->id);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to destroy domain '%d'"), vm->def->id);
goto cleanup;
}
virCheckFlags(0, -1);
if (dxml) {
- libxlError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
- _("xml modification unsupported"));
+ virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
+ _("xml modification unsupported"));
return -1;
}
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- libxlError(VIR_ERR_NO_DOMAIN,
- _("No domain with matching uuid '%s'"), uuidstr);
+ virReportError(VIR_ERR_NO_DOMAIN,
+ _("No domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (!virDomainObjIsActive(vm)) {
- libxlError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running"));
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running"));
goto cleanup;
}
virCheckFlags(0, -1);
if (dxml) {
- libxlError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
- _("xml modification unsupported"));
+ virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
+ _("xml modification unsupported"));
return -1;
}
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- libxlError(VIR_ERR_NO_DOMAIN,
- _("No domain with matching uuid '%s'"), uuidstr);
+ virReportError(VIR_ERR_NO_DOMAIN,
+ _("No domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (!virDomainObjIsActive(vm)) {
- libxlError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running"));
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running"));
goto cleanup;
}
if (!(flags & VIR_DUMP_LIVE) &&
virDomainObjGetState(vm, NULL) == VIR_DOMAIN_RUNNING) {
if (libxl_domain_pause(&priv->ctx, dom->id) != 0) {
- libxlError(VIR_ERR_INTERNAL_ERROR,
- _("Before dumping core, failed to suspend domain '%d'"
- " with libxenlight"),
- dom->id);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Before dumping core, failed to suspend domain '%d'"
+ " with libxenlight"),
+ dom->id);
goto cleanup;
}
virDomainObjSetState(vm, VIR_DOMAIN_PAUSED, VIR_DOMAIN_PAUSED_DUMP);
}
if (libxl_domain_core_dump(&priv->ctx, dom->id, to) != 0) {
- libxlError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to dump core of domain '%d' with libxenlight"),
- dom->id);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to dump core of domain '%d' with libxenlight"),
+ dom->id);
goto cleanup_unpause;
}
libxlDriverLock(driver);
if (flags & VIR_DUMP_CRASH) {
if (libxlVmReap(driver, vm, 1, VIR_DOMAIN_SHUTOFF_CRASHED) != 0) {
- libxlError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to destroy domain '%d'"), dom->id);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to destroy domain '%d'"), dom->id);
goto cleanup_unlock;
}
cleanup_unpause:
if (virDomainObjIsActive(vm) && paused) {
if (libxl_domain_unpause(&priv->ctx, dom->id) != 0) {
- libxlError(VIR_ERR_INTERNAL_ERROR,
- _("After dumping core, failed to resume domain '%d' with"
- " libxenlight"), dom->id);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("After dumping core, failed to resume domain '%d' with"
+ " libxenlight"), dom->id);
} else {
virDomainObjSetState(vm, VIR_DOMAIN_RUNNING,
VIR_DOMAIN_RUNNING_UNPAUSED);
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- libxlError(VIR_ERR_NO_DOMAIN,
- _("No domain with matching uuid '%s'"), uuidstr);
+ virReportError(VIR_ERR_NO_DOMAIN,
+ _("No domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (!virDomainObjIsActive(vm)) {
- libxlError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running"));
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running"));
goto cleanup;
}
if (!vm->persistent) {
- libxlError(VIR_ERR_OPERATION_INVALID, "%s",
- _("cannot do managed save for transient domain"));
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("cannot do managed save for transient domain"));
goto cleanup;
}
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- libxlError(VIR_ERR_NO_DOMAIN,
- _("No domain with matching uuid '%s'"), uuidstr);
+ virReportError(VIR_ERR_NO_DOMAIN,
+ _("No domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- libxlError(VIR_ERR_NO_DOMAIN,
- _("No domain with matching uuid '%s'"), uuidstr);
+ virReportError(VIR_ERR_NO_DOMAIN,
+ _("No domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if ((flags & (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG)) == 0 ||
(flags & (VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_LIVE)) ==
(VIR_DOMAIN_VCPU_MAXIMUM | VIR_DOMAIN_VCPU_LIVE)) {
- libxlError(VIR_ERR_INVALID_ARG,
- _("invalid flag combination: (0x%x)"), flags);
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("invalid flag combination: (0x%x)"), flags);
return -1;
}
if (!nvcpus) {
- libxlError(VIR_ERR_INVALID_ARG, "%s", _("nvcpus is zero"));
+ virReportError(VIR_ERR_INVALID_ARG, "%s", _("nvcpus is zero"));
return -1;
}
libxlDriverUnlock(driver);
if (!vm) {
- libxlError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid"));
+ virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid"));
goto cleanup;
}
if (!virDomainObjIsActive(vm) && (flags & VIR_DOMAIN_VCPU_LIVE)) {
- libxlError(VIR_ERR_OPERATION_INVALID, "%s",
- _("cannot set vcpus on an inactive domain"));
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("cannot set vcpus on an inactive domain"));
goto cleanup;
}
if (!vm->persistent && (flags & VIR_DOMAIN_VCPU_CONFIG)) {
- libxlError(VIR_ERR_OPERATION_INVALID, "%s",
- _("cannot change persistent config of a transient domain"));
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("cannot change persistent config of a transient domain"));
goto cleanup;
}
if ((max = libxlGetMaxVcpus(dom->conn, NULL)) < 0) {
- libxlError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("could not determine max vcpus for the domain"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("could not determine max vcpus for the domain"));
goto cleanup;
}
}
if (nvcpus > max) {
- libxlError(VIR_ERR_INVALID_ARG,
- _("requested vcpus is greater than max allowable"
- " vcpus for the domain: %d > %d"), nvcpus, max);
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("requested vcpus is greater than max allowable"
+ " vcpus for the domain: %d > %d"), nvcpus, max);
goto cleanup;
}
case VIR_DOMAIN_VCPU_LIVE:
if (libxl_set_vcpuonline(&priv->ctx, dom->id, &map) != 0) {
- libxlError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to set vcpus for domain '%d'"
- " with libxenlight"), dom->id);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to set vcpus for domain '%d'"
+ " with libxenlight"), dom->id);
goto cleanup;
}
break;
case VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG:
if (libxl_set_vcpuonline(&priv->ctx, dom->id, &map) != 0) {
- libxlError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to set vcpus for domain '%d'"
- " with libxenlight"), dom->id);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to set vcpus for domain '%d'"
+ " with libxenlight"), dom->id);
goto cleanup;
}
def->vcpus = nvcpus;
libxlDriverUnlock(driver);
if (!vm) {
- libxlError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid"));
+ virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid"));
goto cleanup;
}
flags |= VIR_DOMAIN_VCPU_CONFIG;
}
if ((flags & VIR_DOMAIN_VCPU_LIVE) && (flags & VIR_DOMAIN_VCPU_CONFIG)) {
- libxlError(VIR_ERR_INVALID_ARG,
- _("invalid flag combination: (0x%x)"), flags);
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("invalid flag combination: (0x%x)"), flags);
return -1;
}
if (flags & VIR_DOMAIN_VCPU_LIVE) {
if (!active) {
- libxlError(VIR_ERR_OPERATION_INVALID,
- "%s", _("Domain is not running"));
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ "%s", _("Domain is not running"));
goto cleanup;
}
def = vm->def;
} else {
if (!vm->persistent) {
- libxlError(VIR_ERR_OPERATION_INVALID,
- "%s", _("domain is transient"));
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ "%s", _("domain is transient"));
goto cleanup;
}
def = vm->newDef ? vm->newDef : vm->def;
libxlDriverUnlock(driver);
if (!vm) {
- libxlError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid"));
+ virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid"));
goto cleanup;
}
if (!virDomainObjIsActive(vm)) {
- libxlError(VIR_ERR_OPERATION_INVALID, "%s",
- _("cannot pin vcpus on an inactive domain"));
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("cannot pin vcpus on an inactive domain"));
goto cleanup;
}
map.size = maplen;
map.map = cpumap;
if (libxl_set_vcpuaffinity(&priv->ctx, dom->id, vcpu, &map) != 0) {
- libxlError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to pin vcpu '%d' with libxenlight"), vcpu);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to pin vcpu '%d' with libxenlight"), vcpu);
goto cleanup;
}
if (virDomainVcpuPinAdd(vm->def, cpumap, maplen, vcpu) < 0) {
- libxlError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("failed to update or add vcpupin xml"));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("failed to update or add vcpupin xml"));
goto cleanup;
}
libxlDriverUnlock(driver);
if (!vm) {
- libxlError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid"));
+ virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid"));
goto cleanup;
}
if (!virDomainObjIsActive(vm)) {
- libxlError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running"));
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running"));
goto cleanup;
}
priv = vm->privateData;
if ((vcpuinfo = libxl_list_vcpu(&priv->ctx, dom->id, &maxcpu,
&hostcpus)) == NULL) {
- libxlError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to list vcpus for domain '%d' with libxenlight"),
- dom->id);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to list vcpus for domain '%d' with libxenlight"),
+ dom->id);
goto cleanup;
}
libxlDriverUnlock(driver);
if (!vm) {
- libxlError(VIR_ERR_NO_DOMAIN, "%s",
- _("no domain with matching uuid"));
+ virReportError(VIR_ERR_NO_DOMAIN, "%s",
+ _("no domain with matching uuid"));
goto cleanup;
}
virCheckFlags(0, NULL);
if (STRNEQ(nativeFormat, LIBXL_CONFIG_FORMAT_XM)) {
- libxlError(VIR_ERR_INVALID_ARG,
- _("unsupported config type %s"), nativeFormat);
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("unsupported config type %s"), nativeFormat);
goto cleanup;
}
goto cleanup;
if (!(def = xenParseXM(conf, ver_info->xen_version_major, driver->caps))) {
- libxlError(VIR_ERR_INTERNAL_ERROR, "%s", _("parsing xm config failed"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("parsing xm config failed"));
goto cleanup;
}
virCheckFlags(0, NULL);
if (STRNEQ(nativeFormat, LIBXL_CONFIG_FORMAT_XM)) {
- libxlError(VIR_ERR_INVALID_ARG,
- _("unsupported config type %s"), nativeFormat);
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("unsupported config type %s"), nativeFormat);
goto cleanup;
}
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- libxlError(VIR_ERR_NO_DOMAIN,
- _("No domain with matching uuid '%s'"), uuidstr);
+ virReportError(VIR_ERR_NO_DOMAIN,
+ _("No domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (virDomainObjIsActive(vm)) {
- libxlError(VIR_ERR_OPERATION_INVALID,
- "%s", _("Domain is already running"));
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ "%s", _("Domain is already running"));
goto cleanup;
}
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- libxlError(VIR_ERR_NO_DOMAIN,
- _("no domain with matching uuid '%s'"), uuidstr);
+ virReportError(VIR_ERR_NO_DOMAIN,
+ _("no domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (!vm->persistent) {
- libxlError(VIR_ERR_OPERATION_INVALID,
- "%s", _("cannot undefine transient domain"));
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ "%s", _("cannot undefine transient domain"));
goto cleanup;
}
if (virFileExists(name)) {
if (flags & VIR_DOMAIN_UNDEFINE_MANAGED_SAVE) {
if (unlink(name) < 0) {
- libxlError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Failed to remove domain managed save image"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Failed to remove domain managed save image"));
goto cleanup;
}
} else {
- libxlError(VIR_ERR_OPERATION_INVALID, "%s",
- _("Refusing to undefine while domain managed "
- "save image exists"));
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("Refusing to undefine while domain managed "
+ "save image exists"));
goto cleanup;
}
}
}
if (!origdisk) {
- libxlError(VIR_ERR_INTERNAL_ERROR,
- _("No device with bus '%s' and target '%s'"),
- virDomainDiskBusTypeToString(disk->bus), disk->dst);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("No device with bus '%s' and target '%s'"),
+ virDomainDiskBusTypeToString(disk->bus), disk->dst);
goto cleanup;
}
if (origdisk->device != VIR_DOMAIN_DISK_DEVICE_CDROM) {
- libxlError(VIR_ERR_INTERNAL_ERROR,
- _("Removable media not supported for %s device"),
- virDomainDiskDeviceTypeToString(disk->device));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Removable media not supported for %s device"),
+ virDomainDiskDeviceTypeToString(disk->device));
return -1;
}
goto cleanup;
if ((ret = libxl_cdrom_insert(&priv->ctx, vm->def->id, &x_disk)) < 0) {
- libxlError(VIR_ERR_INTERNAL_ERROR,
- _("libxenlight failed to change media for disk '%s'"),
- disk->dst);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("libxenlight failed to change media for disk '%s'"),
+ disk->dst);
goto cleanup;
}
case VIR_DOMAIN_DISK_DEVICE_DISK:
if (l_disk->bus == VIR_DOMAIN_DISK_BUS_XEN) {
if (virDomainDiskIndexByName(vm->def, l_disk->dst, true) >= 0) {
- libxlError(VIR_ERR_OPERATION_FAILED,
- _("target %s already exists"), l_disk->dst);
+ virReportError(VIR_ERR_OPERATION_FAILED,
+ _("target %s already exists"), l_disk->dst);
goto cleanup;
}
if (!l_disk->src) {
- libxlError(VIR_ERR_INTERNAL_ERROR,
- "%s", _("disk source path is missing"));
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ "%s", _("disk source path is missing"));
goto cleanup;
}
if ((ret = libxl_device_disk_add(&priv->ctx, vm->def->id,
&x_disk)) < 0) {
- libxlError(VIR_ERR_INTERNAL_ERROR,
- _("libxenlight failed to attach disk '%s'"),
- l_disk->dst);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("libxenlight failed to attach disk '%s'"),
+ l_disk->dst);
goto cleanup;
}
virDomainDiskInsertPreAlloced(vm->def, l_disk);
} else {
- libxlError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("disk bus '%s' cannot be hotplugged."),
- virDomainDiskBusTypeToString(l_disk->bus));
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("disk bus '%s' cannot be hotplugged."),
+ virDomainDiskBusTypeToString(l_disk->bus));
}
break;
default:
- libxlError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("disk device type '%s' cannot be hotplugged"),
- virDomainDiskDeviceTypeToString(l_disk->device));
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("disk device type '%s' cannot be hotplugged"),
+ virDomainDiskDeviceTypeToString(l_disk->device));
break;
}
if ((i = virDomainDiskIndexByName(vm->def,
dev->data.disk->dst,
false)) < 0) {
- libxlError(VIR_ERR_OPERATION_FAILED,
- _("disk %s not found"), dev->data.disk->dst);
+ virReportError(VIR_ERR_OPERATION_FAILED,
+ _("disk %s not found"), dev->data.disk->dst);
goto cleanup;
}
if ((ret = libxl_device_disk_del(&priv->ctx, &x_disk,
wait_secs)) < 0) {
- libxlError(VIR_ERR_INTERNAL_ERROR,
- _("libxenlight failed to detach disk '%s'"),
- l_disk->dst);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("libxenlight failed to detach disk '%s'"),
+ l_disk->dst);
goto cleanup;
}
virDomainDiskDefFree(l_disk);
} else {
- libxlError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("disk bus '%s' cannot be hot unplugged."),
- virDomainDiskBusTypeToString(dev->data.disk->bus));
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("disk bus '%s' cannot be hot unplugged."),
+ virDomainDiskBusTypeToString(dev->data.disk->bus));
}
break;
default:
- libxlError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("device type '%s' cannot hot unplugged"),
- virDomainDiskDeviceTypeToString(dev->data.disk->device));
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("device type '%s' cannot hot unplugged"),
+ virDomainDiskDeviceTypeToString(dev->data.disk->device));
break;
}
break;
default:
- libxlError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("device type '%s' cannot be attached"),
- virDomainDeviceTypeToString(dev->type));
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("device type '%s' cannot be attached"),
+ virDomainDeviceTypeToString(dev->type));
break;
}
case VIR_DOMAIN_DEVICE_DISK:
disk = dev->data.disk;
if (virDomainDiskIndexByName(vmdef, disk->dst, true) >= 0) {
- libxlError(VIR_ERR_INVALID_ARG,
- _("target %s already exists."), disk->dst);
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("target %s already exists."), disk->dst);
return -1;
}
if (virDomainDiskInsert(vmdef, disk)) {
break;
default:
- libxlError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("persistent attach of device is not supported"));
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("persistent attach of device is not supported"));
return -1;
}
return 0;
break;
default:
- libxlError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("device type '%s' cannot be detached"),
- virDomainDeviceTypeToString(dev->type));
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("device type '%s' cannot be detached"),
+ virDomainDeviceTypeToString(dev->type));
break;
}
case VIR_DOMAIN_DEVICE_DISK:
disk = dev->data.disk;
if (!(detach = virDomainDiskRemoveByName(vmdef, disk->dst))) {
- libxlError(VIR_ERR_INVALID_ARG,
- _("no target device %s"), disk->dst);
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("no target device %s"), disk->dst);
break;
}
virDomainDiskDefFree(detach);
ret = 0;
break;
default:
- libxlError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("persistent detach of device is not supported"));
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("persistent detach of device is not supported"));
break;
}
dev->data.disk = NULL;
break;
default:
- libxlError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("disk bus '%s' cannot be updated."),
- virDomainDiskBusTypeToString(disk->bus));
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("disk bus '%s' cannot be updated."),
+ virDomainDiskBusTypeToString(disk->bus));
break;
}
break;
default:
- libxlError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("device type '%s' cannot be updated"),
- virDomainDeviceTypeToString(dev->type));
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("device type '%s' cannot be updated"),
+ virDomainDeviceTypeToString(dev->type));
break;
}
case VIR_DOMAIN_DEVICE_DISK:
disk = dev->data.disk;
if ((i = virDomainDiskIndexByName(vmdef, disk->dst, false)) < 0) {
- libxlError(VIR_ERR_INVALID_ARG,
- _("target %s doesn't exist."), disk->dst);
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("target %s doesn't exist."), disk->dst);
goto cleanup;
}
orig = vmdef->disks[i];
if (!(orig->device == VIR_DOMAIN_DISK_DEVICE_CDROM)) {
- libxlError(VIR_ERR_INVALID_ARG, "%s",
- _("this disk doesn't support update"));
+ virReportError(VIR_ERR_INVALID_ARG, "%s",
+ _("this disk doesn't support update"));
goto cleanup;
}
disk->src = NULL;
break;
default:
- libxlError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("persistent update of device is not supported"));
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("persistent update of device is not supported"));
goto cleanup;
}
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
if (!vm) {
- libxlError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid"));
+ virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid"));
goto cleanup;
}
flags |= VIR_DOMAIN_DEVICE_MODIFY_CONFIG;
/* check consistency between flags and the vm state */
if (flags & VIR_DOMAIN_DEVICE_MODIFY_LIVE) {
- libxlError(VIR_ERR_OPERATION_INVALID,
- "%s", _("Domain is not running"));
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ "%s", _("Domain is not running"));
goto cleanup;
}
}
if ((flags & VIR_DOMAIN_DEVICE_MODIFY_CONFIG) && !vm->persistent) {
- libxlError(VIR_ERR_OPERATION_INVALID,
- "%s", _("cannot modify device on transient domain"));
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ "%s", _("cannot modify device on transient domain"));
goto cleanup;
}
case LIBXL_DEVICE_UPDATE:
ret = libxlDomainUpdateDeviceConfig(vmdef, dev);
default:
- libxlError(VIR_ERR_INTERNAL_ERROR,
- _("unknown domain modify action %d"), action);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unknown domain modify action %d"), action);
break;
}
} else
case LIBXL_DEVICE_UPDATE:
ret = libxlDomainUpdateDeviceLive(priv, vm, dev);
default:
- libxlError(VIR_ERR_INTERNAL_ERROR,
- _("unknown domain modify action %d"), action);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unknown domain modify action %d"), action);
break;
}
/*
libxlDriverPrivatePtr driver = conn->privateData;
if (libxl_get_physinfo(&driver->ctx, &phy_info)) {
- libxlError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("libxl_get_physinfo_info failed"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("libxl_get_physinfo_info failed"));
return 0;
}
if ((ver_info = libxl_get_version_info(&driver->ctx)) == NULL) {
- libxlError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("libxl_get_version_info failed"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("libxl_get_version_info failed"));
return 0;
}
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- libxlError(VIR_ERR_NO_DOMAIN,
- _("No domain with matching uuid '%s'"), uuidstr);
+ virReportError(VIR_ERR_NO_DOMAIN,
+ _("No domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (!vm) {
char uuidstr[VIR_UUID_STRING_BUFLEN];
virUUIDFormat(dom->uuid, uuidstr);
- libxlError(VIR_ERR_NO_DOMAIN,
- _("No domain with matching uuid '%s'"), uuidstr);
+ virReportError(VIR_ERR_NO_DOMAIN,
+ _("No domain with matching uuid '%s'"), uuidstr);
goto cleanup;
}
if (!vm->persistent) {
- libxlError(VIR_ERR_OPERATION_INVALID,
- "%s", _("cannot set autostart for transient domain"));
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ "%s", _("cannot set autostart for transient domain"));
goto cleanup;
}
libxlDriverUnlock(driver);
if (!vm) {
- libxlError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid"));
+ virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid"));
goto cleanup;
}
if (!virDomainObjIsActive(vm)) {
- libxlError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running"));
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running"));
goto cleanup;
}
priv = vm->privateData;
if ((sched_id = libxl_get_sched_id(&priv->ctx)) < 0) {
- libxlError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to get scheduler id for domain '%d'"
- " with libxenlight"), dom->id);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to get scheduler id for domain '%d'"
+ " with libxenlight"), dom->id);
goto cleanup;
}
libxlDriverUnlock(driver);
if (!vm) {
- libxlError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid"));
+ virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid"));
goto cleanup;
}
if (!virDomainObjIsActive(vm)) {
- libxlError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running"));
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running"));
goto cleanup;
}
priv = vm->privateData;
if ((sched_id = libxl_get_sched_id(&priv->ctx)) < 0) {
- libxlError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to get scheduler id for domain '%d'"
- " with libxenlight"), dom->id);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to get scheduler id for domain '%d'"
+ " with libxenlight"), dom->id);
goto cleanup;
}
if (sched_id != XEN_SCHEDULER_CREDIT) {
- libxlError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Only 'credit' scheduler is supported"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Only 'credit' scheduler is supported"));
goto cleanup;
}
if (libxl_sched_credit_domain_get(&priv->ctx, dom->id, &sc_info) != 0) {
- libxlError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to get scheduler parameters for domain '%d'"
- " with libxenlight"), dom->id);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to get scheduler parameters for domain '%d'"
+ " with libxenlight"), dom->id);
goto cleanup;
}
libxlDriverUnlock(driver);
if (!vm) {
- libxlError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid"));
+ virReportError(VIR_ERR_NO_DOMAIN, "%s", _("no domain with matching uuid"));
goto cleanup;
}
if (!virDomainObjIsActive(vm)) {
- libxlError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running"));
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not running"));
goto cleanup;
}
priv = vm->privateData;
if ((sched_id = libxl_get_sched_id(&priv->ctx)) < 0) {
- libxlError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to get scheduler id for domain '%d'"
- " with libxenlight"), dom->id);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to get scheduler id for domain '%d'"
+ " with libxenlight"), dom->id);
goto cleanup;
}
if (sched_id != XEN_SCHEDULER_CREDIT) {
- libxlError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Only 'credit' scheduler is supported"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Only 'credit' scheduler is supported"));
goto cleanup;
}
if (libxl_sched_credit_domain_get(&priv->ctx, dom->id, &sc_info) != 0) {
- libxlError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to get scheduler parameters for domain '%d'"
- " with libxenlight"), dom->id);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to get scheduler parameters for domain '%d'"
+ " with libxenlight"), dom->id);
goto cleanup;
}
}
if (libxl_sched_credit_domain_set(&priv->ctx, dom->id, &sc_info) != 0) {
- libxlError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to set scheduler parameters for domain '%d'"
- " with libxenlight"), dom->id);
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to set scheduler parameters for domain '%d'"
+ " with libxenlight"), dom->id);
goto cleanup;
}
obj = virDomainFindByUUID(&driver->domains, dom->uuid);
libxlDriverUnlock(driver);
if (!obj) {
- libxlError(VIR_ERR_NO_DOMAIN, NULL);
+ virReportError(VIR_ERR_NO_DOMAIN, NULL);
goto cleanup;
}
ret = virDomainObjIsActive(obj);
obj = virDomainFindByUUID(&driver->domains, dom->uuid);
libxlDriverUnlock(driver);
if (!obj) {
- libxlError(VIR_ERR_NO_DOMAIN, NULL);
+ virReportError(VIR_ERR_NO_DOMAIN, NULL);
goto cleanup;
}
ret = obj->persistent;
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
libxlDriverUnlock(driver);
if (!vm) {
- libxlError(VIR_ERR_NO_DOMAIN, NULL);
+ virReportError(VIR_ERR_NO_DOMAIN, NULL);
goto cleanup;
}
ret = vm->updated;