[libvirt] [PATCH] libxl: add discard support to libxl_device_disk
by Olaf Hering
Translate libvirt discard settings into libxl-4.5 discard settings.
Signed-off-by: Olaf Hering <olaf(a)aepfle.de>
---
default means leave decision to libxl.
Not sure if that is what "default" in libvirt terms really means.
src/libxl/libxl_conf.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index b7fed7f..4cb062e 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -713,6 +713,33 @@ libxlMakeDomBuildInfo(virDomainObjPtr vm, libxl_domain_config *d_config)
return -1;
}
+static void
+libxlDiskSetDiscard(libxl_device_disk *x_disk, int discard)
+{
+ if (!x_disk->readwrite)
+ return;
+#if defined(LIBXL_HAVE_LIBXL_DEVICE_DISK_DISCARD_ENABLE)
+ switch (discard) {
+ case VIR_DOMAIN_DISK_DISCARD_DEFAULT:
+ break;
+ case VIR_DOMAIN_DISK_DISCARD_UNMAP:
+ libxl_defbool_set(&x_disk->discard_enable, true);
+ break;
+ default:
+ case VIR_DOMAIN_DISK_DISCARD_IGNORE:
+ libxl_defbool_set(&x_disk->discard_enable, false);
+ break;
+ }
+#else
+ if (discard == VIR_DOMAIN_DISK_DISCARD_DEFAULT)
+ return;
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("This version of libxenlight does not support "
+ "discard= option passing"));
+#endif
+}
+
+
int
libxlMakeDisk(virDomainDiskDefPtr l_disk, libxl_device_disk *x_disk)
{
@@ -827,6 +854,7 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk, libxl_device_disk *x_disk)
x_disk->removable = 1;
x_disk->readwrite = !l_disk->readonly;
x_disk->is_cdrom = l_disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM ? 1 : 0;
+ libxlDiskSetDiscard(x_disk, l_disk->discard);
/* An empty CDROM must have the empty format, otherwise libxl fails. */
if (x_disk->is_cdrom && !x_disk->pdev_path)
x_disk->format = LIBXL_DISK_FORMAT_EMPTY;
10 years, 10 months
[libvirt] [libvirt-glib] spec: Substitute minimum glib2 version from configure.ac
by Christophe Fergeau
This way we don't have to keep track of the minimum glib2 version we
need in 2 separate places.
Signed-off-by: Christophe Fergeau <cfergeau(a)redhat.com>
---
configure.ac | 1 +
libvirt-glib.spec.in | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 097f7f4..80ab703 100644
--- a/configure.ac
+++ b/configure.ac
@@ -12,6 +12,7 @@ AM_SILENT_RULES([yes])
LIBVIRT_REQUIRED=0.10.2
AC_SUBST([LIBVIRT_REQUIRED]) dnl used in the .spec file
GLIB2_REQUIRED=2.22.0
+AC_SUBST([GLIB2_REQUIRED]) dnl used in the .spec file
GLIB2_TEST_REQUIRED=2.38.0
GOBJECT2_REQUIRED=2.10.0
GIO_REQUIRED=2.10.0
diff --git a/libvirt-glib.spec.in b/libvirt-glib.spec.in
index 202e624..32ce4f0 100644
--- a/libvirt-glib.spec.in
+++ b/libvirt-glib.spec.in
@@ -30,7 +30,7 @@ URL: http://libvirt.org/
Source0: ftp://libvirt.org/libvirt/glib/%{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-BuildRequires: glib2-devel >= 2.22.0
+BuildRequires: glib2-devel >= @GLIB2_REQUIRED@
BuildRequires: libvirt-devel >= %{libvirt_version}
BuildRequires: python-devel
%if %{with_introspection}
--
1.9.3
10 years, 10 months
[libvirt] [PATCH] LXC: Allow setting max mem lower than current mem
by Ján Tomko
For inactive domains, set both current and maximum memory
to the specified 'maximum memory' value.
This matches the behavior of QEMU driver's SetMaxMemory.
https://bugzilla.redhat.com/show_bug.cgi?id=1091132
---
src/lxc/lxc_driver.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 9c006e9..b47ac5e 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -692,9 +692,14 @@ static int lxcDomainSetMaxMemory(virDomainPtr dom, unsigned long newmax)
goto cleanup;
if (newmax < vm->def->mem.cur_balloon) {
- virReportError(VIR_ERR_INVALID_ARG,
- "%s", _("Cannot set max memory lower than current memory"));
- goto cleanup;
+ if (!virDomainObjIsActive(vm)) {
+ vm->def->mem.cur_balloon = newmax;
+ } else {
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("Cannot set max memory lower than current"
+ " memory for an active domain"));
+ goto cleanup;
+ }
}
vm->def->mem.max_balloon = newmax;
--
1.8.5.5
10 years, 10 months
[libvirt] [PATCH] virsh: domain: Use inactive XML when unplugging interface with --config
by Peter Krempa
Similary to cmdDetachDisk fetch the inactive definition when --config
is specified as the active may not contain the network interface
if it was plugged with --config.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1056902
---
tools/virsh-domain.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index b1ab911..3efaced 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -10131,7 +10131,12 @@ cmdDetachInterface(vshControl *ctl, const vshCmd *cmd)
virDomainIsActive(dom) == 1)
flags |= VIR_DOMAIN_AFFECT_LIVE;
- if (!(doc = virDomainGetXMLDesc(dom, 0)))
+ if (flags & VIR_DOMAIN_AFFECT_CONFIG)
+ doc = virDomainGetXMLDesc(dom, VIR_DOMAIN_XML_INACTIVE);
+ else
+ doc = virDomainGetXMLDesc(dom, 0);
+
+ if (!doc)
goto cleanup;
if (!(xml = virXMLParseStringCtxt(doc, _("(domain_definition)"), &ctxt))) {
--
1.9.3
10 years, 10 months
[libvirt] [PATCH] virt-lxc-convert: make free return values in bytes
by Cédric Bosdonnat
Tiny fix for virt-lxc-convert: we are setting memory values in bytes, while
free may give us values in a different unit by default: force free to output
bytes with -b flag.
---
examples/lxcconvert/virt-lxc-convert | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/examples/lxcconvert/virt-lxc-convert b/examples/lxcconvert/virt-lxc-convert
index 7220153..e62172e 100644
--- a/examples/lxcconvert/virt-lxc-convert
+++ b/examples/lxcconvert/virt-lxc-convert
@@ -64,7 +64,7 @@ if test -r "$fstab"; then
sed 's/^\([^#]\)/lxc.mount.entry = \1/' "$fstab" >>"${conf_new}"
fi
-memory=$(free | sed -n '/Mem:/s/ \+/ /gp' | cut -f 2 -d ' ')
+memory=$(free -b | sed -n '/Mem:/s/ \+/ /gp' | cut -f 2 -d ' ')
default_tmpfs="size=$((memory/2))"
# Do we have tmpfs without size param?
--
1.8.4.5
10 years, 10 months
[libvirt] [PATCH] qemu: dump: Report better error when dumping VM with passthrough devices
by Peter Krempa
For the regular dump operation we migrate the VM to a file. This won't
work when the VM has passthrough devices assigned. Rather than reporting
a cryptic error from qemu run our check whether it can be migrated.
This does not influence the memory-only dump that is allowed with
passthrough devices.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=874418
---
src/qemu/qemu_driver.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 2d1aa9e..fe76d55 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3481,6 +3481,10 @@ doCoreDump(virQEMUDriverPtr driver,
"memory-only dump"));
goto cleanup;
}
+
+ if (!qemuMigrationIsAllowed(driver, vm, vm->def, false, false))
+ goto cleanup;
+
ret = qemuMigrationToFile(driver, vm, fd, 0, path,
qemuCompressProgramName(compress), false,
QEMU_ASYNC_JOB_DUMP);
--
2.0.0
10 years, 10 months
[libvirt] [PATCH] LXC: remove duplicate controller check code
by Chen Hanxiao
We invoked virCgroupHasController twice for checking
VIR_CGROUP_CONTROLLER_DEVICES
in lxcDomainAttachDeviceDiskLive.
Signed-off-by: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
---
src/lxc/lxc_driver.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index fce16f2..9c006e9 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -4052,12 +4052,6 @@ lxcDomainAttachDeviceDiskLive(virLXCDriverPtr driver,
goto cleanup;
}
- if (!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_DEVICES)) {
- virReportError(VIR_ERR_OPERATION_INVALID, "%s",
- _("devices cgroup isn't mounted"));
- goto cleanup;
- }
-
perms = (def->readonly ?
VIR_CGROUP_DEVICE_READ :
VIR_CGROUP_DEVICE_RW) |
--
1.9.0
10 years, 10 months
[libvirt] Possible to set iSCSI initiator-name?
by Richard W.M. Jones
Glancing at the libvirt code in git, it doesn't appear to be possible
to set the iSCSI initiator name for domains which are backed with
iSCSI disks.
Some background:
When qemu contacts the iSCSI target, it sends its own initiator name,
which, if not set, defaults to 'iqn.2008-11.org.linux-kvm'.
Some iSCSI targets have variable configuration keyed on the initiator
name -- that is definitely the case for a userspace iscsi target that
I tested (called pyTarget[1]), and for a libguestfs user's unspecified
target[2].
qemu lets you override the default initiator name[3] using:
qemu -iscsi initiator-name=iqn.YYYY-MM...
This appears to be a global setting. I'm not clear if it makes sense
or is possible to have multiple initiator names for a single qemu.
I'm not missing something am I?
(Note I'm not talking about storage pools which do have a way to
specify initiator name).
Rich.
[1] https://pytarget.codeplex.com/
[2] https://www.redhat.com/archives/libguestfs/2014-July/msg00013.html
[3] https://lists.gnu.org/archive/html/qemu-devel/2012-01/msg02765.html
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top
10 years, 10 months
[libvirt] Not able to run "virsh qemu-agent-command" when socat is working
by Puneet Bakshi
Hi,
I am running qemu guest agent in Windows 2k8. I am able to execute
"qemu-agent-commands" using socat but not through "virsh
qemu-agent-command".
*Guest VM xml*
<controller type='virtio-serial' index='0'>
<alias name='virtio-serial0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05'
function='0x0'/>
</controller>
<channel type='unix'>
<source mode='bind' path='/var/lib/libvirt/qemu/g06.agent'/>
<target type='virtio' name='org.qemu.guest_agent.1'/>
<alias name='channel0'/>
<address type='virtio-serial' controller='0' bus='0' port='1'/>
</channel>
*Guest win2k8 is running following command*
C:\qemu-ga> qemu-ga.exe -t c:\qemu-ga -p
\\.Global\org.qemu.guest_agent.1
*Host CentOS system*
socat returns response appropriately.
[root@sdsr720-14 ~]# echo "{'execute':'guest-ping'}" | socat
stdio,ignoreeof /var/lib/libvirt/qemu/g06.agent
{"return": {}}
*"virsh qemu-agent-command" returns blank.*
[root@sdsr720-14 ~]# virsh qemu-agent-command vm_win_06 '{ "execute":
"guest_ping"}'
[root@sdsr720-14 ~]#
Why "virsh qemu-agent-command" is not working? Am I doing something wrong
here?
Regards,
~Puneet
10 years, 10 months
[libvirt] [PATCH 0/2] docs: hacking and formatdomain fixes
by Michele Paolino
replaced link in haking.html.in and fixed XML tags in
formatdomain.html.in
Michele Paolino (2):
docs: Fix broken link in the HACKING page
docs: formatdomain.html fixes
docs/formatdomain.html.in | 8 ++++----
docs/hacking.html.in | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
--
1.9.3
10 years, 10 months