[libvirt] [PATCH v2] Ensure disk names follow the disk name regex
by Nitesh Konkar
Currently disk names do not follow the
(regex) /^[fhv]d[a-z]+[0-9]*$/ completely
and hence one can assign disk names like
vd2 etc. This patch ensures that the
disk names follow the regex mentioned.
This patch also adds a testcase.
Signed-off-by: Nitesh Konkar <nitkon12(a)linux.vnet.ibm.com>
---
src/util/virutil.c | 2 +-
tests/utiltest.c | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/util/virutil.c b/src/util/virutil.c
index 91178d1..2796671 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -563,7 +563,7 @@ int virDiskNameParse(const char *name, int *disk, int *partition)
}
}
- if (!ptr)
+ if (!ptr || !c_islower(*ptr))
return -1;
for (i = 0; *ptr; i++) {
diff --git a/tests/utiltest.c b/tests/utiltest.c
index 9b7a4a3..bd55d44 100644
--- a/tests/utiltest.c
+++ b/tests/utiltest.c
@@ -37,7 +37,8 @@ static struct testDiskName diskNamesPart[] = {
};
static const char* diskNamesInvalid[] = {
- "sda00", "sda01", "sdb-1"
+ "sda00", "sda01", "sdb-1",
+ "vd2"
};
static int
--
1.9.3
7 years, 9 months
[libvirt] [PATCH] Validate required CPU features even for host-passthrough
by Ján Tomko
Commit adff345 allowed enabling features with -cpu host
without ajdusting the validity checks on domain startup
and migration.
---
src/qemu/qemu_migration.c | 2 +-
src/qemu/qemu_process.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 0f4a6cf..0db1616 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -2322,7 +2322,7 @@ qemuMigrationIsAllowed(virQEMUDriverPtr driver,
if (!qemuMigrationIsAllowedHostdev(vm->def))
return false;
- if (vm->def->cpu && vm->def->cpu->mode != VIR_CPU_MODE_HOST_PASSTHROUGH) {
+ if (vm->def->cpu) {
for (i = 0; i < vm->def->cpu->nfeatures; i++) {
virCPUFeatureDefPtr feature = &vm->def->cpu->features[i];
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 184440d..2ad6451 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3819,7 +3819,7 @@ qemuProcessVerifyGuestCPU(virQEMUDriverPtr driver,
}
}
- if (def->cpu && def->cpu->mode != VIR_CPU_MODE_HOST_PASSTHROUGH) {
+ if (def->cpu) {
for (i = 0; i < def->cpu->nfeatures; i++) {
virCPUFeatureDefPtr feature = &def->cpu->features[i];
--
2.10.2
7 years, 9 months
[libvirt] libvirt-php --with-php-config=/path/to/php is broken.
by Shaun Reitan
When running the following command I ended up getting errors that phpize
was missing. Trying to dig into this further i found that configure.ac
was just trying to run php-config without providing a path. The
following patch corrects the issue by using the $PHPCONFIG variable
instead.
./configure --prefix=/opt/libvirt-php
--with-php-config=/path/to/php-config`
diff --git a/configure.ac b/configure.ac
index f232756..d93e946 100644
--- a/configure.ac
+++ b/configure.ac
@@ -159,7 +159,7 @@ if test "x$PHPCONFIG" = "xno"; then
AC_MSG_ERROR([php-config not found; please install the PHP SDK])
fi
-AC_PATH_PROG([PHPIZE], [phpize], [no], [`php-config
--prefix`/bin$PATH_SEPARATOR$PATH])
+AC_PATH_PROG([PHPIZE], [phpize], [no], [`$PHPCONFIG
--prefix`/bin$PATH_SEPARATOR$PATH])
if test "x$PHPIZE" = "xno"; then
AC_MSG_ERROR([phpize not found; please install the PHP SDK])
fi
--
Shaun Reitan
Network Data Center Host, Inc.
7 years, 9 months
[libvirt] [PATCH] qemu: Allow empty script path to <interface/>
by Michal Privoznik
Before 9c17d665fdc5f (v1.3.2 - I know, right?) it was possible to
have the following interface configuration:
<interface type='ethernet'/>
<script path=''/>
</interface>
This resulted in -netdev tap,script=,.. Fortunately, qemu helped
us to get away with this as it just ignored the empty script
path. However, after the commit mentioned above it's libvirtd
who is executing the script. Unfortunately without special
case-ing empty script path.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
docs/news.xml | 10 ++++++++++
src/util/virnetdev.c | 4 ++++
2 files changed, 14 insertions(+)
diff --git a/docs/news.xml b/docs/news.xml
index f408293a1..e7388a8f6 100644
--- a/docs/news.xml
+++ b/docs/news.xml
@@ -56,6 +56,16 @@
a fabric name has been removed by making it optional.
</description>
</change>
+ <change>
+ <summary>
+ qemu: Allow empty script path to <interface/>
+ </summary>
+ <description>
+ Historically, this was always allowed. Unfortunately, due to some
+ rework done for 1.3.2 release a bug was dragged in which suddenly
+ stop allowing domain with such configuration to start.
+ </description>
+ </change>
</section>
</release>
<release version="v3.0.0" date="2017-01-17">
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index fa695d4a6..d12324878 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -2615,6 +2615,10 @@ virNetDevRunEthernetScript(const char *ifname, const char *script)
virCommandPtr cmd;
int ret;
+ /* Not a bug! Previously we did accept script="" as a NO-OP. */
+ if (STREQ(script, ""))
+ return 0;
+
cmd = virCommandNew(script);
virCommandAddArgFormat(cmd, "%s", ifname);
virCommandClearCaps(cmd);
--
2.11.0
7 years, 9 months
[libvirt] [PATCH] news: add entries for libxl driver improvements and bug fixes
by Jim Fehlig
Signed-off-by: Jim Fehlig <jfehlig(a)suse.com>
---
Since news changes are not candidates for backport I assume it is fine
to include recent libxl improvements and bug fixes in a single commit.
I can break this up if that assumption is wrong.
docs/news.xml | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/docs/news.xml b/docs/news.xml
index 5bca75ea1..22f00cc55 100644
--- a/docs/news.xml
+++ b/docs/news.xml
@@ -83,6 +83,16 @@
and network.
</description>
</change>
+ <change>
+ <summary>
+ libxl: improve support for <timer> configurations
+ </summary>
+ <description>
+ Add support for multiple timers. Extend the tsc timer to
+ support the emulate mode. Improve conversion of timer XML
+ to/from xl.cfg.
+ </description>
+ </change>
</section>
<section title="Bug fixes">
<change>
@@ -116,6 +126,25 @@
regenerate it properly.
</description>
</change>
+ <change>
+ <summary>
+ libxl: maximum memory fixes
+ </summary>
+ <description>
+ Fix reporting of domain maximum memory. Fix setting dom0
+ maximum memory.
+ </description>
+ </change>
+ <change>
+ <summary>
+ libxl: fix disk detach when <driver> not specified
+ </summary>
+ </change>
+ <change>
+ <summary>
+ libxl: fix dom0 autoballooning with Xen 4.8
+ </summary>
+ </change>
</section>
</release>
<release version="v3.0.0" date="2017-01-17">
--
2.11.0
7 years, 9 months
[libvirt] [PATCH] libxl: fix potential double free in libxlDriverGetDom0MaxmemConf
by Jim Fehlig
Commit 4ab0c959 fixed a memory leak in libxlDriverGetDom0MaxmemConf
but introduced a potential double free of mem_tokens
*** Error in `/usr/sbin/libvirtd': double free or corruption (out):
0x00007fffc808cfd0 ***
Avoid double free by setting mem_tokens to NULL after calling
virStringListFree.
Signed-off-by: Jim Fehlig <jfehlig(a)suse.com>
---
src/libxl/libxl_conf.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index f5b788b50..4bab651b3 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -1623,6 +1623,7 @@ libxlDriverGetDom0MaxmemConf(libxlDriverConfigPtr cfg,
}
}
virStringListFree(mem_tokens);
+ mem_tokens = NULL;
}
physmem:
--
2.11.0
7 years, 9 months
[libvirt] [PATCH] news: fix spelling of tunneled
by Jim Fehlig
s/tunnelled/tunneled/ in news for the libxl tunneled migration feature.
Signed-off-by: Jim Fehlig <jfehlig(a)suse.com>
---
Pushed under trivial rule.
docs/news.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/docs/news.xml b/docs/news.xml
index b0629b523..5bca75ea1 100644
--- a/docs/news.xml
+++ b/docs/news.xml
@@ -55,10 +55,10 @@
</change>
<change>
<summary>
- libxl: add tunnelled migration support
+ libxl: add tunneled migration support
</summary>
<description>
- Add tunnelled migration to libxl driver, which is always capable of
+ Add tunneled migration to libxl driver, which is always capable of
strong encryption and doesn't require any extra network connection
other than what's required for remote access of libvirtd.
</description>
--
2.11.0
7 years, 9 months
[libvirt] [v6 00/10] Support cache tune in libvirt
by Eli Qiao
Addressed comment from v6 -> v5
Marcelo:
* Support other APPs to operate /sys/fs/resctrl at same time
Libvirt will scan /sys/fs/resctrl again before doing cache allocation.
patch 10 will address this.
Addressed comment from v4 -> v5:
Marcelo:
* Several typos
* Use flock instead of virFileLock
Addressed comment from v3 -> v4:
Daniel & Marcelo:
* Added concurrence support
Addressed comment from v2 -> v3:
Daniel:
* Fixed coding style, passed `make check` and `make syntax-check`
* Variables renaming and move from header file to c file.
* For locking/mutex support, no progress.
There are some discussion from mailing list, but I can not find a better
way to add locking support without performance impact.
I'll explain the process and please help to advice what shoud we do.
VM create:
1) Get the cache left value on each bank of the host. This should be
shared amount all VMs.
2) Calculate the schemata on the bank based on all created resctrl
domain's schemata
3) Calculate the default schemata by scaning all domain's schemata.
4) Flush default schemata to /sys/fs/resctrl/schemata
VM destroy:
1) Remove the resctrl domain of that VM
2) Recalculate default schemata
3) Flush default schemata to /sys/fs/resctrl/schemata
The key point is that all VMs shares /sys/fs/resctrl/schemata, and
when a VM create a resctrl domain, the schemata of that VM depends on
the default schemata and all other exsited schematas. So a global
mutex is reqired.
Before calculate a schemata or update default schemata, libvirt
should gain this global mutex.
I will try to think more about how to support this gracefully in next
patch set.
Marcelo:
* Added vcpu support for cachetune, this will allow user to define which
vcpu using which cache allocation bank.
<cachetune id='0' host_id=0 size='3072' unit='KiB' vcpus='0,1'/>
vcpus is a cpumap, the vcpu pids will be added to tasks file
* Added cdp compatible, user can specify l3 cache even host enable cdp.
See patch 8.
On a cdp enabled host, specify l3code/l3data by
<cachetune id='0' host_id='0' type='l3' size='3072' unit='KiB'/>
This will create a schemata like:
L3data:0=0xff00;...
L3code:0=0xff00;...
* Would you please help to test if the functions work.
Martin:
* Xml test case, I have no time to work on this yet, would you please
show me an example, would like to amend it later.
This series patches are for supportting CAT featues, which also
called cache tune in libvirt.
First to expose cache information which could be tuned in capabilites XML.
Then add new domain xml element support to add cacahe bank which will apply
on this libvirt domain.
This series patches add a util file `resctrl.c/h`, an interface to talk with
linux kernel's system fs.
There are still one TODO left:
1. Expose a new public interface to get free cache information.
2. Expose a new public interface to set cachetune lively.
Some discussion about this feature support can be found from:
https://www.redhat.com/archives/libvir-list/2017-January/msg00644.html
Eli Qiao (10):
Resctrl: Add some utils functions
Resctrl: expose cache information to capabilities
Resctrl: Add new xml element to support cache tune
Resctrl: Add private interface to set cachebanks
Qemu: Set cache banks
Resctrl: enable l3code/l3data
Resctrl: Make sure l3data/l3code are pairs
Resctrl: Compatible mode for cdp enabled
Resctrl: concurrence support
Resctrl: Scan resctrl before doing cache allocation
docs/schemas/domaincommon.rng | 46 ++
include/libvirt/virterror.h | 1 +
po/POTFILES.in | 1 +
src/Makefile.am | 1 +
src/conf/capabilities.c | 56 ++
src/conf/capabilities.h | 23 +
src/conf/domain_conf.c | 182 +++++++
src/conf/domain_conf.h | 19 +
src/libvirt_private.syms | 11 +
src/nodeinfo.c | 64 +++
src/nodeinfo.h | 1 +
src/qemu/qemu_capabilities.c | 8 +
src/qemu/qemu_driver.c | 6 +
src/qemu/qemu_process.c | 53 ++
src/util/virerror.c | 1 +
src/util/virresctrl.c | 1208 +++++++++++++++++++++++++++++++++++++++++
src/util/virresctrl.h | 88 +++
17 files changed, 1769 insertions(+)
create mode 100644 src/util/virresctrl.c
create mode 100644 src/util/virresctrl.h
--
1.9.1
7 years, 9 months
[libvirt] [RFC PATCH 00/16] Introduce vGPU mdev framework to libvirt
by Erik Skultety
Finally. It's here. This is the initial suggestion on how libvirt might
interract with the mdev framework, currently only focussing on the non-managed
devices, i.e. those pre-created by the user, since that will be revisited once
we all settled on how the XML should look like, given we might not want to use
the sysfs path directly as an attribute in the domain XML. My proposal on the
XML is the following:
<hostdev mode='subsystem' type='mdev'>
<source>
<!-- this is the host's physical device address -->
<address domain='0x0000' bus='0x00' slot='0x00' function='0x00'>
<uuid>vGPU_UUID<uuid>
<source>
<!-- target PCI address can be omitted to assign it automatically -->
</hostdev>
So the mediated device is identified by the physical parent device visible on
the host and a UUID which allows us to construct the sysfs path by ourselves,
which we then put on the QEMU's command line.
A few remarks if you actually happen to have a machine to test this on:
- right now the mediated devices are one-time use only, i.e. they have to be
recreated before every machine boot
- I wouldn't recommend assigning multiple vGPUs to a single domain
Once this series is sorted out, we can then continue with 'managed=yes' where
as Laine pointed out [1], we need to figure out how exactly should the
management layer hint libvirt which vGPU type should be used for device
instantiation.
[1] https://www.redhat.com/archives/libvir-list/2017-January/msg00287.html
#pleaseshareyourfeedback
Thanks,
Erik
Erik Skultety (16):
util: Introduce new module virmdev
conf: Introduce new hostdev device type mdev
docs: Update RNG schema to reflect the new hostdev type mdev
conf: Adjust the domain parser to work with mdevs
Adjust the formatter to reflect the new hostdev type mdev
security: dac: Enable labeling of vfio mediated devices
security: selinux: Enable labeling of vfio mediated devices
conf: Enable cold-plug of a mediated device
qemu: Assign PCI addresses for mediated devices as well
hostdev: Maintain a driver list of active mediated devices
hostdev: Introduce a reattach method for mediated devices
qemu: cgroup: Adjust cgroups' logic to allow mediated devices
qemu: namespace: Hook up the discovery of mdevs into the namespace
code
qemu: Format mdevs on the qemu command line
test: Add some test cases for our test suite regarding the mdevs
docs: Document the new hostdev device type 'mdev'
docs/formatdomain.html.in | 40 ++-
docs/schemas/domaincommon.rng | 17 +
po/POTFILES.in | 1 +
src/Makefile.am | 1 +
src/conf/domain_conf.c | 81 ++++-
src/conf/domain_conf.h | 10 +
src/libvirt_private.syms | 19 ++
src/qemu/qemu_cgroup.c | 35 ++
src/qemu/qemu_command.c | 49 +++
src/qemu/qemu_command.h | 5 +
src/qemu/qemu_domain.c | 13 +
src/qemu/qemu_domain_address.c | 12 +-
src/qemu/qemu_hostdev.c | 37 ++
src/qemu/qemu_hostdev.h | 8 +
src/qemu/qemu_hotplug.c | 2 +
src/security/security_apparmor.c | 3 +
src/security/security_dac.c | 56 +++
src/security/security_selinux.c | 55 +++
src/util/virhostdev.c | 179 +++++++++-
src/util/virhostdev.h | 16 +
src/util/virmdev.c | 375 +++++++++++++++++++++
src/util/virmdev.h | 85 +++++
tests/domaincapsschemadata/full.xml | 1 +
...qemuxml2argv-hostdev-mdev-unmanaged-no-uuid.xml | 37 ++
.../qemuxml2argv-hostdev-mdev-unmanaged.args | 25 ++
.../qemuxml2argv-hostdev-mdev-unmanaged.xml | 38 +++
tests/qemuxml2argvtest.c | 6 +
.../qemuxml2xmlout-hostdev-mdev-unmanaged.xml | 41 +++
tests/qemuxml2xmltest.c | 1 +
29 files changed, 1239 insertions(+), 9 deletions(-)
create mode 100644 src/util/virmdev.c
create mode 100644 src/util/virmdev.h
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hostdev-mdev-unmanaged-no-uuid.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hostdev-mdev-unmanaged.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hostdev-mdev-unmanaged.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-mdev-unmanaged.xml
--
2.10.2
7 years, 9 months
[libvirt] [PATCH 0/2] apparmor: bug fix and improvement
by Jim Fehlig
Patch1 is a small improvement. Patch2 fixes a bug that is triggered
when the apparmor security driver is enabled and domain config
specifies a different security driver. E.g.
# virsh dumpxml test | grep seclabel
<seclabel type='none' model='none'/>
# virsh start test
error: Failed to start domain test
error: An error occurred, but the cause is unknown
Jim Fehlig (2):
apparmor: don't overwrite error from reload_profile
apparmor: don't fail on non-apparmor <seclabel>
src/security/security_apparmor.c | 72 ++++++++++------------------------------
1 file changed, 18 insertions(+), 54 deletions(-)
--
2.9.2
7 years, 9 months