Azure VM waagent:解析 ExtensionsConfig 时出错。无法发送状态报告

Azure VM waagent:解析 ExtensionsConfig 时出错。无法发送状态报告

使用经典模型部署的 OpenLogic Azure CentOS 7.2 VM。

Azure Linux 代理版本: WALinuxAgent-2.0.18

VM 运行良好,但我不知道 waagent 日志中出现的这个错误的来源以及它意味着什么。

启动 waagent 时/var/log/waagent.log报告:

2016/04/24 08:29:42 Finished processing ExtensionsConfig.xml
2016/04/24 08:29:42 ERROR:Error parsing ExtensionsConfig.  Unable to send status reports
2016/04/24 08:29:42 ERROR:Failed to report handler status

然后每 25 秒日志就会获取一次:

2016/04/24 07:44:24 ERROR:Error parsing ExtensionsConfig.  Unable to send status reports
2016/04/24 07:44:24 ERROR:Failed to report handler status

在 waagent 代码中,此错误来自:

# Process our extensions.
if goalState.ExtensionsConfig == None and goalState.ExtensionsConfigXml != None :
    reportHandlerStatusCount = 0 #Reset count when new goal state comes
    goalState.ExtensionsConfig = ExtensionsConfig().Parse(goalState.ExtensionsConfigXml)

# report the status/heartbeat results of extension processing
if goalState.ExtensionsConfig != None :
    ret = goalState.ExtensionsConfig.ReportHandlerStatus()
    if ret != 0:
        Error("Failed to report handler status")
    elif reportHandlerStatusCount % 1000 == 0:
        #Agent report handler status every 25 seconds. Reduce the log entries by adding a count
        Log("Successfully reported handler status")

然后在方法中ReportHAndlerStatus错误来自:

    #agent state
    if provisioned == False:
        if provisionError == None :
            agent_state='Provisioning'
            agent_msg='Guest Agent is starting.'
        else:
            agent_state='Provisioning Error.'
            agent_msg=provisionError
    else:
        agent_state='Ready'
        agent_msg='GuestAgent is running and accepting new configurations.'

    status='{"version":"1.0","timestampUTC":"'+tstamp+'","aggregateStatus":{"guestAgentStatus":{"version":"'+GuestAgentVersion+'","status":"'+agent_state+'","formattedMessage":{"lang":"en-US","message":"'+agent_msg+'"}},"handlerAggregateStatus":['+statuses+']}}'
    try:
        uri=GetNodeTextData(self.Extensions[0].getElementsByTagName("StatusUploadBlob")[0]).replace('&','&')
    except:
        Error('Error parsing ExtensionsConfig.  Unable to send status reports')
        return -1

答案1

您是否在此虚拟机中安装了配置代理?如果您只是安装 walinuxagent 包而不启用配置代理(通过门户或 CLI),则 walinuxagent 的配置将不包含上传状态 blob 的位置。参考“安装”备注这里。简而言之(通过 powershell):

$vm = Get-AzureVM -ServiceName 'MyServiceName' -Name 'MyVMName'
$vm.GetInstance().ProvisionGuestAgent = $true
$vm | Update-AzureVM

相关内容