[libvirt] [PATCH 0/3] Storage: Allow pool building while creating it
by Osier Yang
Patch 1/3 is just about the indention fix.
We tries to start the pool while creating a transicient pool,
if the pool target is not existed yet, we must fail on starting,
and thus we see many users raise up the problem on either list
or bugzilla. Patch 2/3 and 3/3 are to fix the problem by introducing
flags to allow the pool building for APIs virStoragePoolCreate
and virStoragePoolCreateXML, and expose the flags to commands
pool-create/pool-create-as/pool-start.
Osier Yang (3):
Fix the indentions of libvirt.h.in
storage: New flags to allow building the pool while creating it
virsh: New options for the 3 pool commands to allow pool building
include/libvirt/libvirt.h.in | 109 +++++++++++++++++++++++------------------
src/libvirt.c | 4 +-
src/storage/storage_driver.c | 38 ++++++++++++++-
tools/virsh.c | 100 ++++++++++++++++++++++++++++++++++++--
tools/virsh.pod | 27 +++++++++-
5 files changed, 217 insertions(+), 61 deletions(-)
Regards,
Osier
--
1.7.7.3
12 years, 8 months
[libvirt] [PATCHv2] selinux: Fix incorrect file label generation.
by Viktor Mihajlovski
This is an ad-hoc fix for the file label generation. It uses the base context
role to determine whether to use the libvirt process context role. If this
is object_r we don't touch it.
It might be better to add a new flag to virSecuritySELinuxGenNewContext that
specifies the context type (process or file) in the future.
V2 Change:
Use STRNEQ instead of strlen.
Signed-off-by: Viktor Mihajlovski <mihajlov(a)linux.vnet.ibm.com>
---
src/security/security_selinux.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
index 48fd78b..4bc44ef 100644
--- a/src/security/security_selinux.c
+++ b/src/security/security_selinux.c
@@ -176,7 +176,9 @@ virSecuritySELinuxGenNewContext(const char *basecontext, const char *mcs)
goto cleanup;
}
- if (context_role_set(context,
+ /* don't exchange role context if object_r as this is a file context */
+ if (STRNEQ("object_r", context_role_get(context)) &&
+ context_role_set(context,
context_role_get(ourContext)) != 0) {
virReportSystemError(errno,
_("Unable to set SELinux context user '%s'"),
--
1.7.0.4
12 years, 8 months
[libvirt] [test-API][PATCH 3/3] Target path should not with lines in pool xml
by Wayne Sun
The xml for define and create pool is with line switch in target
path.
For aa.xml:
<pool type="netfs">
<name>netfs_pool</name>
<source>
<host name="192.168.0.121"/>
<dir path="/dir"/>
<format type="nfs"/>
</source>
<target>
<path>
/tmp/netfs
</path>
</target>
</pool>
virsh pool-create aa.xml
error: Failed to create pool from aa.xml
error: cannot open path '
/tmp/netfs
': No such file or directory
Signed-off-by: Wayne Sun <gsun(a)redhat.com>
---
repos/storage/xmls/netfs_pool.xml | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/repos/storage/xmls/netfs_pool.xml b/repos/storage/xmls/netfs_pool.xml
index 309a652..d8b88c2 100644
--- a/repos/storage/xmls/netfs_pool.xml
+++ b/repos/storage/xmls/netfs_pool.xml
@@ -6,8 +6,6 @@
<format type="nfs"/>
</source>
<target>
- <path>
- TARGETPATH
- </path>
+ <path>TARGETPATH</path>
</target>
</pool>
--
1.7.1
12 years, 8 months
[libvirt] [PATCH v3] qemu: Set swap_hard_limit before hard_limit
by Osier Yang
Setting hard_limit larger than previous swap_hard_limit must fail,
it's not that good if one wants to change the swap_hard_limit
and hard_limit together. E.g.
% virsh memtune rhel6
hard_limit : 1000000
soft_limit : 1000000
swap_hard_limit: 1000000
% virsh memtune rhel6 --hard-limit 1000020 --soft-limit 1000020 \
--swap-hard-limit 1000020 --live
This patch reorder the limits setting to set the swap_hard_limit
first, hard_limit then, and soft_limit last if it's greater than
current swap_hard_limit. And soft_limit first, hard_limit then,
swap_hard_limit last, if not.
---
src/qemu/qemu_driver.c | 67 +++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 61 insertions(+), 6 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 80cfa84..bd97008 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -6651,11 +6651,18 @@ qemuDomainSetMemoryParameters(virDomainPtr dom,
virDomainDefPtr persistentDef = NULL;
virCgroupPtr group = NULL;
virDomainObjPtr vm = NULL;
+ virTypedParameterPtr hard_limit = NULL;
+ virTypedParameterPtr swap_hard_limit = NULL;
+ int hard_limit_index = 0;
+ int swap_hard_limit_index = 0;
+ unsigned long long val = 0;
+
int ret = -1;
int rc;
virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
VIR_DOMAIN_AFFECT_CONFIG, -1);
+
if (virTypedParameterArrayValidate(params, nparams,
VIR_DOMAIN_MEMORY_HARD_LIMIT,
VIR_TYPED_PARAM_ULLONG,
@@ -6694,13 +6701,61 @@ qemuDomainSetMemoryParameters(virDomainPtr dom,
}
}
+ for (i = 0; i < nparams; i++) {
+ if (STREQ(params[i].field, VIR_DOMAIN_MEMORY_HARD_LIMIT)) {
+ hard_limit = ¶ms[i];
+ hard_limit_index = i;
+ } else if (STREQ(params[i].field, VIR_DOMAIN_MEMORY_SWAP_HARD_LIMIT)) {
+ swap_hard_limit = ¶ms[i];
+ swap_hard_limit_index = i;
+ }
+ }
+
+ /* It will fail if hard limit greater than swap hard limit anyway */
+ if (swap_hard_limit &&
+ hard_limit &&
+ (hard_limit->value.ul > swap_hard_limit->value.ul)) {
+ virReportError(VIR_ERR_INVALID_ARG, "%s",
+ _("hard limit must be lower than swap hard limit"));
+ goto cleanup;
+ }
+
+ /* Get current swap hard limit */
+ rc = virCgroupGetMemSwapHardLimit(group, &val);
+ if (rc != 0) {
+ virReportSystemError(-rc, "%s",
+ _("unable to get swap hard limit"));
+ goto cleanup;
+ }
+
+ /* Swap hard_limit and swap_hard_limit to ensure the setting
+ * could succeed if both of them are provided.
+ */
+ if (swap_hard_limit && hard_limit) {
+ virTypedParameter param;
+
+ if (swap_hard_limit->value.ul > val) {
+ if (hard_limit_index < swap_hard_limit_index) {
+ param = params[hard_limit_index];
+ params[hard_limit_index] = params[swap_hard_limit_index];
+ params[swap_hard_limit_index] = param;
+ }
+ } else {
+ if (hard_limit_index > swap_hard_limit_index) {
+ param = params[hard_limit_index];
+ params[hard_limit_index] = params[swap_hard_limit_index];
+ params[swap_hard_limit_index] = param;
+ }
+ }
+ }
+
ret = 0;
for (i = 0; i < nparams; i++) {
virTypedParameterPtr param = ¶ms[i];
if (STREQ(param->field, VIR_DOMAIN_MEMORY_HARD_LIMIT)) {
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
- rc = virCgroupSetMemoryHardLimit(group, params[i].value.ul);
+ rc = virCgroupSetMemoryHardLimit(group, param->value.ul);
if (rc != 0) {
virReportSystemError(-rc, "%s",
_("unable to set memory hard_limit tunable"));
@@ -6709,11 +6764,11 @@ qemuDomainSetMemoryParameters(virDomainPtr dom,
}
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
- persistentDef->mem.hard_limit = params[i].value.ul;
+ persistentDef->mem.hard_limit = param->value.ul;
}
} else if (STREQ(param->field, VIR_DOMAIN_MEMORY_SOFT_LIMIT)) {
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
- rc = virCgroupSetMemorySoftLimit(group, params[i].value.ul);
+ rc = virCgroupSetMemorySoftLimit(group, param->value.ul);
if (rc != 0) {
virReportSystemError(-rc, "%s",
_("unable to set memory soft_limit tunable"));
@@ -6722,11 +6777,11 @@ qemuDomainSetMemoryParameters(virDomainPtr dom,
}
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
- persistentDef->mem.soft_limit = params[i].value.ul;
+ persistentDef->mem.soft_limit = param->value.ul;
}
} else if (STREQ(param->field, VIR_DOMAIN_MEMORY_SWAP_HARD_LIMIT)) {
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
- rc = virCgroupSetMemSwapHardLimit(group, params[i].value.ul);
+ rc = virCgroupSetMemSwapHardLimit(group, param->value.ul);
if (rc != 0) {
virReportSystemError(-rc, "%s",
_("unable to set swap_hard_limit tunable"));
@@ -6734,7 +6789,7 @@ qemuDomainSetMemoryParameters(virDomainPtr dom,
}
}
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
- persistentDef->mem.swap_hard_limit = params[i].value.ul;
+ persistentDef->mem.swap_hard_limit = param->value.ul;
}
}
}
--
1.7.7.3
12 years, 8 months
[libvirt] [PATCH 0/3] Allow to override disk geometry.
by Viktor Mihajlovski
With qemu it is possible to override the geometry (cylinders, heads,
sectors) of disks.
This series adds a new XML tag for geometry and the related
support in the qemu driver.
J.B. Joret (3):
qemu: Support for Disk Geometry Override
qemu: Documentation for Disk Geometry Override
qemu: Testcase for Disk Geometry Override
docs/formatdomain.html.in | 25 +++++++
docs/schemas/domaincommon.rng | 28 ++++++++
src/conf/domain_conf.c | 71 ++++++++++++++++++++
src/conf/domain_conf.h | 17 +++++
src/libvirt_private.syms | 2 +
src/qemu/qemu_command.c | 59 ++++++++++++++++
.../qemuxml2argv-disk-geometry.args | 4 +
.../qemuxml2argv-disk-geometry.xml | 26 +++++++
tests/qemuxml2argvtest.c | 2 +
9 files changed, 234 insertions(+), 0 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-geometry.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-geometry.xml
12 years, 8 months
[libvirt] QEMU 1.2 Test Day - August 16 2012
by Stefan Hajnoczi
I have set up the QEMU 1.2 Testing wiki page and suggest August 16 as
the Test Day:
http://wiki.qemu.org/Planning/1.2/Testing
Test Day is an event for QEMU contributors and users to try out the
release candidate. QEMU has a large feature matrix that is hard to
test by a single entity. On Test Day everyone is encouraged to test
their favorite features, host OSes, and guest OSes to make sure that
the release candidate is stable.
Please add yourself to the http://wiki.qemu.org/Planning/1.2/Testing wiki page!
The Test Day is August 16 2012, one day after the planned -rc0
release. On the day, use #qemu IRC on irc.oftc.net to chat about bugs
and update the wiki page with your pass/fail results.
There are usually -rc1, -rc2, ... follow-up release candidates.
Please retest those if you have time, especially if bugs you found are
supposed to be resolved.
Stefan
12 years, 8 months
[libvirt] [PATCH] build: fix syntax check during 'make distcheck'
by Eric Blake
'make distcheck' was failing because a syntax check file,
.sc-start-sc_vulnerable_makefile_CVE-2012-3386, got left
behind. I traced it to the 'distdir' rule depending on a
shortcut syntax-check name rather than the full rule name
normally used during 'local-check' from maint.mk.
* cfg.mk (distdir): Depend on full rule, not shorthand name.
---
Pushing under the build-breaker rule.
cfg.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cfg.mk b/cfg.mk
index 1318593..e9138a8 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -85,7 +85,7 @@ local-checks-to-skip = \
ifeq ($(filter dist%, $(MAKECMDGOALS)), )
local-checks-to-skip += sc_vulnerable_makefile_CVE-2012-3386
else
-distdir: sc_vulnerable_makefile_CVE-2012-3386
+distdir: sc_vulnerable_makefile_CVE-2012-3386.z
endif
# Files that should never cause syntax check failures.
--
1.7.11.2
12 years, 8 months
[libvirt] distcheck issues on maint and master
by Cole Robinson
I just pushed a bunch of patches to -maint branches, but both are giving me
distcheck errors that seem related to a gnulib update:
ERROR: files left in build directory after distclean:
./.sc-start-sc_vulnerable_makefile_CVE-2012-3386
Any hints?
I tried to reproduce on master, but it has its own set of issues:
IOError: [Errno 13] Permission denied: '../../src/hyperv/hyperv_wmi.generated.h'
types_typedef = open_and_print(os.path.join(output_dirname,
"esx_vi_types.generated.typedef"))
File "../../src/esx/esx_vi_generator.py", line 1492, in open_and_print
return open(filename, "wb")
IOError: [Errno 13] Permission denied:
'../../src/esx/esx_vi_types.generated.typedef'
make[3]: *** [.hyperv_wmi_generator.stamp] Error 1
make[3]: *** Waiting for unfinished jobs....
make[3]: *** [.esx_vi_generator.stamp] Error 1
I can get past that with:
$ git revert 1bfb47dfe61c3cf9a716db072cbe22f26e980081
[master f5a9a90] Revert "Make ESX & Hyper-V code generator safe with parallel
builds"
Then I get:
GEN check-symfile
Can't open perl script "../../src/check-symfile.pl": No such file or directory
make[4]: *** [check-symfile] Error 2
Which I fixed with:
$ git diff
diff --git a/src/Makefile.am b/src/Makefile.am
index 5ae84b1..a5223f2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -331,7 +331,7 @@ else !WITH_REMOTE
# re-generated when configured --without-remote.
check-protocol:
endif
-EXTRA_DIST += $(PROTOCOL_STRUCTS)
+EXTRA_DIST += $(PROTOCOL_STRUCTS) check-symfile.pl
check-local: check-protocol check-symfile
.PHONY: check-protocol $(PROTOCOL_STRUCTS:structs=struct)
But since this is all black magic to me I have no idea if that's correct.
Thanks,
Cole
12 years, 8 months
[libvirt] [PATCH] build: ship stamp files
by Eric Blake
'make distcheck' fails because the generated ESX and HyperV files
are (intentionally) marked read-only, but since the stamp file was
missing, make assumes they need to be rebuilt. Shipping the stamp
file solves the problem.
* src/Makefile.am (EXTRA_DIST): Ship stamp files.
---
Pushing under the build-breaker rule.
src/Makefile.am | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/Makefile.am b/src/Makefile.am
index ac5a27f..213bd83 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -930,6 +930,8 @@ BUILT_SOURCES += $(ESX_DRIVER_GENERATED)
ESX_GENERATED_STAMP = .esx_vi_generator.stamp
+EXTRA_DIST += $(ESX_GENERATED_STAMP)
+
$(ESX_DRIVER_GENERATED): $(ESX_GENERATED_STAMP)
$(ESX_GENERATED_STAMP): $(srcdir)/esx/esx_vi_generator.input \
@@ -956,6 +958,8 @@ BUILT_SOURCES += $(HYPERV_DRIVER_GENERATED)
HYPERV_GENERATED_STAMP = .hyperv_wmi_generator.stamp
+EXTRA_DIST += $(HYPERV_GENERATED_STAMP)
+
$(HYPERV_DRIVER_GENERATED): $(HYPERV_GENERATED_STAMP)
$(HYPERV_GENERATED_STAMP): $(srcdir)/hyperv/hyperv_wmi_generator.input \
--
1.7.11.2
12 years, 8 months