File virtview-dont-show-Domain-0.patch of Package virt-viewer
References: bsc#983689
A user should not be able to connect to Domain-0. Don't show it
in the list.
Index: virt-viewer-6.0/src/virt-viewer.c
===================================================================
--- virt-viewer-6.0.orig/src/virt-viewer.c
+++ virt-viewer-6.0/src/virt-viewer.c
@@ -827,6 +827,7 @@ choose_vm(GtkWindow *main_window,
virDomainPtr *domains, dom = NULL;
int i, vms_running;
unsigned int flags = VIR_CONNECT_LIST_DOMAINS_RUNNING;
+ const char *domain_name;
g_return_val_if_fail(vm_name != NULL, NULL);
free(*vm_name);
@@ -835,8 +836,11 @@ choose_vm(GtkWindow *main_window,
vms_running = virConnectListAllDomains(conn, &domains, flags);
for (i = 0; i < vms_running; i++) {
+ domain_name = virDomainGetName(domains[i]);
+ if (domain_name == NULL || !strcmp(domain_name, "Domain-0"))
+ continue;
gtk_list_store_append(model, &iter);
- gtk_list_store_set(model, &iter, 0, virDomainGetName(domains[i]), -1);
+ gtk_list_store_set(model, &iter, 0, domain_name, -1);
virDomainFree(domains[i]);
}
free(domains);