I have been tasked to create virtual device using virt-install by writing it as a shell script. How can I achieve the same in python script? I'm new to both virt-install and python. Thanks!
virt-install \
--name centos7 \
--ram 1024 \
--disk path=./centos7.qcow2,size=8 \
--vcpus 1 \
--os-type linux \
--os-variant centos7 \
--network bridge=virbr0 \
--graphics none \
--console pty,target_type=serial \
--location 'http://mirror.i3d.net/pub/centos/7/os/x86_64/' \
--extra-args 'console=ttyS0,115200n8 serial'
(virtinstall.sh) and runs fine.
You can use subprocess. Here's a sample:
libvirt has a python interface. So, if you are planning to use Python - you can directly use the python interface.
http://www.ibm.com/developerworks/library/os-python-kvm-scripting1/