[libvirt-users] Issue with virsh screenshot
by Tadas
Hello lists,
I have strange issue while creating VM screenshots.
virsh screenshot vmname produces ppm image. But when i try to make
second screenshot, it produces the same image, even is VM screen has
changed. Running screenshot on third time, it produces correct image.
It looks like screenshot is producing last image every second time it
is ran.
OS debian stretch.
virsh --version
2.0.0
qemu-system-x86_64 --version
QEMU emulator version 2.6.0 (Debian 1:2.6+dfsg-3), Copyright (c) 2003-
2008 Fabrice Bellard
8 years, 2 months
[libvirt-users] Use libvirt to create an NIC on the guest machine and connect to an existing TAP interface
by Marina Danial
Hello,
I am facing the following issue.
I have several TAP interfaces that are created by the following method on
OpenVSwitch:
*ovs-vsctl add-br br1*
*sudo /usr/sbin/tunctl -t tap01 -p -u root*
*sudo /sbin/ip link set tap01 up*
*# Disable multicast*
*sudo /sbin/ifconfig tap01 -multicast*
*ovs-vsctl add-port br1 tap01*
I need to launch a qemu VMs and have its NIC card that is created using
libvirt to be connected to tap01 or other taps that are created with the
above method.
I need a way that libvirt only creates the new NIC on either eth0 or eht1
on the guest machine and connect it to tap01.
Please help me in the best way to do so whether using the C++ APIs that
libvirt provides or use the domain and/or network XMLs to achieve this.
Thanks a lot
Marina
8 years, 2 months
[libvirt-users] virtfs / 9p - and "Permission denied" in guests
by lejeczek
hi all
I wonder host is your virtfs passthrough working?
I'm for the first time trying, a pretty regular setup:
<filesystem type='mount' accessmode='passthrough'>
<source
dir='/__.aLocalStorages/2/__.home.usersSecondHome'/>
<target dir='__.x.USERs.SECOND_HOME'/>
<address type='pci' domain='0x0000' bus='0x00'
slot='0x09' function='0x0'/>
</filesystem>
and guests mounts that mount tag, even lists the
mountpoint's content, shows files & dirs but when tries to
list a contets below, eg a subfolder of the mountpoint then
it gets denied.
would you have some suggestions how to troubleshoot it?
many thanks,
L
8 years, 2 months
[libvirt-users] Lifecycle of a connection to libvirtd
by Vincent Bernat
Hey!
I am trying to figure out how to reliably maintain a connection to
libvirtd. From the documentation, I would expect something like that:
- virConnectOpen()
- virConnectRegisterCloseCallback()
- virConnectSetKeepAlive()
- Application logic
And in the registered callback, I would:
- virConnectUnregisterCloseCallback()
- virConnectClose()
- virConnectOpen()
- virConnectRegisterCloseCallback()
- virConnectSetKeepAlive()
However, looking at the source code of virsh, I see that it additional
stuff, notably:
- virConnectIsAlive()
- checking error codes of all calls to check if they are the result of
a disconnect
Are those steps needed? Randomly checking virConnectIsAlive() doesn't
seem reliable. Checking individual error codes either (maybe I will miss
one of them or misinterpret another one).
virsh code uses those error codes to check if there is a disconnection:
(((last_error->code == VIR_ERR_SYSTEM_ERROR) &&
(last_error->domain == VIR_FROM_REMOTE)) ||
(last_error->code == VIR_ERR_RPC) ||
(last_error->code == VIR_ERR_NO_CONNECT) ||
(last_error->code == VIR_ERR_INVALID_CONN))))
Any hint?
--
Program defensively.
- The Elements of Programming Style (Kernighan & Plauger)
8 years, 2 months
Re: [libvirt-users] Attaching disks with external snapshots
by Erlon Cruz
Hi Han,
Any update on this?
Erlon
On Wed, Aug 17, 2016 at 9:58 AM, Erlon Cruz <sombrafam(a)gmail.com> wrote:
> Han,
>
> Did the same test again with libvirt debug enabled. This time I added the
> disk[1] without snaps (OK), and then added the disk[2] with snapshots. The
> libvirt log[3] (line 320) says:
>
> *Could not open
> '/opt/stack/data/nova/mnt/a3b4c6ddd9bf82edd4f726872be58d05/volume-a75b42e8-8175-4516-b724-43ee6f3d2520':
> Permission denied\r\n", "id": "libvirt-33"}]*
>
> But this file has 777 permissions. I can access it with any user I
> tried[4]. Tough its mounted over NFS, the permissions seems to be right.
>
> Erlon
>
> [1] http://paste.openstack.org/show/556055/
> [2] http://paste.openstack.org/show/556056/
> [3] http://pastebin.com/CCFcKq5b
> [4] http://paste.openstack.org/show/559018/
>
>
> On Tue, Aug 16, 2016 at 2:41 PM, Erlon Cruz <sombrafam(a)gmail.com> wrote:
>
>> Hi Han,
>>
>> Thanks for helping. What is the XML before the snapshot is created? Can
>> you post the XML files you used too? The files are in the links pointed by
>> the numbers [1], [2] etc.
>>
>> The versions are:
>> qemu-system-x86_64 --version
>> QEMU emulator version 2.5.0 (Debian 1:2.5+dfsg-5ubuntu10.4), Copyright
>> (c) 2003-2008 Fabrice Bellard
>>
>> libvirtd --version
>> libvirtd (libvirt) 1.3.1
>>
>>
>>
>> Erlon
>>
>> On Mon, Aug 15, 2016 at 12:56 AM, Han Han <hhan(a)redhat.com> wrote:
>>
>>> Hi,Erlon
>>> I was not able to reproduce your problem. It is ok to attach disk with
>>> external snapshot.
>>> I did it with following steps:
>>> # qemu-img create /tmp/vdb 100M
>>> Formatting '/tmp/vdb', fmt=raw size=104857600
>>> # virsh start snap
>>> Domain snap started
>>> # virsh snapshot-create-as snap s1 --disk-only --diskspec
>>> vdb,file=/tmp/vdb.s1 --quiesce
>>> Domain snapshot s1 created
>>> # virsh dumpxml snap|awk '/<disk/,/<\/disk/'
>>> <disk type='file' device='disk'>
>>> <driver name='qemu' type='qcow2' cache='none'/>
>>> <source file='/var/lib/libvirt/images/snap.s1'/>
>>> <backingStore type='file' index='1'>
>>> <format type='qcow2'/>
>>> <source file='/var/lib/libvirt/images/snap.qcow2'/>
>>> <backingStore/>
>>> </backingStore>
>>> <target dev='vda' bus='virtio'/>
>>> <alias name='virtio-disk0'/>
>>> <address type='pci' domain='0x0000' bus='0x00' slot='0x07'
>>> function='0x0'/>
>>> </disk>
>>> <disk type='file' device='disk'>
>>> <driver name='qemu' type='qcow2'/>
>>> <source file='/tmp/vdb.s1'/>
>>> <backingStore type='file' index='1'>
>>> <format type='raw'/>
>>> <source file='/tmp/vdb'/>
>>> <backingStore/>
>>> </backingStore>
>>> <target dev='vdb' bus='virtio'/>
>>> <alias name='virtio-disk1'/>
>>> <address type='pci' domain='0x0000' bus='0x00' slot='0x0c'
>>> function='0x0'/>
>>> </disk>
>>>
>>> Save the dumped vdb's xml to /tmp/vdb.xml
>>> # virsh detach-device snap /tmp/vdb.xml
>>> Device detached successfully
>>> # virsh attach-device snap /tmp/vdb.xml
>>> Device attached successfully
>>> # virsh dumpxml snap|awk '/<disk/,/<\/disk/'
>>> <disk type='file' device='disk'>
>>> <driver name='qemu' type='qcow2' cache='none'/>
>>> <source file='/var/lib/libvirt/images/snap.s1'/>
>>> <backingStore type='file' index='1'>
>>> <format type='qcow2'/>
>>> <source file='/var/lib/libvirt/images/snap.qcow2'/>
>>> <backingStore/>
>>> </backingStore>
>>> <target dev='vda' bus='virtio'/>
>>> <alias name='virtio-disk0'/>
>>> <address type='pci' domain='0x0000' bus='0x00' slot='0x07'
>>> function='0x0'/>
>>> </disk>
>>> <disk type='file' device='disk'>
>>> <driver name='qemu' type='qcow2'/>
>>> <source file='/tmp/vdb.s1'/>
>>> <backingStore type='file' index='1'>
>>> <format type='raw'/>
>>> <source file='/tmp/vdb'/>
>>> <backingStore/>
>>> </backingStore>
>>> <target dev='vdb' bus='virtio'/>
>>> <alias name='virtio-disk1'/>
>>> <address type='pci' domain='0x0000' bus='0x00' slot='0x0c'
>>> function='0x0'/>
>>> </disk>
>>>
>>> So I managed to attach disks with snapshot.
>>> I want to know what is your libvirt and qemu-kvm version?
>>> And can you provide your files: /tmp/disk.xml[1],
>>> /tmp/snap-from-disk.xml[2], /tmp/disk-with-snap.xml[4],
>>> /tmp/disk-with-snap.xml . I need more details.
>>>
>>> Han Han
>>>
>>> ----- Original Message -----
>>> From: "Erlon Cruz" <sombrafam(a)gmail.com>
>>> To: libvirt-users(a)redhat.com
>>> Sent: Friday, August 12, 2016 10:23:24 AM
>>> Subject: [libvirt-users] Attaching disks with external snapshots
>>>
>>> Hi folks,
>>>
>>> I'm trying to to attach a disk to an instance using libvirt. The problem
>>> is, this disk has external snapshots. The process tried was:
>>>
>>> 1 - Attach a disk in the domain:
>>> virsh# attach-device instance-00000006 /tmp/disk.xml[1] --live
>>>
>>> 2 - Snapshot the disk[2]:
>>> virsh# snapshot-create instance-00000006 --quiesce --xmlfile
>>> /tmp/snap-from-disk.xml[2] --disk-only
>>>
>>> 3 - Dump the domain XML and create a new disk file from it:
>>> virsh# dumpxml instance-00000006
>>> ... [3]
>>>
>>> 4 - Dettach the device and re-add it using the new disk file:
>>> virsh# detach-device instance-00000006 /tmp/disk-with-snap.xml[4]
>>> Device detached successfully
>>> virsh# attach-device instance-00000006 /tmp/disk-with-snap.xml
>>> error: Failed to attach device from /tmp/disk-with-snap.xml
>>> error: internal error: unable to execute QEMU command 'device_add':
>>> Property 'virtio-blk-device.drive' can't find value 'drive-virtio-disk1'
>>>
>>> Question, is this operation supported? If yes, how is the correct
>>> procedure?
>>>
>>> Erlon
>>>
>>>
>>> [1] http://paste.openstack.org/show/556055/
>>> [2] http://paste.openstack.org/show/556056/
>>> [3] http://paste.openstack.org/show/556063/
>>> [4] http://paste.openstack.org/show/556064/
>>>
>>> _______________________________________________
>>> libvirt-users mailing list
>>> libvirt-users(a)redhat.com
>>> https://www.redhat.com/mailman/listinfo/libvirt-users
>>>
>>
>>
>
8 years, 3 months
[libvirt-users] qemu+ssh authentication
by Shahar Havivi
Hi,
I try to login via the libvirt.openauth() API with qemu+tcp protocol and prompt for password,
I am setting the username, password and the callback methdod with the
following keys:
auth = [[libvirt.VIR_CRED_AUTHNAME, libvirt.VIR_CRED_PASSPHRASE], request_cred, None]
When I call openauth() method:
conn = libvirt.openAuth('qemu+ssh://...', auth, 0)
I am getting prompt for entriyng password.
When using qemu+tcp it works fine.
Thank you,
Shahar.
8 years, 3 months
[libvirt-users] libvirt-lxc capabilities mknod
by jsl6uy js16uy
Hello all, hope all is well
Issue: Any way to give granular mknod capabilities to a container? Only
allow creation of specific device?
bit of background
Have a laptop running arch and libvirt
loading an arch lxc container created from lxc-create
Overall container is up and running, I use it for vpn connections
Initially it would not setup of the tun device. Previously using just the
lxc tool set, I can edit the lxc.conf config file for the container and
allow device creation of just the tun device.
In libvirt I can add capabilities for mknod, but seems to be blanket for
any device creation within the container? Is this correct?
Thanks and Regards
8 years, 3 months