X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=examples%2Fvm_power_manager%2Fchannel_manager.c;h=e068ae2864972679bdcbc4d3dbca8de98c098c55;hb=e124a69fc7956c7269c3cedec5c1bec08ca34fdc;hp=db76f2e82c876cb135ceac73801181382b43d870;hpb=67ff575ee8d20508f5e2ea82ac97442130693e54;p=dpdk.git diff --git a/examples/vm_power_manager/channel_manager.c b/examples/vm_power_manager/channel_manager.c index db76f2e82c..e068ae2864 100644 --- a/examples/vm_power_manager/channel_manager.c +++ b/examples/vm_power_manager/channel_manager.c @@ -45,7 +45,6 @@ #include #include -#include #include #include #include @@ -668,6 +667,7 @@ add_vm(const char *vm_name) return -1; } strncpy(new_domain->name, vm_name, sizeof(new_domain->name)); + new_domain->name[sizeof(new_domain->name) - 1] = '\0'; new_domain->channel_mask = 0; new_domain->num_channels = 0; @@ -734,7 +734,7 @@ connect_hypervisor(const char *path) int channel_manager_init(const char *path) { - int n_cpus; + virNodeInfo info; LIST_INIT(&vm_list_head); if (connect_hypervisor(path) < 0) { @@ -756,13 +756,12 @@ channel_manager_init(const char *path) goto error; } - n_cpus = virNodeGetCPUMap(global_vir_conn_ptr, NULL, NULL, 0); - if (n_cpus <= 0) { - RTE_LOG(ERR, CHANNEL_MANAGER, "Unable to get the number of Host " - "CPUs\n"); + if (virNodeGetInfo(global_vir_conn_ptr, &info)) { + RTE_LOG(ERR, CHANNEL_MANAGER, "Unable to retrieve node Info\n"); goto error; } - global_n_host_cpus = (unsigned)n_cpus; + + global_n_host_cpus = (unsigned)info.cpus; if (global_n_host_cpus > CHANNEL_CMDS_MAX_CPUS) { RTE_LOG(WARNING, CHANNEL_MANAGER, "The number of host CPUs(%u) exceeds the "