And use that for all of its callers in the tree.
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
/* update /vm/<uuid>/name */
rc = libxl_domain_info(ctx, &info, domid);
if (rc)
- goto x_fail;
+ goto x_rc;
uuid = GCSPRINTF(LIBXL_UUID_FMT, LIBXL_UUID_BYTES(info.uuid));
vm_name_path = GCSPRINTF("/vm/%s/name", uuid);
LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "getting domain info list");
return ERROR_FAIL;
}
- if (ret==0 || xcinfo.domain != domid) return ERROR_INVAL;
+ if (ret==0 || xcinfo.domain != domid) return ERROR_DOMAIN_NOTFOUND;
if (info_r)
xcinfo2xlinfo(ctx, &xcinfo, info_r);
switch(rc) {
case 0:
break;
- case ERROR_INVAL:
+ case ERROR_DOMAIN_NOTFOUND:
LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "non-existant domain %d", domid);
default:
goto out;
libxl_dominfo info;
char *dompath;
xs_transaction_t t;
- int i, rc = ERROR_FAIL;
+ int i, rc;
libxl_dominfo_init(&info);
- if (libxl_domain_info(CTX, &info, domid) < 0) {
+ rc = libxl_domain_info(CTX, &info, domid);
+ if (rc < 0) {
LOGE(ERROR, "getting domain info list");
goto out;
}
+ rc = ERROR_FAIL;
if (!(dompath = libxl__xs_get_dompath(gc, domid)))
goto out;
libxl_bitmap *cpumap)
{
libxl_dominfo info;
- int i;
+ int i, rc;
libxl_dominfo_init(&info);
- if (libxl_domain_info(CTX, &info, domid) < 0) {
+ rc = libxl_domain_info(CTX, &info, domid);
+ if (rc < 0) {
LOGE(ERROR, "getting domain info list");
libxl_dominfo_dispose(&info);
- return ERROR_FAIL;
+ return rc;
}
for (i = 0; i <= info.vcpu_max_id; i++) {
if (libxl_bitmap_test(cpumap, i)) {
*/
#define LIBXL_HAVE_BUILDINFO_HVM_MMIO_HOLE_MEMKB 1
+/*
+ * libxl_domain_info returns ERROR_DOMAIN_NOTFOUND if the domain
+ * is not present, instead of ERROR_INVAL.
+ */
+#define LIBXL_HAVE_ERROR_DOMAIN_NOTFOUND 1
/*
* libxl ABI compatibility
*
*/
int libxl_primary_console_get_tty(libxl_ctx *ctx, uint32_t domid_vm, char **path);
-/* May be called with info_r == NULL to check for domain's existance */
+/* May be called with info_r == NULL to check for domain's existence.
+ * Returns ERROR_DOMAIN_NOTFOUND if domain does not exist (used to return
+ * ERROR_INVAL for this scenario). */
int libxl_domain_info(libxl_ctx*, libxl_dominfo *info_r,
uint32_t domid);
(-18, "REMUS_DEVOPS_DOES_NOT_MATCH"),
(-19, "REMUS_DEVICE_NOT_SUPPORTED"),
(-20, "VNUMA_CONFIG_INVALID"),
+ (-21, "DOMAIN_NOTFOUND"),
], value_namespace = "")
libxl_domain_type = Enumeration("domain_type", [
} else if (optind == argc-1) {
uint32_t domid = find_domain(argv[optind]);
rc = libxl_domain_info(ctx, &info_buf, domid);
- if (rc == ERROR_INVAL) {
+ if (rc == ERROR_DOMAIN_NOTFOUND) {
fprintf(stderr, "Error: Domain \'%s\' does not exist.\n",
argv[optind]);
return -rc;
} else if (optind == argc-1) {
uint32_t domid = find_domain(argv[optind]);
rc = libxl_domain_info(ctx, &info_buf, domid);
- if (rc == ERROR_INVAL) {
+ if (rc == ERROR_DOMAIN_NOTFOUND) {
fprintf(stderr, "Error: Domain \'%s\' does not exist.\n",
argv[optind]);
return -rc;