mirror of
https://gitlab.com/virt-viewer/virt-viewer.git
synced 2024-12-23 17:34:01 +03:00
Add error message when conecting to inactive VM (Hiroyuki Kaguchi)
This commit is contained in:
parent
5feb3b8e18
commit
e2712473f6
22
src/main.c
22
src/main.c
@ -785,6 +785,7 @@ viewer_start (const char *uri, const char *name,
|
||||
GtkWidget *vnc;
|
||||
virConnectPtr conn = NULL;
|
||||
virDomainPtr dom = NULL;
|
||||
virDomainInfo domInfo;
|
||||
char *host = NULL;
|
||||
char *vncport = NULL;
|
||||
char *transport = NULL;
|
||||
@ -813,11 +814,24 @@ viewer_start (const char *uri, const char *name,
|
||||
usleep(500*1000);
|
||||
} while (!dom);
|
||||
|
||||
viewer_extract_vnc_graphics(dom, &vncport);
|
||||
if (!vncport && !waitvnc) {
|
||||
fprintf(stderr, "unable to find vnc graphics for %s\n", name);
|
||||
return 4;
|
||||
if (virDomainGetInfo(dom, &domInfo) != 0) {
|
||||
fprintf(stderr, "unable to get information for %s\n", name);
|
||||
return 6;
|
||||
}
|
||||
|
||||
if (domInfo.state == VIR_DOMAIN_SHUTOFF && !waitvnc) {
|
||||
fprintf(stderr, "%s is not running\n", name);
|
||||
return 7;
|
||||
}
|
||||
|
||||
if (domInfo.state != VIR_DOMAIN_SHUTOFF) {
|
||||
viewer_extract_vnc_graphics(dom, &vncport);
|
||||
if (!vncport) {
|
||||
fprintf(stderr, "unable to find vnc graphics for %s\n", name);
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
|
||||
if (!vncport) {
|
||||
virDomainFree(dom);
|
||||
usleep(300*1000);
|
||||
|
Loading…
Reference in New Issue
Block a user