Skip to content

Commit

Permalink
Azure cloud_init: do not print early error messages
Browse files Browse the repository at this point in the history
When an Azure instance starts, a few seconds may elapse before its
network interface acquires a DHCP address, and during this time
interval the Azure Wire Server is unreachable. To avoid potentially
misleading log output, do not print error messages if connection to
the server fails at the first attempt.
  • Loading branch information
francescolavra committed Jan 10, 2025
1 parent 92df866 commit 58eb420
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion klib/cloud_azure.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ typedef struct azure {
vector extensions;
struct spinlock lock;
boolean goalstate_pending;
boolean goalstate_print_errors;
boolean provisioned;
} *azure;

Expand Down Expand Up @@ -75,9 +76,11 @@ closure_func_basic(timer_handler, void, az_report_th,
if (is_ok(s)) {
az->goalstate_pending = true;
} else {
msg_err("%s error %v", func_ss, s);
if (az->goalstate_print_errors)
msg_err("%s error %v", func_ss, s);
timm_dealloc(s);
}
az->goalstate_print_errors = true;
}

static void az_report_status(azure az)
Expand Down Expand Up @@ -563,6 +566,9 @@ boolean azure_cloud_init(heap h)
spin_lock_init(&az->lock);
az->container_id_len = az->instance_id_len = 0;
az->goalstate_pending = az->provisioned = false;
/* Do not print error messages if the Azure Wire Server is unreachable just after instance
* startup (a few seconds may elapse before the network interface acquires a DHCP address). */
az->goalstate_print_errors = false;
az_status_upload_init(az);
init_timer(&az->report_timer);
register_timer(kernel_timers, &az->report_timer, CLOCK_ID_MONOTONIC, seconds(2), false,
Expand Down

0 comments on commit 58eb420

Please sign in to comment.