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. --- src/vmx/vmx.c | 25 ++++++++++++++++++++++ tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-1.vmx | 13 +++++++++++ tests/xml2vmxdata/xml2vmx-ws-in-the-wild-1.vmx | 13 +++++++++++ tests/xml2vmxdata/xml2vmx-ws-in-the-wild-2.vmx | 13 +++++++++++ 4 files changed, 64 insertions(+) diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c index f729e5d..5b98dac 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -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,7 @@ 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) { @@ -3298,6 +3300,7 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virDomainDe } } + for (i = 0; i < def->ndisks; ++i) { switch (def->disks[i]->device) { case VIR_DOMAIN_DISK_DEVICE_DISK: @@ -3380,6 +3383,28 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virDomainDe goto cleanup; } + if (virtualHW_version >= 7) { + if (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; diff --git a/tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-1.vmx b/tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-1.vmx index 5693210..ab09bc9 100644 --- a/tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-1.vmx +++ b/tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-1.vmx @@ -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" diff --git a/tests/xml2vmxdata/xml2vmx-ws-in-the-wild-1.vmx b/tests/xml2vmxdata/xml2vmx-ws-in-the-wild-1.vmx index 4211a67..acdf772 100644 --- a/tests/xml2vmxdata/xml2vmx-ws-in-the-wild-1.vmx +++ b/tests/xml2vmxdata/xml2vmx-ws-in-the-wild-1.vmx @@ -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" diff --git a/tests/xml2vmxdata/xml2vmx-ws-in-the-wild-2.vmx b/tests/xml2vmxdata/xml2vmx-ws-in-the-wild-2.vmx index ad68df9..5086605 100644 --- a/tests/xml2vmxdata/xml2vmx-ws-in-the-wild-2.vmx +++ b/tests/xml2vmxdata/xml2vmx-ws-in-the-wild-2.vmx @@ -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" -- 2.7.4 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list