Hey Guys,
Here is the issue I am having:
I'm creating vm's on a kvm host from a webpage/app I am developing using libvirt-php.
For some reason, I'm stuck on trying to access the vm's after they have been created. I've tried everything I can think of.
"virsh console vm-name" doesn't work- it just always hangs at the "escape character is ^]" prompt. There is a console defined- see the vm.xml dump below.
I can't get any of the methods of connecting via vnc to work either (remote-viewer, vncviewer, etc.), and the local kvm host I am working on is command line only (no access to a gui).
I can't ssh to the vm yet, as the vm's are not sending out a DHCP request automatically to get an IP like I assumed they would (since they should be set to iface inet dhcp by default, they are plain Ubuntu 14.04.2 loads).
To make sure my DHCP setup was working (this is a separate DHCP server in the lab since my kvm host is using a bridge, not NAT), I created a vm manually with ubuntu-vm-builder (which is being deprecated) and set a static ip/gw on the vm that way.
Then I SSH'd to the vm on the IP I just set, wiped out the /etc/network/interfaces config in the vm and changed its eth0 from static to dhcp. Rebooted the vm, and voila, it grabbed an address from the dhcp server no problem- so there is no issue with the bonding or bridging or dhcp on the kvm host- dhcp is working. All of these vm's are on the same bridge also, so no variable there.
But when I create a vm from my webpage using libvirt-php (on the same kvm host, same bridge), I don't want to assign a static IP for obvious reasons- instead I want the newly created vm to just get an IP automatically from my DHCP server. I thought the vm would just do this automatically when it first booted up, but apparently I am wrong.
Worst part is I can't even access the vm's that I am successfully creating using the webpage, because neither virsh console nor vnc seem to work to get me into the vm to troubleshoot. (I don't want my users to have an extra step anyways i.e. vnc, so I need to figure out why the vm's aren't automatically sending a DHCP request.)
Please help. Thank you for your time!
Dump of active vm.xml:
Code:
<domain type='kvm' id='7'>
<name>newvm17</name>
<uuid>f85ef41b-42f6-4cae-a875-ecdbfe806aa4</uuid>
<memory unit='KiB'>2000896</memory>
<currentMemory unit='KiB'>2000000</currentMemory>
<vcpu placement='static'>1</vcpu>
<resource>
<partition>/machine</partition>
</resource>
<os>
<type arch='x86_64' machine='pc-i440fx-trusty'>hvm</type>
<boot dev='cdrom'/>
</os>
<features>
<acpi/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/bin/kvm</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/home/apslab/images/newvm17.qcow2'/>
<target dev='hda' bus='ide'/>
<alias name='ide0-0-0'/>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>
<disk type='file' device='cdrom'>
<driver name='qemu' type='raw'/>
<source file='/home/apslab/images/ubuntu-14.04.2-server-amd64.iso'/>
<target dev='hdc' bus='ide'/>
<readonly/>
<alias name='ide0-1-0'/>
<address type='drive' controller='0' bus='1' target='0' unit='0'/>
</disk>
<controller type='usb' index='0'>
<alias name='usb0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
</controller>
<controller type='pci' index='0' model='pci-root'>
<alias name='pci.0'/>
</controller>
<controller type='ide' index='0'>
<alias name='ide0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
</controller>
<interface type='bridge'>
<mac address='52:54:00:de:dc:e0'/>
<source bridge='br0'/>
<target dev='vnet4'/>
<model type='virtio'/>
<alias name='net0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<serial type='pty'>
<source path='/dev/pts/5'/>
<target port='0'/>
<alias name='serial0'/>
</serial>
<console type='pty' tty='/dev/pts/5'>
<source path='/dev/pts/5'/>
<target type='serial' port='0'/>
<alias name='serial0'/>
</console>
<input type='mouse' bus='ps2'/>
<input type='keyboard' bus='ps2'/>
<graphics type='vnc' port='5904' autoport='yes' listen='127.0.0.1'>
<listen type='address' address='127.0.0.1'/>
</graphics>
<video>
<model type='cirrus' vram='9216' heads='1'/>
<alias name='video0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<memballoon model='virtio'>
<alias name='balloon0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</memballoon>
</devices>
<seclabel type='dynamic' model='apparmor' relabel='yes'>
<label>libvirt-f85ef41b-42f6-4cae-a875-ecdbfe806aa4</label>
<imagelabel>libvirt-f85ef41b-42f6-4cae-a875-ecdbfe806aa4</imagelabel>
</seclabel>
</domain>