Re: [libvirt-users] libvirt unavailable while a VM is in migration?]
by Igor Serebryany
On Mon, Dec 20, 2010 at 02:14:42PM +0100, Jiri Denemark wrote:
> Ouch, I wonder if that could be the reason...
Just to make sure that my strange compiling/packages aren't causing the
problem, I've set up two servers running fedora 14 with the official
libvirt packages. i experience the same problem -- while a vm is in
migration, nothing else works. my traces reveal libvirt getting stuck at
the same exact spot as on my debian machines.
at this point, i'm pretty sure that this is a bug in libvirt. Has
libvirt ever had the ability to perform other operations while a qemu
migration is in progress? If so than this is a regression, and a pretty
serious one. For me, this makes live-migrations totally unusable, and
since I cannot run my project without live-migrations and I cannot use
any outside tools to do live-migrations when I'm using libvirt this
makes libvirt totally unusable.
i am desperate to get this bug fixed, and i don't think i have the
resources to try to patch it myself. is there anything i can do to help
you guys? more debugging info? foot massage?
--Igor
13 years, 9 months
[libvirt-users] libvirt cgroup
by Zvi Dubitzky
1. I am using libvirt 0.8.3 on fedora14 . Acoording to
http://berrange.com/posts/2009/12/03/using-cgroups-with-libvirt-and-lxckv...
inorder to have libvirt memory cgroup under a pre specified group
one should add
CGROUP_DAEMON="memory:/virt" to /etc/sysconfig/libvirtd and restart
cgconfig service and the
libvirtd service . That did not help . any idea ?
2. Also : specifying a limit to the memory subsystem
(/dev/cgroup/memory/libvirt/qemu/memory.limit_in_bytes)
by echoing a value , does not propagate to a VM generated later under
qemu which is actually generated with a huge default
value for memory.limit_in_bytes .
Suppose there was such a limit . Should it decline a generation of a
VM that requests a higher memory size in its
XML file or the limit prevents the VM from consuming more that the
specified cgroup limit when consuming a higher value
thanks
Zvi Dubitzky
Email:dubi@il.ibm.com
13 years, 10 months
[libvirt-users] Using qemu-kvm divre snapshot option
by Alessandro Italiano
Hi,
looking at the qemu-kvm man page, it is possible to enable
snapshot for a given drive. This is what we need because we would like to start a domain
with two drives, one on a file with snapshot=on and an other drive on LVM with snapshot=off.
Unfortunately it seems that if you use libvirt the same option is not available when you define the domain with a XML file.
I mean, I didn't find out a way to support the above use case.
So, does libvirt support the drive snapshot option as qemu-kvm does ?
[root@dom0-103-13-26-b libvirt-0.8.8]# cat /etc/issue
Scientific Linux sl54_x86_64
[root@dom0-103-13-26-b libvirt-0.8.8]# rpm -qa | grep libvirt
libvirt-0.6.3-20.1.el5_4.x86_64
libvirt-python-0.6.3-20.1.el5_4.x86_64
[root@dom0-103-13-26-b libvirt-0.8.8]# rpm -qa | grep qemu
qemu-common-0.10.5-1.el5.2.x86_64
kvm-qemu-img-83-164.el5_5.21.x86_64
qemu-system-x86-0.10.5-1.el5.2.x86_64
Below you can find a copy of the XML where we would like to add somewhere the option snapshot
<domain type='kvm'>
<name>centos5_b</name>
<uuid>a973d1d4-7af6-3f41-a3c1-bea958aba98b</uuid>
<memory>524288</memory>
<currentMemory>524288</currentMemory>
<vcpu>1</vcpu>
<os>
<type arch='x86_64' machine='rhel5.4.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/libexec/qemu-kvm</emulator>
<disk type='file' device='disk'>
<driver name='qemu' cache='none'/>
<source file='/home/davide/WNoDeS/disks/centos5_b.raw'/>
<target dev='vda' bus='virtio'>
</disk>
<disk type=block device='disk'>
<source file='/dev/vg0/lv_slash'/>
<target dev='vda' bus='virtio'>
</disk>
<disk type='file' device='cdrom'>
<target dev='hdc' bus='ide'/>
<readonly/>
</disk>
<interface type='bridge'>
<mac address='00:16:36:36:70:3e'/>
<source bridge='br0'/>
<model type='virtio'/>
</interface>
<serial type='pty'>
<target port='0'/>
</serial>
<console type='pty'>
<target port='0'/>
</console>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes' keymap='it'/>
</devices>
</domain>
Thanks in advance
Alessanndro
**********************************************
Alessandro Italiano
INFN-CNAF,Tier1 Farming Group
Viale Berti Pichat 6/2, 40127 Bologna, Italy
Tel: +39 051 6092751
alessandro.italiano(a)cnaf.infn.it
www.cnaf.infn.it
Skype#alessandroitaliano
**********************************************
13 years, 10 months
[libvirt-users] [PATCH 1/2] libvirt/qemu : allow persistent modification of disks via A(De)ttachDeviceFlags
by KAMEZAWA Hiroyuki
>From 030135224dd6563af0fb8615dc6a4b8e6084410d Mon Sep 17 00:00:00 2001
From: KAMEZAWA Hiroyuki <kamezawa(a)bluextal.(none)>
Date: Wed, 23 Feb 2011 15:25:26 +0900
Subject: [PATCH 1/2] libvirt/qemu : support attach/detach-disk --persistent
Now, only Xen supports 'virsh attach/detach-disk XXXX --persistent',
modifying inactive domain definition via virsh.
This patch adds a support for qemu. With this patch,
virsh attach/detach-disk --persistent works well with qemu.
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu(a)jp.fujitsu.com>
---
src/qemu/qemu_driver.c | 170 ++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 163 insertions(+), 7 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 0f25a2a..703f86a 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4082,16 +4082,174 @@ cleanup:
return ret;
}
+static int qemuDomainFindDiskByName(virDomainDefPtr vmdef, const char *name)
+{
+ virDomainDiskDefPtr vdisk;
+ int i;
+
+ for (i = 0; i < vmdef->ndisks; i++) {
+ vdisk = vmdef->disks[i];
+ if (!strcmp(vdisk->dst, name))
+ return i;
+ }
+ return -1;
+}
+/*
+ * Attach a device given by XML, the change will be persistent
+ * and domain XML definition file is updated.
+ */
+static int qemuDomainAttachDevicePersistent(virDomainDefPtr vmdef,
+ virDomainDeviceDefPtr newdev)
+{
+ virDomainDiskDefPtr disk;
+
+ /* At first, check device confliction */
+ switch(newdev->type) {
+ case VIR_DOMAIN_DEVICE_DISK:
+ disk = newdev->data.disk;
+ if (qemuDomainFindDiskByName(vmdef, disk->dst) >= 0) {
+ qemuReportError(VIR_ERR_INVALID_ARG,
+ _("target %s already exists."), disk->dst);
+ return -1;
+ }
+
+ if (virDomainDiskInsert(vmdef, disk)) {
+ virReportOOMError();
+ return -1;
+ }
+ if (disk->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
+ /*
+ * Address/Drive information is NULL. If virtio, PCI address
+ * shoule be fixed. Other devices as IDE, SCSI...will get ID
+ * automatically
+ */
+ qemuDomainAssignPCIAddresses(vmdef);
+
+ }
+ newdev->data.disk = NULL;
+ break;
+ default:
+ qemuReportError(VIR_ERR_INVALID_ARG, "%s",
+ _("Sorry, the device is not suppored for now"));
+ return -1;
+ }
+
+ return 0;
+}
+
+static int qemuDomainDetachDevicePersistent(virDomainDefPtr vmdef,
+ virDomainDeviceDefPtr device)
+{
+ int x;
+ virDomainDiskDefPtr disk;
+
+ switch(device->type) {
+ case VIR_DOMAIN_DEVICE_DISK:
+ disk = device->data.disk;
+ x = qemuDomainFindDiskByName(vmdef, disk->dst);
+ if (x < 0) {
+ qemuReportError(VIR_ERR_INVALID_ARG,
+ _("target %s doesn't exist."), disk->dst);
+ return -1;
+ }
+ virDomainDiskRemove(vmdef, x);
+ break;
+ default:
+ qemuReportError(VIR_ERR_INVALID_ARG, "%s",
+ _("Sorry, the device is not suppored for now"));
+ return -1;
+ }
+ return 0;
+}
+
+static int qemuDomainModifyDevicePersistent(virDomainPtr dom,
+ const char *xml,
+ unsigned int attach)
+{
+ struct qemud_driver *driver;
+ virDomainDeviceDefPtr device;
+ virDomainDefPtr vmdef;
+ virDomainObjPtr vm;
+ int ret = -1;
+
+ if (!dom || !dom->conn || !dom->name || !xml) {
+ qemuReportError(VIR_ERR_INVALID_ARG,
+ _("internal error : %s"), __FUNCTION__);
+ return -1;
+ }
+
+ if (dom->conn->flags & VIR_CONNECT_RO)
+ return -1;
+
+ driver = dom->conn->privateData;
+ qemuDriverLock(driver);
+ vm = virDomainFindByUUID(&driver->domains, dom->uuid);
+ if (!vm) {
+ qemuReportError(VIR_ERR_NO_DOMAIN, _("cannot find domain '%s'"),
+ dom->name);
+ goto unlock_out;
+ }
+
+ if (qemuDomainObjBeginJobWithDriver(driver, vm) < 0) {
+ /*
+ * For now, just allow updating inactive domains. Further development
+ * will allow updating both active domain and its config file at
+ * the same time.
+ */
+ qemuReportError(VIR_ERR_INVALID_ARG,
+ _("cannot update alive domain : %s"), __FUNCTION__);
+ goto endjob;
+ }
+ vmdef = virDomainObjGetPersistentDef(driver->caps, vm);
+
+ if (!vmdef)
+ goto endjob;
+
+ device = virDomainDeviceDefParse(driver->caps,
+ vmdef, xml, VIR_DOMAIN_XML_INACTIVE);
+ if (!device)
+ goto endjob;
+
+ if (attach) {
+ ret = qemuDomainAttachDevicePersistent(vmdef, device);
+ if (ret < 0)
+ goto out;
+ } else {
+ ret = qemuDomainDetachDevicePersistent(vmdef, device);
+ if (ret < 0)
+ goto out;
+ }
+ ret = virDomainSaveConfig(driver->configDir, vmdef);
+
+out:
+ virDomainDeviceDefFree(device);
+endjob:
+ if (qemuDomainObjEndJob(vm) == 0)
+ vm = NULL;
+ if (vm)
+ virDomainObjUnlock(vm);
+ /* Note: insert of newdev is done by copy */
+unlock_out:
+ qemuDriverUnlock(driver);
+ return ret;
+}
+
static int qemudDomainAttachDeviceFlags(virDomainPtr dom,
const char *xml,
unsigned int flags) {
if (flags & VIR_DOMAIN_DEVICE_MODIFY_CONFIG) {
- qemuReportError(VIR_ERR_OPERATION_INVALID,
- "%s", _("cannot modify the persistent configuration of a domain"));
- return -1;
+ /*
+ * Because we can't update the live guest and XML
+ * in atomic, limiting modification as only-acrive and
+ * only-inactive. Need some idea to update both at the same time.
+ */
+ return qemuDomainModifyDevicePersistent(dom, xml, 1);
}
- return qemudDomainAttachDevice(dom, xml);
+ if (flags & VIR_DOMAIN_DEVICE_MODIFY_LIVE)
+ return qemudDomainAttachDevice(dom, xml);
+
+ return -1;
}
@@ -4304,9 +4462,7 @@ static int qemudDomainDetachDeviceFlags(virDomainPtr dom,
const char *xml,
unsigned int flags) {
if (flags & VIR_DOMAIN_DEVICE_MODIFY_CONFIG) {
- qemuReportError(VIR_ERR_OPERATION_INVALID,
- "%s", _("cannot modify the persistent configuration of a domain"));
- return -1;
+ return qemuDomainModifyDevicePersistent(dom, xml, 0);
}
return qemudDomainDetachDevice(dom, xml);
--
1.7.1
13 years, 10 months
[libvirt-users] Vista guest doesn't start after libvirt upgrade
by Matthias Meyer
Hi,
I've updated my Debian lenny to Debian squeeze last week. So I have now:
libvirt 0.8.3-5
qemu-kvm 0.12.5+dfsg-3
virt-manager 0.8.4-8
Today I try to start my Vista quest again. I am surprised because it won't
starts. In "/var/log/libvirt/qemu/devel-vista.log" stands "Read failed". The
Console stays as a black screen after a short SeaBIOS message.
I tried system recovery too but Vista system recovery identified the Vista
installation without any errors.
Nearly the same occurs with my Windows7 guest. The logfile seems fine but the
console present me:
Starting SeaBIOS (version...)
Booting from Hard Disk...
Boot failed: not a bootable disk
I tried system recovery too and indeed, W7 doesn't found a Windows
Installation.
linux-dev:~# LANG==C ls -lh --block-size=1M /var/lib/libvirt/images/
total 90399
-rwxr-xr-x 1 root root 10000 Feb 12 19:20 devel-CentOS.img
-rwxr-xr-x 1 root root 10000 Feb 15 20:17 devel-SUSE.img
-rwxr-xr-x 1 root root 10001 Feb 16 22:55 devel-fedora.img
-rwxr-xr-x 1 root root 10000 Feb 16 19:23 devel-ubuntu.img
-rwxr-xr-x 1 root root 12575 Feb 1 07:56 devel-vista.qcow2
-rwxr-xr-x 1 libvirt-qemu kvm 40961 Feb 21 23:50 devel-vista.qcow2.2del
-rwxr-xr-x 1 root root 9330 Jan 23 18:03 devel-w7.qcow2
-rwxr-xr-x 1 root root 10136 Feb 13 20:58 devel-w7.qcow2.2del
-rwxr-xr-x 1 root root 10241 Feb 22 00:34 devel-xp.qcow2
the *.2del files are the original images which doesn't start. The responding
files without .2del are restored from a backup.
WindowsXP as well as different Linux guests does start and run fine.
There are any experience with this obscurse behavior?
Thanks in advance
Matthias
--
Don't Panic
13 years, 10 months
Re: [libvirt-users] LXC libvirt support
by Nirmal Guhan
2011/2/11 Nirmal Guhan <vavatutu(a)gmail.com>:
> On Fri, Feb 11, 2011 at 9:05 PM, Osier Yang <jyang(a)redhat.com> wrote:
>> 于 2011年02月12日 11:52, Nirmal Guhan 写道:
>>>
>>> Hi,
>>>
>>> Has anyone used libvirt to start/stop/manage LXC (linux containers) ?
>>> Is it supported at all? Last I tried, had few issues and the reply was
>>> :
>>
>> Yes, it's supported, though still much work to do, but the basic is
>> there.
>>
>>>
>>> ///
>>> Note that libvirt lxc driver is a different implementation from lxc tools
>>> and doesn't use lxc tools internally.
>>
>> Indeed, it doesn't invoke lxc tools.
>>
>> You may not be able to do what
>>>
>>> you are doing with lxc tools. Especially, the driver doesn't take aware
>>> of files and settings inside a container at all. You have to prepare them
>>> by yourself in advance
>>
>> libvirt.org has the example, e.g. the busybox example, I guess it could
>> explain "the driver doesn't take care of files and setting inside a
>> container at all, you have to prepare them by yourself in advance."
>>
>> Regards
>> Osier
>
> Thanks. Will give a try.
> ~nirmal
>
Seeing some strange behavior running fedora 12 for both host and lxc container.
I do a define, start and console :
[root@fedora12new lxc-libvirt-scripts]# virsh -c lxc:// console testf12new
Connected to domain testf12new
Escape character is ^]
--> I press enter here and virsh exits.
I don't get login prompt always. Sometimes I do and when I try to
login it rejects my password. Apparently, the same rootfs works fine
with lxc tools and I can login.
Snippet from etc/event.d/tty1 :
respawn
exec /sbin/mingetty pts/0
I use "exec /sbin/mingetty tty1" for lxc tools and that works fine. I
had to try pts/0 for libvirt since tty1 does not even get me the
occasional login prompts I get with pts.
Also even after virsh shutdown, I see that the container processes do
not exit. Is there something else I should do?
~nirmal
13 years, 10 months
[libvirt-users] altering virtual network driver iptables behavior
by Ryan Sumner
I have the need to modify the behavior of the virtual network driver's
behavior and how it deals with routed networks. I'm running
libvirt-0.8.3-2.fc14.
According to http://libvirt.org/firewall.html, the following is
automatically added to the FORWARD chain of iptables when a network type
of "routed" is started up:
"Allow inbound, but only to our expected subnet. Allow outbound, but only
from our expected subnet. Allow traffic between guests. Deny all other
inbound. Deny all other outbound. "
The part of this that I need to adjust is the fact that only IPs on my
subnet will be allowed in and out. I have IP addresses assigned to my
guests that have static routes configured on the hypervisor to route to
the local bridged interface. I have to do this due to the way the
surrounding routers and switches on the network are configured to handle
public IP addresses and MAC address filtering. Here is an example of my
config where the public IP address on the guest machine is 1.1.2.2:
My network to do the routing mode:
<network>
<name>local</name>
<forward dev='eth0' mode='route'/>
<bridge name='virbr_local' stp='on' delay='0' />
<ip address='192.168.122.1' netmask='255.255.255.0'/>
</network>
The network portion of the domain:
<interface type='network'>
<mac address='xx:xx:xx:cc:xx:xx'/>
<source network='local'/>
<target dev='vnet0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02'
function='0x0'/>
</interface>
And finally the static route configured on the hypervisor to get the
routed traffic from eth0 on the hypervisor down to the virbr_local device:
# ip route add 1.1.2.2 dev virbr_local
This will setup the iptables filters just as the documentation defines,
but the problem is that all traffic from the guest will get REJECTED by
iptables due to the source and destination IP not falling within
192.168.122.0/24.
I've tried adding a custom filter into the network filter driver, but
haven't had much luck. Here are some of the things that I've tried.
The custom network filter. Notice that I'm using tcp, udp, and icmp
specifically. I'm doing this so it will force inclusion into the iptables
filtering rules rather than ebtables.
<filter name='my-static-ip' chain='root'>
<rule action='accept' direction='out' priority='500'>
<tcp srcipaddr='$MYIP'/>
</rule>
<rule action='accept' direction='out' priority='500'>
<udp srcipaddr='$MYIP'/>
</rule>
<rule action='accept' direction='out' priority='500'>
<icmp srcipaddr='$MYIP'/>
</rule>
<rule action='accept' direction='in' priority='500'>
<tcp dstipaddr='$MYIP'/>
</rule>
<rule action='accept' direction='in' priority='500'>
<udp dstipaddr='$MYIP'/>
</rule>
<rule action='accept' direction='in' priority='500'>
<icmp dstipaddr='$MYIP'/>
</rule>
</filter>
And the modifications made to the domain's network interface definition:
<interface type='network'>
<mac address='xx:xx:xx:xx'/>
<source network='local'/>
<target dev='vnet0'/>
<filterref filter='my-static-ip'>
<parameter name='MYIP' value=1.1.2.2'/>
</filterref>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02'
function='0x0'/>
</interface>
With the exception of simply manually adding iptables rules in place after
I start the network using virsh, does anyone know how to accomplish what
I'm trying to do?
Ryan Sumner
13 years, 10 months
[libvirt-users] schedinfo
by Zvi Dubitzky
libvirt schedinfo :
------------------
What is the meaning of the 'cap' parameter in the schedinfo virsh
command (what are the units and range of values ) and what is
the 'weigth' parameter ?
Zvi Dubitzky
Email:dubi@il.ibm.com
13 years, 10 months