[libvirt-users] follow-up to thread : Acces to hypervisor from a KVM guest, ( by the way , how to enter a follow up in a thread ?) Thx
by Jean-Pierre Ribeauville
Hi,
This is what I tried :
Y , how enter an answer in the thread ?)
virsh -c qemu+ssh://127.0.0.1:22/system hostname root(a)127.0.0.1's<mailto:root@127.0.0.1's> password:
error: End of file while reading data: : Input/output error
error: failed to connect to the hypervisor
In another hand ,as we have few information to share , I was thinking to use a virtio channel to dialog between host and guest .
Does it fit ?
Thx
J.P. ?
-----Message d'origine-----
De : Eric Blake [mailto:eblake@redhat.com] Envoyé : vendredi 4 juillet 2014 15:20 À : Jean-Pierre Ribeauville; libvirt-users(a)redhat.com<mailto:libvirt-users@redhat.com> Objet : Re: [libvirt-users] Acces to hypervisor from a KVM guest
On 07/04/2014 04:23 AM, Jean-Pierre Ribeauville wrote:
> Hi,
>
>>From a KVM guest, I want to retrieve the hostname of the host on which the hypervisor is running.
> Before doing that by using libvirt API, I first try via virsh.
Well, virsh just uses the libvirt API under the hood. I'd suggest that you try: virsh -c qemu://host/system hostname
except that this is a chicken-and-egg situation, because virsh in the guest doesn't know what host to connect to.
If you are using the out-of-the-box NAT setup, then you could use qemu://192.168.122.1/system, since your guest will be using an IP address assigned from that subnet from the host.
Other than that, libvirt is not really designed for guest-to-host communication, but for host management of guests. You'll have to solve your problem in some other way. Consider the same situation with bare metal hosts - if you are provisioning a cluster, and want machines in the cluster to communicate to a particular controller, but not all machines connect to the same controller, how would you do that? If you can solve that problem, then you can use it to solve your guest provisioning problem.
> error: Failed to reconnect to the hypervisor
> error: no valid connection
> error: internal error Unable to locate libvirtd daemon in /usr/sbin
> (to override, set $LIBVIRTD_PATH to the name of the libvirtd binary)
This failure is because you did not use -c to connect to a remote daemon, but don't have libvirtd running in the guest. You do not need libvirtd running locally to use virsh for remote connections, but you do need to know where the remote connection lives.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[cid:image001.png@01CF75CE.35F97F50]
Jean-Pierre RIBEAUVILLE
Developer
Tel: 01 49 11 45 81
Discover Systar's Videos!<https://www.youtube.com/channel/UCvyaJkMXCGFo8_XZYd9rcBw>
P Please consider the environment before printing this e-mail
10 years, 4 months
[libvirt-users] getting CPU usage through virsh command or libvirt API
by Restituto Marcus Arevalo
Hi,
Is it possible to get the CPU usage of a guest through a virsh command? I have tried almost all the commands (vcpuinfo, cpu-stats, etc.) that gets the details of a guest cpu, but it only returns the cpu time. Is there any command that returns the cpu usage (just like the graph that virt-manager displays) of a guest? Or do I have to create a program using libvirt API? Thanks in advance.
regards,
Marco
10 years, 4 months
[libvirt-users] qemu-kvm version for CentOS
by kerwin
WHY CentOS still using qemu-kvm 0.12?
What I am need is high version of qemu-kvm for CentOS, but seems like they do not officially provide newest qemu, only qemu 0.12 source code with 3522 patched rpm package.
Is there any reasonable to keep low version for qemu-kvm ? or what should I do if I need newest qemu-kvm rpm package?
✉ --
朴元奎
kerwin
10 years, 4 months
[libvirt-users] virsh: cannot start domain with channel device,
by John
Here is what I got.
root ubuntu:/home/john# virsh start ubuntu2
error: Failed to start domain ubuntu2
error: internal error Process exited while reading console log output: char device redirected to /dev/pts/1
bind(unix:/var/lib/libvirt/qemu/ubuntu2.libguestfs): Permission denied
chardev: opening backend "socket" failed: Permission denied
root ubuntu:/home/john# ll /var/lib/libvirt/qemu/
total 20
drwxr-x--- 5 libvirt-qemu kvm 4096 Jul 5 14:44 ./
drwxr-xr-x 8 root root 4096 May 20 04:18 ../
drwxr-xr-x 2 libvirt-qemu kvm 4096 May 20 04:18 dump/
drwxr-xr-x 2 libvirt-qemu kvm 4096 May 20 04:18 save/
drwxr-xr-x 2 libvirt-qemu kvm 4096 May 20 04:18 snapshot/
root ubuntu:/home/john# cat /etc/libvirt/qemu/ubuntu2.xml
<!--
WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
OVERWRITTEN AND LOST. Changes to this xml configuration should be made using:
virsh edit ubuntu2
or other application using the libvirt API.
-->
<domain type='kvm' xmlns:qemu='/schemas/domain/qemu/1.0'>
<qemu:commandline>
<qemu:arg value='-s'/>
</qemu:commandline>
<name>ubuntu2</name>
<uuid>03f4c36d-9509-05dd-167d-d2613d1dd883</uuid>
<memory>1024000</memory>
<currentMemory>1024000</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='x86_64' machine='pc-1.0'>hvm</type>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</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/john/ubuntu-1204-vm.img'/>
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' unit='0'/>
</disk>
<controller type='ide' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
</controller>
<interface type='bridge'>
<mac address='52:54:00:d4:7d:07'/>
<source bridge='br0'/>
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<serial type='pty'>
<target port='0'/>
</serial>
<console type='pty'>
<target type='serial' port='0'/>
</console>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes'/>
<sound model='ich6'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</sound>
<video>
<model type='cirrus' vram='9216' heads='1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</memballoon>
<channel type='unix'>
<source mode='bind' path='/var/lib/libvirt/qemu/ubuntu2.libguestfs' />
<target type='virtio' name='org.libguestfs.channel.0' />
</channel>
</devices>
</domain>
When I deleted the <channel>...</channel> part, it will start normally. But I need it to use guestfish with --live option.
No SELinux or AppArmor is used. qemu.conf shows it's running by root user. I did "virsh start" operation under root and the error remains. Should I change the permission attributes of files under /var/lib/libvirt/qemu ?
10 years, 4 months
[libvirt-users] Source code of virt-manager
by Restituto Marcus Arevalo
Hi,
Does anyone know where I could view the source code of virt-manager? Because I'm trying to learn how the virt-manager gets the CPU usage of a VM(the graph it displays). I'm trying to make a program using java that gets the CPU usage of a VM in KVM. Anybody have suggestions on where I could start?Thanks
regards,
Marco
10 years, 4 months
[libvirt-users] virsh blockcopy: doesn't seem to flatten the chain by default
by Kashyap Chamarthy
Versions
--------
(Libvirt locally built from a recent git commit -ec7b922):
$ rpm -q libvirt-daemon-kvm qemu-system-x86
libvirt-daemon-kvm-1.2.6-1.fc20.x86_64
qemu-system-x86-2.0.0-1.fc21.x86_64
Test
----
[All images are qcow2 files.]
We have this simple chain:
base <- snap1
Let's quickly examine the contents of 'base' and 'snap1' images:
'base' has just a single file: foo
$ guestfish --ro -a base.qcow2
[. . .]
><fs> ls /
><fs> run
><fs> mount /dev/sda1 /
><fs> ls /
foo
lost+found
><fs> quit
'snap1' has files: bar, baz, jazz
$ guestfish --ro -a snap1.qcow2
[. . .]
><fs> run
><fs> mount /dev/sda1 /
><fs> ls /
bar
baz
jazz
lost+found
><fs>
Now, let's do a live blockcopy (with a '--finish' to graecully finish
the mirroring):
$ virsh blockcopy --domain testvm2 vda \
/export/dst/copy.qcow2 \
--wait --verbose --finish
Examine the contents of the above 'copy':
$ guestfish --ro -a copy.qcow2
[. . .]
><fs> run
><fs> mount /dev/sda1 /
><fs> ls /
bar
baz
jazz
lost+found
><fs> quit
If I'm reading the man page of 'blockcopy' correctly, shouldn't it
'flatten' the entire chain, by also copying the contents of base into
copy.qcow2? i.e. the 'copy' should have files (including the file foo
from 'base':
foo, bar, baz, jazz
True or false?
PS: I've tested the cases of --pivot, --shallow and --reuse-external,
will post my notes about them on a wiki.
--
/kashyap
10 years, 4 months
[libvirt-users] Acces to hypervisor from a KVM guest
by Jean-Pierre Ribeauville
Hi,
>From a KVM guest, I want to retrieve the hostname of the host on which the hypervisor is running.
Before doing that by using libvirt API, I first try via virsh.
So, I run virsh and the run hostname command.( got that in virsh help : .... hostname print the hypervisor hostname ....)
Unfortunately, I got following error when starting virsh :
error: Failed to reconnect to the hypervisor
error: no valid connection
error: internal error Unable to locate libvirtd daemon in /usr/sbin (to override, set $LIBVIRTD_PATH to the name of the libvirtd binary)
Do I miss to install some package on my KVM guest ? or is it not the right way to get this information ?
Any help is welcome.
Thx.
[cid:image001.png@01CF75CE.35F97F50]
Jean-Pierre RIBEAUVILLE
Developer
Tel: 01 49 11 45 81
Discover Systar's Videos!<https://www.youtube.com/channel/UCvyaJkMXCGFo8_XZYd9rcBw>
P Please consider the environment before printing this e-mail
10 years, 4 months
[libvirt-users] os/type/machine/pc-xxxx meaning ? following live migration issue after an upgrade
by Benoit Rousselle
Dear All,
I have upgrade my hypervisors:
qemu-kvm 0.12.5 => 1.1.2
libvirt-bin 0.8.3-5 => 0.9.12.3
(debian6 to debian7)
After that upgrade, i noticed that live migration was most of the time
failing (freeze) (not always)
I also noticed that creating a machine with the updated hypervisor was
always working.
After some days of investigation mainly on network side, i found this
setting that seems to fix the issue in the xml:
<os>
<type arch='x86_64' machine='pc-0.12'>hvm</type>
<boot dev='hd'/>
</os>
replacing pc-0.12 with pc-1.1 seems to fix the issue.
Here are my questions :
1) what is the meaning/purpose of that setting ? (i guess it is somehow
linked to the version of kvm ;) )
2) can i just change it in all xmls ? ( i have plenty of linux/windows
flavors running in my vms)
3) is it possible to put a more generic value? So we don't have the same
issue on next upgrade.
4) Is there a script/doc that explains what needs to be done on the vm
itself (xml or other) when we upgrade libvirt/kvm ?
Thanks for the feedback !
Benoit.
--
Benoit Rousselle
10 years, 4 months
[libvirt-users] getting CPU usage of VMs through libvirt
by Restituto Marcus Arevalo
Greetings everyone,
I just want to ask if it is possible to get the CPU usage of the VMs in KVM through libvirt? I mean, how does the virt-manager produce the graph it displays? Is there a way get this graph? But instead of the graph itself, I just need to get it in percentage(%) form. I'd like to know how. Thank you and your help will be greatly appreciated.
regards,
Marco
10 years, 4 months