#endif
/*
- * Define what guest info types and nic info versions could be sent
- * to update nic info at VMX. The order defines a sequence of fallback
- * paths to provide backward compatibility for ESX running with nic
- * info version older than the guest OS.
+ * Define what guest info types and NIC info versions could be sent to update
+ * the NIC info in the VMX. The order defines a sequence of fallback paths to
+ * provide backward compatibility for ESX running with NIC info version older
+ * than the guest OS.
*/
typedef enum NicInfoMethod {
NIC_INFO_V3_WITH_INFO_IPADDRESS_V3,
GuestInfoType infoType,
void *info,
size_t infoSize);
-static Bool SetGuestInfo(ToolsAppCtx *ctx, GuestInfoType key,
+static Bool SetGuestInfo(ToolsAppCtx *ctx,
+ GuestInfoType key,
const char *value);
static void SendUptime(ToolsAppCtx *ctx);
static Bool DiskInfoChanged(const GuestDiskInfo *diskInfo);
static void GuestInfoClearCache(void);
static GuestNicList *NicInfoV3ToV2(const NicInfoV3 *infoV3);
-static void TweakGatherLoops(ToolsAppCtx *ctx, gboolean enable);
+static void TweakGatherLoops(ToolsAppCtx *ctx,
+ gboolean enable);
/*
******************************************************************************
- * GuestInfoVMSupport -- */ /**
+ * GuestInfoVMSupport --
*
* Launches the vm-support process. Data returned asynchronously via RPCI.
*
/*
******************************************************************************
- * GuestInfoCheckIfRunningSlow -- */ /**
+ * GuestInfoCheckIfRunningSlow --
*
* Checks the time when the guestInfo was last collected.
* Logs a warning message and sends a RPC message to the VMX if
if (!RpcChannel_Send(ctx->rpc, rpcMsg, strlen(rpcMsg) + 1,
NULL, NULL)) {
- g_warning("%s: Error sending rpc message.\n", __FUNCTION__);
+ g_warning("%s: Error sending RPC message.\n", __FUNCTION__);
}
g_warning("%s", msg);
/*
******************************************************************************
- * GuestInfoSetConfigList -- */ /**
+ * GuestInfoSetConfigList --
*
* Gets a list setting from the config, and sets the list pointed to by pList.
*
configName, defaultValue);
if (g_strcmp0(listString, *pCachedValue) != 0) {
gchar **list = NULL;
+
if (listString != NULL && listString[0] != '\0') {
list = g_strsplit(listString, ",", 0);
}
/*
* ****************************************************************************
- * GuestInfoResetNicPrimaryList -- */ /**
+ * GuestInfoResetNicPrimaryList --
*
* Gets primary-nics setting from the config, and sets the list of primary
* patterns.
/*
* ****************************************************************************
- * GuestInfoResetNicLowPriorityList -- */ /**
+ * GuestInfoResetNicLowPriorityList --
*
* Gets low-priority-nics setting from the config, and sets the list of low
* priority patterns.
/*
* ****************************************************************************
- * GuestInfoResetNicExcludeList -- */ /**
+ * GuestInfoResetNicExcludeList --
*
* Gets exclude-nics setting from the config, and sets the list of exclude
* patterns.
* this message. Continue, if thats the case.
*/
- g_warning("Failed to update VMDB with tools version.\n");
+ g_warning("Failed to update the VMX with tools version.\n");
}
/* Check for manual override of guest information in the config file */
CONFGROUPNAME_GUESTOSINFO,
CONFNAME_GUESTOSINFO_SHORTNAME,
NULL);
+
osNameFullOverride = VMTools_ConfigGetString(ctx->config,
CONFGROUPNAME_GUESTOSINFO,
CONFNAME_GUESTOSINFO_LONGNAME,
/* Only use override if at least the short OS name is provided */
if (osNameOverride == NULL) {
Bool sendOsNames = FALSE;
- static Bool sendStructuredOsInfo = FALSE;
+ Bool sendStructuredOsInfo = FALSE;
char *osName = NULL;
char *osFullName = NULL;
char *structuredString = NULL;
structuredString = Hostinfo_GetOSStructuredString();
}
if (structuredString == NULL) {
+ g_message("No structured data.\n");
sendOsNames = TRUE;
sendStructuredOsInfo = FALSE;
} else {
if (GuestInfoUpdateVMX(ctx, INFO_OS_STRUCTURED, structuredInfoHeader,
infoSize)) {
- g_debug("Structured OS info sent successfully.\n");
GuestInfoFreeStructuredInfo(gInfoCache.structuredOSInfo);
gInfoCache.structuredOSInfo = structuredInfoHeader;
+ g_debug("Structured OS info sent successfully.\n");
} else {
/* Only send the OS Name if the VMX failed to receive the
* structured os info. */
sendStructuredOsInfo = FALSE;
sendOsNames = TRUE;
- g_warning("Failed to update VMX for structured OS info\n");
+ g_debug("Structured OS info was not sent successfully.\n");
}
}
g_warning("Failed to get OS info.\n");
} else {
if (!GuestInfoUpdateVMX(ctx, INFO_OS_NAME_FULL, osFullName, 0)) {
- g_warning("Failed to update VMDB\n");
+ g_warning("Failed to update INFO_OS_NAME_FULL\n");
}
}
if (osName == NULL) {
g_warning("Failed to get OS info.\n");
} else {
if (!GuestInfoUpdateVMX(ctx, INFO_OS_NAME, osName, 0)) {
- g_warning("Failed to update VMDB\n");
+ g_warning("Failed to update INFO_OS_NAME\n");
}
}
}
(osNameFullOverride == NULL) ? "" :
osNameFullOverride,
0)) {
- g_warning("Failed to update VMDB\n");
+ g_warning("Failed to send INFO_OS_NAME_FULL\n");
}
g_free(osNameFullOverride);
if (!GuestInfoUpdateVMX(ctx, INFO_OS_NAME, osNameOverride, 0)) {
- g_warning("Failed to update VMDB\n");
+ g_warning("Failed to send INFO_OS_NAME\n");
}
g_free(osNameOverride);
g_debug("Using values in tools.conf to override OS Name.\n");
GuestInfo_FreeDiskInfo(gInfoCache.diskInfo);
gInfoCache.diskInfo = diskInfo;
} else {
- g_warning("Failed to update VMDB\n.");
+ g_warning("Failed to update INFO_DISK_FREE_SPACE\n.");
GuestInfo_FreeDiskInfo(diskInfo);
}
}
if (!System_GetNodeName(sizeof name, name)) {
g_warning("Failed to get netbios name.\n");
} else if (!GuestInfoUpdateVMX(ctx, INFO_DNS_NAME, name, 0)) {
- g_warning("Failed to update VMDB.\n");
+ g_warning("Failed to update INFO_DNS_NAME.\n");
}
/* Get NIC information. */
if (!GuestInfo_GetNicInfo(maxIPv4RoutesToGather,
maxIPv6RoutesToGather,
&nicInfo)) {
- g_warning("Failed to get nic info.\n");
+ g_warning("Failed to get NIC info.\n");
/*
- * Return an empty nic info.
+ * Return an empty NIC info.
*/
nicInfo = Util_SafeCalloc(1, sizeof (struct NicInfoV3));
}
/*
- * We need to check if the setting for the primary interfaces or
- * low priority nics have changed, because
- * GuestInfo_IsEqual_NicInfoV3 does not detect a change in the
- * order.
+ * We need to check if the setting for the primary interfaces or low
+ * priority NICs have changed, because GuestInfo_IsEqual_NicInfoV3 does not
+ * detect a change in the order.
*/
if (!primaryChanged && !lowPriorityChanged &&
GuestInfo_IsEqual_NicInfoV3(nicInfo, gInfoCache.nicInfo)) {
- g_debug("Nic info not changed.\n");
+ g_debug("NIC info not changed.\n");
GuestInfo_FreeNicInfo(nicInfo);
} else if (GuestInfoUpdateVMX(ctx, INFO_IPADDRESS, nicInfo, 0)) {
/*
GuestInfo_FreeNicInfo(gInfoCache.nicInfo);
gInfoCache.nicInfo = nicInfo;
} else {
- g_warning("Failed to update VMDB.\n");
+ g_warning("Failed to update INFO_IPADDRESS.\n");
GuestInfo_FreeNicInfo(nicInfo);
}
- /* Send the uptime to VMX so that it can detect soft resets. */
+ /* Send the uptime to the VMX so that it can detect soft resets. */
SendUptime(ctx);
return TRUE;
/*
******************************************************************************
- * GuestInfoSendNicInfoXdr -- */ /**
+ * GuestInfoSendNicInfoXdr --
*
- * Push updated nic info to VMX using XDR data format.
+ * Push updated nic info to the VMX using XDR data format.
*
* @param[in] ctx Application context.
* @param[in] message The protocol for a 'nic info' message.
goto exit;
}
- /* Write preamble and serialized nic info to XDR stream. */
+ /* Write preamble and serialized NIC info to XDR stream. */
if (!DynXdr_AppendRaw(&xdrs, request, strlen(request)) ||
!xdr_GuestNicProto(&xdrs, message)) {
- g_warning("Error serializing nic info v%d data.", message->ver);
+ g_warning("Error serializing NIC info v%d data.", message->ver);
} else {
status = RpcChannel_Send(ctx->rpc, DynXdr_Get(&xdrs), xdr_getpos(&xdrs),
&reply, &replyLen);
/*
******************************************************************************
- * GuestInfoSendData -- */ /**
+ * GuestInfoSendData --
*
* Push GuestInfo information to the VMX. So far, it is mainly used to
- * send the fixed nic info V1 data.
+ * send the fixed NIC info V1 data.
*
* @param[in] ctx Application context.
* @param[in] info Guest information data.
/*
******************************************************************************
- * GuestInfoSendNicInfo -- */ /**
+ * GuestInfoSendNicInfo --
*
- * Push updated nic info to the VMX. Take care of failed transmissions or
+ * Push updated NIC info to the VMX. Take care of failed transmissions or
* unknown guest information types. Use a fixed sequence of fallback paths
* to retry.
*
}
{
GuestNicList *nicList = NicInfoV3ToV2(info64);
+
message.ver = NIC_INFO_V2;
message.GuestNicProto_u.nicsV2 = nicList;
if (GuestInfoSendNicInfoXdr(ctx, &message, INFO_IPADDRESS_V2)) {
case NIC_INFO_V1_WITH_INFO_IPADDRESS:
{
GuestNicInfoV1 infoV1;
+
GuestInfoConvertNicInfoToNicInfoV1(info, &infoV1);
if (GuestInfoSendData(ctx, &infoV1, sizeof(infoV1),
INFO_IPADDRESS)) {
#endif
static Bool
-GuestInfoUpdateVMX(ToolsAppCtx *ctx, // IN: Application context
- GuestInfoType infoType, // IN: guest information type
- void *info, // IN: type specific information
- size_t infoSize) // IN: size of *info
+GuestInfoUpdateVMX(ToolsAppCtx *ctx, // IN: Application context
+ GuestInfoType infoType, // IN: guest information type
+ void *info, // IN: type specific information
+ size_t infoSize) // IN: size of *info
{
ASSERT(info);
- g_debug("Entered update vmdb: %d.\n", infoType);
+ g_debug("Entered update the VMX: %d.\n", infoType);
if (gVMResumed) {
gVMResumed = FALSE;
}
if (!GuestInfoSendData(ctx, info, infoSize, INFO_OS_STRUCTURED)) {
- g_warning("Failed to update structured os information.\n");
+ g_warning("Failed to update structured OS information.\n");
return FALSE;
}
break;
case INFO_IPADDRESS:
{
if (!GuestInfoSendNicInfo(ctx, (NicInfoV3 *) info)) {
- g_warning("Failed to update nic information.\n");
+ g_warning("Failed to update NIC information.\n");
return FALSE;
}
break;
/*
******************************************************************************
- * SetGuestInfo -- */ /**
+ * SetGuestInfo --
*
* Sends a simple key-value update request to the VMX.
*
* @param[in] ctx Application context.
- * @param[in] key VMDB key to set
- * @param[in] value GuestInfo data
+ * @param[in] key Key sent to the VMX
+ * @param[in] value GuestInfo data sent to the VMX
*
* @retval TRUE RPCI succeeded.
* @retval FALSE RPCI failed.
*/
Bool
-SetGuestInfo(ToolsAppCtx *ctx,
- GuestInfoType key,
- const char *value)
+SetGuestInfo(ToolsAppCtx *ctx, // IN:
+ GuestInfoType key, // IN:
+ const char *value) // IN:
{
Bool status;
char *reply;
g_free(msg);
if (!status) {
- g_warning("Error sending rpc message: %s\n", reply ? reply : "NULL");
+ g_warning("Error sending RPC message: %s\n", reply ? reply : "NULL");
vm_free(reply);
return FALSE;
}
- /* The reply indicates whether the key,value pair was updated in VMDB. */
+ /* The reply indicates whether the key,value pair was updated in the VMX. */
status = (*reply == '\0');
vm_free(reply);
return status;
/*
******************************************************************************
- * GuestInfoFindMacAddress -- */ /**
+ * GuestInfoFindMacAddress --
*
* Locates a NIC with the given MAC address in the NIC list.
*
for (i = 0; i < nicInfo->nics.nics_len; i++) {
GuestNicV3 *nic = &nicInfo->nics.nics_val[i];
+
if (strncmp(nic->macAddress, macAddress, NICINFO_MAC_LEN) == 0) {
return nic;
}
/*
******************************************************************************
- * DiskInfoChanged -- */ /**
+ * DiskInfoChanged --
*
* Checks whether disk info information just obtained is different from the
* information last sent to the VMX.
/*
******************************************************************************
- * GuestInfoClearCache -- */ /**
+ * GuestInfoClearCache --
*
* Clears the cached guest info data.
*
/*
***********************************************************************
- * NicInfoV3ToV2 -- */ /**
+ * NicInfoV3ToV2 --
*
* @brief Converts the NicInfoV3 NIC list to a GuestNicList.
*
static GuestNicList *
NicInfoV3ToV2(const NicInfoV3 *infoV3)
{
- GuestNicList *nicList;
unsigned int i, j;
-
- nicList = Util_SafeCalloc(sizeof *nicList, 1);
+ GuestNicList *nicList = Util_SafeCalloc(sizeof *nicList, 1);
(void)XDRUTIL_ARRAYAPPEND(nicList, nics, infoV3->nics.nics_len);
XDRUTIL_FOREACH(i, infoV3, nics) {
GuestNicV3 *nic = XDRUTIL_GETITEM(infoV3, nics, i);
GuestNic *oldNic = XDRUTIL_GETITEM(nicList, nics, i);
- Str_Strcpy(oldNic->macAddress, nic->macAddress, sizeof oldNic->macAddress);
+ Str_Strcpy(oldNic->macAddress, nic->macAddress,
+ sizeof oldNic->macAddress);
(void)XDRUTIL_ARRAYAPPEND(oldNic, ips, nic->ips.ips_len);
/* XXX */
oldIp->addressFamily = (ip->ipAddressAddrType == IAT_IPV4) ?
- NICINFO_ADDR_IPV4 : NICINFO_ADDR_IPV6;
+ NICINFO_ADDR_IPV4 : NICINFO_ADDR_IPV6;
NetUtil_InetNToP(ip->ipAddressAddrType == IAT_IPV4 ?
AF_INET : AF_INET6,
/*
******************************************************************************
- * TweakGatherLoop -- */ /**
+ * TweakGatherLoop --
*
* @brief Start, stop, reconfigure a GuestInfoGather poll loop.
*
/*
******************************************************************************
- * TweakGatherLoops -- */ /**
+ * TweakGatherLoops --
*
* @brief Start, stop, reconfigure the GuestInfoGather loops.
*
* Report gathered stats.
*
* Results:
- * Stats reported to VMX/VMDB. Returns FALSE on failure.
+ * Stats reported to the VMX. Returns FALSE on failure.
*
* Side effects:
* None.
/*
******************************************************************************
- * GuestInfoServerConfReload -- */ /**
+ * GuestInfoServerConfReload --
*
* @brief Reconfigures the poll loop interval upon config file reload.
*
/*
******************************************************************************
- * GuestInfoServerIOFreeze -- */ /**
+ * GuestInfoServerIOFreeze --
*
* IO freeze signal handler. Disables info gathering while I/O is frozen.
* See bug 529653.
/*
******************************************************************************
- * GuestInfoServerShutdown -- */ /**
+ * GuestInfoServerShutdown --
*
* Cleanup internal data on shutdown.
*
/*
******************************************************************************
- * GuestInfoServerReset -- */ /**
+ * GuestInfoServerReset --
*
* Reset callback - sets the internal flag that says we should purge all
* caches.
/*
******************************************************************************
- * GuestInfoServerSendCaps -- */ /**
+ * GuestInfoServerSendCaps --
*
* Send capabilities callback. If setting capabilities, sends VM's uptime.
*
/*
******************************************************************************
- * GuestInfoServerSetOption -- */ /**
+ * GuestInfoServerSetOption --
*
* Responds to a "broadcastIP" Set_Option command, by sending the primary IP
* back to the VMX.
/*
******************************************************************************
- * ToolsOnLoad -- */ /**
+ * ToolsOnLoad --
*
* Plugin entry point. Initializes internal plugin state.
*