Hello,
I've a script that limits disks io of all VMs. With upgrade to 5.5 Ux, that doesn'nt work anymore.
my $io_alloc = StorageIOAllocationInfo->new (shares => $sharesInfo, limit=> "10");
$device->storageIOAllocation ($io_alloc);
my $virtualDeviceConfigSpec = VirtualDeviceConfigSpec->new (device => $device, operation => VirtualDeviceConfigSpecOperation->new('edit'));
my $vmConfig = VirtualMachineConfigSpec->new (deviceChange => [$virtualDeviceConfigSpec]);
$vm->ReconfigVM (spec => $vmConfig);
I'm getting the following error:
SOAP Fault:
-----------
Fault string: Ein angegebener Parameter war nicht korrekt.
spec.sharesInfo.limit
Why is there any problem with shares?
I think that's a bug. Now I'm unable to set the disk io limit.
Any ideas, tricks oder workarounds?
Thanks!
Regards,
Alex
Don't have the cycles to test, but try the PrimType in case the 5.5 API parser is sensitive to the soap XSD type:
my $io_alloc = StorageIOAllocationInfo->new (shares => $sharesInfo, limit=> PrimType->new(10, 'long'));
$device->storageIOAllocation ($io_alloc);
my $virtualDeviceConfigSpec = VirtualDeviceConfigSpec->new (device => $device, operation => VirtualDeviceConfigSpecOperation->new('edit'));
my $vmConfig = VirtualMachineConfigSpec->new (deviceChange => [$virtualDeviceConfigSpec]);
$vm->ReconfigVM (spec => $vmConfig);
If that doesn't work, I'll see if I can reproduce it in my lab environment, but always possible it's a bug.
Now I'm getting the following error:
Cannot parse "PrimType=HASH(0x3330340)" as a long value
Further ideas?
Looks like it didn't serialize? (assuming your error is coming from the API vs the SDK)
Maybe try to pull it out, then pass it in?
$long_type = PrimType->new(10, 'long');
my $io_alloc = StorageIOAllocationInfo->new (shares => $sharesInfo, limit => $long_type );
$device->storageIOAllocation ($io_alloc);
my $virtualDeviceConfigSpec = VirtualDeviceConfigSpec->new (device => $device, operation => VirtualDeviceConfigSpecOperation->new('edit'));
my $vmConfig = VirtualMachineConfigSpec->new (deviceChange => [$virtualDeviceConfigSpec]);
$vm->ReconfigVM (spec => $vmConfig);
I'll give it a pass later to see what's going on. Shouldn't be seeing the HASH value, should be serialized by the SDK into a proper SOAP XSD value of type 'long'.
Also tried that this morning.
Same error ![]()
I took another look at this, I think you added the limit property to your sharesInfo object. The object sharesInfo only has two properties: level & shares. Sorry to spin the thread out in another direction, the problem was actually simpler
I tested it with a proper sharesInfo object and it worked.
Could you post your solution?
#!/usr/bin/perl
use strict;
use warnings;
use VMware::VIRuntime;
use Data::Dumper;
Opts::parse();
Opts::validate();
Util::connect();
my $vms = Vim::find_entity_views(
view_type => 'VirtualMachine',
properties => ['config.hardware.device', 'name']
);
my $vm = $vms->[0];
my @disks = grep { $_->isa('VirtualDisk') } @{$vm->{'config.hardware.device'}};
my $disk = $disks[0];
my $sharesInfo = new SharesInfo(
level => new SharesLevel("custom"),
shares => 4000
);
my $io_alloc = StorageIOAllocationInfo->new(
shares => $sharesInfo,
limit => "10"
);
$disk->storageIOAllocation($io_alloc);
my $virtualDeviceConfigSpec = VirtualDeviceConfigSpec->new (device => $disk, operation => VirtualDeviceConfigSpecOperation->new('edit'));
my $vmConfig = VirtualMachineConfigSpec->new (deviceChange => [$virtualDeviceConfigSpec]);
$vm->ReconfigVM (spec => $vmConfig);
print "VM " . $vm->{'name'} . " reconfigured\n";
Which vsphere version are you using?
I've cut&pasted this script 1:1 and again the following error:
SOAP Fault:
-----------
Fault string: Ein angegebener Parameter war nicht korrekt.
spec.sharesInfo.limit
Fault detail: InvalidArgument
My script worked with vsphere 5.1, but with 5.5 (U2 or above) it doesn't - maybe you have 5.1?
I'm on vSphere 5.5u2d (VCSA Sim)
5.5 U2b (218311) here ...
Strange stuff. Maybe it works with U2d again ...
Perhaps, can't say I remember calling it on a specific version.
However, the error you're posting still seems to indicate there is the 'limit' property in the SharesInfo object. You just copied and pasted it in? Perhaps you are using an older VIPerl SDK version (like 5.1)?
No, newest version (build-2043780)
Yeah, not sure. From the error message it seems to be complaining about a property that shouldn't be set on SharesInfo, but if you copy-pasted my example, not sure where it's picking it up or why it's bombing out there. You could add '--verbose' to the script command line and review the XML that's going out. If you post it up I can look at it.
