diff --git a/ChangeLog b/ChangeLog index 00a140c75f44d34642d1571cae02700c9c4caa90..fa6b5b347e6b51edd06ddf096c45955e75f2a689 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 783a492661d3dc3de89616bd10e486dbd6f353fe..eb2dd3e4e406237345e6ad6dba106120157545ca 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 972f500b8da82c21608a6f9267ec44fd98fc2d3e..4385fb586c263f76a2d1128049873e544a8834d1 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 0000000000000000000000000000000000000000..989a1aeaec58de18829c7c7e0e5f52edc4093bf0 --- /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 0000000000000000000000000000000000000000..65d29589d392baa8c2ecd7c8ed4bd3e21bc6fec9 --- /dev/null +++ b/docs/libvir-refs.xml @@ -0,0 +1,959 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/include/libvir.h b/include/libvir.h index ed8a738d94b8a9592f01b7d28b310590b7c76b3b..6707f8ff972253a071f0393c335b6db7b5d2f4c5 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 27265c8c6a1735f78ed5893545109db0ba9ed736..fb711c4a56b917671e200aab9e99d9a26e66c172 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 f1d17553f280582cb61a63e4e3de39462d21ed2c..349662c4799bb9fa999b0034e0ee8d65bedbf921 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); }