VMware {code} Community
shar_234
Contributor
Contributor

Adding virtual floppy device as a client device usng SDK2.5

Hi

I was trying to add a virtual floppy object in the new VM that I created using the createVM_task method.

I'm not sure wat value should be se tin the VirtualDeviceConfigSpec or the VirtualFloppyDeviceBackingInfo that would create it as a client device and not a host device.

When we create a VM through VC it typically creates a floppy as a client device only.

Pls let me know how I can do it.

Thanks

Sharada

0 Kudos
1 Reply
njain
Expert
Expert

Hi Sharada,

In order to add a Virtual Floppy Drive as a client device, you need to implement the "VirtualFloppyRemoteDeviceBackingInfo" instead of "VirtualFloppyDeviceBackingInfo" and assign it to the "backing" property of the "VirtualDeviceConfigSpec".

Below is a code snippet from C# that illustrates how to add a floppy drive and the implementation of "VirtualFloppyRemoteDeviceBackingInfo":

>VirtualMachineConfigSpec configSpec = new VirtualMachineConfigSpec();

>

>VirtualDeviceConfigSpec floppySpec = new VirtualDeviceConfigSpec();

>floppySpec.operation = VirtualDeviceConfigSpecOperation.add;

>floppySpec.operationSpecified = true;

>

>VirtualFloppy floppy = new VirtualFloppy();

>VirtualFloppyRemoteDeviceBackingInfo flpRemoteBacking = new VirtualFloppyRemoteDeviceBackingInfo();

>flpRemoteBacking.deviceName = "";

>VirtualDeviceConnectInfo vdConnectInfo = new VirtualDeviceConnectInfo();

>vdConnectInfo.startConnected = false;

>vdConnectInfo.allowGuestControl = true;

>vdConnectInfo.connected = false;

>floppy.backing = flpRemoteBacking;

>floppy.key = -43;

>floppy.connectable = vdConnectInfo;

>

>floppySpec.device = floppy;

>

>VirtualDeviceConfigSpec[] deviceConfigSpec = new VirtualDeviceConfigSpec[1];

>deviceConfigSpec[0] = floppySpec;

>

>configSpec.deviceChange = deviceConfigSpec;

>ManagedObjectReference task = service.ReconfigVMTask(vmRef, configSpec);

The above code snippet would reconfigure the existing VM and add a floppy drive as a client device.

Hope the above information is helpful.

Regards,

Neha

0 Kudos