Update libgovirt requirements

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
This commit is contained in:
Eduardo Lima (Etrunko) 2020-06-25 21:34:39 -03:00
parent cbbd7b5a93
commit be0dd059ac
3 changed files with 6 additions and 42 deletions

View File

@ -39,23 +39,8 @@
/* Have libgovirt? */
#mesondefine HAVE_OVIRT
/* Define to 1 if you have the `ovirt_api_search_vms' function. */
#undef HAVE_OVIRT_API_SEARCH_VMS
/* Define to 1 if you have the `ovirt_cluster_get_data_center' function. */
#undef HAVE_OVIRT_CLUSTER_GET_DATA_CENTER
/* Have support for data center */
#undef HAVE_OVIRT_DATA_CENTER
/* Define to 1 if you have the `ovirt_host_get_cluster' function. */
#undef HAVE_OVIRT_HOST_GET_CLUSTER
/* Define to 1 if you have the `ovirt_storage_domain_get_disks' function. */
#undef HAVE_OVIRT_STORAGE_DOMAIN_GET_DISKS
/* Define to 1 if you have the `ovirt_vm_get_host' function. */
#undef HAVE_OVIRT_VM_GET_HOST
/* Have ovirt_storage_domain_get_disks function? */
#mesondefine HAVE_OVIRT_STORAGE_DOMAIN_GET_DISKS
/* Have spice-gtk? */
#mesondefine HAVE_SPICE_GTK

View File

@ -38,7 +38,7 @@ libvirt_glib_min_version='>=0.1.8'
gtk_vnc_min_version='>=0.4.0'
spice_gtk_min_version='>=0.35'
spice_protocol_min_version='>=0.12.7'
govirt_min_version='>=0.3.3'
govirt_min_version='>=0.3.7'
rest_min_version='>=0.8'
vte_min_version='>=0.46.0'
bash_completion_version='2.0'
@ -446,6 +446,9 @@ if get_option('ovirt').auto()
endif
endif
if govirt_dep.found()
if cc.has_function('ovirt_storage_domain_get_disks', dependencies: govirt_dep)
conf_data.set('HAVE_OVIRT_STORAGE_DOMAIN_GET_DISKS', '1')
endif
conf_data.set('HAVE_OVIRT', '1')
endif

View File

@ -54,11 +54,9 @@ typedef enum {
STATE_0,
STATE_API,
STATE_VM,
#ifdef HAVE_OVIRT_DATA_CENTER
STATE_HOST,
STATE_CLUSTER,
STATE_DATA_CENTER,
#endif
STATE_STORAGE_DOMAIN,
STATE_VM_CDROM,
STATE_CDROM_FILE,
@ -68,11 +66,9 @@ typedef enum {
static void ovirt_foreign_menu_next_async_step(OvirtForeignMenu *menu, GTask *task, OvirtForeignMenuState state);
static void ovirt_foreign_menu_fetch_api_async(OvirtForeignMenu *menu, GTask *task);
static void ovirt_foreign_menu_fetch_vm_async(OvirtForeignMenu *menu, GTask *task);
#ifdef HAVE_OVIRT_DATA_CENTER
static void ovirt_foreign_menu_fetch_host_async(OvirtForeignMenu *menu, GTask *task);
static void ovirt_foreign_menu_fetch_cluster_async(OvirtForeignMenu *menu, GTask *task);
static void ovirt_foreign_menu_fetch_data_center_async(OvirtForeignMenu *menu, GTask *task);
#endif
static void ovirt_foreign_menu_fetch_storage_domain_async(OvirtForeignMenu *menu, GTask *task);
static void ovirt_foreign_menu_fetch_vm_cdrom_async(OvirtForeignMenu *menu, GTask *task);
static void ovirt_foreign_menu_refresh_cdrom_file_async(OvirtForeignMenu *menu, GTask *task);
@ -84,11 +80,9 @@ struct _OvirtForeignMenu {
OvirtProxy *proxy;
OvirtApi *api;
OvirtVm *vm;
#ifdef HAVE_OVIRT_DATA_CENTER
OvirtHost *host;
OvirtCluster *cluster;
OvirtDataCenter *data_center;
#endif
char *vm_guid;
OvirtCollection *files;
@ -215,11 +209,9 @@ ovirt_foreign_menu_dispose(GObject *obj)
g_clear_object(&self->proxy);
g_clear_object(&self->api);
g_clear_object(&self->vm);
#ifdef HAVE_OVIRT_DATA_CENTER
g_clear_object(&self->host);
g_clear_object(&self->cluster);
g_clear_object(&self->data_center);
#endif
g_clear_pointer(&self->vm_guid, g_free);
g_clear_object(&self->files);
g_clear_object(&self->cdrom);
@ -333,7 +325,6 @@ ovirt_foreign_menu_next_async_step(OvirtForeignMenu *menu,
ovirt_foreign_menu_fetch_vm_async(menu, task);
break;
}
#ifdef HAVE_OVIRT_DATA_CENTER
G_GNUC_FALLTHROUGH;
case STATE_HOST:
if (menu->host == NULL) {
@ -352,7 +343,6 @@ ovirt_foreign_menu_next_async_step(OvirtForeignMenu *menu,
ovirt_foreign_menu_fetch_data_center_async(menu, task);
break;
}
#endif
G_GNUC_FALLTHROUGH;
case STATE_STORAGE_DOMAIN:
if (menu->files == NULL) {
@ -648,7 +638,6 @@ static void ovirt_foreign_menu_fetch_vm_cdrom_async(OvirtForeignMenu *menu,
cdroms_fetched_cb, task);
}
#ifdef HAVE_OVIRT_DATA_CENTER
static gboolean strv_contains(const gchar * const *strv, const gchar *str)
{
return g_strv_contains (strv, str);
@ -669,7 +658,6 @@ static gboolean storage_domain_attached_to_data_center(OvirtStorageDomain *domai
return match;
}
#endif
static gboolean storage_domain_validate(OvirtForeignMenu *menu G_GNUC_UNUSED,
OvirtStorageDomain *domain)
@ -690,12 +678,10 @@ static gboolean storage_domain_validate(OvirtForeignMenu *menu G_GNUC_UNUSED,
ret = FALSE;
}
#ifdef HAVE_OVIRT_DATA_CENTER
if (!storage_domain_attached_to_data_center(domain, menu->data_center)) {
g_debug("Storage domain '%s' is not attached to data center", name);
ret = FALSE;
}
#endif
g_debug ("Storage domain '%s' is %s", name, ret ? "valid" : "not valid");
g_free(name);
@ -794,15 +780,11 @@ static void ovirt_foreign_menu_fetch_storage_domain_async(OvirtForeignMenu *menu
{
OvirtCollection *collection = NULL;
#ifdef HAVE_OVIRT_DATA_CENTER
g_return_if_fail(OVIRT_IS_FOREIGN_MENU(menu));
g_return_if_fail(OVIRT_IS_PROXY(menu->proxy));
g_return_if_fail(OVIRT_IS_DATA_CENTER(menu->data_center));
collection = ovirt_data_center_get_storage_domains(menu->data_center);
#else
collection = ovirt_api_get_storage_domains(menu->api);
#endif
g_debug("Start fetching iso file collection");
ovirt_collection_fetch_async(collection, menu->proxy,
@ -811,7 +793,6 @@ static void ovirt_foreign_menu_fetch_storage_domain_async(OvirtForeignMenu *menu
}
#ifdef HAVE_OVIRT_DATA_CENTER
static void data_center_fetched_cb(GObject *source_object,
GAsyncResult *result,
gpointer user_data)
@ -921,7 +902,6 @@ static void ovirt_foreign_menu_fetch_host_async(OvirtForeignMenu *menu,
host_fetched_cb,
task);
}
#endif /* HAVE_OVIRT_DATA_CENTER */
static void vms_fetched_cb(GObject *source_object,
@ -978,13 +958,9 @@ static void ovirt_foreign_menu_fetch_vm_async(OvirtForeignMenu *menu,
g_return_if_fail(OVIRT_IS_PROXY(menu->proxy));
g_return_if_fail(OVIRT_IS_API(menu->api));
#ifdef HAVE_OVIRT_API_SEARCH_VMS
char * query = g_strdup_printf("id=%s", menu->vm_guid);
vms = ovirt_api_search_vms(menu->api, query);
g_free(query);
#else
vms = ovirt_api_get_vms(menu->api);
#endif
ovirt_collection_fetch_async(vms, menu->proxy,
g_task_get_cancellable(task),