mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
sysinfo: implement the public API
* src/libvirt.c (virConnectGetSysinfo): New function. * docs/formatdomain.html.in: Mention it.
This commit is contained in:
parent
dec13a5a15
commit
addee8a096
@ -125,7 +125,10 @@
|
|||||||
The <code>mode</code> attribute must be specified, and is either
|
The <code>mode</code> attribute must be specified, and is either
|
||||||
"emulate" (let the hypervisor generate all values), "host" (copy
|
"emulate" (let the hypervisor generate all values), "host" (copy
|
||||||
all of Block 0 and Block 1, except for the UUID, from the host's
|
all of Block 0 and Block 1, except for the UUID, from the host's
|
||||||
SMBIOS values), or "sysinfo" (use the values in
|
SMBIOS values;
|
||||||
|
the <a href="html/libvirt-libvirt.html#virConnectGetSysinfo">
|
||||||
|
<code>virConnectGetSysinfo</code></a> call can be
|
||||||
|
used to see what values are copied), or "sysinfo" (use the values in
|
||||||
the <a href="#elementsSysinfo">sysinfo</a> element). If not
|
the <a href="#elementsSysinfo">sysinfo</a> element). If not
|
||||||
specified, the hypervisor default is used. <span class="since">
|
specified, the hypervisor default is used. <span class="since">
|
||||||
Since 0.8.7</span>
|
Since 0.8.7</span>
|
||||||
|
@ -776,7 +776,7 @@ virRegisterStateDriver(virStateDriverPtr driver)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* virStateInitialize:
|
* virStateInitialize:
|
||||||
* @privileged: set to 1 if running with root priviledge, 0 otherwise
|
* @privileged: set to 1 if running with root privilege, 0 otherwise
|
||||||
*
|
*
|
||||||
* Initialize all virtualization drivers.
|
* Initialize all virtualization drivers.
|
||||||
*
|
*
|
||||||
@ -1593,6 +1593,46 @@ error:
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* virConnectGetSysinfo:
|
||||||
|
* @conn: pointer to a hypervisor connection
|
||||||
|
* @flags: callers should always pass 0
|
||||||
|
*
|
||||||
|
* This returns the XML description of the sysinfo details for the
|
||||||
|
* host on which the hypervisor is running, in the same format as the
|
||||||
|
* <sysinfo> element of a domain XML. This information is generally
|
||||||
|
* available only for hypervisors running with root privileges.
|
||||||
|
*
|
||||||
|
* Returns the XML string which must be freed by the caller, or
|
||||||
|
* NULL if there was an error.
|
||||||
|
*/
|
||||||
|
char *
|
||||||
|
virConnectGetSysinfo (virConnectPtr conn, unsigned int flags)
|
||||||
|
{
|
||||||
|
DEBUG("conn=%p", conn);
|
||||||
|
|
||||||
|
virResetLastError();
|
||||||
|
|
||||||
|
if (!VIR_IS_CONNECT(conn)) {
|
||||||
|
virLibConnError(VIR_ERR_INVALID_CONN, __FUNCTION__);
|
||||||
|
virDispatchError(NULL);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (conn->driver->getSysinfo) {
|
||||||
|
char *ret = conn->driver->getSysinfo (conn, flags);
|
||||||
|
if (!ret)
|
||||||
|
goto error;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
virLibConnError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
|
||||||
|
|
||||||
|
error:
|
||||||
|
virDispatchError(conn);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* virConnectGetMaxVcpus:
|
* virConnectGetMaxVcpus:
|
||||||
* @conn: pointer to the hypervisor connection
|
* @conn: pointer to the hypervisor connection
|
||||||
|
Loading…
Reference in New Issue
Block a user