Skip to content

Commit

Permalink
Warn when no vms are found (#583)
Browse files Browse the repository at this point in the history
  • Loading branch information
aguillenv authored Jun 24, 2021
1 parent adaf1f1 commit 000d527
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
9 changes: 4 additions & 5 deletions avm/src/daemon/ctrl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::path::{Path, PathBuf};
use std::str;
use std::sync::Arc;

use anycloud::error;
use anycloud::{error, warn};
use futures::future::join_all;
use hyper::{
body,
Expand Down Expand Up @@ -658,11 +658,10 @@ impl ControlPort {
.filter(|vm| vm.private_ip_addr == self_ip)
.collect();
if self_vm_vec.len() == 0 {
error!(
warn!(
NoDnsPrivateIp,
"Failed to find self in cluster. Maybe I am being shut down?"
)
.await;
"Failed to find self in cluster. Maybe I am being shut down or initialize?"
);
// TODO: Should this error propagate up to the stats loop or no?
return;
} else if self_vm_vec.len() > 1 {
Expand Down
13 changes: 9 additions & 4 deletions avm/src/daemon/daemon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::io::Read;

use anycloud::common::{file_exist, get_app_tar_gz_b64, get_dockerfile_b64};
use anycloud::deploy;
use anycloud::{error, CLUSTER_ID};
use anycloud::{error, warn, CLUSTER_ID};
use base64;
use byteorder::{LittleEndian, ReadBytesExt};
use flate2::read::GzDecoder;
Expand Down Expand Up @@ -72,7 +72,7 @@ async fn post_v1(endpoint: &str, body: Value) -> String {
Ok(res) => res,
Err(err) => {
let err = format!("{:?}", err);
error!(PostFailed, "{:?}", err).await;
error!(PostFailed, "Endpoint: {} - Error: {:?}", endpoint, err).await;
err
}
}
Expand Down Expand Up @@ -292,7 +292,8 @@ pub async fn start(is_local_anycloud_app: bool, local_agz_b64: Option<String>) {
let vms = match dns.get_vms(&cluster_id, is_local).await {
Ok(vms) => Some(vms),
Err(err) => {
error!(NoDnsVms, "{}", err).await;
// We do not retry on failure here since every minute we are updating the vms list
warn!(NoDnsVms, "{}", err);
None
}
};
Expand Down Expand Up @@ -335,7 +336,11 @@ pub async fn start(is_local_anycloud_app: bool, local_agz_b64: Option<String>) {
if let Ok(stats_factor) = stats_factor {
factor = stats_factor;
} else if let Err(err) = stats_factor {
error!(PostFailed, "{}", err).await;
error!(
PostFailed,
"Failed sending stats for cluster {}: {}", &cluster_id, err
)
.await;
}
println!(
"VM stats sent for cluster {} of size {}. Cluster factor: {}.",
Expand Down

0 comments on commit 000d527

Please sign in to comment.