mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-07-31 05:57:16 +00:00
remote: introduce emulator pinning RPCs
Introduce 2 APIs to support emulator threads in remote driver. 1) remoteDomainPinEmulator: call driver api, such as qemudDomainPinEmulator. 2) remoteDomainGetEmulatorPinInfo: call driver api, such as qemudDomainGetEmulatorPinInfo. They are similar to remoteDomainPinVcpuFlags and remoteDomainGetVcpuPinInfo. Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com> Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
This commit is contained in:
parent
3dbf4838e4
commit
ca5c99aecb
@ -1592,6 +1592,97 @@ no_memory:
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
remoteDispatchDomainPinEmulator(virNetServerPtr server ATTRIBUTE_UNUSED,
|
||||||
|
virNetServerClientPtr client,
|
||||||
|
virNetMessagePtr msg ATTRIBUTE_UNUSED,
|
||||||
|
virNetMessageErrorPtr rerr,
|
||||||
|
remote_domain_pin_emulator_args *args)
|
||||||
|
{
|
||||||
|
int rv = -1;
|
||||||
|
virDomainPtr dom = NULL;
|
||||||
|
struct daemonClientPrivate *priv =
|
||||||
|
virNetServerClientGetPrivateData(client);
|
||||||
|
|
||||||
|
if (!priv->conn) {
|
||||||
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
if (virDomainPinEmulator(dom,
|
||||||
|
(unsigned char *) args->cpumap.cpumap_val,
|
||||||
|
args->cpumap.cpumap_len,
|
||||||
|
args->flags) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
rv = 0;
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
if (rv < 0)
|
||||||
|
virNetMessageSaveError(rerr);
|
||||||
|
if (dom)
|
||||||
|
virDomainFree(dom);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
remoteDispatchDomainGetEmulatorPinInfo(virNetServerPtr server ATTRIBUTE_UNUSED,
|
||||||
|
virNetServerClientPtr client ATTRIBUTE_UNUSED,
|
||||||
|
virNetMessagePtr msg ATTRIBUTE_UNUSED,
|
||||||
|
virNetMessageErrorPtr rerr,
|
||||||
|
remote_domain_get_emulator_pin_info_args *args,
|
||||||
|
remote_domain_get_emulator_pin_info_ret *ret)
|
||||||
|
{
|
||||||
|
virDomainPtr dom = NULL;
|
||||||
|
unsigned char *cpumaps = NULL;
|
||||||
|
int r;
|
||||||
|
int rv = -1;
|
||||||
|
struct daemonClientPrivate *priv =
|
||||||
|
virNetServerClientGetPrivateData(client);
|
||||||
|
|
||||||
|
if (!priv->conn) {
|
||||||
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
/* Allocate buffers to take the results */
|
||||||
|
if (args->maplen > 0 &&
|
||||||
|
VIR_ALLOC_N(cpumaps, args->maplen) < 0)
|
||||||
|
goto no_memory;
|
||||||
|
|
||||||
|
if ((r = virDomainGetEmulatorPinInfo(dom,
|
||||||
|
cpumaps,
|
||||||
|
args->maplen,
|
||||||
|
args->flags)) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
|
ret->ret = r;
|
||||||
|
ret->cpumaps.cpumaps_len = args->maplen;
|
||||||
|
ret->cpumaps.cpumaps_val = (char *) cpumaps;
|
||||||
|
cpumaps = NULL;
|
||||||
|
|
||||||
|
rv = 0;
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
if (rv < 0)
|
||||||
|
virNetMessageSaveError(rerr);
|
||||||
|
VIR_FREE(cpumaps);
|
||||||
|
if (dom)
|
||||||
|
virDomainFree(dom);
|
||||||
|
return rv;
|
||||||
|
|
||||||
|
no_memory:
|
||||||
|
virReportOOMError();
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
remoteDispatchDomainGetVcpus(virNetServerPtr server ATTRIBUTE_UNUSED,
|
remoteDispatchDomainGetVcpus(virNetServerPtr server ATTRIBUTE_UNUSED,
|
||||||
virNetServerClientPtr client ATTRIBUTE_UNUSED,
|
virNetServerClientPtr client ATTRIBUTE_UNUSED,
|
||||||
|
@ -1884,6 +1884,103 @@ done:
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
remoteDomainPinEmulator (virDomainPtr dom,
|
||||||
|
unsigned char *cpumap,
|
||||||
|
int cpumaplen,
|
||||||
|
unsigned int flags)
|
||||||
|
{
|
||||||
|
int rv = -1;
|
||||||
|
struct private_data *priv = dom->conn->privateData;
|
||||||
|
remote_domain_pin_emulator_args args;
|
||||||
|
|
||||||
|
remoteDriverLock(priv);
|
||||||
|
|
||||||
|
if (cpumaplen > REMOTE_CPUMAP_MAX) {
|
||||||
|
virReportError(VIR_ERR_RPC,
|
||||||
|
_("%s length greater than maximum: %d > %d"),
|
||||||
|
"cpumap", cpumaplen, REMOTE_CPUMAP_MAX);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
make_nonnull_domain(&args.dom, dom);
|
||||||
|
args.cpumap.cpumap_val = (char *)cpumap;
|
||||||
|
args.cpumap.cpumap_len = cpumaplen;
|
||||||
|
args.flags = flags;
|
||||||
|
|
||||||
|
if (call(dom->conn, priv, 0, REMOTE_PROC_DOMAIN_PIN_EMULATOR,
|
||||||
|
(xdrproc_t) xdr_remote_domain_pin_emulator_args,
|
||||||
|
(char *) &args,
|
||||||
|
(xdrproc_t) xdr_void, (char *) NULL) == -1) {
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
rv = 0;
|
||||||
|
|
||||||
|
done:
|
||||||
|
remoteDriverUnlock(priv);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
remoteDomainGetEmulatorPinInfo (virDomainPtr domain,
|
||||||
|
unsigned char *cpumaps,
|
||||||
|
int maplen,
|
||||||
|
unsigned int flags)
|
||||||
|
{
|
||||||
|
int rv = -1;
|
||||||
|
int i;
|
||||||
|
remote_domain_get_emulator_pin_info_args args;
|
||||||
|
remote_domain_get_emulator_pin_info_ret ret;
|
||||||
|
struct private_data *priv = domain->conn->privateData;
|
||||||
|
|
||||||
|
remoteDriverLock(priv);
|
||||||
|
|
||||||
|
/* There is only one cpumap for all emulator threads */
|
||||||
|
if (maplen > REMOTE_CPUMAPS_MAX) {
|
||||||
|
virReportError(VIR_ERR_RPC,
|
||||||
|
_("vCPU map buffer length exceeds maximum: %d > %d"),
|
||||||
|
maplen, REMOTE_CPUMAPS_MAX);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
make_nonnull_domain(&args.dom, domain);
|
||||||
|
args.maplen = maplen;
|
||||||
|
args.flags = flags;
|
||||||
|
|
||||||
|
memset(&ret, 0, sizeof(ret));
|
||||||
|
|
||||||
|
if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_EMULATOR_PIN_INFO,
|
||||||
|
(xdrproc_t) xdr_remote_domain_get_emulator_pin_info_args,
|
||||||
|
(char *) &args,
|
||||||
|
(xdrproc_t) xdr_remote_domain_get_emulator_pin_info_ret,
|
||||||
|
(char *) &ret) == -1)
|
||||||
|
goto done;
|
||||||
|
|
||||||
|
if (ret.cpumaps.cpumaps_len > maplen) {
|
||||||
|
virReportError(VIR_ERR_RPC,
|
||||||
|
_("host reports map buffer length exceeds maximum: %d > %d"),
|
||||||
|
ret.cpumaps.cpumaps_len, maplen);
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(cpumaps, 0, maplen);
|
||||||
|
|
||||||
|
for (i = 0; i < ret.cpumaps.cpumaps_len; ++i)
|
||||||
|
cpumaps[i] = ret.cpumaps.cpumaps_val[i];
|
||||||
|
|
||||||
|
rv = ret.ret;
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
xdr_free ((xdrproc_t) xdr_remote_domain_get_emulator_pin_info_ret,
|
||||||
|
(char *) &ret);
|
||||||
|
|
||||||
|
done:
|
||||||
|
remoteDriverUnlock(priv);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
remoteDomainGetVcpus (virDomainPtr domain,
|
remoteDomainGetVcpus (virDomainPtr domain,
|
||||||
virVcpuInfoPtr info,
|
virVcpuInfoPtr info,
|
||||||
@ -5344,6 +5441,8 @@ static virDriver remote_driver = {
|
|||||||
.domainPinVcpu = remoteDomainPinVcpu, /* 0.3.0 */
|
.domainPinVcpu = remoteDomainPinVcpu, /* 0.3.0 */
|
||||||
.domainPinVcpuFlags = remoteDomainPinVcpuFlags, /* 0.9.3 */
|
.domainPinVcpuFlags = remoteDomainPinVcpuFlags, /* 0.9.3 */
|
||||||
.domainGetVcpuPinInfo = remoteDomainGetVcpuPinInfo, /* 0.9.3 */
|
.domainGetVcpuPinInfo = remoteDomainGetVcpuPinInfo, /* 0.9.3 */
|
||||||
|
.domainPinEmulator = remoteDomainPinEmulator, /* 0.10.0 */
|
||||||
|
.domainGetEmulatorPinInfo = remoteDomainGetEmulatorPinInfo, /* 0.10.0 */
|
||||||
.domainGetVcpus = remoteDomainGetVcpus, /* 0.3.0 */
|
.domainGetVcpus = remoteDomainGetVcpus, /* 0.3.0 */
|
||||||
.domainGetMaxVcpus = remoteDomainGetMaxVcpus, /* 0.3.0 */
|
.domainGetMaxVcpus = remoteDomainGetMaxVcpus, /* 0.3.0 */
|
||||||
.domainGetSecurityLabel = remoteDomainGetSecurityLabel, /* 0.6.1 */
|
.domainGetSecurityLabel = remoteDomainGetSecurityLabel, /* 0.6.1 */
|
||||||
|
@ -1059,6 +1059,23 @@ struct remote_domain_get_vcpu_pin_info_ret {
|
|||||||
int num;
|
int num;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct remote_domain_pin_emulator_args {
|
||||||
|
remote_nonnull_domain dom;
|
||||||
|
opaque cpumap<REMOTE_CPUMAP_MAX>; /* (unsigned char *) */
|
||||||
|
unsigned int flags;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct remote_domain_get_emulator_pin_info_args {
|
||||||
|
remote_nonnull_domain dom;
|
||||||
|
int maplen;
|
||||||
|
unsigned int flags;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct remote_domain_get_emulator_pin_info_ret {
|
||||||
|
opaque cpumaps<REMOTE_CPUMAPS_MAX>;
|
||||||
|
int ret;
|
||||||
|
};
|
||||||
|
|
||||||
struct remote_domain_get_vcpus_args {
|
struct remote_domain_get_vcpus_args {
|
||||||
remote_nonnull_domain dom;
|
remote_nonnull_domain dom;
|
||||||
int maxinfo;
|
int maxinfo;
|
||||||
@ -2869,7 +2886,9 @@ enum remote_procedure {
|
|||||||
REMOTE_PROC_DOMAIN_SNAPSHOT_LIST_ALL_CHILDREN = 275, /* skipgen skipgen priority:high */
|
REMOTE_PROC_DOMAIN_SNAPSHOT_LIST_ALL_CHILDREN = 275, /* skipgen skipgen priority:high */
|
||||||
REMOTE_PROC_DOMAIN_EVENT_BALLOON_CHANGE = 276, /* autogen autogen */
|
REMOTE_PROC_DOMAIN_EVENT_BALLOON_CHANGE = 276, /* autogen autogen */
|
||||||
REMOTE_PROC_DOMAIN_GET_HOSTNAME = 277, /* autogen autogen */
|
REMOTE_PROC_DOMAIN_GET_HOSTNAME = 277, /* autogen autogen */
|
||||||
REMOTE_PROC_DOMAIN_GET_SECURITY_LABEL_LIST = 278 /* skipgen skipgen priority:high */
|
REMOTE_PROC_DOMAIN_GET_SECURITY_LABEL_LIST = 278, /* skipgen skipgen priority:high */
|
||||||
|
REMOTE_PROC_DOMAIN_PIN_EMULATOR = 279, /* skipgen skipgen */
|
||||||
|
REMOTE_PROC_DOMAIN_GET_EMULATOR_PIN_INFO = 280 /* skipgen skipgen */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Notice how the entries are grouped in sets of 10 ?
|
* Notice how the entries are grouped in sets of 10 ?
|
||||||
|
@ -718,6 +718,26 @@ struct remote_domain_get_vcpu_pin_info_ret {
|
|||||||
} cpumaps;
|
} cpumaps;
|
||||||
int num;
|
int num;
|
||||||
};
|
};
|
||||||
|
struct remote_domain_pin_emulator_args {
|
||||||
|
remote_nonnull_domain dom;
|
||||||
|
struct {
|
||||||
|
u_int cpumap_len;
|
||||||
|
char * cpumap_val;
|
||||||
|
} cpumap;
|
||||||
|
u_int flags;
|
||||||
|
};
|
||||||
|
struct remote_domain_get_emulator_pin_info_args {
|
||||||
|
remote_nonnull_domain dom;
|
||||||
|
int maplen;
|
||||||
|
u_int flags;
|
||||||
|
};
|
||||||
|
struct remote_domain_get_emulator_pin_info_ret {
|
||||||
|
struct {
|
||||||
|
u_int cpumaps_len;
|
||||||
|
char * cpumaps_val;
|
||||||
|
} cpumaps;
|
||||||
|
int ret;
|
||||||
|
};
|
||||||
struct remote_domain_get_vcpus_args {
|
struct remote_domain_get_vcpus_args {
|
||||||
remote_nonnull_domain dom;
|
remote_nonnull_domain dom;
|
||||||
int maxinfo;
|
int maxinfo;
|
||||||
@ -2270,4 +2290,6 @@ enum remote_procedure {
|
|||||||
REMOTE_PROC_DOMAIN_EVENT_BALLOON_CHANGE = 276,
|
REMOTE_PROC_DOMAIN_EVENT_BALLOON_CHANGE = 276,
|
||||||
REMOTE_PROC_DOMAIN_GET_HOSTNAME = 277,
|
REMOTE_PROC_DOMAIN_GET_HOSTNAME = 277,
|
||||||
REMOTE_PROC_DOMAIN_GET_SECURITY_LABEL_LIST = 278,
|
REMOTE_PROC_DOMAIN_GET_SECURITY_LABEL_LIST = 278,
|
||||||
|
REMOTE_PROC_DOMAIN_PIN_EMULATOR = 279,
|
||||||
|
REMOTE_PROC_DOMAIN_GET_EMULATOR_PIN_INFO = 280,
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user