diff --git a/src/utils/qemu.c b/src/utils/qemu.c index 4835b6fa1..e9b3a2c8f 100644 --- a/src/utils/qemu.c +++ b/src/utils/qemu.c @@ -67,15 +67,15 @@ int pg_util_ssh(const char *host, } int pg_util_spawn_qemu(const char *socket_path_0, - const char *socket_path_1, - const char *mac_0, - const char *mac_1, + const char *socket_path_1, + const char *mac_0, + const char *mac_1, const int is_server_0, const int is_server_1, - const char *vm_image_path, - const char *vm_key_path, - const char *hugepages_path, - struct pg_error **errp) + const char *vm_image_path, + const char *vm_key_path, + const char *hugepages_path, + struct pg_error **errp) { int child_pid = 0; static uint16_t vm_id; @@ -83,11 +83,12 @@ int pg_util_spawn_qemu(const char *socket_path_0, pg_autofree char *argv_qemu = NULL; const char *argv_sock_0 = ""; const char *argv_sock_1 = ""; - const char* server_params = ",server,nowait"; + const char *server_params = ",server,nowait"; pg_autofree char *argv_sock_0_t = NULL; pg_autofree char *argv_sock_1_t = NULL; pg_autofree char *ssh_cmd = NULL; GError *error = NULL; + if(!is_server_1) g_assert(g_file_test(socket_path_0, G_FILE_TEST_EXISTS)); if (socket_path_1 && !is_server_1) @@ -102,7 +103,9 @@ int pg_util_spawn_qemu(const char *socket_path_0, " -netdev type=vhost-user,id=mynet0,", "chardev=char0,vhostforce", " -device virtio-net-pci,mac=%s", - ",netdev=mynet0"), socket_path_0, is_server_0 ? server_params : "", mac_0); + ",netdev=mynet0"), socket_path_0, + is_server_0 ? server_params : "", + mac_0); argv_sock_0 = argv_sock_0_t; } @@ -112,7 +115,9 @@ int pg_util_spawn_qemu(const char *socket_path_0, " -netdev type=vhost-user,id=mynet1,", "chardev=char1,vhostforce", " -device virtio-net-pci,mac=%s", - ",netdev=mynet1"), socket_path_1, is_server_0 ? server_params : "", mac_1); + ",netdev=mynet1"), socket_path_1, + is_server_0 ? server_params : "", + mac_1); argv_sock_1 = argv_sock_1_t; } @@ -136,10 +141,10 @@ int pg_util_spawn_qemu(const char *socket_path_0, argv = g_strsplit(argv_qemu, " ", 0); g_assert(g_spawn_async(NULL, argv, NULL, - (GSpawnFlags) G_SPAWN_SEARCH_PATH | - G_SPAWN_DO_NOT_REAP_CHILD, - (GSpawnChildSetupFunc) NULL, - NULL, &child_pid, &error)); + (GSpawnFlags) G_SPAWN_SEARCH_PATH | + G_SPAWN_DO_NOT_REAP_CHILD, + (GSpawnChildSetupFunc) NULL, + NULL, &child_pid, &error)); g_assert(!error); ssh_cmd = g_strdup_printf( diff --git a/src/utils/qemu.h b/src/utils/qemu.h index 54fc68ab9..a9bc7264b 100644 --- a/src/utils/qemu.h +++ b/src/utils/qemu.h @@ -29,15 +29,15 @@ int pg_util_ssh(const char *host, __attribute__((__format__(__printf__, 4, 5))); int pg_util_spawn_qemu(const char *socket_path_0, - const char *socket_path_1, - const char *mac_0, - const char *mac_1, + const char *socket_path_1, + const char *mac_0, + const char *mac_1, const int is_server_0, const int is_server_1, - const char *vm_image_path, - const char *vm_ssh_key_path, - const char *hugepages_path, - struct pg_error **errp); + const char *vm_image_path, + const char *vm_ssh_key_path, + const char *hugepages_path, + struct pg_error **errp); void pg_util_stop_qemu(int qemu_pid, int signal); diff --git a/src/vhost.c b/src/vhost.c index 7a84d5b37..b76cb9aee 100644 --- a/src/vhost.c +++ b/src/vhost.c @@ -397,14 +397,8 @@ static void vhost_create_socket(struct pg_vhost_state *state, uint64_t flags, path = g_strdup_printf("%s/qemu-%s", sockets_path, state->brick.name); /* If the socket is CLIENT do NOT destroy the socket. */ if((flags & 1) == 0) - { g_remove(path); - } - /*else - { - flags = flags | 31; - } - */ + printf("New vhost-user socket: %s, zero-copy %s\n", path, (flags & RTE_VHOST_USER_DEQUEUE_ZERO_COPY) ? "enable" : "disable");