Monday, January 21, 2019

Cannot connect the virtual device ... because no corresponding device is available on the host

Recently I've been building some VM templates on my MacBook and launching instances of them in VMware. Each time it produced following error:

Cannot connect the virtual device sata0:1 because no corresponding device is available on the host.


Either button caused the guest to boot up. The "No" button ensured that it booted without error on subsequent reboots, while choosing "Yes" allowed me to enjoy the error with each power-on of the guest.

Sata0 is, of course a (virtual) disk controller, and device 1 is an optical drive. I knew that much, but the exact meaning of the error wasn't clear to me, and googling didn't lead to a great explanation.

I wasn't expecting there to be a "corresponding device ... available on the host" because the host has neither a SATA controller nor an optical drive, and no such hardware should be required for my use case, so, what did the error mean?

It turns out that I was producing the template (a .ova file) with the optical drive "connected" (VMware term) to ... something. The issue isn't related to the lack of a device on the host, but that there's no ISO file "inserted" into the virtual drive.

Here's the relevant stanza from the template's .ovf file:

      <Item>
        <rasd:AddressOnParent>1</rasd:AddressOnParent>
        <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
        <rasd:Caption>cdrom1</rasd:Caption>
        <rasd:Description>CD-ROM Drive</rasd:Description>
        <rasd:ElementName>cdrom1</rasd:ElementName>
        <rasd:InstanceID>7</rasd:InstanceID>
        <rasd:Parent>5</rasd:Parent>
        <rasd:ResourceType>15</rasd:ResourceType>

      </Item>

The problem here is the AutomaticaAllocation element. AutomaticAllocation is VMware's "connect at boot" feature, which really boils down to "insert a disk into this virtual drive". Without specifying a backend device and/or file, it can't be connected.

Deleting the element, or setting it to "false" fixes the problem.

AddressOnParent: 1 <- This makes it sata0:1 instead of sata0:0
InstanceID: 7 <- This device is the 8th hardware device defined for the guest
Parent: 5 <- This device is a child of the hardware device at instance id #5 (the sata0)
ResourceType: 15 <- This is an optical drive

No comments:

Post a Comment