Merge "vm_voting on migration action are sometimes not getting rejected"

This commit is contained in:
Zuul 2018-06-19 15:36:28 +00:00 committed by Gerrit Code Review
commit 8992c73e20
3 changed files with 31 additions and 7 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013-2016, Wind River Systems, Inc.
* Copyright (c) 2013-2018, Wind River Systems, Inc.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
@ -119,3 +119,19 @@ int guest_utils_json_get_value( struct json_object* jobj,
return 0;
}
// ****************************************************************************
// ****************************************************************************
// Guest Utilities - replace newline with space
// ======================
char* guest_utils_remove_newline( char* str)
{
char match = '\n';
char replace = ' ';
char *match_found = strchr(str, match);
while (match_found){
*match_found = replace;
match_found = strchr(match_found+1, match);
}
return str;
}
// ****************************************************************************

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013-2016, Wind River Systems, Inc.
* Copyright (c) 2013-2018, Wind River Systems, Inc.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
@ -56,6 +56,11 @@ extern char* guest_utils_basename( char* str );
// =========================================
extern int guest_utils_json_get_value( struct json_object* jobj,
const char* key, void * value );
// ****************************************************************************
// Guest Utilities - replace newline with space
// ======================
char* guest_utils_remove_newline( char* str);
// ****************************************************************************
#ifdef __cplusplus

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013-2016, Wind River Systems, Inc.
* Copyright (c) 2013-2018, Wind River Systems, Inc.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
@ -382,7 +382,8 @@ GuestErrorT guest_heartbeat_msg_send_exit( char log_msg[] )
GuestErrorT error;
char log_msg_buf[GUEST_HEARTBEAT_MSG_MAX_LOG_SIZE];
snprintf(log_msg_buf, GUEST_HEARTBEAT_MSG_MAX_LOG_SIZE, "%s", log_msg);
snprintf(log_msg_buf, GUEST_HEARTBEAT_MSG_MAX_LOG_SIZE, "%s",
guest_utils_remove_newline(log_msg));
char msg[GUEST_HEARTBEAT_MSG_MAX_MSG_SIZE];
snprintf(msg, sizeof(msg), "\n{\"%s\":%d,\"%s\":%d,\"%s\":\"%s\",\"%s\":%d,"
@ -456,7 +457,8 @@ GuestErrorT guest_heartbeat_msg_send_challenge_response(
GuestErrorT error;
char log_msg_buf[GUEST_HEARTBEAT_MSG_MAX_LOG_SIZE];
snprintf(log_msg_buf, GUEST_HEARTBEAT_MSG_MAX_LOG_SIZE, "%s", log_msg);
snprintf(log_msg_buf, GUEST_HEARTBEAT_MSG_MAX_LOG_SIZE, "%s",
guest_utils_remove_newline(log_msg));
char msg[GUEST_HEARTBEAT_MSG_MAX_MSG_SIZE];
snprintf(msg, sizeof(msg), "\n{\"%s\":%d,\"%s\":%d,\"%s\":\"%s\",\"%s\":%d,"
@ -543,7 +545,8 @@ GuestErrorT guest_heartbeat_msg_send_action_response(
GuestErrorT error;
char log_msg_buf[GUEST_HEARTBEAT_MSG_MAX_LOG_SIZE];
snprintf(log_msg_buf, GUEST_HEARTBEAT_MSG_MAX_LOG_SIZE, "%s", log_msg);
snprintf(log_msg_buf, GUEST_HEARTBEAT_MSG_MAX_LOG_SIZE, "%s",
guest_utils_remove_newline(log_msg));
char msg[GUEST_HEARTBEAT_MSG_MAX_MSG_SIZE];
@ -852,7 +855,7 @@ void guest_heartbeat_msg_dispatch(json_object *jobj_msg)
if (guest_utils_json_get_value(jobj_msg, GUEST_HEARTBEAT_MSG_VERSION, &version))
return;
if (GUEST_HEARTBEAT_MSG_VERSION_CURRENT != version)
if (GUEST_HEARTBEAT_MSG_VERSION_CURRENT > version)
{
DPRINTFI("message received version %d, expected %d, dropping\n",
version, GUEST_HEARTBEAT_MSG_VERSION_CURRENT);