Skip to content

Commit

Permalink
DLPX-81521 Don't retry pool scan 15 times during import (openzfs#475)
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Dagnelie <pcd@delphix.com>
  • Loading branch information
pcd1193182 authored Jun 10, 2022
1 parent 2a65d44 commit e234ba7
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
23 changes: 21 additions & 2 deletions cmd/zfs_object_agent/zettaobject/src/public_connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use std::path::Path;
use std::sync::Arc;
use std::sync::Mutex;

use anyhow::Context;
use futures::stream::StreamExt;
use log::*;
use nvpair::NvList;
Expand All @@ -23,7 +24,9 @@ use crate::pool::*;
use crate::pool_destroy;
use crate::pool_destroy::DestroyingPool;
use crate::server::return_ok;
use crate::server::return_result;
use crate::server::ConnectionState;
use crate::server::FailureMessage;
use crate::server::HandlerReturn;
use crate::server::Server;

Expand Down Expand Up @@ -99,8 +102,24 @@ impl PublicConnectionState {
bucket: Option<String>,
guid: Option<u64>,
}
let request: GetPoolsRequest = nvpair::from_nvlist(&nvl)?;
let bucket_access = BucketAccess::new(request.protocol.clone()).await?;
let request: GetPoolsRequest =
match nvpair::from_nvlist(&nvl).context("bad or insufficient parameters") {
Ok(request) => request,
Err(e) => {
let result = Err::<(), _>(FailureMessage::new(e));
return return_result((), result, true);
}
};
let bucket_access = match BucketAccess::new(request.protocol.clone())
.await
.context("connection error")
{
Ok(bucket_access) => bucket_access,
Err(e) => {
let result = Err::<(), _>(FailureMessage::new(e));
return return_result((), result, true);
}
};
let buckets = if let Some(bucket) = request.bucket {
vec![bucket]
} else {
Expand Down
7 changes: 7 additions & 0 deletions lib/libzutil/zutil_import.c
Original file line number Diff line number Diff line change
Expand Up @@ -1901,6 +1901,13 @@ zpool_find_import_agent(libpc_handle_t *hdl, importargs_t *iarg,
nvlist_t *resp = zoa_send_recv_msg(hdl, msg,
AGENT_PUBLIC_PROTOCOL_VERSION, ZFS_PUBLIC_SOCKET, NULL);

char *err;
if (nvlist_lookup_string(resp, "errstr", &err) == 0) {
fprintf(stderr, "Agent pool scan failed: %s\n", err);
fnvlist_free(resp);
return;
}

nvlist_t *pools = NULL;
(void) nvlist_lookup_nvlist(resp, "pools", &pools);

Expand Down

0 comments on commit e234ba7

Please sign in to comment.