#include <stdio.h>
#include <stdlib.h>
-#include <sys/un.h>
#include <fcntl.h>
#include <unistd.h>
#include <inttypes.h>
#define RTE_LOGTYPE_CHANNEL_MANAGER RTE_LOGTYPE_USER1
+struct libvirt_vm_info lvm_info[MAX_CLIENTS];
+
/* Global pointer to libvirt connection */
static virConnectPtr global_vir_conn_ptr;
virDomainPtr domainPtr;
virDomainInfo info;
rte_spinlock_t config_spinlock;
+ int allow_query;
LIST_ENTRY(virtual_machine_info) vms_info;
};
goto error;
}
chan_infos[i] = chan_info;
- rte_strlcpy(chan_info->channel_path, socket_path,
+ strlcpy(chan_info->channel_path, socket_path,
sizeof(chan_info->channel_path));
if (setup_host_channel_info(&chan_info, i) < 0) {
channel_num++;
}
+ info->allow_query = vm_info->allow_query;
info->num_channels = channel_num;
info->num_vcpus = vm_info->info.nrVirtCpu;
rte_spinlock_unlock(&(vm_info->config_spinlock));
else
new_domain->status = CHANNEL_MGR_VM_ACTIVE;
+ new_domain->allow_query = 0;
rte_spinlock_init(&(new_domain->config_spinlock));
LIST_INSERT_HEAD(&vm_list_head, new_domain, vms_info);
return 0;
return 0;
}
+int
+set_query_status(char *vm_name,
+ bool allow_query)
+{
+ struct virtual_machine_info *vm_info;
+
+ vm_info = find_domain_by_name(vm_name);
+ if (vm_info == NULL) {
+ RTE_LOG(ERR, CHANNEL_MANAGER, "VM '%s' not found\n", vm_name);
+ return -1;
+ }
+ rte_spinlock_lock(&(vm_info->config_spinlock));
+ vm_info->allow_query = allow_query ? 1 : 0;
+ rte_spinlock_unlock(&(vm_info->config_spinlock));
+ return 0;
+}
+
static void
disconnect_hypervisor(void)
{