Using Putty to log in to a remote CentOS 7 server, I am able to successfully create a CentOS 7 guest virtual machine in the CentOS 7 host.
However, the command causes the console to freeze and eventually time out, without giving any indication that it has successfully created the virtual machine. I have to then log in again with a separate Putty session in order to confirm that the guest virtual machine has been created.
What specific command(s) need to be typed in order to instruct the CentOS 7 host machine to create the CentOS 7 guest virtual machine in a way that gives meaningful result-reporting in the terminal without locking up? The command needs to produce meaningful feedback that can be integrated into a script afterwards.
Complete Terminal Output:
Here is the terminal log of the locked-up/timed-out Putty session resulting from my current
virt-install
syntax:
[root@remote-host ~]# virt-install --name centos7 --ram 2048 --disk path=/dev/mapper/centos-third,size=242 --vcpus 1 --os-type generic --os-variant generic --network bridge=virbr0 --graphics none --console pty,target_type=serial --cdrom /tmp/CentOS-7-x86_64-Minimal-1611.iso
WARNING CDROM media does not print to the text console by default, so you likely will not see text install output. You might want to use --location. See the man page for examples of using --location with CDROM media
Starting install...
Creating domain... | 0 B 00:00:00
Connected to domain centos7
Escape character is ^]
Independent Validation in a SEPARATE Putty Session:
After the above-documented Putty session timed out, I started another (separate) Putty session, and used
virsh
to discover that the first guest virtual machine had been successfully created, as follows:
[root@remote-host ~]# virsh list --all
Id Name State
----------------------------------------------------
5 centos7 running
[root@remote-host ~]# virsh dominfo centos7
Id: 5
Name: centos7
UUID: some-very-long-string
OS Type: hvm
State: running
CPU(s): 1
CPU time: 1742.1s
Max memory: 2097152 KiB
Used memory: 2097152 KiB
Persistent: yes
Autostart: disable
Managed save: no
Security model: selinux
Security DOI: 0
Security label: system_u:system_r:svirt_t:s0:c654,c992 (enforcing)
[root@remote-host ~]# virsh vcpuinfo centos7
VCPU: 0
CPU: 2
State: running
CPU time: 1839.3s
CPU Affinity: yyyy
[root@remote-host ~]#
Another Attempt:
Next, I tried the suggestion from the error message above and opened up a separate (third) Putty session to run the following command to create a different guest virtual machine using --location
instead of --cdrom
so that console output can be printed, but I am getting the following error:
[root@remote-host ~]# virt-install --name centos7b --ram 2048 --disk path=/dev/mapper/centos-fourth,size=242 --vcpus 1 --os-type generic --os-variant generic --network bridge=virbr0 --graphics none --console pty,target_type=serial --location=/tmp/CentOS-7-x86_64-Minimal-1611.iso
ERROR 'NoneType' object is not iterable
How can we change the commands above to provide meaningful feedback about success or failure of the virt-install
command without having to wait until the session times out and start a separate session?