From 7ad55373678e0ff33e42c3642c05d236f96f62a8 Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Tue, 6 Dec 2005 16:50:31 +0000 Subject: [PATCH] * docs/Makefile.am docs/apibuild.py docs/libvir-api.xml docs/libvir-refs.xml: fix XML API generation * include/libvir.h src/libvir.c src/virsh.c: fix the info memory API again, use KB, not bytes so that an unsigned long is sufficient. Daniel --- ChangeLog | 7 + docs/Makefile.am | 2 +- docs/apibuild.py | 26 +- docs/libvir-api.xml | 175 ++++++++ docs/libvir-refs.xml | 959 +++++++++++++++++++++++++++++++++++++++++++ include/libvir.h | 4 +- src/libvir.c | 8 +- src/virsh.c | 4 +- 8 files changed, 1175 insertions(+), 10 deletions(-) create mode 100644 docs/libvir-api.xml create mode 100644 docs/libvir-refs.xml diff --git a/ChangeLog b/ChangeLog index 00a140c75f..fa6b5b347e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Tue Dec 6 17:47:11 CET 2005 Daniel Veillard + + * docs/Makefile.am docs/apibuild.py docs/libvir-api.xml + docs/libvir-refs.xml: fix XML API generation + * include/libvir.h src/libvir.c src/virsh.c: fix the info memory + API again, use KB, not bytes so that an unsigned long is sufficient. + Tue Dec 6 17:12:52 CET 2005 Daniel Veillard * include/libvir.h src/libvir.c src/virsh.c: adding the extraction diff --git a/docs/Makefile.am b/docs/Makefile.am index 783a492661..eb2dd3e4e4 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -8,7 +8,7 @@ PAGES= # index.html APIPAGES=APIconstructors.html APIfiles.html APIfunctions.html \ APIsymbols.html APIchunk0.html EXTRA_DIST= \ - libvir-api.xml apibuild.py + libvir-api.xml libxen-refs.xml apibuild.py man_MANS= diff --git a/docs/apibuild.py b/docs/apibuild.py index 972f500b8d..4385fb586c 100755 --- a/docs/apibuild.py +++ b/docs/apibuild.py @@ -963,6 +963,9 @@ class CParser: # preprocessor and comments since they are logically not part of # the program structure. # + def push(self, tok): + self.lexer.push(tok) + def token(self): global ignored_words @@ -1228,7 +1231,28 @@ class CParser: self.type = self.type + " " + token[1] token = self.token() - if token[0] == "name" and (token[1] == "long" or token[1] == "short"): + if token[0] == "name" and token[1] == "long": + if self.type == "": + self.type = token[1] + else: + self.type = self.type + " " + token[1] + + # some read ahead for long long + oldtmp = token + token = self.token() + if token[0] == "name" and token[1] == "long": + self.type = self.type + " " + token[1] + else: + self.push(token) + token = oldtmp + + if token[0] == "name" and token[1] == "int": + if self.type == "": + self.type = tmp[1] + else: + self.type = self.type + " " + tmp[1] + + elif token[0] == "name" and token[1] == "short": if self.type == "": self.type = token[1] else: diff --git a/docs/libvir-api.xml b/docs/libvir-api.xml new file mode 100644 index 0000000000..989a1aeaec --- /dev/null +++ b/docs/libvir-api.xml @@ -0,0 +1,175 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Macro to flag conciously unused parameters to functions + + + macro to flag unimplemented blocks + + + + + + + + + + + a virConnectPtr is pointer to a virConnect private structure, this is the type used to reference a connection to the Xen Hypervisor in the API. + + + + + + + + + + + + a virDomainInfoPtr is a pointer to a virDomainInfo structure. + + + a virDomainPtr is pointer to a virDomain private structure, this is the type used to reference a Xen domain in the API. + + + + This function closes the connection to the Hypervisor. This should not be called if further interaction with the Hypervisor are needed especially if there is running domain which need further monitoring by the application. + + + + + Get the version level of the Hypervisor running. + + + + + Collect the list of active domains, and store their ID in @maxids + + + + + + + This function should be called first to get a connection to the Hypervisor and xen store + + + + + This function should be called first to get a read-only connection to the xen store. The set of APIs usable are then restricted. + + + + + Launch a new Linux guest domain + + + + + + + + + + Destroy the domain object. The running instance is shutdown if not down already and all resources used by it are given back to the hypervisor. + + + + + Get the hypervisor ID number for the domain + + + + + Extract information about a domain. Note that if the connection used to get the domain is limited only a partial set of the informations can be extracted. + + + + + + Retrieve the maximum amount of physical memory allocated to a domain. If domain is NULL, then this get the amount of memory reserved to Domain0 i.e. the domain where the application runs. + + + + + Get the public name for that domain + + + + + Try to find a domain based on the hypervisor ID number + + + + + + Try to lookup a domain on the given hypervisor + + + + + + Resume an suspended domain, the process is restarted from the state where it was frozen by calling virSuspendDomain(). + + + + + Dynamically change the maximum amount of physical memory allocated to a domain. If domain is NULL, then this change the amount of memory reserved to Domain0 i.e. the domain where the application runs. + + + + + + Suspends an active domain, the process is frozen without further access to CPU resources and I/O but the memory used by the domain at the hypervisor level will stay allocated. Use virDomainResume() to reactivate the domain. + + + + + diff --git a/docs/libvir-refs.xml b/docs/libvir-refs.xml new file mode 100644 index 0000000000..65d29589d3 --- /dev/null +++ b/docs/libvir-refs.xml @@ -0,0 +1,959 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/include/libvir.h b/include/libvir.h index ed8a738d94..6707f8ff97 100644 --- a/include/libvir.h +++ b/include/libvir.h @@ -71,8 +71,8 @@ typedef struct _virDomainInfo virDomainInfo; struct _virDomainInfo { unsigned char state; /* the running state, one of virDomainFlags */ - unsigned long maxMem; /* the maximum memory in bytes allowed */ - unsigned long memory; /* the memory in bytes used by the domain */ + unsigned long maxMem; /* the maximum memory in KBytes allowed */ + unsigned long memory; /* the memory in KBytes used by the domain */ unsigned short nrVirtCpu; /* the number of virtual CPUs for the domain */ /* diff --git a/src/libvir.c b/src/libvir.c index 27265c8c6a..fb711c4a56 100644 --- a/src/libvir.c +++ b/src/libvir.c @@ -586,8 +586,8 @@ virDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info) { } tmp = virDomainDoStoreQuery(domain, "memory/target"); if (tmp != NULL) { - info->memory = atol(tmp) * 1024; - info->maxMem = atol(tmp) * 1024; + info->memory = atol(tmp); + info->maxMem = atol(tmp); free(tmp); } else { info->memory = 0; @@ -645,8 +645,8 @@ virDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info) { */ info->cpuTime = dominfo.cpu_time; - info->memory = dominfo.tot_pages * 4096; - info->maxMem = dominfo.max_pages * 4096; + info->memory = dominfo.tot_pages * 4; + info->maxMem = dominfo.max_pages * 4; info->nrVirtCpu = dominfo.nr_online_vcpus; } return(0); diff --git a/src/virsh.c b/src/virsh.c index f1d17553f2..349662c479 100644 --- a/src/virsh.c +++ b/src/virsh.c @@ -56,9 +56,9 @@ static void printDomain(virDomainPtr dom) { printf("%.1fs time, ", cpuUsed); } mem = info.memory; - mem /= 1024 * 1024; + mem /= 1024; maxMem = info.maxMem; - maxMem /= 1024 * 1024; + maxMem /= 1024; printf("%.0f MB mem used, %.0f MB max_mem\n", mem, maxMem); } -- GitLab