norisnetwork
Enthusiast
Enthusiast

IO Limit Disks Bug?

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

Reply
0 Kudos
stumpr
Virtuoso
Virtuoso

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.

Reuben Stump | http://www.virtuin.com | @ReubenStump
Reply
0 Kudos
norisnetwork
Enthusiast
Enthusiast

Now I'm getting the following error:

Cannot parse "PrimType=HASH(0x3330340)" as a long value

Further ideas?

Reply
0 Kudos
stumpr
Virtuoso
Virtuoso

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'.

Reuben Stump | http://www.virtuin.com | @ReubenStump
Reply
0 Kudos
norisnetwork
Enthusiast
Enthusiast

Also tried that this morning.

Same error Smiley Sad

Reply
0 Kudos
stumpr
Virtuoso
Virtuoso

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 Smiley Sad  I tested it with a proper sharesInfo object and it worked.

Reuben Stump | http://www.virtuin.com | @ReubenStump
Reply
0 Kudos
norisnetwork
Enthusiast
Enthusiast

Could you post your solution?

Reply
0 Kudos
stumpr
Virtuoso
Virtuoso

#!/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";

Reuben Stump | http://www.virtuin.com | @ReubenStump
Reply
0 Kudos
norisnetwork
Enthusiast
Enthusiast

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?

Reply
0 Kudos
stumpr
Virtuoso
Virtuoso

I'm on vSphere 5.5u2d (VCSA Sim)

Reuben Stump | http://www.virtuin.com | @ReubenStump
Reply
0 Kudos
norisnetwork
Enthusiast
Enthusiast

5.5 U2b (218311) here ...

Strange stuff. Maybe it works with U2d again ...

Reply
0 Kudos
stumpr
Virtuoso
Virtuoso

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)?

Reuben Stump | http://www.virtuin.com | @ReubenStump
Reply
0 Kudos
norisnetwork
Enthusiast
Enthusiast

No, newest version (build-2043780)

Reply
0 Kudos
stumpr
Virtuoso
Virtuoso

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.

Reuben Stump | http://www.virtuin.com | @ReubenStump
Reply
0 Kudos