mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
vmx: convert cpuid.coresPerSocket for CPU topology
Convert the cpuid.coresPerSocket key as both number of CPU sockets, and cores per socket. Add the VMX file attached to RHBZ#1568148 as testcase esx-in-the-wild-9; adapt the resulting XML of testcase esx-in-the-wild-8 to the CPU topology present in that VMX. https://bugzilla.redhat.com/show_bug.cgi?id=1568148 Signed-off-by: Pino Toscano <ptoscano@redhat.com> Acked-by: Richard W.M. Jones <rjones@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
b78c9c86da
commit
5cceadcbac
@ -1353,6 +1353,8 @@ virVMXParseConfig(virVMXContext *ctx,
|
||||
long long sharedFolder_maxNum = 0;
|
||||
int cpumasklen;
|
||||
struct virVMXConfigScanResults results = { -1 };
|
||||
long long coresPerSocket = 0;
|
||||
virCPUDefPtr cpu = NULL;
|
||||
|
||||
if (ctx->parseFileName == NULL) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
@ -1516,6 +1518,31 @@ virVMXParseConfig(virVMXContext *ctx,
|
||||
if (virDomainDefSetVcpus(def, numvcpus) < 0)
|
||||
goto cleanup;
|
||||
|
||||
/* vmx:cpuid.coresPerSocket -> def:cpu */
|
||||
if (virVMXGetConfigLong(conf, "cpuid.coresPerSocket", &coresPerSocket, 1,
|
||||
true) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (coresPerSocket > 1) {
|
||||
if (VIR_ALLOC(cpu) < 0)
|
||||
goto cleanup;
|
||||
|
||||
cpu->type = VIR_CPU_TYPE_GUEST;
|
||||
cpu->mode = VIR_CPU_MODE_CUSTOM;
|
||||
|
||||
cpu->sockets = numvcpus / coresPerSocket;
|
||||
if (cpu->sockets <= 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("VMX entry 'cpuid.coresPerSocket' smaller than "
|
||||
"'numvcpus'"));
|
||||
goto cleanup;
|
||||
}
|
||||
cpu->cores = coresPerSocket;
|
||||
cpu->threads = 1;
|
||||
|
||||
VIR_STEAL_PTR(def->cpu, cpu);
|
||||
}
|
||||
|
||||
/* vmx:sched.cpu.affinity -> def:cpumask */
|
||||
/* NOTE: maps to VirtualMachine:config.cpuAffinity.affinitySet */
|
||||
if (virVMXGetConfigString(conf, "sched.cpu.affinity", &sched_cpu_affinity,
|
||||
@ -1881,6 +1908,7 @@ virVMXParseConfig(virVMXContext *ctx,
|
||||
VIR_FREE(sched_cpu_affinity);
|
||||
VIR_FREE(sched_cpu_shares);
|
||||
VIR_FREE(guestOS);
|
||||
virCPUDefFree(cpu);
|
||||
|
||||
return def;
|
||||
}
|
||||
|
@ -10,6 +10,9 @@
|
||||
<os>
|
||||
<type arch='x86_64'>hvm</type>
|
||||
</os>
|
||||
<cpu>
|
||||
<topology sockets='4' cores='2' threads='1'/>
|
||||
</cpu>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
|
72
tests/vmx2xmldata/vmx2xml-esx-in-the-wild-9.vmx
Normal file
72
tests/vmx2xmldata/vmx2xml-esx-in-the-wild-9.vmx
Normal file
@ -0,0 +1,72 @@
|
||||
.encoding = "UTF-8"
|
||||
config.version = "8"
|
||||
virtualHW.version = "10"
|
||||
vmci0.present = "TRUE"
|
||||
svga.vramSize = "8388608"
|
||||
numvcpus = "16"
|
||||
memSize = "16384"
|
||||
sched.cpu.units = "mhz"
|
||||
sched.cpu.latencySensitivity = "normal"
|
||||
tools.upgrade.policy = "manual"
|
||||
scsi0.virtualDev = "lsisas1068"
|
||||
scsi0.present = "TRUE"
|
||||
sata0.present = "TRUE"
|
||||
scsi0:0.deviceType = "scsi-hardDisk"
|
||||
scsi0:0.fileName = "v2v-windows-kkulkarn.vmdk"
|
||||
sched.scsi0:0.shares = "normal"
|
||||
sched.scsi0:0.throughputCap = "off"
|
||||
scsi0:0.present = "TRUE"
|
||||
ethernet0.virtualDev = "vmxnet3"
|
||||
ethernet0.networkName = "VM Network"
|
||||
ethernet0.addressType = "vpx"
|
||||
ethernet0.generatedAddress = "00:50:56:80:b3:81"
|
||||
ethernet0.uptCompatibility = "TRUE"
|
||||
ethernet0.present = "TRUE"
|
||||
floppy0.startConnected = "FALSE"
|
||||
floppy0.clientDevice = "TRUE"
|
||||
floppy0.fileName = "Floppy 0"
|
||||
sata0:0.startConnected = "FALSE"
|
||||
sata0:0.deviceType = "atapi-cdrom"
|
||||
sata0:0.clientDevice = "TRUE"
|
||||
sata0:0.fileName = "CD/DVD drive 0"
|
||||
sata0:0.present = "TRUE"
|
||||
displayName = "v2v-windows-kkulkarn"
|
||||
guestOS = "windows8srv-64"
|
||||
toolScripts.afterPowerOn = "TRUE"
|
||||
toolScripts.afterResume = "TRUE"
|
||||
toolScripts.beforeSuspend = "TRUE"
|
||||
toolScripts.beforePowerOff = "TRUE"
|
||||
tools.syncTime = "FALSE"
|
||||
tools.guest.desktop.autolock = "FALSE"
|
||||
uuid.bios = "42 00 93 72 17 da be 73-77 9d 00 7c cf 1b d2 28"
|
||||
vc.uuid = "50 00 d2 b0 61 6e 61 29-8c 06 82 b0 74 40 a8 71"
|
||||
nvram = "v2v-windows-kkulkarn.nvram"
|
||||
pciBridge0.present = "TRUE"
|
||||
svga.present = "TRUE"
|
||||
pciBridge4.present = "TRUE"
|
||||
pciBridge4.virtualDev = "pcieRootPort"
|
||||
pciBridge4.functions = "8"
|
||||
pciBridge5.present = "TRUE"
|
||||
pciBridge5.virtualDev = "pcieRootPort"
|
||||
pciBridge5.functions = "8"
|
||||
pciBridge6.present = "TRUE"
|
||||
pciBridge6.virtualDev = "pcieRootPort"
|
||||
pciBridge6.functions = "8"
|
||||
pciBridge7.present = "TRUE"
|
||||
pciBridge7.virtualDev = "pcieRootPort"
|
||||
pciBridge7.functions = "8"
|
||||
hpet0.present = "TRUE"
|
||||
scsi0.pciSlotNumber = "160"
|
||||
sata0.pciSlotNumber = "33"
|
||||
vmci0.pciSlotNumber = "32"
|
||||
ethernet0.pciSlotNumber = "192"
|
||||
disk.EnableUUID = "TRUE"
|
||||
migrate.hostLog = "v2v-windows-kkulkarn-1017c46c.hlog"
|
||||
sched.cpu.min = "0"
|
||||
sched.cpu.shares = "normal"
|
||||
sched.mem.min = "0"
|
||||
sched.mem.minSize = "0"
|
||||
sched.mem.shares = "normal"
|
||||
migrate.encryptionMode = "opportunistic"
|
||||
annotation = "MIQ GUID=b55c806d-99b9-4fa5-bbcc-a4de04f822e5"
|
||||
cpuid.coresPerSocket = "4"
|
37
tests/vmx2xmldata/vmx2xml-esx-in-the-wild-9.xml
Normal file
37
tests/vmx2xmldata/vmx2xml-esx-in-the-wild-9.xml
Normal file
@ -0,0 +1,37 @@
|
||||
<domain type='vmware'>
|
||||
<name>v2v-windows-kkulkarn</name>
|
||||
<uuid>42009372-17da-be73-779d-007ccf1bd228</uuid>
|
||||
<description>MIQ GUID=b55c806d-99b9-4fa5-bbcc-a4de04f822e5</description>
|
||||
<memory unit='KiB'>16777216</memory>
|
||||
<currentMemory unit='KiB'>16777216</currentMemory>
|
||||
<vcpu placement='static'>16</vcpu>
|
||||
<cputune>
|
||||
<shares>16000</shares>
|
||||
</cputune>
|
||||
<os>
|
||||
<type arch='x86_64'>hvm</type>
|
||||
</os>
|
||||
<cpu>
|
||||
<topology sockets='4' cores='4' threads='1'/>
|
||||
</cpu>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
<on_crash>destroy</on_crash>
|
||||
<devices>
|
||||
<disk type='file' device='disk'>
|
||||
<source file='[datastore] directory/v2v-windows-kkulkarn.vmdk'/>
|
||||
<target dev='sda' bus='scsi'/>
|
||||
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
|
||||
</disk>
|
||||
<controller type='scsi' index='0' model='lsisas1068'/>
|
||||
<interface type='bridge'>
|
||||
<mac address='00:50:56:80:b3:81'/>
|
||||
<source bridge='VM Network'/>
|
||||
<model type='vmxnet3'/>
|
||||
</interface>
|
||||
<video>
|
||||
<model type='vmvga' vram='8192' primary='yes'/>
|
||||
</video>
|
||||
</devices>
|
||||
</domain>
|
@ -269,6 +269,7 @@ mymain(void)
|
||||
DO_TEST("esx-in-the-wild-6", "esx-in-the-wild-6");
|
||||
DO_TEST("esx-in-the-wild-7", "esx-in-the-wild-7");
|
||||
DO_TEST("esx-in-the-wild-8", "esx-in-the-wild-8");
|
||||
DO_TEST("esx-in-the-wild-9", "esx-in-the-wild-9");
|
||||
|
||||
DO_TEST("gsx-in-the-wild-1", "gsx-in-the-wild-1");
|
||||
DO_TEST("gsx-in-the-wild-2", "gsx-in-the-wild-2");
|
||||
|
Loading…
Reference in New Issue
Block a user