VMware {code} Community
edechaux
Contributor
Contributor
Jump to solution

[VI PERL] Move VM between ESX servers and uuid change question

I am writting a script to move VM between two ESX 3.0.1 servers in order to simulate an HA fonctionnality in an environment were VMware HA does not work.

I use UnregisterVM method on the first ESX followed by RegisterVM method on the second ESX server. Everything goes fine except when I power on the VM on the second ESX. The PowerOnVM method does not complete and I the Virtual Center I am asked to either keep or change the VM uuid.

In my case I would like to keep the uuid, but as the PowerOnVM method do complete (read It does not terminate) I can't use the AnswerVM method to unlock the situation.

What can I do to make it work ?

Many thanks.

--

Eric

0 Kudos
1 Solution

Accepted Solutions
jnhall
Enthusiast
Enthusiast
Jump to solution

The need to use ->val to access the value of an enumeration is documented in the Programmer's Guide (formerly User's Guide). It's not that convenient or intuitive syntax-wise, I'll grant.

The values of enumerations can be found in the API reference. For example, TaskInfoState is at:

http://pubs.vmware.com/vi301/sdk/ReferenceGuide/vim.TaskInfo.State.html

Again, it might be nice to have more elegant support for enumerations, but this is what we've got currently. We could use more examples, too, but I think you will see them increase in number over time.

-joseph

View solution in original post

0 Kudos
3 Replies
edechaux
Contributor
Contributor
Jump to solution

Well, I found out by my self, RTFM I would say.

I now use the PowerOnVM_Task method to startup the VM in background which allow my to answer the question.

Just a little advice, the documentation should be more specify about tasks :

  • A view should be created on it in order to be able to use method update_view_data.

  • The task state info must be accessed with the val property : $task_view->info->state->val.

A nice thing to have would also be a hash made of all possible tasks states included in the API :

our %TASK_STATES = { 'SUCCESS' => 'success', 'FAILURE' => 'error' ... };

--

Eric

0 Kudos
jnhall
Enthusiast
Enthusiast
Jump to solution

The need to use ->val to access the value of an enumeration is documented in the Programmer's Guide (formerly User's Guide). It's not that convenient or intuitive syntax-wise, I'll grant.

The values of enumerations can be found in the API reference. For example, TaskInfoState is at:

http://pubs.vmware.com/vi301/sdk/ReferenceGuide/vim.TaskInfo.State.html

Again, it might be nice to have more elegant support for enumerations, but this is what we've got currently. We could use more examples, too, but I think you will see them increase in number over time.

-joseph

0 Kudos
edechaux
Contributor
Contributor
Jump to solution

Thank you for your help. I missed this chapter in the documentation.

0 Kudos