From 5486abfe4ede6a649561de2b6f829c2bba908f2c Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Fri, 25 Sep 2009 13:24:40 +0100 Subject: [PATCH] Fix API doc extractor to stop munging comment formatting The python method help docs are copied across from the C funtion comments, but in the process all line breaks and indentation was being lost. This made the resulting text and code examples completely unreadable. Both the API doc extractor and the python generator were destroying whitespace & this fixes them to preserve it exactly. * docs/apibuild.py: Preserve all whitespace when extracting function comments. Print function comment inside a 0 and lines[0] == '*': del lines[0] - desc = "" + desc = None while len(lines) > 0: l = lines[0] - while len(l) > 0 and l[0] == '*': - l = l[1:] - l = string.strip(l) - if len(l) >= 6 and l[0:6] == "return" or l[0:6] == "Return": - try: + i = 0 + # Remove all leading '*', followed by at most one ' ' character + # since we need to preserve correct identation of code examples + while i < len(l) and l[i] == '*': + i = i + 1 + if i > 0: + if i < len(l) and l[i] == ' ': + i = i + 1 + l = l[i:] + if len(l) >= 6 and l[0:7] == "returns" or l[0:7] == "Returns": + try: l = string.split(l, ' ', 1)[1] except: l = "" @@ -859,9 +865,14 @@ class CParser: retdesc = retdesc + " " + l del lines[0] else: - desc = desc + " " + l + if desc is not None: + desc = desc + "\n" + l + else: + desc = l del lines[0] + if desc is None: + desc = "" retdesc = string.strip(retdesc) desc = string.strip(desc) @@ -1716,7 +1727,7 @@ class docBuilder: try: (args, desc) = id.info if desc != None and desc != "": - output.write(" %s\n" % (escape(desc))) + output.write(" \n" % (desc)) self.indexString(name, desc) for arg in args: (name, desc) = arg @@ -1760,7 +1771,7 @@ class docBuilder: try: desc = id.extra if desc != None and desc != "": - output.write(">\n %s\n" % (escape(desc))) + output.write(">\n \n" % (desc)) output.write(" \n") else: output.write("/>\n") @@ -1796,7 +1807,7 @@ class docBuilder: output.write(" %s\n"% (apstr)); try: (ret, params, desc) = id.info - output.write(" %s\n" % (escape(desc))) + output.write(" \n" % (desc)) self.indexString(name, desc) if ret[0] != None: if ret[0] == "void": diff --git a/docs/libvirt-api.xml b/docs/libvirt-api.xml index 23c1423cd0..f5018b9d6c 100644 --- a/docs/libvirt-api.xml +++ b/docs/libvirt-api.xml @@ -490,63 +490,63 @@ - Macro providing the version of the library as version * 1,000,000 + minor * 1000 + micro + - This macro is to be used in conjunction with virDomainGetVcpus() and virDomainPinVcpu() APIs. VIR_COPY_CPUMAP macro extract the cpumap of the specified vcpu from cpumaps array and copy it into cpumap to be used later by virDomainPinVcpu() API. + - This macro is to be used in conjunction with virDomainPinVcpu() API. It returns the length (in bytes) required to store the complete CPU map between a single virtual & all physical CPUs of a domain. + - This macro is to be used in conjunction with virDomainGetVcpus() API. VIR_CPU_USABLE macro returns a non zero value (true) if the cpu is usable by the vcpu, and 0 otherwise. + - Macro providing the field length of virSchedParameter + - This macro is to be used in conjunction with virDomainGetVcpus() and virDomainPinVcpu() APIs. VIR_GET_CPUMAP macro returns a pointer to the cpumap of the specified vcpu from cpumaps array. + - This macro is to calculate the total number of CPUs supported but not necessary active in the host. + - Macro providing the maximum length of the virSecurityModel doi string. + - Macro providing the maximum length of the virSecurityLabel label string. Note that this value is based on that used by Labeled NFS. + - Macro providing the maximum length of the virSecurityModel model string. + - This macro is to be used in conjunction with virDomainPinVcpu() API. USE_CPU macro reset the bit (CPU not usable) of the related cpu in cpumap. + - This macro is to be used in conjunction with virDomainPinVcpu() API. USE_CPU macro set the bit (CPU usable) of the related cpu in cpumap. + - This macro provides the length of the buffer required for virDomainGetUUID() + - This macro provides the length of the buffer required for virDomainGetUUIDString() + @@ -738,11 +738,11 @@ - a virConnectPtr is pointer to a virConnect private structure, this is the type used to reference a connection to the Hypervisor in the API. + - A pointer to a virDomainBlockStats structure + @@ -767,10 +767,10 @@ - a virDomainInfoPtr is a pointer to a virDomainInfo structure. + - A pointer to a virDomainInterfaceStats structure + @@ -785,7 +785,7 @@ - a virDomainPtr is pointer to a virDomain private structure, this is the type used to reference a domain in the API. + @@ -813,15 +813,15 @@ see note above'/> - a virInterfacePtr is pointer to a virInterface private structure, this is the type used to reference a virtual interface in the API. + - a virNetworkPtr is pointer to a virNetwork private structure, this is the type used to reference a virtual network in the API. + - A virNodeDevicePtr is a pointer to a virNodeDevice structure. Get one via virNodeDeviceLookupByKey, virNodeDeviceLookupByName, or virNodeDeviceCreate. Be sure to Call virNodeDeviceFree when done using a virNodeDevicePtr obtained from any of the above functions to avoid leaking memory. + @@ -834,14 +834,14 @@ see note above'/> - a virNodeInfoPtr is a pointer to a virNodeInfo structure. + - a virSchedParameterPtr is a pointer to a virSchedParameter structure. + @@ -849,11 +849,11 @@ see note above'/> - a virSecurityLabelPtr is a pointer to a virSecurityLabel. + - a virSecurityModelPtr is a pointer to a virSecurityModel. + @@ -866,7 +866,7 @@ see note above'/> - a virStoragePoolPtr is pointer to a virStoragePool private structure, this is the type used to reference a storage pool in the API. + @@ -878,7 +878,7 @@ see note above'/> - a virStorageVolPtr is pointer to a virStorageVol private structure, this is the type used to reference a storage volume in the API. + @@ -891,42 +891,80 @@ see note above'/> - Copy the content of the last error caught on that connection This method is not protected against access from multiple threads. In a multi-threaded application, always use the global virGetLastError() API which is backed by thread local storage. If the connection object was discovered to be invalid by an API call, then the error will be reported against the global error object. Since 0.6.0, all errors reported in the per-connection object are also duplicated in the global error object. As such an application can always use virGetLastError(). This method remains for backwards compatability. One will need to free the result with virResetError() + - Provide a pointer to the last error caught on that connection This method is not protected against access from multiple threads. In a multi-threaded application, always use the global virGetLastError() API which is backed by thread local storage. If the connection object was discovered to be invalid by an API call, then the error will be reported against the global error object. Since 0.6.0, all errors reported in the per-connection object are also duplicated in the global error object. As such an application can always use virGetLastError(). This method remains for backwards compatability. + - The error object is kept in thread local storage, so separate threads can safely access this concurrently. Reset the last error caught on that connection + - Set a connection error handling function, if @handler is NULL it will reset to default which is to pass error back to the global library handler. + - + - 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. + - A callback function to be registered, and called when a domain event occurs + @@ -935,13 +973,20 @@ see note above'/> - Removes a Domain Event Callback. De-registering for a domain callback will disable delivery of this event type + - Adds a Domain Event Callback. Registering for a domain callback will enable delivery of the events The virDomainPtr object handle passed into the callback upon delivery of an event is only valid for the duration of execution of the callback. If the callback wishes to keep the domain object after the callback + @@ -949,7 +994,9 @@ see note above'/> - Reads native configuration data describing a domain, and generates libvirt domain XML. The format of the native data is hypervisor dependant. + @@ -957,7 +1004,9 @@ see note above'/> - Reads a domain XML configuration document, and generates generates a native configuration file describing the domain. The format of the native data is hypervisor dependant. + @@ -965,7 +1014,15 @@ see note above'/> - Talks to a storage backend and attempts to auto-discover the set of available storage pool sources. e.g. For iSCSI this would be a set of iSCSI targets. For NFS this would be a list of exported paths. The srcSpec (optional for some storage pool types, e.g. local ones) is an instance of the storage pool's source element specifying where to look for the pools. srcSpec is not required for some types (e.g., those querying local storage resources only) + @@ -973,185 +1030,256 @@ see note above'/> - Provides capabilities of the hypervisor / driver. + - This returns the system hostname on which the hypervisor is running (the result of the gethostname(2) system call). If we are connected to a remote system, then this returns the hostname of the remote system. + - Provides the maximum number of virtual CPUs supported for a guest VM of a specific type. The 'type' parameter here corresponds to the 'type' attribute in the <domain> element of the XML. + element of the XML.]]> - Get the name of the Hypervisor software used. + - This returns the URI (name) of the hypervisor connection. Normally this is the same as or similar to the string passed to the virConnectOpen/virConnectOpenReadOnly call, but the driver may make the URI canonical. If name == NULL was passed to virConnectOpen, then the driver will return a non-NULL URI which can be used to connect to the same hypervisor later. + - Get the version level of the Hypervisor running. This may work only with hypervisor call, i.e. with privileged access to the hypervisor, not with a Read-Only connection. + - list the defined but inactive domains, stores the pointers to the names in @names + - Collect the list of defined (inactive) physical host interfaces, and store their names in @names. + - list the inactive networks, stores the pointers to the names in @names + - Provides the list of names of inactive storage pools upto maxnames. If there are more than maxnames, the remaining names will be silently ignored. + - Collect the list of active domains, and store their ID in @maxids + - Collect the list of active physical host interfaces, and store their names in @names + - Collect the list of active networks, and store their names in @names + - List UUIDs of defined secrets, store pointers to names in uuids. + - Provides the list of names of active storage pools upto maxnames. If there are more than maxnames, the remaining names will be silently ignored. + - Provides the number of defined but inactive domains. + - Provides the number of defined (inactive) interfaces on the physical host. + - Provides the number of inactive networks. + - Provides the number of inactive storage pools + - Provides the number of active domains. + - Provides the number of active interfaces on the physical host. + - Provides the number of active networks. + - Fetch number of currently defined secrets. + - Provides the number of active storage pools + - 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 connection to the Hypervisor. If necessary, authentication will be performed fetching credentials via the callback See virConnectOpen for notes about environment variables which can have an effect on opening drivers + - This function should be called first to get a restricted connection to the library functionalities. The set of APIs usable are then restricted on the available methods to control the domains. See virConnectOpen for notes about environment variables which can have an effect on opening drivers + - Increment the reference count on the connection. For each additional call to this method, there shall be a corresponding call to virConnectClose to release the reference count, once the caller no longer needs the reference to this object. This method is typically useful for applications where multiple threads are using a connection, and it is required that the connection remain open until all threads have finished using it. ie, each new thread using a connection would increment the reference count. + - Copy the content of the last error caught at the library level The error object is kept in thread local storage, so separate threads can safely access this concurrently. One will need to free the result with virResetError() + - Default routine reporting an error to stderr. + - Create a virtual device attachment to backend. + - This function allows you to read the contents of a domain's disk device. Typical uses for this are to determine if the domain has written a Master Boot Record (indicating that the domain has completed installation), or to try to work out the state of the domain's filesystems. (Note that in the local case you might try to open the block device or file directly, but that won't work in the remote case, nor if you don't have sufficient permission. Hence the need for this call). 'path' must be a device or file corresponding to the domain. In other words it must be the precise string returned in a <disk><source dev='...'/></disk> from virDomainGetXMLDesc. 'offset' and 'size' represent an area which must lie entirely within the device or file. 'size' may be 0 to test if the call would succeed. 'buffer' is the return buffer and must be at least 'size' bytes. NB. The remote driver imposes a 64K byte limit on 'size'. For your program to be able to work reliably over a remote connection you should split large requests to <= 65536 bytes. + from +virDomainGetXMLDesc. + +'offset' and 'size' represent an area which must lie entirely +within the device or file. 'size' may be 0 to test if the +call would succeed. + +'buffer' is the return buffer and must be at least 'size' bytes. + +NB. The remote driver imposes a 64K byte limit on 'size'. +For your program to be able to work reliably over a remote +connection you should split large requests to <= 65536 bytes.]]> @@ -1161,7 +1289,19 @@ see note above'/> - This function returns block device (disk) stats for block devices attached to the domain. The path parameter is the name of the block device. Get this by calling virDomainGetXMLDesc and finding the <target dev='...'> attribute within //domain/devices/disk. (For example, "xvda"). Domains may have more than one block device. To get stats for each you should make multiple calls to this function. Individual fields within the stats structure may be returned as -1, which indicates that the hypervisor does not support that particular statistic. + +attribute within //domain/devices/disk. (For example, "xvda"). + +Domains may have more than one block device. To get stats for +each you should make multiple calls to this function. + +Individual fields within the stats structure may be returned +as -1, which indicates that the hypervisor does not support +that particular statistic.]]> @@ -1169,128 +1309,166 @@ see note above'/> - This method will dump the core of a domain on a given file for analysis. Note that for remote Xen Daemon the file path will be interpreted in the remote host. + - launch a defined domain. If the call succeed the domain moves from the defined to the running domains pools. + - Deprecated after 0.4.6. Renamed to virDomainCreateXML() providing identical functionality. This existing name will left indefinitely for API compatability. + - Launch a new guest domain, based on an XML description similar to the one returned by virDomainGetXMLDesc() This function may requires privileged access to the hypervisor. The domain is not persistent, so its definition will disappear when it is destroyed, or if the host is restarted (see virDomainDefineXML() to define persistent domains). + - Define a domain, but does not start it. This definition is persistent, until explicitly undefined with virDomainUndefine(). A previous definition for this domain would be overriden if it already exists. + - 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. This does not free the associated virDomainPtr object. This function may require privileged access + - Destroy a virtual device attachment to backend. + - Free the domain object. The running instance is kept alive. The data structure is freed and should not be used thereafter. + - Provides a boolean value indicating whether the domain configured to be automatically started when the host machine boots. + - Provides the connection pointer associated with a domain. The reference counter on the connection is not increased by this call. WARNING: When writing libvirt bindings in other languages, do not use this function. Instead, store the connection and the domain object together. + - 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 information 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. + - Provides the maximum number of virtual CPUs supported for the guest VM. If the guest is inactive, this is basically the same as virConnectGetMaxVcpus. If the guest is running this will reflect the maximum number of virtual CPUs the guest was booted with. + - Get the public name for that domain + - Get the type of domain operation system. + - Get the scheduler parameters, the @params array will be filled with the values. + - Get the scheduler type. + - Extract security label of an active domain. The 'label' field in the @seclabel argument will be initialized to the empty string if the domain is not running under a security model. + - Get the UUID for a domain + - Get the UUID for a domain as string. For more information about UUID see RFC4122. + - Extract information about virtual CPUs of domain, store it in info array and also in cpumaps if this pointer isn't NULL. + @@ -1299,13 +1477,24 @@ see note above'/> - Provide an XML description of the domain. The description may be reused later to relaunch the domain with virDomainCreateXML(). + - This function returns network interface stats for interfaces attached to the domain. The path parameter is the name of the network interface. Domains may have more than network interface. To get stats for each you should make multiple calls to this function. Individual fields within the stats structure may be returned as -1, which indicates that the hypervisor does not support that particular statistic. + @@ -1313,31 +1502,52 @@ see note above'/> - Try to find a domain based on the hypervisor ID number Note that this won't work for inactive domains which have an ID of -1, in that case a lookup based on the Name or UUId need to be done instead. + - Try to lookup a domain on the given hypervisor based on its name. + - Try to lookup a domain on the given hypervisor based on its UUID. + - Try to lookup a domain on the given hypervisor based on its UUID. + - This function allows you to read the contents of a domain's memory. The memory which is read is controlled by the 'start', 'size' and 'flags' parameters. If 'flags' is VIR_MEMORY_VIRTUAL then the 'start' and 'size' parameters are interpreted as virtual memory addresses for whichever task happens to be running on the domain at the moment. Although this sounds haphazard it is in fact what you want in order to read Linux kernel state, because it ensures that pointers in the kernel image can be interpreted coherently. 'buffer' is the return buffer and must be at least 'size' bytes. 'size' may be 0 to test if the call would succeed. NB. The remote driver imposes a 64K byte limit on 'size'. For your program to be able to work reliably over a remote connection you should split large requests to <= 65536 bytes. + @@ -1346,7 +1556,40 @@ see note above'/> - Migrate the domain object from its current host to the destination host given by dconn (a connection to the destination host). Flags may be one of more of the following: VIR_MIGRATE_LIVE Attempt a live migration. If a hypervisor supports renaming domains during migration, then you may set the dname parameter to the new name (otherwise it keeps the same name). If this is not supported by the hypervisor, dname must be NULL or else you will get an error. Since typically the two hypervisors connect directly to each other in order to perform the migration, you may need to specify a path from the source to the destination. This is the purpose of the uri parameter. If uri is NULL, then libvirt will try to find the best method. Uri may specify the hostname or IP address of the destination host as seen from the source. Or uri may be a URI giving transport, hostname, user, port, etc. in the usual form. Refer to driver documentation for the particular URIs supported. The maximum bandwidth (in Mbps) that will be used to do migration can be specified with the bandwidth parameter. If set to 0, libvirt will choose a suitable default. Some hypervisors do not support this feature and will return an error if bandwidth is not 0. To see which features are supported by the current hypervisor, see virConnectGetCapabilities, /capabilities/host/migration_features. There are many limitations on migration imposed by the underlying technology - for example it may not be possible to migrate between different processors even with the same architecture, or between different types of hypervisor. + @@ -1356,7 +1599,8 @@ see note above'/> - Dynamically change the real CPUs which can be allocated to a virtual CPU. This function requires privileged access to the hypervisor. + @@ -1364,87 +1608,128 @@ see note above'/> - Reboot a domain, the domain object is still usable there after but the domain OS is being stopped for a restart. Note that the guest OS may ignore the request. + - Increment the reference count on the domain. For each additional call to this method, there shall be a corresponding call to virDomainFree to release the reference count, once the caller no longer needs the reference to this object. This method is typically useful for applications where multiple threads are using a connection, and it is required that the connection remain open until all threads have finished using it. ie, each new thread using a domain would increment the reference count. + - This method will restore a domain saved to disk by virDomainSave(). + - Resume an suspended domain, the process is restarted from the state where it was frozen by calling virSuspendDomain(). This function may requires privileged access + - This method will suspend a domain and save its memory contents to a file on disk. After the call, if successful, the domain is not listed as running anymore (this may be a problem). Use virDomainRestore() to restore a domain after saving. + - Configure the domain to be automatically started when the host machine boots. + - 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. This function requires privileged access to the hypervisor. + - Dynamically change the target 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. This function may requires privileged access to the hypervisor. + - Change the scheduler parameters + - Dynamically change the number of virtual CPUs used by the domain. Note that this call may fail if the underlying virtualization hypervisor does not support it or if growing the number is arbitrary limited. This function requires privileged access to the hypervisor. + - Shutdown a domain, the domain object is still usable there after but the domain OS is being stopped. Note that the guest OS may ignore the request. TODO: should we add an option for reboot, knowing it may not be doable in the general case ? + - 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. This function may requires privileged access. + - Undefine a domain but does not stop it if it is running + - Signature of a function to use when there is an error raised by the library. + - Part of the EventImpl, this callback Adds a file handle callback to listen for specific events. The same file handle can be registered multiple times provided the requested event sets are non-overlapping If the opaque user data requires free'ing when the handle is unregistered, then a 2nd callback can be supplied for this purpose. + @@ -1453,7 +1738,12 @@ see note above'/> - Part of the EventImpl, this user-defined callback handles adding an event timeout. If the opaque user data requires free'ing when the handle is unregistered, then a 2nd callback can be supplied for this purpose. + @@ -1461,7 +1751,8 @@ see note above'/> - Callback for receiving file handle events. The callback will be invoked once for each event which is pending. + @@ -1469,7 +1760,7 @@ see note above'/> - + @@ -1479,298 +1770,411 @@ see note above'/> - Part of the EventImpl, this user-provided callback is notified when an fd is no longer being listened on. If a virEventHandleFreeFunc was supplied when the handle was registered, it will be invoked some time during, or after this function call, when it is safe to release the user data. + - Part of the EventImpl, this user-defined callback removes a timer If a virEventTimeoutFreeFunc was supplied when the handle was registered, it will be invoked some time during, or after this function call, when it is safe to release the user data. + - callback for receiving timer events + - Part of the EventImpl, this user-provided callback is notified when events to listen on change + - Part of the EventImpl, this user-defined callback updates an event timeout. + - + - Resets and frees the given error. + - Provide a pointer to the last error caught at the library level The error object is kept in thread local storage, so separate threads can safely access this concurrently. + - Provides two information back, @libVer is the version of the library while @typeVer will be the version of the hypervisor type @type against which the library was compiled. If @type is NULL, "Xen" is assumed, if @type is unknown or not available, an error code will be returned and @typeVer will be 0. + - Initialize the library. It's better to call this routine at startup in multithreaded applications to avoid potential race when initializing the library. + - Activate an interface (ie call "ifup") + - Define an interface (or modify existing interface configuration) + - deactivate an interface (ie call "ifdown") This does not remove the interface from the config, and does not free the associated virInterfacePtr object. + - Free the interface object. The interface itself is unaltered. The data structure is freed and should not be used thereafter. + - Provides the connection pointer associated with an interface. The reference counter on the connection is not increased by this call. WARNING: When writing libvirt bindings in other languages, do not use this function. Instead, store the connection and the interface object together. + - Get the MAC for an interface as string. For more information about MAC see RFC4122. + - Get the public name for that interface + - Provide an XML description of the interface. The description may be reused later to redefine the interface with virInterfaceDefineXML(). + - Try to lookup an interface on the given hypervisor based on its MAC. + - Try to lookup an interface on the given hypervisor based on its name. + - Increment the reference count on the interface. For each additional call to this method, there shall be a corresponding call to virInterfaceFree to release the reference count, once the caller no longer needs the reference to this object. This method is typically useful for applications where multiple threads are using a connection, and it is required that the connection remain open until all threads have finished using it. ie, each new thread using an interface would increment the reference count. + - Undefine an interface, ie remove it from the config. This does not free the associated virInterfacePtr object. + - Create and start a defined network. If the call succeed the network moves from the defined to the running networks pools. + - Create and start a new virtual network, based on an XML description similar to the one returned by virNetworkGetXMLDesc() + - Define a network, but does not create it + - Destroy the network object. The running instance is shutdown if not down already and all resources used by it are given back to the hypervisor. This does not free the associated virNetworkPtr object. This function may require privileged access + - Free the network object. The running instance is kept alive. The data structure is freed and should not be used thereafter. + - Provides a boolean value indicating whether the network configured to be automatically started when the host machine boots. + - Provides a bridge interface name to which a domain may connect a network interface in order to join the network. + - Provides the connection pointer associated with a network. The reference counter on the connection is not increased by this call. WARNING: When writing libvirt bindings in other languages, do not use this function. Instead, store the connection and the network object together. + - Get the public name for that network + - Get the UUID for a network + - Get the UUID for a network as string. For more information about UUID see RFC4122. + - Provide an XML description of the network. The description may be reused later to relaunch the network with virNetworkCreateXML(). + - Try to lookup a network on the given hypervisor based on its name. + - Try to lookup a network on the given hypervisor based on its UUID. + - Try to lookup a network on the given hypervisor based on its UUID. + - Increment the reference count on the network. For each additional call to this method, there shall be a corresponding call to virNetworkFree to release the reference count, once the caller no longer needs the reference to this object. This method is typically useful for applications where multiple threads are using a connection, and it is required that the connection remain open until all threads have finished using it. ie, each new thread using a network would increment the reference count. + - Configure the network to be automatically started when the host machine boots. + - Undefine a network but does not stop it if it is running + - Create a new device on the VM host machine, for example, virtual HBAs created using vport_create. + - Destroy the device object. The virtual device is removed from the host operating system. This function may require privileged access + - Dettach the node device from the node itself so that it may be assigned to a guest domain. Depending on the hypervisor, this may involve operations such as unbinding any device drivers from the device, binding the device to a dummy device driver and resetting the device. If the device is currently in use by the node, this method may fail. Once the device is not assigned to any guest, it may be re-attached to the node using the virNodeDeviceReattach() method. + - Drops a reference to the node device, freeing it if this was the last reference. + - Just return the device name + - Accessor for the parent of the device + - Fetch an XML document describing all aspects of the device. + - Lists the names of the capabilities supported by the device. + - Lookup a node device by its name. + - Accessor for the number of capabilities supported by the device. + - Re-attach a previously dettached node device to the node so that it may be used by the node again. Depending on the hypervisor, this may involve operations such as resetting the device, unbinding it from a dummy device driver and binding it to its appropriate driver. If the device is currently in use by a guest, this method may fail. + - Increment the reference count on the dev. For each additional call to this method, there shall be a corresponding call to virNodeDeviceFree to release the reference count, once the caller no longer needs the reference to this object. This method is typically useful for applications where multiple threads are using a connection, and it is required that the connection remain open until all threads have finished using it. ie, each new thread using a dev would increment the reference count. + - Reset a previously dettached node device to the node before or after assigning it to a guest. The exact reset semantics depends on the hypervisor and device type but, for example, KVM will attempt to reset PCI devices with a Function Level Reset, Secondary Bus Reset or a Power Management D-State reset. If the reset will affect other devices which are currently in use, this function may fail. + - This call returns the amount of free memory in one or more NUMA cells. The @freeMems array must be allocated by the caller and will be filled with the amount of free memory in bytes for each cell requested, starting with startCell (in freeMems[0]), up to either (startCell + maxCells), or the number of additional cells in the node, whichever is smaller. + @@ -1778,24 +2182,31 @@ see note above'/> - provides the free memory available on the Node Note: most libvirt APIs provide memory sizes in kilobytes, but in this function the returned value is in bytes. Divide by 1024 as necessary. + - Extract hardware information about the node. + - Extract the security model of a hypervisor. The 'model' field in the @secmodel argument may be initialized to the empty string if the driver has not activated a security model. + - Collect the list of node devices, and store their names in @names If the optional 'cap' argument is non-NULL, then the count will be restricted to devices with the specified capability + @@ -1804,103 +2215,143 @@ see note above'/> - Provides the number of node devices. If the optional 'cap' argument is non-NULL, then the count will be restricted to devices with the specified capability + - Reset the error being pointed to + - Reset the last error caught at the library level. The error object is kept in thread local storage, so separate threads can safely access this concurrently, only resetting their own error object. + - Save the last error into a new error object. + - If XML specifies an UUID, locates the specified secret and replaces all attributes of the secret specified by UUID by attributes specified in xml (any attributes not specified in xml are discarded). Otherwise, creates a new secret with an automatically chosen UUID, and initializes its attributes from xml. + - Release the secret handle. The underlying secret continues to exist. + - Provides the connection pointer associated with a secret. The reference counter on the connection is not increased by this call. WARNING: When writing libvirt bindings in other languages, do not use this function. Instead, store the connection and the secret object together. + - Fetches the UUID of the secret. + - Get the UUID for a secret as string. For more information about UUID see RFC4122. + - Get the unique identifier of the object with which this secret is to be used. The format of the identifier is dependant on the usage type of the secret. For a secret with a usage type of VIR_SECRET_USAGE_TYPE_VOLUME the identifier will be a fully qualfied path name. The identifiers are intended to be unique within the set of all secrets sharing the same usage type. ie, there shall only ever be one secret for each volume path. + - Get the type of object which uses this secret. The returned value is one of the constants defined in the virSecretUsageType enumeration. More values may be added to this enumeration in the future, so callers should expect to see usage types they do not explicitly know about. + - Fetches the value of a secret. + - Fetches an XML document describing attributes of the secret. + - Try to lookup a secret on the given hypervisor based on its UUID. Uses the 16 bytes of raw data to describe the UUID + - Try to lookup a secret on the given hypervisor based on its UUID. Uses the printable string value to describe the UUID + - Try to lookup a secret on the given hypervisor based on its usage The usageID is unique within the set of secrets sharing the same usageType value. + - Increment the reference count on the secret. For each additional call to this method, there shall be a corresponding call to virSecretFree to release the reference count, once the caller no longer needs the reference to this object. This method is typically useful for applications where multiple threads are using a connection, and it is required that the connection remain open until all threads have finished using it. ie, each new thread using a secret would increment the reference count. + - Sets the value of a secret. + @@ -1908,164 +2359,204 @@ see note above'/> - Deletes the specified secret. This does not free the associated virSecretPtr object. + - Set a library global error handling function, if @handler is NULL, it will reset to default printing on stderr. The error raised there are those for which no handler at the connection level could caught. + - Build the underlying storage pool + - Starts an inactive storage pool + - Create a new storage based on its XML description. The pool is not persistent, so its definition will disappear when it is destroyed, or if the host is restarted + - Define a new inactive storage pool based on its XML description. The pool is persistent, until explicitly undefined. + - Delete the underlying pool resources. This is a non-recoverable operation. The virStoragePoolPtr object itself is not free'd. + - Destroy an active storage pool. This will deactivate the pool on the host, but keep any persistent config associated with it. If it has a persistent config it can later be restarted with virStoragePoolCreate(). This does not free the associated virStoragePoolPtr object. + - Free a storage pool object, releasing all memory associated with it. Does not change the state of the pool on the host. + - Fetches the value of the autostart flag, which determines whether the pool is automatically started at boot time + - Provides the connection pointer associated with a storage pool. The reference counter on the connection is not increased by this call. WARNING: When writing libvirt bindings in other languages, do not use this function. Instead, store the connection and the pool object together. + - Get volatile information about the storage pool such as free space / usage summary + - Fetch the locally unique name of the storage pool + - Fetch the globally unique ID of the storage pool + - Fetch the globally unique ID of the storage pool as a string + - Fetch an XML document describing all aspects of the storage pool. This is suitable for later feeding back into the virStoragePoolCreateXML method. + - Fetch list of storage volume names, limiting to at most maxnames. + - Fetch a storage pool based on its unique name + - Fetch a storage pool based on its globally unique id + - Fetch a storage pool based on its globally unique id + - Fetch a storage pool which contains a particular volume + - Fetch the number of storage volumes within a pool + - Increment the reference count on the pool. For each additional call to this method, there shall be a corresponding call to virStoragePoolFree to release the reference count, once the caller no longer needs the reference to this object. This method is typically useful for applications where multiple threads are using a connection, and it is required that the connection remain open until all threads have finished using it. ie, each new thread using a pool would increment the reference count. + - Request that the pool refresh its list of volumes. This may involve communicating with a remote server, and/or initializing new devices at the OS layer + - Sets the autostart flag + - Undefine an inactive storage pool + - Create a storage volume within a pool based on an XML description. Not all pools support creation of volumes + - Create a storage volume in the parent pool, using the 'clonevol' volume as input. Information for the new volume (name, perms) are passed via a typical volume XML description. + @@ -2073,68 +2564,96 @@ see note above'/> - Delete the storage volume from the pool + - Release the storage volume handle. The underlying storage volume continues to exist. + - Provides the connection pointer associated with a storage volume. The reference counter on the connection is not increased by this call. WARNING: When writing libvirt bindings in other languages, do not use this function. Instead, store the connection and the volume object together. + - Fetches volatile information about the storage volume such as its current allocation + - Fetch the storage volume key. This is globally unique, so the same volume will have the same key no matter what host it is accessed from + - Fetch the storage volume name. This is unique within the scope of a pool + - Fetch the storage volume path. Depending on the pool configuration this is either persistent across hosts, or dynamically assigned at pool startup. Consult pool documentation for information on getting the persistent naming + - Fetch an XML document describing all aspects of the storage volume + - Fetch a pointer to a storage volume based on its globally unique key + - Fetch a pointer to a storage volume based on its name within a pool + - Fetch a pointer to a storage volume based on its locally (host) unique path + - Increment the reference count on the vol. For each additional call to this method, there shall be a corresponding call to virStorageVolFree to release the reference count, once the caller no longer needs the reference to this object. This method is typically useful for applications where multiple threads are using a connection, and it is required that the connection remain open until all threads have finished using it. ie, each new thread using a vol would increment the reference count. + diff --git a/python/generator.py b/python/generator.py index c34cb34702..178a415183 100755 --- a/python/generator.py +++ b/python/generator.py @@ -44,6 +44,7 @@ if sgmlop: self.finish_starttag = target.start self.finish_endtag = target.end self.handle_data = target.data + self.handle_cdata = target.cdata # activate parser self.parser = sgmlop.XMLParser() @@ -78,6 +79,7 @@ class SlowParser(xmllib.XMLParser): def __init__(self, target): self.unknown_starttag = target.start self.handle_data = target.data + self.handle_cdata = target.cdata self.unknown_endtag = target.end xmllib.XMLParser.__init__(self) @@ -108,6 +110,11 @@ class docParser: print "data %s" % text self._data.append(text) + def cdata(self, text): + if debug: + print "data %s" % text + self._data.append(text) + def start(self, tag, attrs): if debug: print "start %s, %s" % (tag, attrs) @@ -843,20 +850,14 @@ def writeDoc(name, args, indent, output): val = string.replace(val, "NULL", "None"); output.write(indent) output.write('"""') - while len(val) > 60: - if val[0] == " ": - val = val[1:] - continue - str = val[0:60] - i = string.rfind(str, " "); - if i < 0: - i = 60 - str = val[0:i] - val = val[i:] + i = string.find(val, "\n") + while i >= 0: + str = val[0:i+1] + val = val[i+1:] output.write(str) - output.write('\n '); + i = string.find(val, "\n") output.write(indent) - output.write(val); + output.write(val) output.write(' """\n') def buildWrappers(): diff --git a/src/libvirt.c b/src/libvirt.c index 9fb0617e10..f164f60650 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -814,7 +814,7 @@ virRegisterStateDriver(virStateDriverPtr driver) * * Initialize all virtualization drivers. * - * Return 0 if all succeed, -1 upon any failure. + * Returns 0 if all succeed, -1 upon any failure. */ int virStateInitialize(int privileged) { int i, ret = 0; @@ -835,7 +835,7 @@ int virStateInitialize(int privileged) { * * Run each virtualization driver's cleanup method. * - * Return 0 if all succeed, -1 upon any failure. + * Returns 0 if all succeed, -1 upon any failure. */ int virStateCleanup(void) { int i, ret = 0; @@ -853,7 +853,7 @@ int virStateCleanup(void) { * * Run each virtualization driver's reload method. * - * Return 0 if all succeed, -1 upon any failure. + * Returns 0 if all succeed, -1 upon any failure. */ int virStateReload(void) { int i, ret = 0; @@ -871,7 +871,7 @@ int virStateReload(void) { * * Run each virtualization driver's "active" method. * - * Return 0 if none are active, 1 if at least one is. + * Returns 0 if none are active, 1 if at least one is. */ int virStateActive(void) { int i, ret = 0; @@ -7040,7 +7040,7 @@ virStoragePoolRef(virStoragePoolPtr pool) * involve communicating with a remote server, and/or initializing * new devices at the OS layer * - * Return 0 if the volume list was refreshed, -1 on failure + * Returns 0 if the volume list was refreshed, -1 on failure */ int virStoragePoolRefresh(virStoragePoolPtr pool, @@ -7085,7 +7085,7 @@ error: * * Fetch the locally unique name of the storage pool * - * Return the name of the pool, or NULL on error + * Returns the name of the pool, or NULL on error */ const char* virStoragePoolGetName(virStoragePoolPtr pool) @@ -7109,7 +7109,7 @@ virStoragePoolGetName(virStoragePoolPtr pool) * * Fetch the globally unique ID of the storage pool * - * Return 0 on success, or -1 on error; + * Returns 0 on success, or -1 on error; */ int virStoragePoolGetUUID(virStoragePoolPtr pool, @@ -7145,7 +7145,7 @@ error: * * Fetch the globally unique ID of the storage pool as a string * - * Return 0 on success, or -1 on error; + * Returns 0 on success, or -1 on error; */ int virStoragePoolGetUUIDString(virStoragePoolPtr pool, @@ -7186,7 +7186,7 @@ error: * Get volatile information about the storage pool * such as free space / usage summary * - * returns 0 on success, or -1 on failure. + * Returns 0 on success, or -1 on failure. */ int virStoragePoolGetInfo(virStoragePoolPtr pool, @@ -7236,7 +7236,7 @@ error: * storage pool. This is suitable for later feeding back * into the virStoragePoolCreateXML method. * - * returns a XML document, or NULL on error + * Returns a XML document, or NULL on error */ char * virStoragePoolGetXMLDesc(virStoragePoolPtr pool, @@ -7283,7 +7283,7 @@ error: * Fetches the value of the autostart flag, which determines * whether the pool is automatically started at boot time * - * return 0 on success, -1 on failure + * Returns 0 on success, -1 on failure */ int virStoragePoolGetAutostart(virStoragePoolPtr pool, @@ -7329,7 +7329,7 @@ error: * * Sets the autostart flag * - * returns 0 on success, -1 on failure + * Returns 0 on success, -1 on failure */ int virStoragePoolSetAutostart(virStoragePoolPtr pool, @@ -7490,7 +7490,7 @@ virStorageVolGetConnect (virStorageVolPtr vol) * Fetch a pointer to a storage volume based on its name * within a pool * - * return a storage volume, or NULL if not found / error + * Returns a storage volume, or NULL if not found / error */ virStorageVolPtr virStorageVolLookupByName(virStoragePoolPtr pool, @@ -7535,7 +7535,7 @@ error: * Fetch a pointer to a storage volume based on its * globally unique key * - * return a storage volume, or NULL if not found / error + * Returns a storage volume, or NULL if not found / error */ virStorageVolPtr virStorageVolLookupByKey(virConnectPtr conn, @@ -7578,7 +7578,7 @@ error: * Fetch a pointer to a storage volume based on its * locally (host) unique path * - * return a storage volume, or NULL if not found / error + * Returns a storage volume, or NULL if not found / error */ virStorageVolPtr virStorageVolLookupByPath(virConnectPtr conn, @@ -7621,7 +7621,7 @@ error: * Fetch the storage volume name. This is unique * within the scope of a pool * - * return the volume name, or NULL on error + * Returns the volume name, or NULL on error */ const char* virStorageVolGetName(virStorageVolPtr vol) @@ -7646,7 +7646,7 @@ virStorageVolGetName(virStorageVolPtr vol) * unique, so the same volume will have the same * key no matter what host it is accessed from * - * return the volume key, or NULL on error + * Returns the volume key, or NULL on error */ const char* virStorageVolGetKey(virStorageVolPtr vol) @@ -7673,7 +7673,7 @@ virStorageVolGetKey(virStorageVolPtr vol) * on an XML description. Not all pools support * creation of volumes * - * return the storage volume, or NULL on error + * Returns the storage volume, or NULL on error */ virStorageVolPtr virStorageVolCreateXML(virStoragePoolPtr pool, @@ -7723,7 +7723,7 @@ error: * volume (name, perms) are passed via a typical volume * XML description. * - * return the storage volume, or NULL on error + * Returns the storage volume, or NULL on error */ virStorageVolPtr virStorageVolCreateXMLFrom(virStoragePoolPtr pool, @@ -7777,7 +7777,7 @@ error: * * Delete the storage volume from the pool * - * Return 0 on success, or -1 on error + * Returns 0 on success, or -1 on error */ int virStorageVolDelete(virStorageVolPtr vol, @@ -7823,7 +7823,7 @@ error: * Release the storage volume handle. The underlying * storage volume continues to exist. * - * Return 0 on success, or -1 on error + * Returns 0 on success, or -1 on error */ int virStorageVolFree(virStorageVolPtr vol) @@ -7881,7 +7881,7 @@ virStorageVolRef(virStorageVolPtr vol) * Fetches volatile information about the storage * volume such as its current allocation * - * Return 0 on success, or -1 on failure + * Returns 0 on success, or -1 on failure */ int virStorageVolGetInfo(virStorageVolPtr vol, @@ -7930,7 +7930,7 @@ error: * Fetch an XML document describing all aspects of * the storage volume * - * Return the XML document, or NULL on error + * Returns the XML document, or NULL on error */ char * virStorageVolGetXMLDesc(virStorageVolPtr vol, @@ -8161,7 +8161,7 @@ error: * Fetch an XML document describing all aspects of * the device. * - * Return the XML document, or NULL on error + * Returns the XML document, or NULL on error */ char *virNodeDeviceGetXMLDesc(virNodeDevicePtr dev, unsigned int flags) { @@ -9377,7 +9377,7 @@ virSecretRef(virSecretPtr secret) * * Release the secret handle. The underlying secret continues to exist. * - * Return 0 on success, or -1 on error + * Returns 0 on success, or -1 on error */ int virSecretFree(virSecretPtr secret)