From e9371d1a46ecb614d3e8046a40e8d10d7c5ef4d9 Mon Sep 17 00:00:00 2001 From: Mark McLoughlin Date: Mon, 22 Jan 2007 16:25:27 +0000 Subject: [PATCH] Mon Jan 22 16:23:52 IST 2007 Mark McLoughlin * src/internal.h: virDomain.handle refers to the "id" in the API, so re-name to virDomain.id to avoid confusion. * src/hash.c, src/libvirt.c, src/proxy_internal.c, src/test.c, src/xen_internal.c, src/xend_internal.c, src/xm_internal.c, src/xml.c, src/xs_internal.c: update for rename. --- ChangeLog | 10 ++++++++++ src/hash.c | 6 +++--- src/internal.h | 2 +- src/libvirt.c | 4 ++-- src/proxy_internal.c | 20 ++++++++++---------- src/test.c | 34 +++++++++++++++++----------------- src/xen_internal.c | 42 +++++++++++++++++++++--------------------- src/xend_internal.c | 44 ++++++++++++++++++++++---------------------- src/xm_internal.c | 26 +++++++++++++------------- src/xml.c | 4 ++-- src/xs_internal.c | 26 +++++++++++++------------- 11 files changed, 114 insertions(+), 104 deletions(-) diff --git a/ChangeLog b/ChangeLog index ab798e901b..62f6a72799 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Mon Jan 22 16:23:52 IST 2007 Mark McLoughlin + + * src/internal.h: virDomain.handle refers to the "id" + in the API, so re-name to virDomain.id to avoid + confusion. + + * src/hash.c, src/libvirt.c, src/proxy_internal.c, src/test.c, + src/xen_internal.c, src/xend_internal.c, src/xm_internal.c, + src/xml.c, src/xs_internal.c: update for rename. + Mon Jan 22 16:17:25 IST 2007 Mark McLoughlin * src/driver.h: remove Free(), GetName(), GetID() and diff --git a/src/hash.c b/src/hash.c index ebc6229a83..45ecb9735d 100644 --- a/src/hash.c +++ b/src/hash.c @@ -757,7 +757,7 @@ virGetDomain(virConnectPtr conn, const char *name, const unsigned char *uuid) { } ret->magic = VIR_DOMAIN_MAGIC; ret->conn = conn; - ret->handle = -1; + ret->id = -1; if (uuid != NULL) memcpy(&(ret->uuid[0]), uuid, 16); @@ -819,7 +819,7 @@ virFreeDomain(virConnectPtr conn, virDomainPtr domain) { goto done; } domain->magic = -1; - domain->handle = -1; + domain->id = -1; if (domain->path != NULL) free(domain->path); if (domain->xml) @@ -880,7 +880,7 @@ virGetDomainByID(virConnectPtr conn, int id) { while (iter != NULL) { next = iter->next; cur = (virDomainPtr) iter->payload; - if ((cur != NULL) && (cur->handle == id)) { + if ((cur != NULL) && (cur->id == id)) { ret = cur; goto done; } diff --git a/src/internal.h b/src/internal.h index 9b94b27381..e629de3112 100644 --- a/src/internal.h +++ b/src/internal.h @@ -150,7 +150,7 @@ struct _virDomain { virConnectPtr conn; /* pointer back to the connection */ char *name; /* the domain external name */ char *path; /* the domain internal path */ - int handle; /* internal handle for the domnain ID */ + int id; /* the domain ID */ int flags; /* extra flags */ unsigned char uuid[16]; /* the domain unique identifier */ char *xml; /* the XML description for defined domains */ diff --git a/src/libvirt.c b/src/libvirt.c index 5f0489ad22..90b555affe 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -1223,7 +1223,7 @@ virDomainGetUUID(virDomainPtr domain, unsigned char *uuid) return (-1); } - if (domain->handle == 0) { + if (domain->id == 0) { memset(uuid, 0, 16); } else { if ((domain->uuid[0] == 0) && (domain->uuid[1] == 0) && @@ -1292,7 +1292,7 @@ virDomainGetID(virDomainPtr domain) virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__); return ((unsigned int) -1); } - return (domain->handle); + return (domain->id); } /** diff --git a/src/proxy_internal.c b/src/proxy_internal.c index 4f6a87cf51..bfa6de2c96 100644 --- a/src/proxy_internal.c +++ b/src/proxy_internal.c @@ -694,9 +694,9 @@ xenProxyDomainGetMaxMemory(virDomainPtr domain) virProxyError(domain->conn, VIR_ERR_INVALID_DOMAIN, __FUNCTION__); return (0); } - if (domain->handle < 0) + if (domain->id < 0) return (0); - return(xenProxyDomainGetDomMaxMemory(domain->conn, domain->handle)); + return(xenProxyDomainGetDomMaxMemory(domain->conn, domain->id)); } /** @@ -723,7 +723,7 @@ xenProxyDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info) virProxyError(domain->conn, VIR_ERR_INVALID_DOMAIN, __FUNCTION__); return (-1); } - if (domain->handle < 0) + if (domain->id < 0) return (-1); if (info == NULL) { virProxyError(domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__); @@ -731,7 +731,7 @@ xenProxyDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info) } memset(&req, 0, sizeof(req)); req.command = VIR_PROXY_DOMAIN_INFO; - req.data.arg = domain->handle; + req.data.arg = domain->id; req.len = sizeof(req); ret = xenProxyCommand(domain->conn, &req, &ans, 0); if (ret < 0) { @@ -793,7 +793,7 @@ xenProxyLookupByID(virConnectPtr conn, int id) if (res == NULL) virProxyError(conn, VIR_ERR_NO_MEMORY, _("allocating domain")); else - res->handle = id; + res->id = id; return(res); } @@ -840,7 +840,7 @@ xenProxyLookupByUUID(virConnectPtr conn, const unsigned char *uuid) if (res == NULL) virProxyError(conn, VIR_ERR_NO_MEMORY, _("allocating domain")); else - res->handle = req.data.arg; + res->id = req.data.arg; return(res); } @@ -891,7 +891,7 @@ xenProxyDomainLookupByName(virConnectPtr conn, const char *name) if (res == NULL) virProxyError(conn, VIR_ERR_NO_MEMORY, _("allocating domain")); else - res->handle = req.data.arg; + res->id = req.data.arg; return(res); } @@ -963,11 +963,11 @@ xenProxyDomainDumpXML(virDomainPtr domain, int flags ATTRIBUTE_UNUSED) virProxyError(domain->conn, VIR_ERR_INVALID_DOMAIN, __FUNCTION__); return (NULL); } - if (domain->handle < 0) + if (domain->id < 0) return (NULL); memset(&req, 0, sizeof(req)); req.command = VIR_PROXY_DOMAIN_XML; - req.data.arg = domain->handle; + req.data.arg = domain->id; req.len = sizeof(req); ret = xenProxyCommand(domain->conn, &req, &ans, 0); if (ret < 0) { @@ -1016,7 +1016,7 @@ xenProxyDomainGetOSType(virDomainPtr domain) } memset(&req, 0, sizeof(req)); req.command = VIR_PROXY_DOMAIN_OSTYPE; - req.data.arg = domain->handle; + req.data.arg = domain->id; req.len = sizeof(req); ret = xenProxyCommand(domain->conn, &req, &ans, 0); if (ret < 0) { diff --git a/src/test.c b/src/test.c index 1745c1495f..9177697873 100644 --- a/src/test.c +++ b/src/test.c @@ -137,7 +137,7 @@ typedef struct _testDev { typedef struct _testDom { int active; - int handle; + int id; char name[20]; unsigned char uuid[16]; virDomainKernel kernel; @@ -389,7 +389,7 @@ static int testLoadDomain(virConnectPtr conn, return (-1); con->domains[handle].active = 1; - con->domains[handle].handle = domid; + con->domains[handle].id = domid; strncpy(con->domains[handle].name, name, sizeof(con->domains[handle].name)); free(name); name = NULL; @@ -482,7 +482,7 @@ static int testOpenDefault(virConnectPtr conn, node->connections[connid].numDomains = 1; node->connections[connid].domains[0].active = 1; - node->connections[connid].domains[0].handle = nextDomID++; + node->connections[connid].domains[0].id = nextDomID++; node->connections[connid].domains[0].onReboot = VIR_DOMAIN_RESTART; node->connections[connid].domains[0].onCrash = VIR_DOMAIN_RESTART; node->connections[connid].domains[0].onPoweroff = VIR_DOMAIN_DESTROY; @@ -725,8 +725,8 @@ static int getDomainIndex(virDomainPtr domain) { testCon *con; con = &node->connections[domain->conn->handle]; for (i = 0 ; i < MAX_DOMAINS ; i++) { - if (domain->handle >= 0) { - if (domain->handle == con->domains[i].handle) + if (domain->id >= 0) { + if (domain->id == con->domains[i].id) return (i); } else { if (!strcmp(domain->name, con->domains[i].name)) @@ -850,7 +850,7 @@ testDomainCreateLinux(virConnectPtr conn, const char *xmlDesc, if (testLoadDomainFromDoc(conn, domid, xmlDesc) < 0) return (NULL); for (i = 0 ; i < MAX_DOMAINS ; i++) { - if (con->domains[i].handle == domid) { + if (con->domains[i].id == domid) { handle = i; break; } @@ -874,7 +874,7 @@ virDomainPtr testLookupDomainByID(virConnectPtr conn, for (i = 0 ; i < MAX_DOMAINS ; i++) { if (con->domains[i].active && - con->domains[i].handle == id) { + con->domains[i].id == id) { idx = i; break; } @@ -889,7 +889,7 @@ virDomainPtr testLookupDomainByID(virConnectPtr conn, testError(conn, NULL, VIR_ERR_NO_MEMORY, _("allocating domain")); return(NULL); } - dom->handle = id; + dom->id = id; return (dom); } @@ -912,7 +912,7 @@ virDomainPtr testLookupDomainByUUID(virConnectPtr conn, testError(conn, NULL, VIR_ERR_NO_MEMORY, _("allocating domain")); return(NULL); } - dom->handle = con->domains[idx].handle; + dom->id = con->domains[idx].id; } return (dom); } @@ -936,7 +936,7 @@ virDomainPtr testLookupDomainByName(virConnectPtr conn, testError(conn, NULL, VIR_ERR_NO_MEMORY, _("allocating domain")); return(NULL); } - dom->handle = con->domains[idx].handle; + dom->id = con->domains[idx].id; } return (dom); } @@ -951,7 +951,7 @@ int testListDomains (virConnectPtr conn, for (i = 0, n = 0 ; i < MAX_DOMAINS && n < maxids ; i++) { if (con->domains[i].active && con->domains[i].info.state != VIR_DOMAIN_SHUTOFF) { - ids[n++] = con->domains[i].handle; + ids[n++] = con->domains[i].id; } } return (n); @@ -1045,8 +1045,8 @@ int testShutdownDomain (virDomainPtr domain) } con->domains[domidx].info.state = VIR_DOMAIN_SHUTOFF; - domain->handle = -1; - con->domains[domidx].handle = -1; + domain->id = -1; + con->domains[domidx].id = -1; return (0); } @@ -1100,8 +1100,8 @@ int testRebootDomain (virDomainPtr domain, virDomainRestart action) con->domains[domidx].info.state = VIR_DOMAIN_SHUTOFF; break; } - domain->handle = -1; - con->domains[domidx].handle = -1; + domain->id = -1; + con->domains[domidx].id = -1; return (0); } @@ -1250,7 +1250,7 @@ char * testDomainDumpXML(virDomainPtr domain, int flags ATTRIBUTE_UNUSED) return (NULL); } - virBufferVSprintf(buf, "\n", domain->handle); + virBufferVSprintf(buf, "\n", domain->id); virBufferVSprintf(buf, " %s\n", domain->name); uuid = domain->uuid; virBufferVSprintf(buf, @@ -1344,7 +1344,7 @@ int testDomainCreate(virDomainPtr domain) { return (-1); } - domain->handle = con->domains[domidx].handle = nextDomID++; + domain->id = con->domains[domidx].id = nextDomID++; con->domains[domidx].info.state = VIR_DOMAIN_RUNNING; return (0); diff --git a/src/xen_internal.c b/src/xen_internal.c index 8e374bb6d1..cd11bcd5c2 100644 --- a/src/xen_internal.c +++ b/src/xen_internal.c @@ -1496,10 +1496,10 @@ static unsigned long xenHypervisorGetMaxMemory(virDomainPtr domain) { if ((domain == NULL) || (domain->conn == NULL) || - (domain->conn->handle < 0) || (domain->handle < 0)) + (domain->conn->handle < 0) || (domain->id < 0)) return (0); - return(xenHypervisorGetDomMaxMemory(domain->conn, domain->handle)); + return(xenHypervisorGetDomMaxMemory(domain->conn, domain->id)); } #endif @@ -1593,10 +1593,10 @@ xenHypervisorGetDomainInfo(virDomainPtr domain, virDomainInfoPtr info) { if ((domain == NULL) || (domain->conn == NULL) || (domain->conn->handle < 0) || (info == NULL) || - (domain->handle < 0)) + (domain->id < 0)) return (-1); - return(xenHypervisorGetDomInfo(domain->conn, domain->handle, info)); + return(xenHypervisorGetDomInfo(domain->conn, domain->id, info)); } @@ -1615,10 +1615,10 @@ xenHypervisorPauseDomain(virDomainPtr domain) int ret; if ((domain == NULL) || (domain->conn == NULL) || - (domain->conn->handle < 0) || (domain->handle < 0)) + (domain->conn->handle < 0) || (domain->id < 0)) return (-1); - ret = virXen_pausedomain(domain->conn->handle, domain->handle); + ret = virXen_pausedomain(domain->conn->handle, domain->id); if (ret < 0) return (-1); return (0); @@ -1638,10 +1638,10 @@ xenHypervisorResumeDomain(virDomainPtr domain) int ret; if ((domain == NULL) || (domain->conn == NULL) || - (domain->conn->handle < 0) || (domain->handle < 0)) + (domain->conn->handle < 0) || (domain->id < 0)) return (-1); - ret = virXen_unpausedomain(domain->conn->handle, domain->handle); + ret = virXen_unpausedomain(domain->conn->handle, domain->id); if (ret < 0) return (-1); return (0); @@ -1661,10 +1661,10 @@ xenHypervisorDestroyDomain(virDomainPtr domain) int ret; if ((domain == NULL) || (domain->conn == NULL) || - (domain->conn->handle < 0) || (domain->handle < 0)) + (domain->conn->handle < 0) || (domain->id < 0)) return (-1); - ret = virXen_destroydomain(domain->conn->handle, domain->handle); + ret = virXen_destroydomain(domain->conn->handle, domain->id); if (ret < 0) return (-1); return (0); @@ -1685,10 +1685,10 @@ xenHypervisorSetMaxMemory(virDomainPtr domain, unsigned long memory) int ret; if ((domain == NULL) || (domain->conn == NULL) || - (domain->conn->handle < 0) || (domain->handle < 0)) + (domain->conn->handle < 0) || (domain->id < 0)) return (-1); - ret = virXen_setmaxmem(domain->conn->handle, domain->handle, memory); + ret = virXen_setmaxmem(domain->conn->handle, domain->id, memory); if (ret < 0) return (-1); return (0); @@ -1712,11 +1712,11 @@ xenHypervisorSetVcpus(virDomainPtr domain, unsigned int nvcpus) int ret; if ((domain == NULL) || (domain->conn == NULL) || - (domain->conn->handle < 0) || (domain->handle < 0) || + (domain->conn->handle < 0) || (domain->id < 0) || (nvcpus < 1)) return (-1); - ret = virXen_setmaxvcpus(domain->conn->handle, domain->handle, nvcpus); + ret = virXen_setmaxvcpus(domain->conn->handle, domain->id, nvcpus); if (ret < 0) return (-1); return (0); @@ -1741,11 +1741,11 @@ xenHypervisorPinVcpu(virDomainPtr domain, unsigned int vcpu, int ret; if ((domain == NULL) || (domain->conn == NULL) || - (domain->conn->handle < 0) || (domain->handle < 0) || + (domain->conn->handle < 0) || (domain->id < 0) || (cpumap == NULL) || (maplen < 1)) return (-1); - ret = virXen_setvcpumap(domain->conn->handle, domain->handle, vcpu, + ret = virXen_setvcpumap(domain->conn->handle, domain->id, vcpu, cpumap, maplen); if (ret < 0) return (-1); @@ -1784,7 +1784,7 @@ xenHypervisorGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo, int nbinfo, i; if ((domain == NULL) || (domain->conn == NULL) || - (domain->conn->handle < 0) || (domain->handle < 0) || + (domain->conn->handle < 0) || (domain->id < 0) || (info == NULL) || (maxinfo < 1) || (sizeof(cpumap_t) & 7)) return (-1); @@ -1793,10 +1793,10 @@ xenHypervisorGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo, /* first get the number of virtual CPUs in this domain */ XEN_GETDOMAININFO_CLEAR(dominfo); - ret = virXen_getdomaininfo(domain->conn->handle, domain->handle, + ret = virXen_getdomaininfo(domain->conn->handle, domain->id, &dominfo); - if ((ret < 0) || (XEN_GETDOMAININFO_DOMAIN(dominfo) != domain->handle)) + if ((ret < 0) || (XEN_GETDOMAININFO_DOMAIN(dominfo) != domain->id)) return (-1); nbinfo = XEN_GETDOMAININFO_CPUCOUNT(dominfo) + 1; if (nbinfo > maxinfo) nbinfo = maxinfo; @@ -1806,14 +1806,14 @@ xenHypervisorGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo, for (i = 0, ipt = info; i < nbinfo; i++, ipt++) { if ((cpumaps != NULL) && (i < maxinfo)) { - ret = virXen_getvcpusinfo(domain->conn->handle, domain->handle, i, + ret = virXen_getvcpusinfo(domain->conn->handle, domain->id, i, ipt, (unsigned char *)VIR_GET_CPUMAP(cpumaps, maplen, i), maplen); if (ret < 0) return(-1); } else { - ret = virXen_getvcpusinfo(domain->conn->handle, domain->handle, i, + ret = virXen_getvcpusinfo(domain->conn->handle, domain->id, i, ipt, NULL, 0); if (ret < 0) return(-1); diff --git a/src/xend_internal.c b/src/xend_internal.c index cc05faa8bc..c80cdbb4cd 100644 --- a/src/xend_internal.c +++ b/src/xend_internal.c @@ -1877,7 +1877,7 @@ sexpr_to_xend_domain_info(virDomainPtr domain, struct sexpr *root, virDomainInfo } else { /* Inactive domains don't have a state reported, so mark them SHUTOFF, rather than NOSTATE */ - if (domain->handle < 0) + if (domain->id < 0) info->state = VIR_DOMAIN_SHUTOFF; else info->state = VIR_DOMAIN_NOSTATE; @@ -1966,9 +1966,9 @@ sexpr_to_domain(virConnectPtr conn, struct sexpr *root) goto error; if (tmp) - ret->handle = sexpr_int(root, "domain/domid"); + ret->id = sexpr_int(root, "domain/domid"); else - ret->handle = -1; /* An inactive domain */ + ret->id = -1; /* An inactive domain */ return (ret); @@ -2124,7 +2124,7 @@ xenDaemonDomainSuspend(virDomainPtr domain) __FUNCTION__); return(-1); } - if (domain->handle < 0) + if (domain->id < 0) return(-1); return xend_op(domain->conn, domain->name, "op", "pause", NULL); } @@ -2146,7 +2146,7 @@ xenDaemonDomainResume(virDomainPtr domain) __FUNCTION__); return(-1); } - if (domain->handle < 0) + if (domain->id < 0) return(-1); return xend_op(domain->conn, domain->name, "op", "unpause", NULL); } @@ -2169,7 +2169,7 @@ xenDaemonDomainShutdown(virDomainPtr domain) __FUNCTION__); return(-1); } - if (domain->handle < 0) + if (domain->id < 0) return(-1); return xend_op(domain->conn, domain->name, "op", "shutdown", "reason", "halt", NULL); } @@ -2193,7 +2193,7 @@ xenDaemonDomainReboot(virDomainPtr domain, unsigned int flags ATTRIBUTE_UNUSED) __FUNCTION__); return(-1); } - if (domain->handle < 0) + if (domain->id < 0) return(-1); return xend_op(domain->conn, domain->name, "op", "shutdown", "reason", "reboot", NULL); } @@ -2219,7 +2219,7 @@ xenDaemonDomainDestroy(virDomainPtr domain) __FUNCTION__); return(-1); } - if (domain->handle < 0) + if (domain->id < 0) return(-1); return xend_op(domain->conn, domain->name, "op", "destroy", NULL); } @@ -2246,7 +2246,7 @@ xenDaemonDomainSave(virDomainPtr domain, const char *filename) __FUNCTION__); return(-1); } - if (domain->handle < 0) + if (domain->id < 0) return(-1); return xend_op(domain->conn, domain->name, "op", "save", "file", filename, NULL); } @@ -2273,7 +2273,7 @@ xenDaemonDomainCoreDump(virDomainPtr domain, const char *filename, __FUNCTION__); return(-1); } - if (domain->handle < 0) + if (domain->id < 0) return(-1); return xend_op(domain->conn, domain->name, "op", "dump", "file", filename, "live", "1", "crash", "0", NULL); @@ -2321,7 +2321,7 @@ xenDaemonDomainGetMaxMemory(virDomainPtr domain) __FUNCTION__); return(-1); } - if (domain->handle < 0 && domain->conn->xendConfigVersion < 3) + if (domain->id < 0 && domain->conn->xendConfigVersion < 3) return(-1); /* can we ask for a subset ? worth it ? */ @@ -2357,7 +2357,7 @@ xenDaemonDomainSetMaxMemory(virDomainPtr domain, unsigned long memory) __FUNCTION__); return(-1); } - if (domain->handle < 0 && domain->conn->xendConfigVersion < 3) + if (domain->id < 0 && domain->conn->xendConfigVersion < 3) return(-1); snprintf(buf, sizeof(buf), "%lu", memory >> 10); @@ -2391,7 +2391,7 @@ xenDaemonDomainSetMemory(virDomainPtr domain, unsigned long memory) __FUNCTION__); return(-1); } - if (domain->handle < 0 && domain->conn->xendConfigVersion < 3) + if (domain->id < 0 && domain->conn->xendConfigVersion < 3) return(-1); snprintf(buf, sizeof(buf), "%lu", memory >> 10); @@ -2455,12 +2455,12 @@ xenDaemonDomainDumpXML(virDomainPtr domain, int flags ATTRIBUTE_UNUSED) __FUNCTION__); return(NULL); } - if (domain->handle < 0 && domain->conn->xendConfigVersion < 3) + if (domain->id < 0 && domain->conn->xendConfigVersion < 3) return(NULL); - if (domain->handle < 0) + if (domain->id < 0) return xenDaemonDomainDumpXMLByName(domain->conn, domain->name); else - return xenDaemonDomainDumpXMLByID(domain->conn, domain->handle); + return xenDaemonDomainDumpXMLByID(domain->conn, domain->id); } #endif /* !PROXY */ @@ -2486,7 +2486,7 @@ xenDaemonDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info) __FUNCTION__); return(-1); } - if (domain->handle < 0 && domain->conn->xendConfigVersion < 3) + if (domain->id < 0 && domain->conn->xendConfigVersion < 3) return(-1); root = sexpr_get(domain->conn, "/xend/domain/%s?detail=1", domain->name); @@ -2740,7 +2740,7 @@ xenDaemonLookupByID(virConnectPtr conn, int id) { virXendError(conn, VIR_ERR_NO_MEMORY, _("allocating domain")); goto error; } - ret->handle = id; + ret->id = id; free(name); return (ret); @@ -2770,7 +2770,7 @@ xenDaemonDomainSetVcpus(virDomainPtr domain, unsigned int vcpus) __FUNCTION__); return (-1); } - if (domain->handle < 0 && domain->conn->xendConfigVersion < 3) + if (domain->id < 0 && domain->conn->xendConfigVersion < 3) return(-1); snprintf(buf, sizeof(buf), "%d", vcpus); @@ -2802,7 +2802,7 @@ xenDaemonDomainPinVcpu(virDomainPtr domain, unsigned int vcpu, __FUNCTION__); return (-1); } - if (domain->handle < 0) + if (domain->id < 0) return(-1); /* from bit map, build character string of mapped CPU numbers */ @@ -2857,7 +2857,7 @@ xenDaemonDomainGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo, __FUNCTION__); return (-1); } - if (domain->handle < 0) + if (domain->id < 0) return(-1); root = sexpr_get(domain->conn, "/xend/domain/%s?op=vcpuinfo", domain->name); @@ -2959,7 +2959,7 @@ xenDaemonLookupByUUID(virConnectPtr conn, const unsigned char *uuid) virXendError(conn, VIR_ERR_NO_MEMORY, _("allocating domain")); goto error; } - ret->handle = id; + ret->id = id; if (name != NULL) free(name); return (ret); diff --git a/src/xm_internal.c b/src/xm_internal.c index 54db533b46..daf3ebaf4a 100644 --- a/src/xm_internal.c +++ b/src/xm_internal.c @@ -523,7 +523,7 @@ int xenXMDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info) { return(-1); } - if (domain->handle != -1) + if (domain->id != -1) return (-1); if (!(filename = virHashLookup(nameConfigMap, domain->name))) @@ -991,7 +991,7 @@ char *xenXMDomainDumpXML(virDomainPtr domain, int flags ATTRIBUTE_UNUSED) { __FUNCTION__); return(NULL); } - if (domain->handle != -1) + if (domain->id != -1) return (NULL); if (!(filename = virHashLookup(nameConfigMap, domain->name))) @@ -1019,7 +1019,7 @@ int xenXMDomainSetMemory(virDomainPtr domain, unsigned long memory) { } if (domain->conn->flags & VIR_CONNECT_RO) return (-1); - if (domain->handle != -1) + if (domain->id != -1) return (-1); if (!(filename = virHashLookup(nameConfigMap, domain->name))) @@ -1061,7 +1061,7 @@ int xenXMDomainSetMaxMemory(virDomainPtr domain, unsigned long memory) { } if (domain->conn->flags & VIR_CONNECT_RO) return (-1); - if (domain->handle != -1) + if (domain->id != -1) return (-1); if (!(filename = virHashLookup(nameConfigMap, domain->name))) @@ -1101,7 +1101,7 @@ unsigned long xenXMDomainGetMaxMemory(virDomainPtr domain) { __FUNCTION__); return (-1); } - if (domain->handle != -1) + if (domain->id != -1) return (-1); if (!(filename = virHashLookup(nameConfigMap, domain->name))) @@ -1134,7 +1134,7 @@ int xenXMDomainSetVcpus(virDomainPtr domain, unsigned int vcpus) { } if (domain->conn->flags & VIR_CONNECT_RO) return (-1); - if (domain->handle != -1) + if (domain->id != -1) return (-1); if (!(filename = virHashLookup(nameConfigMap, domain->name))) @@ -1199,7 +1199,7 @@ virDomainPtr xenXMDomainLookupByName(virConnectPtr conn, const char *domname) { /* Ensure its marked inactive, because may be cached handle to a previously active domain */ - ret->handle = -1; + ret->id = -1; return (ret); } @@ -1258,7 +1258,7 @@ virDomainPtr xenXMDomainLookupByUUID(virConnectPtr conn, /* Ensure its marked inactive, because may be cached handle to a previously active domain */ - ret->handle = -1; + ret->id = -1; return (ret); } @@ -1279,7 +1279,7 @@ int xenXMDomainCreate(virDomainPtr domain) { return (-1); } - if (domain->handle != -1) + if (domain->id != -1) return (-1); if (domain->conn->flags & VIR_CONNECT_RO) return (-1); @@ -1309,13 +1309,13 @@ int xenXMDomainCreate(virDomainPtr domain) { if ((ret = xenDaemonDomainLookupByName_ids(domain->conn, domain->name, uuid)) < 0) { return (-1); } - domain->handle = ret; + domain->id = ret; ret = xenDaemonDomainResume(domain); if (ret != 0) { fprintf(stderr, "Failed to resume new domain %s\n", domain->name); xenDaemonDomainDestroy(domain); - domain->handle = -1; + domain->id = -1; return (-1); } @@ -2128,7 +2128,7 @@ virDomainPtr xenXMDomainDefineXML(virConnectPtr conn, const char *xml) { if (!(ret = virGetDomain(conn, value->str, uuid))) goto error; - ret->handle = -1; + ret->id = -1; return (ret); @@ -2152,7 +2152,7 @@ int xenXMDomainUndefine(virDomainPtr domain) { return (-1); } - if (domain->handle != -1) + if (domain->id != -1) return (-1); if (domain->conn->flags & VIR_CONNECT_RO) return (-1); diff --git a/src/xml.c b/src/xml.c index 6c7e22c60f..cd3faee62a 100644 --- a/src/xml.c +++ b/src/xml.c @@ -236,7 +236,7 @@ virDomainGetXMLDeviceInfo(virDomainPtr domain, const char *sub, unsigned int len = 0; snprintf(s, 255, "/local/domain/0/backend/%s/%d/%ld/%s", - sub, domain->handle, dev, name); + sub, domain->id, dev, name); s[255] = 0; return xs_read(domain->conn->xshandle, 0, &s[0], &len); @@ -1693,7 +1693,7 @@ virDomainXMLDevID(virDomainPtr domain, char *xmldesc, char *class, char *ref) if (attr == NULL) goto error; - xref = xenStoreDomainGetNetworkID(domain->conn, domain->handle, + xref = xenStoreDomainGetNetworkID(domain->conn, domain->id, (char *) attr); if (xref != NULL) { strcpy(ref, xref); diff --git a/src/xs_internal.c b/src/xs_internal.c index 0bf83ba241..6e63a2b8b2 100644 --- a/src/xs_internal.c +++ b/src/xs_internal.c @@ -189,7 +189,7 @@ virDomainDoStoreWrite(virDomainPtr domain, const char *path, if (domain->conn->flags & VIR_CONNECT_RO) return (-1); - snprintf(s, 255, "/local/domain/%d/%s", domain->handle, path); + snprintf(s, 255, "/local/domain/%d/%s", domain->id, path); s[255] = 0; if (xs_write(domain->conn->xshandle, 0, &s[0], value, strlen(value))) @@ -271,7 +271,7 @@ virDomainGetVMInfo(virDomainPtr domain, const char *vm, const char *name) static int virConnectCheckStoreID(virConnectPtr conn, int id) { - if (conn->handle >= 0) { + if (conn->id >= 0) { int tmp; tmp = xenHypervisorCheckID(conn, id); @@ -371,10 +371,10 @@ xenStoreGetDomainInfo(virDomainPtr domain, virDomainInfoPtr info) } if (domain->conn->xshandle == NULL) return(-1); - if (domain->handle == -1) + if (domain->id == -1) return(-1); - tmp = virDomainDoStoreQuery(domain->conn, domain->handle, "running"); + tmp = virDomainDoStoreQuery(domain->conn, domain->id, "running"); if (tmp != NULL) { if (tmp[0] == '1') info->state = VIR_DOMAIN_RUNNING; @@ -382,7 +382,7 @@ xenStoreGetDomainInfo(virDomainPtr domain, virDomainInfoPtr info) } else { info->state = VIR_DOMAIN_NONE; } - tmp = virDomainDoStoreQuery(domain->conn, domain->handle, "memory/target"); + tmp = virDomainDoStoreQuery(domain->conn, domain->id, "memory/target"); if (tmp != NULL) { info->memory = atol(tmp); info->maxMem = atol(tmp); @@ -393,7 +393,7 @@ xenStoreGetDomainInfo(virDomainPtr domain, virDomainInfoPtr info) } #if 0 /* doesn't seems to work */ - tmp = virDomainDoStoreQuery(domain->conn, domain->handle, "cpu_time"); + tmp = virDomainDoStoreQuery(domain->conn, domain->id, "cpu_time"); if (tmp != NULL) { info->cpuTime = atol(tmp); free(tmp); @@ -401,7 +401,7 @@ xenStoreGetDomainInfo(virDomainPtr domain, virDomainInfoPtr info) info->cpuTime = 0; } #endif - snprintf(request, 199, "/local/domain/%d/cpu", domain->handle); + snprintf(request, 199, "/local/domain/%d/cpu", domain->id); request[199] = 0; tmp2 = virConnectDoStoreList(domain->conn, request, &nb_vcpus); if (tmp2 != NULL) { @@ -431,7 +431,7 @@ xenStoreDomainSetMemory(virDomainPtr domain, unsigned long memory) __FUNCTION__); return(-1); } - if (domain->handle == -1) + if (domain->id == -1) return(-1); snprintf(value, 19, "%lu", memory); value[19] = 0; @@ -457,10 +457,10 @@ xenStoreDomainGetMaxMemory(virDomainPtr domain) if (!VIR_IS_CONNECTED_DOMAIN(domain)) return (ret); - if (domain->handle == -1) + if (domain->id == -1) return(-1); - tmp = virDomainDoStoreQuery(domain->conn, domain->handle, "memory/target"); + tmp = virDomainDoStoreQuery(domain->conn, domain->id, "memory/target"); if (tmp != NULL) { ret = (unsigned long) atol(tmp); free(tmp); @@ -601,7 +601,7 @@ xenStoreDomainLookupByName(virConnectPtr conn, const char *name) free(path); goto done; } - ret->handle = id; + ret->id = id; ret->path = path; done: @@ -631,7 +631,7 @@ xenStoreDomainShutdown(virDomainPtr domain) __FUNCTION__); return(-1); } - if (domain->handle == -1) + if (domain->id == -1) return(-1); /* * this is very hackish, the domU kernel probes for a special @@ -659,7 +659,7 @@ xenStoreDomainReboot(virDomainPtr domain, unsigned int flags ATTRIBUTE_UNUSED) __FUNCTION__); return(-1); } - if (domain->handle == -1) + if (domain->id == -1) return(-1); /* * this is very hackish, the domU kernel probes for a special -- GitLab