[PATCH][virt-viewer] Add error message when it connects to the stopping domain.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

When the guest domain is stopping, virt-viewer exits without error message.
The patch adds error message when it fails to connect stopping domain.

Thanks,
Signed-off-by: Hiroyuki Kaguchi <fj7025cf@xxxxxxxxxxxxxxxxx>

diff -r 5299a3aaebb5 src/main.c
--- a/src/main.c	Sun Apr 27 23:41:26 2008 -0400
+++ b/src/main.c	Thu May 29 13:58:00 2008 +0900
@@ -785,6 +785,7 @@ viewer_start (const char *uri, const cha
 	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 cha
 				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);


_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/et-mgmt-tools

[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux