Chiqos
Contributor
Contributor

Adding new SCSI controller: "Fault string: Invalid operation for device '0'."

Jump to solution

Hello,

I have an issue when I try to add a SCSI controller to a virtual machine.

I have this error:

Fault string: Invalid operation for device '0'.

Fault detail: InvalidDeviceOperation

Here is my code:

my $info = Description->new(label => "SCSI Controller 2", summary => "LSI Logic Parallel");

my $controller = VirtualLsiLogicController->new(

                deviceInfo => $info,

                scsiCtlrUnitNumber => '7',

                sharedBus => VirtualSCSISharing->new('noSharing'),

                busNumber => -1,

                key => -1,

                backing => $backing_info,

                controllerKey => 100,

                );

my $devspec = VirtualDeviceConfigSpec->new(operation => VirtualDeviceConfigSpecOperation->new('add'),

                device => $controller ,

                fileOperation => VirtualDeviceConfigSpecFileOperation->new('create'),

                );

my $vmspec = VirtualMachineConfigSpec->new(deviceChange => [$devspec] );

eval {

        $vm_view->ReconfigVM( spec => $vmspec );

        Util::trace(0,"Controller has been created.\n");

};

I don't know how to handle it, or even how to troubleshoot.

Any ideas would be greatly appreciated.

Regards,

Jeremy

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
Chiqos
Contributor
Contributor

I finally found a solution.

It seems it fails if you give some parameter marked as mandatory (scsiCtlrUnitNumber, hotAddRemove)... Theses parameters seem to be automatically defined, a dump of the device will show that.

Here is the code used:

my $controller_spec =

                VirtualDeviceConfigSpec->new(   device => VirtualLsiLogicController->new(       key => 0,

                                        device => [0],

                                        busNumber => $scsi_controller,

                                        sharedBus => VirtualSCSISharing->new('noSharing')),

                                operation => VirtualDeviceConfigSpecOperation->new( 'add' ) );

        my $vmspec = VirtualMachineConfigSpec->new(deviceChange => [$controller_spec] );

        eval {

                $vm_view->ReconfigVM( spec => $vmspec );

        };

View solution in original post

0 Kudos
1 Reply
Chiqos
Contributor
Contributor

I finally found a solution.

It seems it fails if you give some parameter marked as mandatory (scsiCtlrUnitNumber, hotAddRemove)... Theses parameters seem to be automatically defined, a dump of the device will show that.

Here is the code used:

my $controller_spec =

                VirtualDeviceConfigSpec->new(   device => VirtualLsiLogicController->new(       key => 0,

                                        device => [0],

                                        busNumber => $scsi_controller,

                                        sharedBus => VirtualSCSISharing->new('noSharing')),

                                operation => VirtualDeviceConfigSpecOperation->new( 'add' ) );

        my $vmspec = VirtualMachineConfigSpec->new(deviceChange => [$controller_spec] );

        eval {

                $vm_view->ReconfigVM( spec => $vmspec );

        };

0 Kudos