[libvirt] [PATCH] Generate RFC4122 compliant UUIDs
by Milos Vyletel
Even though http://libvirt.org/formatdomain.html#elementsMetadata
states that it requires RFC4122 compliance UUIDs that are generated
by virUUIDGenerate() are not. Neither does virUUIDIsValid() check
for RFC4122 compliance. Following patch modifies virUUIDGenerate()
to generate valid UUIDs and adds check to virUUIDIsValid() to validate
UUIDs.
Signed-off-by: Milos Vyletel <milos.vyletel(a)sde.cz>
---
src/util/viruuid.c | 31 +++++++++++++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/src/util/viruuid.c b/src/util/viruuid.c
index 7250543..2dc9a56 100644
--- a/src/util/viruuid.c
+++ b/src/util/viruuid.c
@@ -114,6 +114,25 @@ virUUIDGenerate(unsigned char *uuid)
err = virUUIDGeneratePseudoRandomBytes(uuid, VIR_UUID_BUFLEN);
}
+ /*
+ * Make UUID RFC 4122 compliant. Following form will be used:
+ *
+ * xxxxxxxx-xxxx-Axxx-Bxxx-xxxxxxxxxxxx
+ *
+ * where
+ * A is version defined in 4.1.3 of RFC
+ * Msb0 Msb1 Msb2 Msb3 Version Description
+ * 0 1 0 0 4 The randomly or pseudo-
+ * randomly generated version
+ * specified in this document.
+ *
+ * B is variant defined in 4.1.1 of RFC
+ * Msb0 Msb1 Msb2 Description
+ * 1 0 x The variant specified in this document.
+ */
+ uuid[6] = (uuid[6] & 0x0F) | (4 << 4);
+ uuid[8] = (uuid[8] & 0x3F) | (2 << 6);
+
return err;
}
@@ -209,6 +228,7 @@ virUUIDFormat(const unsigned char *uuid, char *uuidstr)
* Do some basic tests to check whether the given UUID is
* valid as a host UUID.
* Basic tests:
+ * - Validate RFC4122 compliance
* - Not all of the digits may be equal
*/
int
@@ -216,10 +236,21 @@ virUUIDIsValid(unsigned char *uuid)
{
unsigned int i, ctr = 1;
unsigned char c;
+ unsigned char version;
+ unsigned char variant;
if (!uuid)
return 0;
+ /*
+ * RFC4122 defines version 1 to 5 (section 4.1.3)
+ * RFC4122 defined variant is desribed in section 4.1.1
+ */
+ version = (uuid[6] >> 4);
+ variant = (uuid[8] >> 6);
+ if (!(version > 0 && version <= 5) || variant != 2)
+ return 0;
+
c = uuid[0];
for (i = 1; i < VIR_UUID_BUFLEN; i++)
--
1.7.1
11 years, 7 months
[libvirt] [PATCH glib] Auto-generate AUTHORS file from GIT logs during make dist
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
Instead of manually keeping the AUTHORS file in sync with
GIT, auto-generate it during make dist phase
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
AUTHORS => AUTHORS.in | 9 +--------
ChangeLog | 0
Makefile.am | 13 +++++++++++--
autogen.sh | 5 +++++
cfg.mk | 15 ---------------
5 files changed, 17 insertions(+), 25 deletions(-)
rename AUTHORS => AUTHORS.in (52%)
delete mode 100644 ChangeLog
diff --git a/AUTHORS b/AUTHORS.in
similarity index 52%
rename from AUTHORS
rename to AUTHORS.in
index db05f64..6ee6c9c 100644
--- a/AUTHORS
+++ b/AUTHORS.in
@@ -10,13 +10,6 @@ The primary maintainers of libvirt-glib are:
Patches have been received from:
- Guido G��nther <agx(a)sigxcpu.org>
- Nirbheek Chauhan <nirbheek(a)gentoo.org>
- Michal Privoznik <mprivozn(a)redhat.com>
- Jovanka Gulicoska <jovanka.gulicoska(a)gmail.com>
- Timo Juhani Lindfors <timo.lindfors(a)iki.fi>
- Alexander Larsson <alexl(a)redhat.com>
- Claudio Bley <cbley(a)av-test.de>
- Stefano Facchini <stefano.facchini(a)gmail.com>
+#authorslist#
... send patches to get your name added ...
diff --git a/ChangeLog b/ChangeLog
deleted file mode 100644
index e69de29..0000000
diff --git a/Makefile.am b/Makefile.am
index 9add74e..9101fdb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -13,17 +13,18 @@ EXTRA_DIST = $(PACKAGE).spec \
GNUmakefile \
maint.mk \
cfg.mk \
+ AUTHORS.in \
$(NULL)
DISTCLEAN_FILES = $(PACKAGE).spec $(pkgconfig_DATA)
DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc=yes --enable-introspection=yes
-dist-hook: gen-ChangeLog
+dist-hook: gen-ChangeLog gen-AUTHORS
# Generate the ChangeLog file (with all entries since the switch to git)
# and insert it into the directory we're about to use to create a tarball.
-.PHONY: gen-ChangeLog
+.PHONY: gen-ChangeLog gen-AUTHORS
gen-ChangeLog:
if test -d .git || test -d ../.git; then \
$(top_srcdir)/build-aux/gitlog-to-changelog \
@@ -31,3 +32,11 @@ gen-ChangeLog:
rm -f $(distdir)/ChangeLog; \
mv $(distdir)/cl-t $(distdir)/ChangeLog; \
fi
+
+gen-AUTHORS:
+ $(AM_V_GEN)if test -d $(srcdir)/.git; then \
+ out="`cd $(srcdir) && git log --pretty=format:'%aN <%aE>' | sort -u`" && \
+ perl -p -e "s/#authorslist#// and print '$$out'" \
+ < $(srcdir)/AUTHORS.in > $(distdir)/AUTHORS-tmp && \
+ mv -f $(distdir)/AUTHORS-tmp $(distdir)/AUTHORS ; \
+ fi
diff --git a/autogen.sh b/autogen.sh
index bcec826..8030ab1 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -29,6 +29,11 @@ if test -z "$*"; then
echo "the $0 command line."
fi
+# Real ChangeLog/AUTHORS is auto-generated from GIT logs at
+# make dist time, but automake requires that it
+# exists at all times :-(
+touch ChangeLog AUTHORS
+
mkdir -p build-aux
intltoolize --force
autoreconf -if
diff --git a/cfg.mk b/cfg.mk
index 099ffa3..293d4e4 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -18,7 +18,6 @@
# Tests not to run as part of "make distcheck".
local-checks-to-skip = \
changelog-check \
- check-AUTHORS \
makefile-check \
makefile_path_separator_check \
patch-check \
@@ -109,20 +108,6 @@ sc_copyright_format:
# We don't use this feature of maint.mk.
prev_version_file = /dev/null
-# Give credit where due:
-# Ensure that each commit author email address (possibly mapped via
-# git log's .mailmap) appears in our AUTHORS file.
-sc_check_author_list:
- @fail=0; \
- for i in $$(git log --pretty=format:%aE%n|sort -u|grep -v '^$$'); do \
- sanitized=$$(echo "$$i"|LC_ALL=C sed 's/\([^a-zA-Z0-9_@-]\)/\\\1/g'); \
- grep -iq "<$$sanitized>" $(srcdir)/AUTHORS \
- || { printf '%s\n' "$$i" >&2; fail=1; }; \
- done; \
- test $$fail = 1 \
- && echo '$(ME): committer(s) not listed in AUTHORS' >&2; \
- test $$fail = 0
-
exclude_file_name_regexp--sc_bindtextdomain = ^(libvirt-gconfig/tests|examples)/|libvirt-glib/libvirt-glib-event.c|libvirt-glib/libvirt-glib-main.c
--
1.8.1.4
11 years, 7 months
[libvirt] [PATCH designer] Auto-generate AUTHORS file from GIT logs
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
Rather than trying to manually keep track of authors,
just auto-generate the list from GIT logs
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
.gitignore | 2 ++
AUTHORS => AUTHORS.in | 4 +---
ChangeLog | 0
Makefile.am | 18 +++++++++++++++---
autogen.sh | 5 +++++
cfg.mk | 15 ---------------
6 files changed, 23 insertions(+), 21 deletions(-)
rename AUTHORS => AUTHORS.in (61%)
delete mode 100644 ChangeLog
diff --git a/.gitignore b/.gitignore
index 03b75ce..6b05db9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -53,3 +53,5 @@ docs/*.prerequisites
docs/*.signals
docs/*.types
examples/*.1
+AUTHORS
+ChangeLog
diff --git a/AUTHORS b/AUTHORS.in
similarity index 61%
rename from AUTHORS
rename to AUTHORS.in
index 79812d7..334ed3e 100644
--- a/AUTHORS
+++ b/AUTHORS.in
@@ -7,8 +7,6 @@ The primary maintainers of libvirt-designer are:
Patches have been received from:
- Christophe Fergeau <cfergeau(a)redhat.com>
- Michal Privoznik <mprivozn(a)redhat.com>
- Zeeshan Ali (Khattak) <zeeshanak(a)gnome.org>
+#authorslist#
... send patches to get your name added ...
diff --git a/ChangeLog b/ChangeLog
deleted file mode 100644
index e69de29..0000000
diff --git a/Makefile.am b/Makefile.am
index f5bcc47..7801b63 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -6,17 +6,21 @@ ACLOCAL_AMFLAGS = -I m4
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libvirt-designer-1.0.pc
-EXTRA_DIST = $(PACKAGE).spec $(pkgconfig_DATA:%.pc=%.pc.in)
+EXTRA_DIST = \
+ $(PACKAGE).spec \
+ $(pkgconfig_DATA:%.pc=%.pc.in) \
+ AUTHORS.in \
+ $(NULL)
DISTCLEAN_FILES = $(PACKAGE).spec $(pkgconfig_DATA)
DISTCHECK_CONFIGURE_FLAGS = --enable-introspection=yes --enable-gtk-doc=yes
-dist-hook: gen-ChangeLog
+dist-hook: gen-ChangeLog gen-AUTHORS
# Generate the ChangeLog file (with all entries since the switch to git)
# and insert it into the directory we're about to use to create a tarball.
-.PHONY: gen-ChangeLog
+.PHONY: gen-ChangeLog gen-AUTHORS
gen-ChangeLog:
if test -d .git || test -d ../.git; then \
$(top_srcdir)/build-aux/gitlog-to-changelog \
@@ -24,3 +28,11 @@ gen-ChangeLog:
rm -f $(distdir)/ChangeLog; \
mv $(distdir)/cl-t $(distdir)/ChangeLog; \
fi
+
+gen-AUTHORS:
+ $(AM_V_GEN)if test -d $(srcdir)/.git; then \
+ out="`cd $(srcdir) && git log --pretty=format:'%aN <%aE>' | sort -u`" && \
+ perl -p -e "s/#authorslist#// and print '$$out'" \
+ < $(srcdir)/AUTHORS.in > $(distdir)/AUTHORS-tmp && \
+ mv -f $(distdir)/AUTHORS-tmp $(distdir)/AUTHORS ; \
+ fi
diff --git a/autogen.sh b/autogen.sh
index cf89d7f..9a0c976 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -36,6 +36,11 @@ if test -z "$*"; then
echo "the $0 command line."
fi
+# Real ChangeLog/AUTHORS is auto-generated from GIT logs at
+# make dist time, but automake requires that it
+# exists at all times :-(
+touch ChangeLog AUTHORS
+
mkdir -p build-aux
libtoolize --copy --force
aclocal -I m4
diff --git a/cfg.mk b/cfg.mk
index cf0f61f..54f62d4 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -18,7 +18,6 @@
# Tests not to run as part of "make distcheck".
local-checks-to-skip = \
changelog-check \
- check-AUTHORS \
makefile-check \
makefile_path_separator_check \
patch-check \
@@ -104,20 +103,6 @@ sc_copyright_format:
# We don't use this feature of maint.mk.
prev_version_file = /dev/null
-# Give credit where due:
-# Ensure that each commit author email address (possibly mapped via
-# git log's .mailmap) appears in our AUTHORS file.
-sc_check_author_list:
- @fail=0; \
- for i in $$(git log --pretty=format:%aE%n|sort -u|grep -v '^$$'); do \
- sanitized=$$(echo "$$i"|LC_ALL=C sed 's/\([^a-zA-Z0-9_@-]\)/\\\1/g'); \
- grep -iq "<$$sanitized>" $(srcdir)/AUTHORS \
- || { printf '%s\n' "$$i" >&2; fail=1; }; \
- done; \
- test $$fail = 1 \
- && echo '$(ME): committer(s) not listed in AUTHORS' >&2; \
- test $$fail = 0
-
exclude_file_name_regexp--sc_bindtextdomain = ^(libvirt-designer/test)|(libvirt-designer/libvirt-designer-init-*)|(examples/virtxml.c)
--
1.8.1.4
11 years, 7 months
[libvirt] 1.4.0 memballoon bug?
by Serge Hallyn
Hi,
When I run
virsh -c qemu:///system domxml-to-native qemu-argv /tmp/qatest.xml
from 1.4.0 with the qatest.xml below (which has no memballoon
device specified), I get an 'unspecified error'. Some printf
debugging shows that virDomainDefParseXML is automatically
adding a virtio memballoon device, but that its
memballoon->info.type is 0, not the 1 or 8 which is required at
qemuBuildMemballoonDevStr().
This didn't happen at 1.2.0, but I'm not sure where the
error was introduced, as I don't see any suspicious changes around
any of the relevant functions. So I was hoping to send a patch,
but for now I'm just asking for help :) Anyone know what might
be going on?
thanks,
-serge
11 years, 7 months
[libvirt] [libvirt-php PATCH 0/1] use LDFLAGS for libvirt-php.so
by stefan.kuhn@foss-group.ch
I'm getting this warning:
* QA Notice: Files built without respecting LDFLAGS have been detected
* Please include the following list of files in your report:
* /usr/lib64/php5.3/lib/extensions/no-debug-non-zts-20090626/libvirt-php.so
The attached patch seems reasonable to me, please check it.
Thank you very much for the quick responses and for adding me to the authors! :-)
Stefan
Stefan Kuhn (1):
src/Makefile.am: use LDFLAGS for libvirt-php.so
src/Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--
1.7.12.4
11 years, 7 months
[libvirt] [libvirt-php PATCH 0/1] Fix: mutlithreading compilation: set_error needs 2 params
by stefan.kuhn@foss-group.ch
= Info =
Someone reports errors withing "PHP_FUNCTION(libvirt_domain_migrate)" due to "set_error":
libvirt-php.c: In function ‘zif_libvirt_domain_migrate’:
libvirt-php.c:5456:3: error: too few arguments to function ‘set_error’
= Background =
Michal Novotny already reacted to Gentoos bug:
Bug 437624 - =dev-php/libvirt-php-0.4.6: too few arguments to function ‘set_error’
https://bugs.gentoo.org/show_bug.cgi?id=437624
with commit:
bfca998ae921ab897f95025344fad71d9633ccf6
http://libvirt.org/git/?p=libvirt-php.git;a=commit;h=bfca998ae921ab897f95...
but some calls to "set_error" still lacked the 2nd param "TSRMLS_CC", especially in the "PHP_FUNCTION(libvirt_domain_migrate)".
= Patch =
Add 2nd param "TSRMLS_CC" to all calls of "set_error" where only 1 param was supplied.
Stefan Kuhn (1):
Fix: mutlithreading compilation: set_error needs 2 params
src/libvirt-php.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
--
1.7.12.4
11 years, 7 months
[libvirt] [PATCH] Unmount existing filesystems under user specified mounts in LXC
by Daniel P. Berrange
From: "Daniel P. Berrange" <berrange(a)redhat.com>
If the user requests a mount for /run, this may hide any existing
mounts that are lower down in /run. The result is that the
container still sees the mounts in /proc/mounts, but cannot
access them
sh-4.2# df
df: '/run/user/501/gvfs': No such file or directory
df: '/run/media/berrange/LIVE': No such file or directory
df: '/run/media/berrange/SecureDiskA1': No such file or directory
df: '/run/libvirt/lxc/sandbox': No such file or directory
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/vg_t500wlan-lv_root 151476396 135390200 8384900 95% /
tmpfs 1970888 3204 1967684 1% /run
/dev/sda1 194241 155940 28061 85% /boot
devfs 64 0 64 0% /dev
tmpfs 64 0 64 0% /sys/fs/cgroup
tmpfs 1970888 1200 1969688 1% /etc/libvirt-sandbox/scratch
Before mounting any filesystem at a particular location, we
must recursively unmount anything at or below the target mount
point
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/lxc/lxc_container.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index b4ad0c5..30738bb 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -1361,6 +1361,10 @@ static int lxcContainerMountAllFS(virDomainDefPtr vmDef,
STREQ(vmDef->fss[i]->dst, "/"))
continue;
+ if (lxcContainerUnmountSubtree(vmDef->fss[i]->dst,
+ false) < 0)
+ return -1;
+
if (lxcContainerMountFS(vmDef->fss[i], dstprefix, sec_mount_options) < 0)
return -1;
}
--
1.8.1.4
11 years, 7 months