void VirshGui::toggleVMStatus() { string vmname = ui->vmnameLabel->text().toStdString(); VM vm = vmlist[vmname]; try { if (vm.getStatus() == VMStatus::shutoff) { vm.start(); } else if (vm.getStatus() == VMStatus::running) { vm.destroy(); } } catch (ssh::SshException e) { handleDisconnect(); } refreshVmList(); }
void VirshGui::rebootVM() { string vmname = ui->vmnameLabel->text().toStdString(); VM vm = vmlist[vmname]; if (vm.getStatus() == VMStatus::running) { try { vm.reboot(); } catch (ssh::SshException e) { handleDisconnect(); } } }