diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/main.cpp | 2 | ||||
-rw-r--r-- | src/worker/main.cpp | 19 |
2 files changed, 16 insertions, 5 deletions
diff --git a/src/client/main.cpp b/src/client/main.cpp index dfec059..10a497b 100644 --- a/src/client/main.cpp +++ b/src/client/main.cpp @@ -120,7 +120,7 @@ int main(int argc, char* argv[]) } else if (ret == GEARMAN_WORK_FAIL) { - cerr << "[ERROR] " << msg << endl; + cerr << "[REMOTE ERROR] " << msg << endl; cerr << "[ERROR] Work failed" << endl; free(result); } diff --git a/src/worker/main.cpp b/src/worker/main.cpp index ff97041..a0d6cb4 100644 --- a/src/worker/main.cpp +++ b/src/worker/main.cpp @@ -70,11 +70,22 @@ static void *start_nbd_server(gearman_job_st *job, void *context, stringstream command; command << "nbd-server " << _nbd_server_port << " " << *image; cout << "[DEBUG] " << "Running command: " << command.str() << endl; - system(command.str().c_str()); + int ret = system(command.str().c_str()); + if (ret == 0) + { + current_port = _nbd_server_port; + _map[*image] = _nbd_server_port; + _nbd_server_port++; + } + else + { + cerr << "[ERROR] Command execution failed, aborting!" << endl; + char msg[] = "Couldn't start nbd-server"; + gearman_job_send_data(job, msg, sizeof(msg)); + *ret_ptr = GEARMAN_WORK_FAIL; + return NULL; + } - current_port = _nbd_server_port; - _map[*image] = _nbd_server_port; - _nbd_server_port++; } // send port number to client |