Hi, I am trying to vmotion a VM between two hosts in the same cluster.
vmmigrate.pl requires a "--targetpool" option to be specified.
Unfortunately ALL my clusters have the same Resource Pools names so I keep getting:
Resource pool <Build> not unique.
Doea anyone know how to get around this? I cannot change the Resource Pools naming conventions unfortunately..
As this is only a test I could create a test Resource Pool and then delete it. Is there a tool to do that or do I need to code it?
Thank you...
vmmigrate.pl looks like it followos all the steps to do a migration, but the information that gets from the HostUtil.pm module is not correct.
That is the module that needs to be tweaked.
That script is a little problematic.
I had to hack it to make it work.
I have fixed the resource problem that you have, but I am still hacking other things that does not work, as migration another datastore, when the datastore is shared among different ESX.
This is the diff of the code I changed in apps/AppUtil/HostUtil.pm.
I have not considered side effects of my changes, but at least it works for vmmigrate.pl to resolve the resource problem you and I have.
-Francisco
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
diff apps/AppUtil/HostUtil.pm vmware-viperl-distrib/apps/AppUtil/HostUtil.pm
164d163
< #Fix line
166c165
< filter => {name => "^$pool_name\$"});
---
> filter => {name => $pool_name});
169,170d167
< my $cluster;
< my $morer;
176c173,174
< Util::trace(1, "Resource pool $#{$target_pool} : <$pool_name> not unique.\n");
---
> Util::trace(0, "Resource pool <$pool_name> not unique.\n");
> return (foundhost => $found_host, mor => $mor);
182,196c180,190
< $pool_owner = Vim::get_view(mo_ref => $pool_owner);
< $cluster = $pool_owner->name;
< Util::trace(1, "Resource pool: <$pool_name> Cluster: $cluster.\n");
< if(defined $pool_owner->host) {
< my $host_mor_array = $pool_owner->host;
< my $host_array = Vim::get_views(mo_ref_array => $host_mor_array);
<
< foreach (@$host_array) {
< if ($_->name eq $targethost) {
< $found_host = 1;
< $morer = $mor;
< Util::trace(1, "Found target host $targethost.\n");
< }
< }
< }
---
> }
> $pool_owner = Vim::get_view(mo_ref => $pool_owner);
> if(defined $pool_owner->host) {
> my $host_mor_array = $pool_owner->host;
> my $host_array = Vim::get_views(mo_ref_array => $host_mor_array);
>
> foreach (@$host_array) {
> if ($_->name eq $targethost) {
> $found_host = 1;
> }
> }
199c193
< Util::trace(0, "Specified Resource pool not belongs to Target Host\n");
---
> Util::trace(0, "Specified Resource pool not belongs to Target Host");
201c195
< return (foundhost => $found_host, mor => $morer);
---
> return (foundhost => $found_host, mor => $mor);
229d222
< Util::trace(1, "Found Datastore name in target: $name\n");
242d234
< Util::trace(1, "Source Datastore name: $name\n");
245d236
< Util::trace(1, "Found Target Datastore name in source: $name\n");
That would be fantastic..but it looks like we are trying to make two different versions work OR I am not very good at interpreting the diif output..do you mind posting your complete script? Many Thanks.
Find attached teh script I am working on, with the Resource issue patched.
For me it looks like on these modules it is not considered that different clusters and ESX can have resources or datastores with the same name.
BTW: I am not sure what I did on the posting that I can replay properly. I hope this will work.
-Francisco
Ok many thanks for that! I now know: we were working on different scripts (I was working on the vmmigrate.pl one) and I cannto get your script to work, isn't it just a monitoring/reporting script? Thanks for your help so far..
bauzo.
vmmigrate.pl looks like it followos all the steps to do a migration, but the information that gets from the HostUtil.pm module is not correct.
That is the module that needs to be tweaked.
This works a treat: many thanks!