提交 f3a70065 编写于 作者: P Peter Krempa

qemu: Simplify qemuDomainGetEmulatorPinInfo by using virDomainObjGetOneDef

virDomainObjGetOneDef is simpler to use than virDomainObjGetDefs
上级 2881c381
...@@ -5400,7 +5400,6 @@ qemuDomainGetEmulatorPinInfo(virDomainPtr dom, ...@@ -5400,7 +5400,6 @@ qemuDomainGetEmulatorPinInfo(virDomainPtr dom,
{ {
virDomainObjPtr vm = NULL; virDomainObjPtr vm = NULL;
virDomainDefPtr def; virDomainDefPtr def;
virDomainDefPtr targetDef;
int ret = -1; int ret = -1;
int hostcpus; int hostcpus;
virBitmapPtr cpumask = NULL; virBitmapPtr cpumask = NULL;
...@@ -5415,19 +5414,16 @@ qemuDomainGetEmulatorPinInfo(virDomainPtr dom, ...@@ -5415,19 +5414,16 @@ qemuDomainGetEmulatorPinInfo(virDomainPtr dom,
if (virDomainGetEmulatorPinInfoEnsureACL(dom->conn, vm->def) < 0) if (virDomainGetEmulatorPinInfoEnsureACL(dom->conn, vm->def) < 0)
goto cleanup; goto cleanup;
if (virDomainObjGetDefs(vm, flags, &def, &targetDef) < 0) if (!(def = virDomainObjGetOneDef(vm, flags)))
goto cleanup; goto cleanup;
if (def)
targetDef = def;
if ((hostcpus = nodeGetCPUCount()) < 0) if ((hostcpus = nodeGetCPUCount()) < 0)
goto cleanup; goto cleanup;
if (targetDef->cputune.emulatorpin) { if (def->cputune.emulatorpin) {
cpumask = targetDef->cputune.emulatorpin; cpumask = def->cputune.emulatorpin;
} else if (targetDef->cpumask) { } else if (def->cpumask) {
cpumask = targetDef->cpumask; cpumask = def->cpumask;
} else { } else {
if (!(bitmap = virBitmapNew(hostcpus))) if (!(bitmap = virBitmapNew(hostcpus)))
goto cleanup; goto cleanup;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册