VMware Cloud Community
koyadume
Contributor
Contributor

vRA Guest agent stops after executing CustomizeOS task

I am using vRA 7.3.1 (build 8004226). I have created a CentOS 7 template in vcenter and installed vra guest agent on it. However when I place a request for a centos composite blueprint, it executes CustomizeOS task and nothing happens after that. Here are last few lines from GuestAgent.log file -

2018-07-18 13:37:54 Application: [Information] vrm.proxyagent.uri -> https://fe-vra-iaas.fe.local/VMPS2Proxy

2018-07-18 13:37:54 Application: [Information] Executing '10_set_hostname.sh' ...

2018-07-18 13:37:54 Application: [Information] Wait for completion of '10_set_hostname.sh'

2018-07-18 13:37:54 Application: [Information] Executing '20_static_ip.sh' ...

2018-07-18 13:37:54 Application: [Information] Wait for completion of '20_static_ip.sh'

2018-07-18 13:37:55 Application: [Information] Executing '30_DiskSetup.sh' ...

2018-07-18 13:37:55 Application: [Information] Wait for completion of '30_DiskSetup.sh'

2018-07-18 13:37:55 Application: [Information] Executing '40_external_script.sh' ...

2018-07-18 13:37:55 Application: [Information] Wait for completion of '40_external_script.sh'

2018-07-18 13:37:55 Application: [Information] <workItemResponse id="eb77a8f7-5369-435b-bac3-7da6e514f4df">

        <task type="CustomizeOS">

                <result succeeded="true">

                        <message/>

                </result>

        </task>

</workItemResponse>

2018-07-18 13:37:55 Application: [Information] Successfully sent the work item response for id=eb77a8f7-5369-435b-bac3-7da6e514f4df

2018-07-18 13:37:55 Application: [Information] /usr/share/gugent/config.xml

2018-07-18 13:37:55 Application: [Information] found termination node

2018-07-18 13:37:55 Application: [Debug] Uninitializing subsystem: Logging Subsystem

At this point if I run /usr/share/gugent/rungugent.sh script explicitly, it executes next task (Finalize) but again it stops before reporting this task as complete to vRA and I can see that workitem.xml is still there in site folder.

What could be the reason behind this behaviour and how to debug this?

Tags (2)
7 Replies
daphnissov
Immortal
Immortal

What are you using the guest agent to perform and how are you going about doing so? If you're simply using the clone workflow to deploy from template, you don't need to invoke the guest agent unless you have specific tasks for which it's required.

Reply
0 Kudos
koyadume
Contributor
Contributor

I want to update hostname and ip address of cloned VM with the values supplied in workitem.xml by vRA.

I can see that guest agent comes with a number of scripts which can be found under /usr/share/gugent/site folder. Some of these scripts updates hostname and ip address after parsing workitem.xml and reading custom properties for these two. I can see that hostname and ip address is getting updated successfully but for some reason guest agent gets struck after that and does not report task completion to vRA.

Reply
0 Kudos
daphnissov
Immortal
Immortal

You don't need the guest agent for that, you need a vCenter customization spec. Hostname and IP address from vRA are populated in the customization spec which is then sent down to the VM.

Reply
0 Kudos
koyadume
Contributor
Contributor

Thanks for your input.

It works if I use vsphere customization spec and vRA network profile with or without having guest agent on OS template. But I am wondering why guest agent could not report the task completed to vRA after executing CustomizeOS task? As mentioned in my previous comment guest agent should be able to update hostname and ip address using a number of scripts available under site/CustomizeOS folder otherwise not sure what is the purpose behind having those scripts.

I also found that it is executing CustomizeOS task even though value of CustomizeOS property is false in config.xml file.

<Property id="CustomizeOS">False</Property>

Reply
0 Kudos
daphnissov
Immortal
Immortal

You're not understanding how the guest agent is invoked and its purpose. It runs those stages and if the workitems are false it essentially does nothing. The CustomizeOS phase is for more than cloning as there are different provisioning workflows. As I said earlier, if you're trying to use the guest agent just to set hostname and IP in a clone provisioning workflow, you're doing it wrong. Use a vSphere Customization Spec as that's all you need.

Reply
0 Kudos
koyadume
Contributor
Contributor

As mentioned in my last comment, my problem of updating hostname and ip address is resolved. So I have crossed that stage and trying to understand what all things I can use guest agent for and how to debug any issue related to guest agent. In this case I was able to use an alternative but if I use it for something where there is no alternative, it should be possible to debug why the agent did not work as expected and left no trace in any of the log files.

Can you give me an example where I can use ONLY guest agent and nothing (e.g. vcenter etc) else?

It runs those stages and if the workitems are false it essentially does nothing

If you look at my last comment carefully, I mentioned that it is executing CustomizeOS stage even though value of CustomizeOS flag is set as false in config.xml. So it contradicts you statement and seems to be a bug.

I had gone through a lot of information available in the public domain to understand the behaviour of guest agent but I don't think any article (including official documentation) mentions about config.xml file. Also I have gone through many files available under /usr/share/gugent as I try to run this agent on newer (and unsupported) versions of ubuntu (16.04 and 18.04). So I believe I understand more than what is available in public domain on this agent.

Reply
0 Kudos
daphnissov
Immortal
Immortal

This is a complex subject with multiple answers. To answer some specific questions

Can you give me an example where I can use ONLY guest agent and nothing (e.g. vcenter etc) else?

Adding drives and bringing them online in a blueprint using the clone workflow is one example. Running guest scripts and passing parameters is another.

If you'd like more information on the capabilities of the guest agent, I'd recommend you read my 3-part blog series below in which I dive into this and even provide a unique enhancement for the guest agent on Linux.

Adding Machine Requestor to Local Administrators Group in vRA 7

Running in-guest scripts on Windows VMs in vRA 7

Running Bash commands in the Linux guest agent in vRA 7