diff --git a/maxscale-system-test/keepalived.cpp b/maxscale-system-test/keepalived.cpp index b5935e35e..16fbb50be 100644 --- a/maxscale-system-test/keepalived.cpp +++ b/maxscale-system-test/keepalived.cpp @@ -43,7 +43,7 @@ int main(int argc, char *argv[]) print_version_string(Test); Test->tprintf("Suspend Maxscale 000 machine and waiting\n"); - system(Test->maxscales->stop_vm_command[0]); + Test->add_result(Test->maxscales->start_vm(0), "Failed to stop VM maxscale_000\n"); sleep(FAILOVER_WAIT_TIME); version = print_version_string(Test); @@ -54,12 +54,12 @@ int main(int argc, char *argv[]) Test->tprintf("Resume Maxscale 000 machine and waiting\n"); - system(Test->maxscales->start_vm_command[0]); + Test->add_result(Test->maxscales->start_vm(0), "Failed to start VM maxscale_000\n"); sleep(FAILOVER_WAIT_TIME); print_version_string(Test); Test->tprintf("Suspend Maxscale 001 machine and waiting\n"); - system(Test->maxscales->stop_vm_command[1]); + Test->add_result(Test->maxscales->start_vm(1), "Failed to stop VM maxscale_001\n"); sleep(FAILOVER_WAIT_TIME); version = print_version_string(Test); @@ -70,7 +70,7 @@ int main(int argc, char *argv[]) print_version_string(Test); Test->tprintf("Resume Maxscale 001 machine and waiting\n"); - system(Test->maxscales->start_vm_command[1]); + Test->add_result(Test->maxscales->start_vm(1), "Failed to start VM maxscale_001\n"); sleep(FAILOVER_WAIT_TIME); print_version_string(Test); diff --git a/maxscale-system-test/nodes.cpp b/maxscale-system-test/nodes.cpp index 6b14162ba..8cfea8bef 100644 --- a/maxscale-system-test/nodes.cpp +++ b/maxscale-system-test/nodes.cpp @@ -472,3 +472,13 @@ const char* Nodes::ip(int i) const { return use_ipv6 ? IP6[i] : IP[i]; } + +int Nodes::start_vm(int node) +{ + return(system(start_vm_command[node])); +} + +int Nodes::stop_vm(int node) +{ + return(system(stop_vm_command[node])); +} diff --git a/maxscale-system-test/nodes.h b/maxscale-system-test/nodes.h index c19ac5575..4ab25e223 100644 --- a/maxscale-system-test/nodes.h +++ b/maxscale-system-test/nodes.h @@ -158,6 +158,20 @@ public: */ int read_basic_env(); + /** + * @brief start_vm Start virtual machine + * @param node Node number + * @return 0 in case of success + */ + int start_vm(int node); + + /** + * @brief stop_vm Stop virtual machine + * @param node Node number + * @return 0 in case of success + */ + int stop_vm(int node); + private: int check_node_ssh(int node);