提交 667ac11e 编写于 作者: E Eric Blake

test: Add various vir*Flags API

Even though we don't accept any flags, it is unfriendly to callers
that use the modern API to have to fall back to the flag-free API.

Note that virDomainBlockStats does not trivially forward to
virDomainBlockStatsFlags, so that one is omitted for now.
Signed-off-by: NEric Blake <eblake@redhat.com>
Acked-by: NPeter Krempa <pkrempa@redhat.com>
上级 b7acc9a6
...@@ -2469,12 +2469,15 @@ static int testDomainSetMaxMemory(virDomainPtr domain, ...@@ -2469,12 +2469,15 @@ static int testDomainSetMaxMemory(virDomainPtr domain,
return 0; return 0;
} }
static int testDomainSetMemory(virDomainPtr domain, static int testDomainSetMemoryFlags(virDomainPtr domain,
unsigned long memory) unsigned long memory,
unsigned int flags)
{ {
virDomainObjPtr privdom; virDomainObjPtr privdom;
int ret = -1; int ret = -1;
virCheckFlags(0, -1);
if (!(privdom = testDomObjFromDomain(domain))) if (!(privdom = testDomObjFromDomain(domain)))
return -1; return -1;
...@@ -2491,6 +2494,12 @@ static int testDomainSetMemory(virDomainPtr domain, ...@@ -2491,6 +2494,12 @@ static int testDomainSetMemory(virDomainPtr domain,
return ret; return ret;
} }
static int testDomainSetMemory(virDomainPtr domain,
unsigned long memory)
{
return testDomainSetMemoryFlags(domain, memory, 0);
}
static int static int
testDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags) testDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
{ {
...@@ -2679,16 +2688,19 @@ static int testDomainGetVcpus(virDomainPtr domain, ...@@ -2679,16 +2688,19 @@ static int testDomainGetVcpus(virDomainPtr domain,
return ret; return ret;
} }
static int testDomainPinVcpu(virDomainPtr domain, static int testDomainPinVcpuFlags(virDomainPtr domain,
unsigned int vcpu, unsigned int vcpu,
unsigned char *cpumap, unsigned char *cpumap,
int maplen) int maplen,
unsigned int flags)
{ {
virDomainVcpuDefPtr vcpuinfo; virDomainVcpuDefPtr vcpuinfo;
virDomainObjPtr privdom; virDomainObjPtr privdom;
virDomainDefPtr def; virDomainDefPtr def;
int ret = -1; int ret = -1;
virCheckFlags(0, -1);
if (!(privdom = testDomObjFromDomain(domain))) if (!(privdom = testDomObjFromDomain(domain)))
return -1; return -1;
...@@ -2720,6 +2732,14 @@ static int testDomainPinVcpu(virDomainPtr domain, ...@@ -2720,6 +2732,14 @@ static int testDomainPinVcpu(virDomainPtr domain,
return ret; return ret;
} }
static int testDomainPinVcpu(virDomainPtr domain,
unsigned int vcpu,
unsigned char *cpumap,
int maplen)
{
return testDomainPinVcpuFlags(domain, vcpu, cpumap, maplen, 0);
}
static int static int
testDomainGetVcpuPinInfo(virDomainPtr dom, testDomainGetVcpuPinInfo(virDomainPtr dom,
int ncpumaps, int ncpumaps,
...@@ -7595,6 +7615,7 @@ static virHypervisorDriver testHypervisorDriver = { ...@@ -7595,6 +7615,7 @@ static virHypervisorDriver testHypervisorDriver = {
.domainGetMaxMemory = testDomainGetMaxMemory, /* 0.1.4 */ .domainGetMaxMemory = testDomainGetMaxMemory, /* 0.1.4 */
.domainSetMaxMemory = testDomainSetMaxMemory, /* 0.1.1 */ .domainSetMaxMemory = testDomainSetMaxMemory, /* 0.1.1 */
.domainSetMemory = testDomainSetMemory, /* 0.1.4 */ .domainSetMemory = testDomainSetMemory, /* 0.1.4 */
.domainSetMemoryFlags = testDomainSetMemoryFlags, /* 5.6.0 */
.domainGetHostname = testDomainGetHostname, /* 5.5.0 */ .domainGetHostname = testDomainGetHostname, /* 5.5.0 */
.domainGetInfo = testDomainGetInfo, /* 0.1.1 */ .domainGetInfo = testDomainGetInfo, /* 0.1.1 */
.domainGetState = testDomainGetState, /* 0.9.2 */ .domainGetState = testDomainGetState, /* 0.9.2 */
...@@ -7611,6 +7632,7 @@ static virHypervisorDriver testHypervisorDriver = { ...@@ -7611,6 +7632,7 @@ static virHypervisorDriver testHypervisorDriver = {
.domainSetVcpusFlags = testDomainSetVcpusFlags, /* 0.8.5 */ .domainSetVcpusFlags = testDomainSetVcpusFlags, /* 0.8.5 */
.domainGetVcpusFlags = testDomainGetVcpusFlags, /* 0.8.5 */ .domainGetVcpusFlags = testDomainGetVcpusFlags, /* 0.8.5 */
.domainPinVcpu = testDomainPinVcpu, /* 0.7.3 */ .domainPinVcpu = testDomainPinVcpu, /* 0.7.3 */
.domainPinVcpuFlags = testDomainPinVcpuFlags, /* 5.6.0 */
.domainGetVcpus = testDomainGetVcpus, /* 0.7.3 */ .domainGetVcpus = testDomainGetVcpus, /* 0.7.3 */
.domainGetVcpuPinInfo = testDomainGetVcpuPinInfo, /* 1.2.18 */ .domainGetVcpuPinInfo = testDomainGetVcpuPinInfo, /* 1.2.18 */
.domainGetMaxVcpus = testDomainGetMaxVcpus, /* 0.7.3 */ .domainGetMaxVcpus = testDomainGetMaxVcpus, /* 0.7.3 */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册