Пример #1
0
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();
}
Пример #2
0
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();
        }
    }
}