SONIC:libvirt module is not importable when we deploy VM

1,062 views
Skip to first unread message

Kalai Selvi

unread,
Jan 29, 2021, 9:52:12 AM1/29/21
to sonic-test-workgroup
Hi ,

When we tried to deploy the VM using below command we are seeing an erroras libvirt module is not importable .
I have refered below link

Could you please let me know whether I am refering the correct link or I am missing out anything 
 
LOG MESSAGE


kalai_sonic@1f73dfa908e7:~/data/sonic-mgmt/ansible$ ./testbed-cli.sh -m veos_vtb -n 4 start-vms server_1 password.txt
Starting VMs on server 'server_1'
/usr/local/lib/python2.7/dist-packages/ansible/parsing/vault/__init__.py:44: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release.
  from cryptography.exceptions import InvalidSignature

PLAY [servers:&vm_host] **********************************************************************************************************************

TASK [vm_set : get host distribution] ********************************************************************************************************
Friday 29 January 2021  20:33:19 +0000 (0:00:00.201)       0:00:00.201 ********
ok: [STR-ACS-VSERV-01]

TASK [vm_set : get host distribution version] ************************************************************************************************
Friday 29 January 2021  20:33:20 +0000 (0:00:01.205)       0:00:01.407 ********
ok: [STR-ACS-VSERV-01]

TASK [vm_set : get host kernel version] ******************************************************************************************************
Friday 29 January 2021  20:33:21 +0000 (0:00:00.135)       0:00:01.542 ********
ok: [STR-ACS-VSERV-01]

TASK [vm_set : Check if kernel upgrade needed] ***********************************************************************************************
Friday 29 January 2021  20:33:21 +0000 (0:00:00.127)       0:00:01.670 ********
skipping: [STR-ACS-VSERV-01]

TASK [vm_set : debug] ************************************************************************************************************************
Friday 29 January 2021  20:33:21 +0000 (0:00:00.028)       0:00:01.699 ********
skipping: [STR-ACS-VSERV-01]

TASK [vm_set : Upgrade kernel package] *******************************************************************************************************
Friday 29 January 2021  20:33:21 +0000 (0:00:00.028)       0:00:01.727 ********
skipping: [STR-ACS-VSERV-01] => (item=[])

TASK [vm_set : Prompt for rebooting] *********************************************************************************************************
Friday 29 January 2021  20:33:21 +0000 (0:00:00.038)       0:00:01.765 ********
skipping: [STR-ACS-VSERV-01]

TASK [vm_set : Install necessary packages] ***************************************************************************************************
Friday 29 January 2021  20:33:21 +0000 (0:00:00.028)       0:00:01.794 ********
ok: [STR-ACS-VSERV-01] => (item=[u'ifupdown', u'qemu', u'openvswitch-switch', u'net-tools', u'bridge-utils', u'util-linux', u'iproute2', u'vlan', u'apt-transport-https', u'ca-certificates', u'curl', u'software-properties-common', u'libvirt-clients'])

TASK [vm_set : apt] **************************************************************************************************************************
Friday 29 January 2021  20:33:23 +0000 (0:00:01.862)       0:00:03.657 ********
skipping: [STR-ACS-VSERV-01]

TASK [vm_set : apt] **************************************************************************************************************************
Friday 29 January 2021  20:33:23 +0000 (0:00:00.030)       0:00:03.688 ********
ok: [STR-ACS-VSERV-01]

TASK [vm_set : Get default pip_executable] ***************************************************************************************************
Friday 29 January 2021  20:33:23 +0000 (0:00:00.763)       0:00:04.451 ********
skipping: [STR-ACS-VSERV-01]

TASK [vm_set : Get default pip_executable] ***************************************************************************************************
Friday 29 January 2021  20:33:23 +0000 (0:00:00.029)       0:00:04.481 ********
ok: [STR-ACS-VSERV-01]

TASK [vm_set : include_tasks] ****************************************************************************************************************
Friday 29 January 2021  20:33:23 +0000 (0:00:00.030)       0:00:04.512 ********
included: /home/kalai_sonic/data/sonic-mgmt/ansible/roles/vm_set/tasks/docker.yml for STR-ACS-VSERV-01

TASK [vm_set : Add docker official GPG key] **************************************************************************************************
Friday 29 January 2021  20:33:24 +0000 (0:00:00.052)       0:00:04.564 ********
ok: [STR-ACS-VSERV-01]

TASK [vm_set : Add docker repository for 16.04] **********************************************************************************************
Friday 29 January 2021  20:33:25 +0000 (0:00:01.304)       0:00:05.869 ********
skipping: [STR-ACS-VSERV-01]

TASK [vm_set : Add docker repository for 17.04] **********************************************************************************************
Friday 29 January 2021  20:33:25 +0000 (0:00:00.029)       0:00:05.899 ********
skipping: [STR-ACS-VSERV-01]

TASK [vm_set : Add docker repository for 18.04] **********************************************************************************************
Friday 29 January 2021  20:33:25 +0000 (0:00:00.026)       0:00:05.925 ********
skipping: [STR-ACS-VSERV-01]

TASK [vm_set : Add docker repository for 20.04] **********************************************************************************************
Friday 29 January 2021  20:33:25 +0000 (0:00:00.026)       0:00:05.951 ********
ok: [STR-ACS-VSERV-01]

TASK [vm_set : Install docker-ce] ************************************************************************************************************
Friday 29 January 2021  20:33:25 +0000 (0:00:00.549)       0:00:06.501 ********
ok: [STR-ACS-VSERV-01]

TASK [vm_set : remove old python packages] ***************************************************************************************************
Friday 29 January 2021  20:33:28 +0000 (0:00:02.744)       0:00:09.245 ********
ok: [STR-ACS-VSERV-01]

TASK [vm_set : Install python packages] ******************************************************************************************************
Friday 29 January 2021  20:33:32 +0000 (0:00:04.003)       0:00:13.248 ********
changed: [STR-ACS-VSERV-01]

TASK [vm_set : Ensure kalai_sonic in docker,sudo group] **************************************************************************************
Friday 29 January 2021  20:33:36 +0000 (0:00:03.902)       0:00:17.151 ********
ok: [STR-ACS-VSERV-01]

TASK [vm_set : Ensure kalai_sonic in libvirt group] ******************************************************************************************
Friday 29 January 2021  20:33:37 +0000 (0:00:00.465)       0:00:17.617 ********
ok: [STR-ACS-VSERV-01]

TASK [vm_set : Install br_netfilter kernel module] *******************************************************************************************
Friday 29 January 2021  20:33:37 +0000 (0:00:00.178)       0:00:17.795 ********
ok: [STR-ACS-VSERV-01]

TASK [vm_set : Set sysctl bridge parameters for testbed] *************************************************************************************
Friday 29 January 2021  20:33:37 +0000 (0:00:00.311)       0:00:18.107 ********
ok: [STR-ACS-VSERV-01] => (item=net.bridge.bridge-nf-call-arptables)
ok: [STR-ACS-VSERV-01] => (item=net.bridge.bridge-nf-call-ip6tables)
ok: [STR-ACS-VSERV-01] => (item=net.bridge.bridge-nf-call-iptables)

TASK [vm_set : Set sysctl RCVBUF max parameter for testbed] **********************************************************************************
Friday 29 January 2021  20:33:38 +0000 (0:00:00.639)       0:00:18.747 ********
ok: [STR-ACS-VSERV-01]

TASK [vm_set : Set sysctl RCVBUF default parameter for testbed] ******************************************************************************
Friday 29 January 2021  20:33:38 +0000 (0:00:00.149)       0:00:18.896 ********
ok: [STR-ACS-VSERV-01]

TASK [vm_set : Setup external front port] ****************************************************************************************************
Friday 29 January 2021  20:33:38 +0000 (0:00:00.140)       0:00:19.037 ********
skipping: [STR-ACS-VSERV-01]

TASK [vm_set : Setup internal management network] ********************************************************************************************
Friday 29 January 2021  20:33:38 +0000 (0:00:00.029)       0:00:19.066 ********
skipping: [STR-ACS-VSERV-01]

TASK [vm_set : getent] ***********************************************************************************************************************
Friday 29 January 2021  20:33:38 +0000 (0:00:00.028)       0:00:19.095 ********
ok: [STR-ACS-VSERV-01]

TASK [vm_set : set_fact] *********************************************************************************************************************
Friday 29 January 2021  20:33:38 +0000 (0:00:00.319)       0:00:19.414 ********
ok: [STR-ACS-VSERV-01]

TASK [vm_set : debug] ************************************************************************************************************************
Friday 29 January 2021  20:33:38 +0000 (0:00:00.033)       0:00:19.448 ********
ok: [STR-ACS-VSERV-01] => {
    "msg": "/home/kalai_sonic"
}

TASK [vm_set : Require veos VMs by default] **************************************************************************************************
Friday 29 January 2021  20:33:38 +0000 (0:00:00.030)       0:00:19.478 ********
ok: [STR-ACS-VSERV-01]

TASK [vm_set : veos VMs not needed when setting up Kubernetes master] ************************************************************************
Friday 29 January 2021  20:33:38 +0000 (0:00:00.028)       0:00:19.506 ********
skipping: [STR-ACS-VSERV-01]

TASK [vm_set : VMs not needed in case of Keysight API Server] ********************************************************************************
Friday 29 January 2021  20:33:39 +0000 (0:00:00.030)       0:00:19.536 ********
skipping: [STR-ACS-VSERV-01]

TASK [vm_set : Retrieve a list of the defined VMs] *******************************************************************************************
Friday 29 January 2021  20:33:39 +0000 (0:00:00.024)       0:00:19.561 ********
fatal: [STR-ACS-VSERV-01]: FAILED! => {"changed": false, "msg": "The `libvirt` module is not importable. Check the requirements."}

PLAY RECAP ***********************************************************************************************************************************
STR-ACS-VSERV-01           : ok=22   changed=1    unreachable=0    failed=1    skipped=13   rescued=0    ignored=0

Friday 29 January 2021  20:33:39 +0000 (0:00:00.316)       0:00:19.877 ********
===============================================================================
vm_set : remove old python packages --------------------------------------------------------------------------------------------------- 4.00s
vm_set : Install python packages ------------------------------------------------------------------------------------------------------ 3.90s
vm_set : Install docker-ce ------------------------------------------------------------------------------------------------------------ 2.74s
vm_set : Install necessary packages --------------------------------------------------------------------------------------------------- 1.86s
vm_set : Add docker official GPG key -------------------------------------------------------------------------------------------------- 1.30s
vm_set : get host distribution -------------------------------------------------------------------------------------------------------- 1.21s
vm_set : apt -------------------------------------------------------------------------------------------------------------------------- 0.76s
vm_set : Set sysctl bridge parameters for testbed ------------------------------------------------------------------------------------- 0.64s
vm_set : Add docker repository for 20.04 ---------------------------------------------------------------------------------------------- 0.55s
vm_set : Ensure kalai_sonic in docker,sudo group -------------------------------------------------------------------------------------- 0.47s
vm_set : getent ----------------------------------------------------------------------------------------------------------------------- 0.32s
vm_set : Retrieve a list of the defined VMs ------------------------------------------------------------------------------------------- 0.32s
vm_set : Install br_netfilter kernel module ------------------------------------------------------------------------------------------- 0.31s
vm_set : Ensure kalai_sonic in libvirt group ------------------------------------------------------------------------------------------ 0.18s
vm_set : Set sysctl RCVBUF max parameter for testbed ---------------------------------------------------------------------------------- 0.15s
vm_set : Set sysctl RCVBUF default parameter for testbed ------------------------------------------------------------------------------ 0.14s
vm_set : get host distribution version ------------------------------------------------------------------------------------------------ 0.14s
vm_set : get host kernel version ------------------------------------------------------------------------------------------------------ 0.13s
vm_set : include_tasks ---------------------------------------------------------------------------------------------------------------- 0.05s
vm_set : Upgrade kernel package ------------------------------------------------------------------------------------------------------- 0.04s
kalai_sonic@1f73dfa908e7:~/data/sonic-mgmt/ansible$ brctl show
bash: brctl: command not found
kalai_sonic@1f73dfa908e7:~/data/sonic-mgmt/ansible$

Thanks
Kalai

Rushabh Dhabe

unread,
Oct 26, 2021, 4:23:43 AM10/26/21
to sonic-test-workgroup
Hi  Kalai I am facing the similar issue, Please help if You have solved this issue

when I execute (i.e. while trying to Deploy T0 topology/ start the VMs): 

./testbed-cli.sh -t vtestbed.csv -m veos_vtb add-topo vms-kvm-t0 password.txt

Error:

rushabh@af15c09bedc0:/data/sonic-mgmt/ansible$ ./testbed-cli.sh -t vtestbed.csv -m veos_vtb add-topo vms-kvm-t0 password.txt
Deploying topology for testbed 'vms-kvm-t0'
reading
Found testbed vms-kvm-t0
[vlab-01] vlab-01
/usr/local/lib/python2.7/dist-packages/ansible/parsing/vault/__init__.py:44: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release.
  from cryptography.exceptions import InvalidSignature

PLAY [servers:&vm_host] **************************************************************************************************************

TASK [Check for a single host] *******************************************************************************************************
Tuesday 26 October 2021  07:26:53 +0000 (0:00:00.137)       0:00:00.137 *******
[WARNING]: conditional statements should not include jinja2 templating delimiters such as {{ }} or {% %}. Found: {{ play_hosts|length
}} != 1

.
.
.
.
.
.
.
TASK [vm_set : veos or SONiC VMs not needed when setting up Kubernetes master] *******************************************************
Tuesday 26 October 2021  07:27:15 +0000 (0:00:00.031)       0:00:22.179 *******
skipping: [STR-ACS-VSERV-01]

TASK [vm_set : VMs not needed in case of Keysight API Server] ************************************************************************
Tuesday 26 October 2021  07:27:15 +0000 (0:00:00.034)       0:00:22.214 *******
skipping: [STR-ACS-VSERV-01]

TASK [vm_set : VMs not needed in case of Keysight IxANVL] ****************************************************************************
Tuesday 26 October 2021  07:27:15 +0000 (0:00:00.040)       0:00:22.255 *******
skipping: [STR-ACS-VSERV-01]

TASK [vm_set : VMs not needed for cable test] ****************************************************************************************
Tuesday 26 October 2021  07:27:15 +0000 (0:00:00.042)       0:00:22.298 *******
skipping: [STR-ACS-VSERV-01]

**TASK [vm_set : Retrieve a list of the defined VMs] ***********************************************************************************
Tuesday 26 October 2021  07:27:15 +0000 (0:00:00.033)       0:00:22.332 *******
**fatal: [STR-ACS-VSERV-01]: FAILED! => {"changed": false, "msg": "The `libvirt` module is not importable. Check the requirements."}****

PLAY RECAP ***************************************************************************************************************************
STR-ACS-VSERV-01           : ok=25   changed=1    unreachable=0    failed=1    skipped=16   rescued=0    ignored=0

Tuesday 26 October 2021  07:36:37 +0000 (0:00:00.021)       0:00:20.210 *******
===============================================================================
vm_set : Install docker-ce ------------------------------------------------------------------------------------ 3.56s
vm_set : Install python packages ------------------------------------------------------------------------- 2.28s
vm_set : Add docker official GPG key --------------------------------------------------------------------- 1.82s
vm_set : remove old python packages ------------------------------------------------------------------------------ 1.67s
vm_set : Install necessary packages ------------------------------------------------------------------------------ 1.65s
vm_set : Set sysctl bridge parameters for testbed -------------------------------------------------------------------- 1.23s
vm_set : apt -------------------------------------------------------------------------------------------------------- 1.17s
vm_set : get host distribution --------------------------------------------------------------------------------------- 0.92s
vm_set : Add docker repository for 18.04 --------------------------------------------------------------------- 0.82s
vm_set : Ensure rushabh 
in docker,sudo group ----------------------------------------------------------------------- 0.71s
vm_set : getent --------------------------------------------------------------------------------------------------- 0.64s
vm_set : Check docker repository ------------------------------------------------------------------------------ 0.63s
vm_set : Install br_netfilter kernel module --------------------------------------------------------------------- 0.54s
vm_set : Set sysctl RCVBUF default parameter for testbed ----------------------------------------------- 0.40s
vm_set : Set sysctl RCVBUF max parameter for testbed ----------------------------------------------------- 0.39s
vm_set : get host kernel version ---------------------------------------------------------------------------- 0.38s
vm_set : get host distribution version ------------------------------------------------------------------------- 0.37s
vm_set : include_tasks ------------------------------------------------------------------------------------------------- 0.06s
vm_set : Upgrade kernel package ------------------------------------------------------------------ 0.05s
vm_set : Set the default variable package_installation -------------------------------------- 0.05s

```

Gord Chen

unread,
Dec 10, 2021, 2:58:57 AM12/10/21
to sonic-test-workgroup
Have you tried to install libvirt-python by using  pip install libvirt-python  on your server 



Rushabh Dhabe 在 2021年10月26日 星期二下午4:23:43 [UTC+8] 的信中寫道:

Karthik V

unread,
Jan 11, 2024, 2:21:12 AM1/11/24
to sonic-test-workgroup
In the command which you have given, you have not mentioned the vm type i.e, veos or ceos or vsonic or vcisco

Try with the following command:

cd /data/sonic-mgmt/ansible

./testbed-cli.sh -t vtestbed.yaml -m veos_vtb -k ceos add-topo vms-kvm-t0 password.txt

Replace "ceos" with the vm you prefer to use accordingly.

Best Regards,
Karthik V
Reply all
Reply to author
Forward
0 new messages