[libvirt-users] Better error codes when stopping a VM that is already stopped
by Guido Winkelmann
Hi,
Sometimes when stopping a virtual domain using virDomainDestroy(), I come
across a domain that is already stopped. (For example when someone already
stopped the domain manually using virsh or because the guest OS issued a
shutdown.) This is a special case that I absolutely need to catch and handle.
Unfortunately, when this happens, and I call virGetLastError() afterwards, I
always just get the error code VIR_ERR_OPERATION_INVALID, which doesn't look
very precise to me...
Two questions about this:
Is the domain not running at that moment the only possible condition that can
trigger this particular error code when calling virDomainDestroy()?
Can't we have a more obvious/precise error code in that case, like
VIR_ERR_DOMAIN_NOT_RUNNING or something like that?
Guido Winkelmann
14 years, 4 months
[libvirt-users] Working example of logical storage pool and volume creation?
by Justin Clift
Hi all,
Does anyone have a working example of creation of a logical storage pool
and volume?
I'm hitting a wall getting logical volumes to work on RHEL 6 beta.
There's a single drive I'm trying to setup (sdc) as a libvirt managed
logical storage pool, but all volume creation on it fails.
Here's what I'm finding so far:
Prior to any storage pool work, only the host boot drive (sda) is in lvm.
# vgs
VG #PV #LV #SN Attr VSize VFree
vg_host2 1 3 0 wz--n- 465.27g 0
# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 vg_host2 lvm2 a- 465.27g 0
# ls -la /dev/mapper
total 0
drwxr-xr-x. 2 root root 120 Jun 1 03:12 .
drwxrwxrwt. 21 root root 3920 Jun 1 03:12 ..
crw-rw----. 1 root root 10, 58 May 31 14:08 control
lrwxrwxrwx. 1 root root 7 May 31 14:10 vg_host2-lv_home -> ../dm-7
lrwxrwxrwx. 1 root root 7 May 31 14:08 vg_host2-lv_root -> ../dm-0
lrwxrwxrwx. 1 root root 7 May 31 14:10 vg_host2-lv_swap -> ../dm-8
#
Creation of a logical storage pool, using sdc:
# virsh pool-define-as guest_images_lvm logical - - /dev/sdc
libvirt_lvm /dev/mapper
Pool guest_images_lvm defined
# virsh pool-info guest_images_lvm
Name: guest_images_lvm
UUID: 17398035-8000-7252-ab25-58db95aed130
State: inactive
# virsh pool-build guest_images_lvm
Pool guest_images_lvm built
#
The physical device and volume group are seen in lvm:
# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 vg_host2 lvm2 a- 465.27g 0
/dev/sdc libvirt_lvm lvm2 a- 465.76g 465.76g
# vgs
VG #PV #LV #SN Attr VSize VFree
libvirt_lvm 1 0 0 wz--n- 465.76g 465.76g
vg_host2 1 3 0 wz--n- 465.27g 0
#
Starting the logical pool works:
# virsh pool-start guest_images_lvm
Pool guest_images_lvm started
#
Creation of volumes fail:
# virsh vol-create-as guest_images_lvm volume1 8G
error: Failed to create vol volume1
error: internal error '/sbin/lvcreate --name volume1 -L 8388608K
/dev/mapper' exited with non-zero status 3 and signal 0: Volume group
name expected (no slash)
Run `lvcreate --help' for more information.
#
So, it looked like "/dev/mapper" in the pool-define-as command should
have instead been the LVM volume group again. That doesn't work either
though:
# virsh pool-define-as guest_images_lvm logical - - /dev/sdc
libvirt_lvm libvirt_lvm
Pool guest_images_lvm defined
# virsh pool-build guest_images_lvm
Pool guest_images_lvm built
# virsh pool-start guest_images_lvm
Pool guest_images_lvm started
# virsh vol-create-as guest_images_lvm volume1 8G
error: Failed to create vol volume1
error: cannot read path 'libvirt_lvm/volume1': No such file or directory
Looking in the libvirtd logs for this last attempt, the volume was
actually successfully created. But libvirtd then checks for it's
presence (wrongly!), doesn't find it, and then lvremove's it:
03:01:24.000: debug : virRunWithHook:832 : /sbin/lvcreate --name
volume1 -L 8388608K libvirt_lvm
...
03:01:24.223: debug : virRunWithHook:848 : Command stdout: Logical
volume "volume1" created
...
03:01:24.223: error : virStorageBackendLogicalCreateVol:616 : cannot
read path 'libvirt_lvm/volume1': No such file or directory
...
03:01:24.223: debug : virRunWithHook:832 : /sbin/lvremove -f
libvirt_lvm/volume1
Guessing I'm either doing something wrong, or hitting bugs, or ?
Anyone have ideas/suggestions/etc?
Regards and best wishes,
Justin Clift
--
Salasaga - Open Source eLearning IDE
http://www.salasaga.org
14 years, 5 months
[libvirt-users] Mount options for fs type storage pools?
by Justin Clift
Hi all,
Presently writing up "Storage Pool" docs for the Fedora Virtualisation
Guide. (using both virsh and virt-manager)
Having trouble finding out how to specify mount options for fs type
storage pools.
For example:
# virsh pool-define-as guest_images_fs fs - - /dev/sdc1 - "/guest_images"
Pool guest_images_fs defined
# virsh pool-build guest_images_fs
Pool guest_images_fs built
# virsh pool-start guest_images_fs
Pool guest_images_fs started
# mount | grep guest_images
/dev/sdc1 on /guest_images type ext4 (rw)
#
Notice that /guest_images is mounted with default options. Nothing
wrong with that, but lets say the SysAdmin has a need to pass specific
mount options. (ie journal_checksum, or noatime, or nodiratime, etc)
Checked the virStorageBackendFileSystemMount() function in present git
master, and it doesn't look like mount options are considered for
anything other than Gluster?
How to do it, or is it best to not use libvirt to manage the mounting of
this type of storage when options are needed?
Regards and best wishes,
Justin Clift
--
Salasaga - Open Source eLearning IDE
http://www.salasaga.org
14 years, 5 months
[libvirt-users] Host should not touch passed-through USB device, how?
by Andreas Ntaflos
Hello list,
this may be off topic but it is closely related to my Libvirt adventures
so maybe you can help me.
I want to pass a USB device (a USB Huawei E620 modem) through to a KVM
guest. Pass-through in general works fine and the modem is visible in
the guest. However, the host still sees it and sometimes tries to access
it (such modems seem to also be USB storage devices). This naturally
leads to conflicts and I believe this crashed the guest very badly
yesterday.
So I am looking for a way to make sure the host passes through the USB
device (in its entirety) without trying to touch it and claim it as its
own. Preferably without disabling the USB storage subsystem completely
on the host.
Any ideas? Is there a best practice for such things in the Libvirt
world? Or any other world?
Thanks!
Andreas
--
Andreas Ntaflos
GPG Fingerprint: 6234 2E8E 5C81 C6CB E5EC 7E65 397C E2A8 090C A9B4
14 years, 5 months
[libvirt-users] Qemu driver not supporting VIR_DOMAIN_DEVICE_MODIFY_CONFIG yet?
by Guido Winkelmann
Hi,
According to the docs on
http://libvirt.org/html/libvirt-libvirt.html#virDomainDetachDeviceFlags
I ought to be able to do
virDomainDetachDeviceFlags(
<domain>,
<devicexml>,
VIR_DOMAIN_DEVICE_MODIFY_LIVE | VIR_DOMAIN_DEVICE_MODIFY_CONFIG);
to detach a volume both from a currently running VM instance and permanently
from the defined config file.
If I actually try that, though, I'm getting this error:
libvir: QEMU error : Requested operation is not valid: cannot modify the
persistent configuration of a domain
The same thing happens whether or not the domain is running and also happens
if I leave out the "VIR_DOMAIN_DEVICE_MODIFY_LIVE" part.
Does the qemu driver simply not support VIR_DOMAIN_DEVICE_MODIFY_CONFIG yet
(libvirt 0.8.1), or is there some other problem here?
Guido
14 years, 5 months
[libvirt-users] Monitoring KVM Machine Uptimes
by Karsten Knese
Hey folks.
Currently, I am working on an accounting-solution for Private Cloud with
Eucalyptus as my bachelor-thesis. Eucalyptus bases on libvirt providing
the KVM machines. Part of the thesis is kind of measurement for the
uptimes of each instance in the cloud.
As Eucalyptus is based on libvirt, i want to know if there is kind of
tool already setup for monitoring a vm in terms of uptimes, cputimes and
disk i/o.
If not, can anyone give me a hint, how i could grep these facts?
I found a tool called "virt-top" which monitors the vm, but for me there
is to much overhead.
Thanks for you support.
cheers,
Karsten
14 years, 5 months
[libvirt-users] ballooning option xml
by udo1
Hi everybody,
I need the ballooning option with kvm using libvirt xml file and virsh
(virsh create domain.xml)
kvm line must be appended with the -balloon virtio switch to enable
ballooning. (can be disabled if there no option or with -balloon none )
I currently using Ubuntu Lucid
How can I define this in the domain xml file, or what need I to do to
get this option?
is there any option like
enabling with
<balloon>virtio</balloon>
or
disabling with
<balloon>none</balloon>
Thanks in Advance
Udo Attila Fischer
14 years, 5 months
[libvirt-users] Update Libvirt
by Rafael Braga
Hi,
I installed the opensuse 11.0 and libvirt version installed is 0.4.
But, Nimbus need the version 0.6.3. How do I upgrade? I can't by YAST...
thanks!
--
Rafael Braga
14 years, 5 months
[libvirt-users] monitoring kvm machines with libvirt
by Karsten Knese
Hey folks.
Currently, i am working on my bachelorthesis. Subject of this thesis is
to setup an accounting-solution for the Private Cloud with Eucalyptus.
Eucalyptus works with libvirt providing kvm instances.
my question is, if i can grep facts like general uptimes, cpu-peaks and
disk i/o of each vm with libvirt-tools?!
I just found one called virt-top, which monitors each vm, but
unfortunately it produces to much overhead.
If you should be no tool, can anybody give me a hint, where i best look
at to grep these facts?
First try is to grep the uptime of each vm by writing a little deamon,
checking one time per minute via virsh, if the vm is in state running.
But i don't know, if this is best.
thanks for your support!
cheers,
Karsten
14 years, 5 months
[libvirt-users] VM parameters best practice?
by Guido Winkelmann
Hi,
When creating many virtual machines from a template (disk image), you often
need to set some different parameters for each vm. Those usually include root
passwords and/or ssh public keys for login, ssh Host keys (so that a) not all
the VMs have the same host key and b) the user can know the real host key for
his vm before connecting for the first time) plus any number of user-defined
parameters.
IP addresses and hostnames can be set via DHCP.
Obviously, some of those parameters need to be treated as confidential, so you
cannot just grab them from some FTP server somewhere. In fact, as long as you
haven't set any authentication credentials (like an SSL Client Certificate for
example) that the vm can use to uniquely and securely identify itself to some
server, you cannot securely get any of these parameters over the network.
How do people usually solve that sort of problem? What is considered best
practice here?
Currently, my own plans are to write these parameters to a floppy image, use
Unix file permissions to make sure nobody else can read the image, and then
hook up that image to a virtual floppy drive in the respective vm. A shell
script in the vm template can then read and apply all those parameter at some
early stage during the very first boot.
Unfortunately, this means mounting the image in the host system, writing the
parameters and then unmounting it again - which seems sort of error prone to
me in a fully automated environment. (What if two vms are being created
simultaneously? What if the script crashes or hangs somewhere between mounting
and unmounting the image?)
Regards
Guido Winkelmann
14 years, 5 months