mirror of
https://github.com/ceph/ceph
synced 2025-01-03 01:22:53 +00:00
rbd: propagate rbd-wnbd errors
This change updates the "rbd device" commands, propagating rbd-wnbd.exe exit codes. Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
This commit is contained in:
parent
afa7b532b2
commit
8d64c7cf42
@ -142,18 +142,20 @@ int SubProcess::join() {
|
||||
close(stdout_pipe_in_fd);
|
||||
close(stderr_pipe_in_fd);
|
||||
|
||||
DWORD status = 0;
|
||||
int status = 0;
|
||||
|
||||
if (WaitForSingleObject(proc_handle, INFINITE) != WAIT_FAILED) {
|
||||
if (!GetExitCodeProcess(proc_handle, &status)) {
|
||||
errstr << cmd << ": Could not get exit code: " << pid
|
||||
<< ". Error code: " << GetLastError();
|
||||
status = -ECHILD;
|
||||
} else if (status) {
|
||||
errstr << cmd << ": exit status: " << status;
|
||||
}
|
||||
} else {
|
||||
errstr << cmd << ": Waiting for child process failed: " << pid
|
||||
<< ". Error code: " << GetLastError();
|
||||
status = -ECHILD;
|
||||
}
|
||||
|
||||
close_h(proc_handle);
|
||||
|
@ -53,9 +53,11 @@ static int call_wnbd_cmd(const po::variables_map &vm,
|
||||
if (process.spawn()) {
|
||||
std::cerr << "rbd: failed to run rbd-wnbd: " << process.err() << std::endl;
|
||||
return -EINVAL;
|
||||
} else if (process.join()) {
|
||||
}
|
||||
int exit_code = process.join();
|
||||
if (exit_code) {
|
||||
std::cerr << "rbd: rbd-wnbd failed with error: " << process.err() << std::endl;
|
||||
return -EINVAL;
|
||||
return exit_code;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user