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

qemu: hotplug: print correct vcpu when validating hot(un)plug config

The error message would contain first vcpu id after the list of vcpus
selected for modification. To print the proper vcpu id remember the
first vcpu selected to be modified.
上级 c4a4c01e
...@@ -5866,6 +5866,7 @@ qemuDomainVcpuValidateConfig(virDomainDefPtr def, ...@@ -5866,6 +5866,7 @@ qemuDomainVcpuValidateConfig(virDomainDefPtr def,
virDomainVcpuDefPtr vcpu; virDomainVcpuDefPtr vcpu;
size_t maxvcpus = virDomainDefGetVcpusMax(def); size_t maxvcpus = virDomainDefGetVcpusMax(def);
ssize_t next; ssize_t next;
ssize_t firstvcpu = -1;
/* vcpu 0 can't be disabled */ /* vcpu 0 can't be disabled */
if (!state && virBitmapIsBitSet(map, 0)) { if (!state && virBitmapIsBitSet(map, 0)) {
...@@ -5880,13 +5881,17 @@ qemuDomainVcpuValidateConfig(virDomainDefPtr def, ...@@ -5880,13 +5881,17 @@ qemuDomainVcpuValidateConfig(virDomainDefPtr def,
continue; continue;
/* skip vcpus being modified */ /* skip vcpus being modified */
if (virBitmapIsBitSet(map, next)) if (virBitmapIsBitSet(map, next)) {
if (firstvcpu < 0)
firstvcpu = next;
continue; continue;
}
if (vcpu->online && vcpu->hotpluggable == VIR_TRISTATE_BOOL_NO) { if (vcpu->online && vcpu->hotpluggable == VIR_TRISTATE_BOOL_NO) {
virReportError(VIR_ERR_INVALID_ARG, virReportError(VIR_ERR_INVALID_ARG,
_("vcpu '%zd' can't be modified as it is followed " _("vcpu '%zd' can't be modified as it is followed "
"by non-hotpluggable online vcpus"), next); "by non-hotpluggable online vcpus"), firstvcpu);
return -1; return -1;
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册