提交 2b89f1d8 编写于 作者: D Dawid Zamirski 提交者: Matthias Bolte

esx: add pciBridge devices when SCSI is used

When a SCSI controller is present, ESX adds several pciBridge devices
to vmx file. This fixes an error message where it refuses to create VM
due to not enough PCI devices available. This applies only to virtualHW
version >= 7.
上级 4d100c7a
......@@ -3082,6 +3082,7 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virDomainDe
int scsi_virtualDev[4] = { -1, -1, -1, -1 };
bool floppy_present[2] = { false, false };
unsigned int maxvcpus;
bool hasSCSI = false;
if (ctx->formatFileName == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
......@@ -3288,6 +3289,8 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virDomainDe
for (i = 0; i < 4; ++i) {
if (scsi_present[i]) {
hasSCSI = true;
virBufferAsprintf(&buffer, "scsi%zu.present = \"true\"\n", i);
if (scsi_virtualDev[i] != -1) {
......@@ -3380,6 +3383,26 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virDomainDe
goto cleanup;
}
if (virtualHW_version >= 7 && hasSCSI) {
virBufferAddLit(&buffer, "pciBridge0.present = \"true\"\n");
virBufferAddLit(&buffer, "pciBridge4.present = \"true\"\n");
virBufferAddLit(&buffer, "pciBridge4.virtualDev = \"pcieRootPort\"\n");
virBufferAddLit(&buffer, "pciBridge4.functions = \"8\"\n");
virBufferAddLit(&buffer, "pciBridge5.present = \"true\"\n");
virBufferAddLit(&buffer, "pciBridge5.virtualDev = \"pcieRootPort\"\n");
virBufferAddLit(&buffer, "pciBridge5.functions = \"8\"\n");
virBufferAddLit(&buffer, "pciBridge6.present = \"true\"\n");
virBufferAddLit(&buffer, "pciBridge6.virtualDev = \"pcieRootPort\"\n");
virBufferAddLit(&buffer, "pciBridge6.functions = \"8\"\n");
virBufferAddLit(&buffer, "pciBridge7.present = \"true\"\n");
virBufferAddLit(&buffer, "pciBridge7.virtualDev = \"pcieRootPort\"\n");
virBufferAddLit(&buffer, "pciBridge7.functions = \"8\"\n");
}
/* Get final VMX output */
if (virBufferCheckError(&buffer) < 0)
goto cleanup;
......
......@@ -28,3 +28,16 @@ ethernet1.addressType = "generated"
ethernet1.generatedAddress = "00:0c:29:3b:64:f4"
ethernet1.generatedAddressOffset = "0"
svga.vramSize = "4194304"
pciBridge0.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"
......@@ -20,3 +20,16 @@ ethernet0.addressType = "static"
ethernet0.address = "00:90:b9:dc:ea:81"
ethernet0.checkMACAddress = "false"
svga.vramSize = "4194304"
pciBridge0.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"
......@@ -20,3 +20,16 @@ ethernet0.addressType = "static"
ethernet0.address = "00:90:b9:dc:ea:81"
ethernet0.checkMACAddress = "false"
svga.vramSize = "4194304"
pciBridge0.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"
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册