- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
#!/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";