[PATCH hivex] ocaml: Link the C bindings with LDFLAGS (RHBZ#1548536).
by Richard W.M. Jones
Use the ocamlmklib -ldopt flag to pass the general $(LDFLAGS) when
calling gcc to link dllmlhivex.so. We were already passing $(CFLAGS)
when building the object file.
When building using Fedora's standard hardening flags this gives:
ocamlmklib -o mlhivex hivex_c.o hivex.cmo \
-verbose -ldopt '-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld' \
-L../lib/.libs -lhivex
+ gcc -shared -o ./dllmlhivex.so hivex_c.o -Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -L../lib/.libs -lhivex
+ ar rc ./libmlhivex.a hivex_c.o; ranlib ./libmlhivex.a
+ /usr/bin/ocamlc -a -o mlhivex.cma hivex.cmo -dllib -lmlhivex -cclib -lmlhivex -cclib -L../lib/.libs -cclib -lhivex
This also works if $(LDFLAGS) is empty, because ocamlmklib ignores
-ldopt ''.
---
ocaml/Makefile.am | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/ocaml/Makefile.am b/ocaml/Makefile.am
index 61db095..85655b6 100644
--- a/ocaml/Makefile.am
+++ b/ocaml/Makefile.am
@@ -41,10 +41,14 @@ OBJS = hivex_c.o hivex.cmo
XOBJS = $(OBJS:.cmo=.cmx)
mlhivex.cma: $(OBJS)
- $(OCAMLMKLIB) -o mlhivex $^ -L$(top_builddir)/lib/.libs -lhivex
+ $(OCAMLMKLIB) -o mlhivex $^ \
+ -ldopt '$(LDFLAGS)' \
+ -L$(top_builddir)/lib/.libs -lhivex
mlhivex.cmxa: $(XOBJS)
- $(OCAMLMKLIB) -o mlhivex $^ -L$(top_builddir)/lib/.libs -lhivex
+ $(OCAMLMKLIB) -o mlhivex $^ \
+ -ldopt '$(LDFLAGS)' \
+ -L$(top_builddir)/lib/.libs -lhivex
hivex_c.o: hivex_c.c
$(CC) $(AM_CPPFLAGS) $(CFLAGS) -fPIC -Wall -c $<
--
2.13.2
6 years, 9 months
[PATCH 1.38.x] builder-repository: fix compute_short_id for sles X.0
by Pino Toscano
It needs to check for the minor version, not major version.
Fixes commit a442d2c3217f709128f0e377f88649fb6ba90f45.
---
builder/repository_main.ml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builder/repository_main.ml b/builder/repository_main.ml
index bb440563b..9932fbae4 100644
--- a/builder/repository_main.ml
+++ b/builder/repository_main.ml
@@ -178,7 +178,7 @@ let compute_short_id distro major minor =
sprintf "%s%d" distro major
| ("fedora"|"mageia") ->
sprintf "%s%d" distro major
- | "sles" when major = 0 ->
+ | "sles" when minor = 0 ->
sprintf "%s%d" distro major
| "sles" ->
sprintf "%s%dsp%d" distro major minor
--
2.14.3
6 years, 9 months
[PATCH 0/5] v2v: Add -o rhv-upload output mode.
by Richard W.M. Jones
The first four patches are straightforward.
The final patch adds the -o rhv-upload output mode. It is
still spooling into a temporary file because I've had some
trouble getting streaming conversions working. There are
other problems as outlined in the commit message, so this
patch is not ready for upstream but is good for discussion.
Also I hit this, which I'm assuming for now will be fixed
by Tomas's work:
ovirtsdk4.Error: Fault reason is "Operation Failed". Fault detail is "failed to parse a given ovf configuration ovf error: [empty name]: cannot read '//*/disksection' with value: null". HTTP response code is 400.
Rich.
6 years, 9 months
[PATCH] New API: inspect_get_osinfo
by Pino Toscano
Try to guess the possible osinfo-db short ID for the specified OS.
Related to: https://bugzilla.redhat.com/show_bug.cgi?id=1544842
---
generator/actions_inspection.ml | 14 ++++++++
lib/Makefile.am | 1 +
lib/inspect-osinfo.c | 75 +++++++++++++++++++++++++++++++++++++++++
3 files changed, 90 insertions(+)
create mode 100644 lib/inspect-osinfo.c
diff --git a/generator/actions_inspection.ml b/generator/actions_inspection.ml
index d8cf571c9..d913f53e3 100644
--- a/generator/actions_inspection.ml
+++ b/generator/actions_inspection.ml
@@ -774,4 +774,18 @@ advice before using trademarks in applications.
=back" };
+ { defaults with
+ name = "inspect_get_osinfo"; added = (1, 39, 1);
+ style = RString (RPlainString, "id"), [String (Mountable, "root")], [];
+ shortdesc = "get a possible osinfo short ID corresponding to this operating system";
+ longdesc = "\
+This function returns a possible short ID for libosinfo corresponding
+to the guest.
+
+I<Note:> The returned ID is only a guess by libguestfs, and nothing
+ensures that it actually exists in osinfo-db.
+
+If no ID could not be determined, then the string C<unknown> is
+returned." };
+
]
diff --git a/lib/Makefile.am b/lib/Makefile.am
index d075174d9..742b182cc 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -95,6 +95,7 @@ libguestfs_la_SOURCES = \
info.c \
inspect-apps.c \
inspect-icon.c \
+ inspect-osinfo.c \
journal.c \
launch.c \
launch-direct.c \
diff --git a/lib/inspect-osinfo.c b/lib/inspect-osinfo.c
new file mode 100644
index 000000000..816d317f1
--- /dev/null
+++ b/lib/inspect-osinfo.c
@@ -0,0 +1,75 @@
+/* libguestfs
+ * Copyright (C) 2018 Red Hat Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <config.h>
+
+#include "guestfs.h"
+#include "guestfs-internal.h"
+#include "guestfs-internal-actions.h"
+
+char *
+guestfs_impl_inspect_get_osinfo (guestfs_h *g, const char *root)
+{
+ CLEANUP_FREE char *type = NULL;
+ CLEANUP_FREE char *distro = NULL;
+ int major, minor;
+
+ type = guestfs_inspect_get_type (g, root);
+ if (!type)
+ return NULL;
+ distro = guestfs_inspect_get_distro (g, root);
+ if (!distro)
+ return NULL;
+ major = guestfs_inspect_get_major_version (g, root);
+ minor = guestfs_inspect_get_minor_version (g, root);
+
+ if (STREQ (type, "linux")) {
+ if (STREQ (distro, "centos")) {
+ if (major >= 7)
+ return safe_asprintf (g, "%s%d.0", distro, major);
+ else if (major == 6)
+ return safe_asprintf (g, "%s%d.%d", distro, major, minor);
+ }
+ else if (STREQ (distro, "debian")) {
+ if (major >= 4)
+ return safe_asprintf (g, "%s%d", distro, major);
+ }
+ else if (STREQ (distro, "fedora") || STREQ (distro, "mageia"))
+ return safe_asprintf (g, "%s%d", distro, major);
+ else if (STREQ (distro, "sles")) {
+ if (minor == 0)
+ return safe_asprintf (g, "%s%d", distro, major);
+ else
+ return safe_asprintf (g, "%s%dsp%d", distro, major, minor);
+ }
+ else if (STREQ (distro, "ubuntu"))
+ return safe_asprintf (g, "%s%d.%02d", distro, major, minor);
+
+ if (major > 0 || minor > 0)
+ return safe_asprintf (g, "%s%d.%d", distro, major, minor);
+ }
+ else if (STREQ (type, "freebsd") || STREQ (type, "netbsd") || STREQ (type, "openbsd"))
+ return safe_asprintf (g, "%s%d.%d", distro, major, minor);
+ else if (STREQ (type, "dos")) {
+ if (STREQ (distro, "msdos"))
+ return safe_strdup (g, "msdos6.22");
+ }
+
+ /* No ID could be guessed, return "unknown". */
+ return safe_strdup (g, "unknown");
+}
--
2.14.3
6 years, 9 months
[PATCH v2 0/3] Make generated OVF more conforming to standard
by Tomáš Golembiovský
The main reason for creating different OVF is that it can be used to create VM
by oVirt REST API. The RHV export domain flavor cannot be used that way.
v1 -> v2:
- introduced flavour types instead of booleans
- instead of referring to the new flavour as "standard OVF" or "fixed OVF" I
refer to it as oVirt flavour. While it is more conforming than the one used
in export domain it can still contain some oVirt specific pieces.
Tomáš Golembiovský (3):
v2v: tests: check generated OVF
v2v: ovf: Create OVF more aligned with the standard
v2v: vdsm: add --vdsm-fixed-ovf option
v2v/Makefile.am | 2 +
v2v/cmdline.ml | 10 ++
v2v/create_ovf.ml | 159 ++++++++++++++++++++++---------
v2v/create_ovf.mli | 21 +++-
v2v/output_rhv.ml | 3 +-
v2v/output_vdsm.ml | 10 +-
v2v/output_vdsm.mli | 1 +
v2v/test-v2v-o-rhv.ovf.expected | 92 ++++++++++++++++++
v2v/test-v2v-o-rhv.sh | 21 ++++
v2v/test-v2v-o-vdsm-options.ovf.expected | 92 ++++++++++++++++++
v2v/test-v2v-o-vdsm-options.sh | 20 +++-
v2v/virt-v2v.pod | 20 ++++
12 files changed, 400 insertions(+), 51 deletions(-)
create mode 100644 v2v/test-v2v-o-rhv.ovf.expected
create mode 100644 v2v/test-v2v-o-vdsm-options.ovf.expected
--
2.16.1
6 years, 9 months
[PATCH] tmp: ignore virt-v2v overlay files
by Tomáš Golembiovský
Failed virt-v2v tests can leave the overlay files on disk. Make sure
they are ignored.
Signed-off-by: Tomáš Golembiovský <tgolembi(a)redhat.com>
---
tmp/.gitignore | 1 +
1 file changed, 1 insertion(+)
diff --git a/tmp/.gitignore b/tmp/.gitignore
index 28ac388f3..912a946b6 100644
--- a/tmp/.gitignore
+++ b/tmp/.gitignore
@@ -2,4 +2,5 @@
/guestfs.*
/libguestfs??????/
/run-*
+/v2vovl*.qcow2
/valgrind-*.log
--
2.16.1
6 years, 9 months
[PATCH 0/3] Make generated OVF more conforming to standard
by Tomáš Golembiovský
The main reason for creating different OVF is that it can be used to create VM
by oVirt REST API. The RHV export domain flavor cannot be used that way.
Tomáš Golembiovský (3):
v2v: tests: check generated OVF
v2v: ovf: Create OVF more aligned with the standard
v2v: vdsm: add --vdsm-fixed-ovf option
v2v/cmdline.ml | 5 ++
v2v/create_ovf.ml | 108 ++++++++++++++++++++++---------
v2v/create_ovf.mli | 2 +-
v2v/output_rhv.ml | 2 +-
v2v/output_vdsm.ml | 9 ++-
v2v/output_vdsm.mli | 1 +
v2v/test-v2v-o-rhv.ovf.expected | 92 ++++++++++++++++++++++++++
v2v/test-v2v-o-rhv.sh | 20 ++++++
v2v/test-v2v-o-vdsm-options.ovf.expected | 92 ++++++++++++++++++++++++++
v2v/test-v2v-o-vdsm-options.sh | 19 +++++-
v2v/virt-v2v.pod | 7 ++
11 files changed, 322 insertions(+), 35 deletions(-)
create mode 100644 v2v/test-v2v-o-rhv.ovf.expected
create mode 100644 v2v/test-v2v-o-vdsm-options.ovf.expected
--
2.16.1
6 years, 9 months
[PATCH] daemon: tsk: handle new enum values in sleuthkit 4.5
by Pino Toscano
Resort to a version check for them, as they do not exist in older
versions.
---
daemon/tsk.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/daemon/tsk.c b/daemon/tsk.c
index af803d749..ad10d74fe 100644
--- a/daemon/tsk.c
+++ b/daemon/tsk.c
@@ -241,6 +241,9 @@ file_type (TSK_FS_FILE *fsfile)
case TSK_FS_NAME_TYPE_SHAD: return 'h';
case TSK_FS_NAME_TYPE_WHT: return 'w';
case TSK_FS_NAME_TYPE_VIRT: return 'u'; /* Temp files created by TSK */
+#if TSK_VERSION_NUM >= 0x040500ff
+ case TSK_FS_NAME_TYPE_VIRT_DIR: return 'u'; /* Temp files created by TSK */
+#endif
}
else if (fsfile->meta != NULL &&
fsfile->meta->type < TSK_FS_META_TYPE_STR_MAX)
@@ -256,6 +259,9 @@ file_type (TSK_FS_FILE *fsfile)
case TSK_FS_META_TYPE_SOCK: return 's';
case TSK_FS_META_TYPE_WHT: return 'w';
case TSK_FS_META_TYPE_VIRT: return 'u'; /* Temp files created by TSK */
+#if TSK_VERSION_NUM >= 0x040500ff
+ case TSK_FS_META_TYPE_VIRT_DIR: return 'u'; /* Temp files created by TSK */
+#endif
}
return 'u';
--
2.14.3
6 years, 9 months
[PATCH] lib: qemu: help GCC 8 by break'ing a case in a switch
by Pino Toscano
GCC 8 thinks that the case drive_protocol_gluster may fall through, most
probably because the only code is a switch case that handles the
elements of an enum, and thus letting other fall through. In reality
this ought to not happen at all, so help GCC by break'ing the case,
which will then lead to the abort() at the end of
guestfs_int_drive_source_qemu_param.
---
lib/qemu.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/qemu.c b/lib/qemu.c
index cd859139d..a50eca988 100644
--- a/lib/qemu.c
+++ b/lib/qemu.c
@@ -746,6 +746,7 @@ guestfs_int_drive_source_qemu_param (guestfs_h *g,
return make_uri (g, "gluster+unix", NULL, NULL,
&src->servers[0], NULL);
}
+ break;
case drive_protocol_http:
return make_uri (g, "http", src->username, src->secret,
--
2.14.3
6 years, 9 months