mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
Implement virDomainAddIOThread and virDomainDelIOThread
Add libvirt API's to manage adding and deleting IOThreads to/from the domain
This commit is contained in:
parent
4dec8a0160
commit
130a0ed281
@ -1615,6 +1615,12 @@ int virDomainPinIOThread(virDomainPtr domain,
|
||||
unsigned char *cpumap,
|
||||
int maplen,
|
||||
unsigned int flags);
|
||||
int virDomainAddIOThread(virDomainPtr domain,
|
||||
unsigned int iothread_id,
|
||||
unsigned int flags);
|
||||
int virDomainDelIOThread(virDomainPtr domain,
|
||||
unsigned int iothread_id,
|
||||
unsigned int flags);
|
||||
|
||||
/**
|
||||
* VIR_USE_CPU:
|
||||
|
@ -392,6 +392,16 @@ typedef int
|
||||
int maplen,
|
||||
unsigned int flags);
|
||||
|
||||
typedef int
|
||||
(*virDrvDomainAddIOThread)(virDomainPtr domain,
|
||||
unsigned int iothread_id,
|
||||
unsigned int flags);
|
||||
|
||||
typedef int
|
||||
(*virDrvDomainDelIOThread)(virDomainPtr domain,
|
||||
unsigned int iothread_id,
|
||||
unsigned int flags);
|
||||
|
||||
typedef int
|
||||
(*virDrvDomainGetSecurityLabel)(virDomainPtr domain,
|
||||
virSecurityLabelPtr seclabel);
|
||||
@ -1273,6 +1283,8 @@ struct _virHypervisorDriver {
|
||||
virDrvDomainGetMaxVcpus domainGetMaxVcpus;
|
||||
virDrvDomainGetIOThreadInfo domainGetIOThreadInfo;
|
||||
virDrvDomainPinIOThread domainPinIOThread;
|
||||
virDrvDomainAddIOThread domainAddIOThread;
|
||||
virDrvDomainDelIOThread domainDelIOThread;
|
||||
virDrvDomainGetSecurityLabel domainGetSecurityLabel;
|
||||
virDrvDomainGetSecurityLabelList domainGetSecurityLabelList;
|
||||
virDrvNodeGetSecurityModel nodeGetSecurityModel;
|
||||
|
@ -8019,6 +8019,124 @@ virDomainPinIOThread(virDomainPtr domain,
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* virDomainAddIOThread:
|
||||
* @domain: a domain object
|
||||
* @iothread_id: the specific IOThread ID value to add
|
||||
* @flags: bitwise-OR of virDomainModificationImpact
|
||||
*
|
||||
* Dynamically add an IOThread to the domain. If @iothread_id is a positive
|
||||
* non-zero value, then attempt to add the specific IOThread ID and error
|
||||
* out if the iothread id already exists.
|
||||
*
|
||||
* Note that this call can fail if the underlying virtualization hypervisor
|
||||
* does not support it or if growing the number is arbitrarily limited.
|
||||
* This function requires privileged access to the hypervisor.
|
||||
*
|
||||
* @flags may include VIR_DOMAIN_AFFECT_LIVE or VIR_DOMAIN_AFFECT_CONFIG.
|
||||
* Both flags may be set.
|
||||
* If VIR_DOMAIN_AFFECT_LIVE is set, the change affects a running domain
|
||||
* and may fail if domain is not alive.
|
||||
* If VIR_DOMAIN_AFFECT_CONFIG is set, the change affects persistent state,
|
||||
* and will fail for transient domains. If neither flag is specified (that is,
|
||||
* @flags is VIR_DOMAIN_AFFECT_CURRENT), then an inactive domain modifies
|
||||
* persistent setup, while an active domain is hypervisor-dependent on whether
|
||||
* just live or both live and persistent state is changed.
|
||||
*
|
||||
* Returns 0 in case of success, -1 in case of failure.
|
||||
*/
|
||||
int
|
||||
virDomainAddIOThread(virDomainPtr domain,
|
||||
unsigned int iothread_id,
|
||||
unsigned int flags)
|
||||
{
|
||||
virConnectPtr conn;
|
||||
|
||||
VIR_DOMAIN_DEBUG(domain, "iothread_id=%u, flags=%x",
|
||||
iothread_id, flags);
|
||||
|
||||
virResetLastError();
|
||||
|
||||
virCheckDomainReturn(domain, -1);
|
||||
virCheckReadOnlyGoto(domain->conn->flags, error);
|
||||
|
||||
conn = domain->conn;
|
||||
|
||||
if (conn->driver->domainAddIOThread) {
|
||||
int ret;
|
||||
ret = conn->driver->domainAddIOThread(domain, iothread_id, flags);
|
||||
if (ret < 0)
|
||||
goto error;
|
||||
return ret;
|
||||
}
|
||||
|
||||
virReportUnsupportedError();
|
||||
|
||||
error:
|
||||
virDispatchError(domain->conn);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* virDomainDelIOThread:
|
||||
* @domain: a domain object
|
||||
* @iothread_id: the specific IOThread ID value to delete
|
||||
* @flags: bitwise-OR of virDomainModificationImpact
|
||||
*
|
||||
* Dynamically delete an IOThread from the domain. The @iothread_id to be
|
||||
* deleted must not have a resource associated with it and can be any of
|
||||
* the currently valid IOThread ID's.
|
||||
*
|
||||
* Note that this call can fail if the underlying virtualization hypervisor
|
||||
* does not support it or if reducing the number is arbitrarily limited.
|
||||
* This function requires privileged access to the hypervisor.
|
||||
*
|
||||
* @flags may include VIR_DOMAIN_AFFECT_LIVE or VIR_DOMAIN_AFFECT_CONFIG.
|
||||
* Both flags may be set.
|
||||
* If VIR_DOMAIN_AFFECT_LIVE is set, the change affects a running domain
|
||||
* and may fail if domain is not alive.
|
||||
* If VIR_DOMAIN_AFFECT_CONFIG is set, the change affects persistent state,
|
||||
* and will fail for transient domains. If neither flag is specified (that is,
|
||||
* @flags is VIR_DOMAIN_AFFECT_CURRENT), then an inactive domain modifies
|
||||
* persistent setup, while an active domain is hypervisor-dependent on whether
|
||||
* just live or both live and persistent state is changed.
|
||||
*
|
||||
* Returns 0 in case of success, -1 in case of failure.
|
||||
*/
|
||||
int
|
||||
virDomainDelIOThread(virDomainPtr domain,
|
||||
unsigned int iothread_id,
|
||||
unsigned int flags)
|
||||
{
|
||||
virConnectPtr conn;
|
||||
|
||||
VIR_DOMAIN_DEBUG(domain, "iothread_id=%u, flags=%x", iothread_id, flags);
|
||||
|
||||
virResetLastError();
|
||||
|
||||
virCheckDomainReturn(domain, -1);
|
||||
virCheckReadOnlyGoto(domain->conn->flags, error);
|
||||
virCheckNonZeroArgGoto(iothread_id, error);
|
||||
|
||||
conn = domain->conn;
|
||||
|
||||
if (conn->driver->domainDelIOThread) {
|
||||
int ret;
|
||||
ret = conn->driver->domainDelIOThread(domain, iothread_id, flags);
|
||||
if (ret < 0)
|
||||
goto error;
|
||||
return ret;
|
||||
}
|
||||
|
||||
virReportUnsupportedError();
|
||||
|
||||
error:
|
||||
virDispatchError(domain->conn);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* virDomainGetSecurityLabel:
|
||||
* @domain: a domain object
|
||||
|
@ -704,4 +704,10 @@ LIBVIRT_1.2.14 {
|
||||
virDomainInterfaceFree;
|
||||
} LIBVIRT_1.2.12;
|
||||
|
||||
LIBVIRT_1.2.15 {
|
||||
global:
|
||||
virDomainAddIOThread;
|
||||
virDomainDelIOThread;
|
||||
} LIBVIRT_1.2.14;
|
||||
|
||||
# .... define new API here using predicted next version number ....
|
||||
|
Loading…
Reference in New Issue
Block a user