[nbdkit PATCH v2] plugin: add and use nbdkit_realpath
by Pino Toscano
Introduce a new helper function to resolve a path name, calling
nbdkit_error on failure: other than doing what nbdkit_absolute_path
does, it also checks that the file exists (and thus avoids errors later
on). To help distinguish it from nbdkit_absolute_path, improve the
documentation of the latter.
Apply it where an existing path is required, both in nbdkit itself and
in plugins.
Related to: https://bugzilla.redhat.com/show_bug.cgi?id=1527334
---
docs/nbdkit-plugin.pod | 18 +++++++++++++++++-
include/nbdkit-common.h | 1 +
plugins/example2/example2.c | 2 +-
plugins/file/file.c | 6 +-----
plugins/gzip/gzip.c | 2 +-
plugins/split/split.c | 2 +-
plugins/vddk/vddk.c | 2 +-
plugins/xz/xz.c | 2 +-
src/plugins.c | 2 +-
src/utils.c | 19 +++++++++++++++++++
10 files changed, 44 insertions(+), 12 deletions(-)
diff --git a/docs/nbdkit-plugin.pod b/docs/nbdkit-plugin.pod
index 44822fc..5faba1d 100644
--- a/docs/nbdkit-plugin.pod
+++ b/docs/nbdkit-plugin.pod
@@ -200,13 +200,29 @@ descriptor.
char *nbdkit_absolute_path (const char *filename);
The utility function C<nbdkit_absolute_path> converts any path to an
-absolute path.
+absolute path: if it is relative, then all this function does is
+prepending the current working directory to the path, with no extra
+checks.
If conversion was not possible, this calls C<nbdkit_error> and returns
C<NULL>. Note that this function does not check that the file exists.
The returned string must be freed by the caller.
+=head2 C<nbdkit_realpath>
+
+ char *nbdkit_realpath (const char *filename);
+
+The utility function C<nbdkit_realpath> converts any path to an
+absolute path, resolving symlinks. Under the hood it uses the
+C<realpath> function, and thus it fails if the path does not exist,
+or it is not possible to access to any of the components of the path.
+
+If the path resolution was not possible, this calls C<nbdkit_error>
+and returns C<NULL>.
+
+The returned string must be freed by the caller.
+
=head1 CALLBACKS
=head2 C<.name>
diff --git a/include/nbdkit-common.h b/include/nbdkit-common.h
index 5e69579..693213f 100644
--- a/include/nbdkit-common.h
+++ b/include/nbdkit-common.h
@@ -60,6 +60,7 @@ extern void nbdkit_vdebug (const char *msg, va_list args);
extern char *nbdkit_absolute_path (const char *path);
extern int64_t nbdkit_parse_size (const char *str);
extern int nbdkit_read_password (const char *value, char **password);
+extern char *nbdkit_realpath (const char *path);
#ifdef __cplusplus
}
diff --git a/plugins/example2/example2.c b/plugins/example2/example2.c
index 5bc4f94..a2d6fca 100644
--- a/plugins/example2/example2.c
+++ b/plugins/example2/example2.c
@@ -78,7 +78,7 @@ example2_config (const char *key, const char *value)
{
if (strcmp (key, "file") == 0) {
/* See FILENAMES AND PATHS in nbdkit-plugin(3). */
- filename = nbdkit_absolute_path (value);
+ filename = nbdkit_realpath (value);
if (!filename)
return -1;
}
diff --git a/plugins/file/file.c b/plugins/file/file.c
index f8cb3d3..b6e33de 100644
--- a/plugins/file/file.c
+++ b/plugins/file/file.c
@@ -65,7 +65,7 @@ file_config (const char *key, const char *value)
if (strcmp (key, "file") == 0) {
/* See FILENAMES AND PATHS in nbdkit-plugin(3). */
free (filename);
- filename = nbdkit_absolute_path (value);
+ filename = nbdkit_realpath (value);
if (!filename)
return -1;
}
@@ -90,10 +90,6 @@ file_config_complete (void)
nbdkit_error ("you must supply the file=<FILENAME> parameter after the plugin name on the command line");
return -1;
}
- if (access (filename, F_OK) < 0) {
- nbdkit_error ("access '%s': %m", filename);
- return -1;
- }
return 0;
}
diff --git a/plugins/gzip/gzip.c b/plugins/gzip/gzip.c
index e9dbfdb..09dd629 100644
--- a/plugins/gzip/gzip.c
+++ b/plugins/gzip/gzip.c
@@ -62,7 +62,7 @@ gzip_config (const char *key, const char *value)
{
if (strcmp (key, "file") == 0) {
/* See FILENAMES AND PATHS in nbdkit-plugin(3). */
- filename = nbdkit_absolute_path (value);
+ filename = nbdkit_realpath (value);
if (!filename)
return -1;
}
diff --git a/plugins/split/split.c b/plugins/split/split.c
index 47c366d..bdcdcf7 100644
--- a/plugins/split/split.c
+++ b/plugins/split/split.c
@@ -76,7 +76,7 @@ split_config (const char *key, const char *value)
return -1;
}
filenames = new_filenames;
- filenames[nr_files] = nbdkit_absolute_path (value);
+ filenames[nr_files] = nbdkit_realpath (value);
if (filenames[nr_files] == NULL)
return -1;
nr_files++;
diff --git a/plugins/vddk/vddk.c b/plugins/vddk/vddk.c
index 1c15127..8bc1517 100644
--- a/plugins/vddk/vddk.c
+++ b/plugins/vddk/vddk.c
@@ -153,7 +153,7 @@ vddk_config (const char *key, const char *value)
if (strcmp (key, "config") == 0) {
/* See FILENAMES AND PATHS in nbdkit-plugin(3). */
free (config);
- config = nbdkit_absolute_path (value);
+ config = nbdkit_realpath (value);
if (!config)
return -1;
}
diff --git a/plugins/xz/xz.c b/plugins/xz/xz.c
index 437f798..f45e489 100644
--- a/plugins/xz/xz.c
+++ b/plugins/xz/xz.c
@@ -67,7 +67,7 @@ xz_config (const char *key, const char *value)
{
if (strcmp (key, "file") == 0) {
/* See FILENAMES AND PATHS in nbdkit-plugin(3). */
- filename = nbdkit_absolute_path (value);
+ filename = nbdkit_realpath (value);
if (!filename)
return -1;
}
diff --git a/src/plugins.c b/src/plugins.c
index dba3e24..595b632 100644
--- a/src/plugins.c
+++ b/src/plugins.c
@@ -134,7 +134,7 @@ plugin_dump_fields (struct backend *b)
struct backend_plugin *p = container_of (b, struct backend_plugin, backend);
char *path;
- path = nbdkit_absolute_path (p->filename);
+ path = nbdkit_realpath (p->filename);
printf ("path=%s\n", path);
free (path);
diff --git a/src/utils.c b/src/utils.c
index 0083370..c6c8003 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -228,3 +228,22 @@ nbdkit_read_password (const char *value, char **password)
return 0;
}
+
+char *
+nbdkit_realpath (const char *path)
+{
+ char *ret;
+
+ if (path == NULL || *path == '\0') {
+ nbdkit_error ("cannot resolve a null or empty path");
+ return NULL;
+ }
+
+ ret = realpath (path, NULL);
+ if (ret == NULL) {
+ nbdkit_error ("realpath(%s): %m", path);
+ return NULL;
+ }
+
+ return ret;
+}
--
2.14.3
6 years, 7 months
ANN: nbdkit stable branch plan
by Richard W.M. Jones
First off, if I do this correctly it shouldn't affect anything
or anyone's workflow. Here's hoping anyway :-)
Problem
-------
We've got a lot of changes going into nbdkit. I think we've had 53
commits since the previous release (1.1.28). There's:
(a) a danger we might break something without noticing and push that
brokenness into a released tarball, and
(b) we are planning to ship nbdkit in RHEL and would prefer a stable
base for that.
Solution: stable and development branches
-----------------------------------------
So what I'm proposing to do is to introduce stable and development
branches. As with old Linux and libguestfs, odd minor numbers will
mean development, even minor numbers will be stable.
I will branch 1.2.0 (stable) at tag v1.1.28. I will also make an
immediate development release (1.3.0) at current HEAD (9ac1eac).
Later I'll see if there are any simple fixes that can be backported
to make a 1.2.1 (stable) release.
Note: this does NOT mean we're planning to break the C plugin ABI.
Downstream packaging
--------------------
I will add 1.3.0 to Fedora Rawhide and 1.2.0 to Fedora <= 28.
Currently Fedora <= 28 has 1.1.28, so this means only the
version number will change.
For EPEL 7, I will add 1.2.0 (currently 1.1.26) so this is a small
update.
For RHEL 7, it would be nice to also move to 1.2.0 (currently 1.1.26)
but I'll need to discuss that with others.
Rich.
--
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
6 years, 7 months
[nbdkit PATCH 0/3] Test zero callback of python plugin
by Eric Blake
I'm planning on tweaking the language callbacks to support fua;
first up is the python bindings. I want to move from:
def zero(h, count, offset, may_trim):
to a nicer:
def zero(h, count, offset, may_trim=False, fua=False):
where the C code passes keywords for the flags (we can add new
flags as needed), perhaps by using introspection to learn
whether the plugin has a mandatory may_trim (old-style) or
optional keywords (new style). But any such changes FIRST need
to make sure I don't cause regressions, so beef up the testsuite
to cover the zero call in the first place :)
Eric Blake (3):
python: Follow pep8 recommendations
tests: Add coverage of zero in language bindings
python: Test implementation of zero callback
plugins/python/example.py | 10 ++++++++--
tests/python-exception.py | 4 ++++
tests/shebang.py | 5 ++++-
tests/test-lang-plugins.c | 7 +++++++
tests/test.py | 22 +++++++++++++++++++---
5 files changed, 42 insertions(+), 6 deletions(-)
--
2.14.3
6 years, 7 months
[nbdkit PATCH] python: Make sure callbacks are actually callable
by Eric Blake
Rather than catching a Python error at runtime when trying to
call an object that wasn't callable, just ignore that object
up front when loading the plugin.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
Various examples on calling Python functions from C recommend
doing this filtering check.
plugins/python/python.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/plugins/python/python.c b/plugins/python/python.c
index 0206b80..35e8df2 100644
--- a/plugins/python/python.c
+++ b/plugins/python/python.c
@@ -94,6 +94,11 @@ callback_defined (const char *name, PyObject **obj_rtn)
obj = PyObject_GetAttrString (module, name);
if (!obj)
return 0;
+ if (!PyCallable_Check (obj)) {
+ nbdkit_debug ("object %s isn't callable", name);
+ Py_DECREF (obj);
+ return 0;
+ }
if (obj_rtn != NULL)
*obj_rtn = obj;
--
2.14.3
6 years, 7 months
[nbdkit PATCH] nbd: Fix gcc warning and off-by-one in socket name length
by Eric Blake
gcc 8 gripes (when using './configure --enable-gcc-warnings'):
nbd.c: In function 'nbd_open':
nbd.c:470:3: error: 'strncpy' specified bound 108 equals destination size [-Werror=stringop-truncation] strncpy (sock.sun_path, sockname, sizeof (sock.sun_path));
The warning is a false positive, given that we currently reject
names >= sizeof(sock.sun_path), and thus we are only ever copying
in a name that will include a trailing NUL. However, note that
Linux permits a socket name to use the full width of sun_path (for
shorter names, you must either provide a trailing NUL or pass
something smaller than sizeof(struct sockaddr_un) to connect();
but for the full-length name, a trailing NUL is not required).
So, relax our off-by-one length restriction (we now permit the user
to pass a 108-byte socket name, instead of a limit of 107), at which
point the gcc complaint is no longer a false positive (we could
indeed be copying a string without its trailing NUL, even though
we know it works), then shut up gcc by using memcpy() instead of
strncpy(), relying on our earlier zero-initialization for supplying
any needed trailing NUL. For convencience, we stick with the
simpler sizeof(struct sockaddr_un) instead of passing exact lengths
to connect().
[strncpy() is seldom the right function to use, because it does
not NUL-terminate on overflow, yet writes a full size bytes even
when the input string is shorter. Initializing sockaddr_un is
one of the few places where it actually does what you want - too
bad newer gcc is now rendering even valid uses of strncpy as a
source of complaints]
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
plugins/nbd/nbd.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/plugins/nbd/nbd.c b/plugins/nbd/nbd.c
index 51de178..a4a1f12 100644
--- a/plugins/nbd/nbd.c
+++ b/plugins/nbd/nbd.c
@@ -100,7 +100,7 @@ nbd_config_complete (void)
nbdkit_error ("you must supply the socket=<SOCKNAME> parameter after the plugin name on the command line");
return -1;
}
- if (strlen (sockname) >= sizeof sock.sun_path) {
+ if (strlen (sockname) > sizeof sock.sun_path) {
nbdkit_error ("socket file name too large");
return -1;
}
@@ -467,7 +467,8 @@ nbd_open (int readonly)
nbdkit_error ("socket: %m");
return NULL;
}
- strncpy (sock.sun_path, sockname, sizeof (sock.sun_path));
+ /* We already validated length during nbd_config_complete */
+ memcpy (sock.sun_path, sockname, strlen (sockname));
if (connect (h->fd, (const struct sockaddr *) &sock, sizeof sock) < 0) {
nbdkit_error ("connect: %m");
goto err;
--
2.14.3
6 years, 7 months
[PATCH] v2v: OVF: write ovirt:id attribute for the OS in OVirt flavour
by Pino Toscano
When writing the OVF in OVirt flavour, add a ovirt:id attribute to the
OperatingSystemSection tag: this attribute represents the numeric value
of the ostype ID, which is ignored by oVirt when parsing OVFs in API
mode.
---
v2v/create_ovf.ml | 202 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 201 insertions(+), 1 deletion(-)
diff --git a/v2v/create_ovf.ml b/v2v/create_ovf.ml
index 64edd2b86..34cd925e7 100644
--- a/v2v/create_ovf.ml
+++ b/v2v/create_ovf.ml
@@ -216,6 +216,203 @@ and get_ostype = function
typ distro major minor arch product;
"Unassigned"
+(* Determine the ovirt:id attribute from libguestfs inspection.
+ * See ovirt-engine sources, file:
+ * packaging/conf/osinfo-defaults.properties
+ * and also:
+ * https://bugzilla.redhat.com/show_bug.cgi?id=1219857#c9
+ *)
+and get_ovirt_osid = function
+ | { i_type = "linux"; i_distro = ("rhel"|"centos"); i_major_version = 3;
+ i_arch = "i386" } ->
+ 9
+
+ | { i_type = "linux"; i_distro = ("rhel"|"centos"); i_major_version = 3;
+ i_arch = "x86_64" } ->
+ 15
+
+ | { i_type = "linux"; i_distro = ("rhel"|"centos"); i_major_version = 4;
+ i_arch = "i386" } ->
+ 8
+
+ | { i_type = "linux"; i_distro = ("rhel"|"centos"); i_major_version = 4;
+ i_arch = "x86_64" } ->
+ 14
+
+ | { i_type = "linux"; i_distro = ("rhel"|"centos"); i_major_version = 5;
+ i_arch = "i386" } ->
+ 7
+
+ | { i_type = "linux"; i_distro = ("rhel"|"centos"); i_major_version = 5;
+ i_arch = "x86_64" } ->
+ 13
+
+ | { i_type = "linux"; i_distro = ("rhel"|"centos"); i_major_version = 6;
+ i_arch = "i386" } ->
+ 18
+
+ | { i_type = "linux"; i_distro = ("rhel"|"centos"); i_major_version = 6;
+ i_arch = "x86_64" } ->
+ 19
+
+ | { i_type = "linux"; i_distro = ("rhel"|"centos"); i_major_version = 6;
+ i_minor_version = min; i_arch = ("ppc64"|"ppc64le") } when min >= 9 ->
+ 1007
+
+ | { i_type = "linux"; i_distro = ("rhel"|"centos"); i_major_version = 6;
+ i_arch = ("ppc64"|"ppc64le") } ->
+ 1003
+
+ | { i_type = "linux"; i_distro = ("rhel"|"centos"); i_major_version = 7;
+ i_arch = "x86_64" } ->
+ 24
+
+ | { i_type = "linux"; i_distro = ("rhel"|"centos"); i_major_version = 7;
+ i_arch = ("ppc64"|"ppc64le") } ->
+ 1006
+
+ | { i_type = "linux"; i_distro = ("rhel"|"centos"); i_major_version = 7;
+ i_arch = "s390x" } ->
+ 2003
+
+ | { i_type = "linux"; i_distro = "sles"; i_major_version = 11;
+ i_arch = "x86_64" } ->
+ 1193
+
+ | { i_type = "linux"; i_distro = "sles"; i_major_version = 11;
+ i_arch = "ppc64" | "ppc64le" } ->
+ 1004
+
+ | { i_type = "linux"; i_distro = "sles"; i_major_version = 12;
+ i_arch = "s390x" } ->
+ 2004
+
+ (* Only Debian 7 is available, so use it for any 7+ version. *)
+ | { i_type = "linux"; i_distro = "debian"; i_major_version = v }
+ when v >= 7 ->
+ 1300
+
+ (* Only Ubuntu 12.04 to 14.04 are available, so use them starting
+ * from 12.04, and 14.04 for anything after it.
+ *)
+ | { i_type = "linux"; i_distro = "ubuntu"; i_major_version = v;
+ i_arch = ("ppc64"|"ppc64le") } when v >= 14 ->
+ 1005
+
+ | { i_type = "linux"; i_distro = "ubuntu"; i_major_version = v;
+ i_arch = "s390x" } when v >= 16 ->
+ 2005
+
+ | { i_type = "linux"; i_distro = "ubuntu"; i_major_version = v }
+ when v >= 14 ->
+ 1256
+
+ | { i_type = "linux"; i_distro = "ubuntu"; i_major_version = 12;
+ i_minor_version = 4 } ->
+ 1252
+
+ | { i_type = "linux"; i_distro = "ubuntu"; i_major_version = 12;
+ i_minor_version = 10 } ->
+ 1253
+
+ | { i_type = "linux"; i_distro = "ubuntu"; i_major_version = 13;
+ i_minor_version = 4 } ->
+ 1254
+
+ | { i_type = "linux"; i_distro = "ubuntu"; i_major_version = 13;
+ i_minor_version = 10 } ->
+ 1255
+
+ | { i_type = "linux"; i_arch = ("ppc64"|"ppc64le") } ->
+ 1002
+
+ | { i_type = "linux"; i_arch = "s390x" } ->
+ 2002
+
+ | { i_type = "linux" } ->
+ 5
+
+ | { i_type = "windows"; i_major_version = 5; i_minor_version = 1 } ->
+ 1 (* no architecture differentiation of XP on RHV *)
+
+ | { i_type = "windows"; i_major_version = 5; i_minor_version = 2;
+ i_product_name = product } when String.find product "XP" >= 0 ->
+ 1 (* no architecture differentiation of XP on RHV *)
+
+ | { i_type = "windows"; i_major_version = 5; i_minor_version = 2;
+ i_arch = "i386" } ->
+ 3
+
+ | { i_type = "windows"; i_major_version = 5; i_minor_version = 2;
+ i_arch = "x86_64" } ->
+ 10
+
+ | { i_type = "windows"; i_major_version = 6; i_minor_version = 0;
+ i_arch = "i386" } ->
+ 4
+
+ | { i_type = "windows"; i_major_version = 6; i_minor_version = 0;
+ i_arch = "x86_64" } ->
+ 16
+
+ | { i_type = "windows"; i_major_version = 6; i_minor_version = 1;
+ i_arch = "i386" } ->
+ 11
+
+ | { i_type = "windows"; i_major_version = 6; i_minor_version = 1;
+ i_arch = "x86_64"; i_product_variant = "Client" } ->
+ 12
+
+ | { i_type = "windows"; i_major_version = 6; i_minor_version = 1;
+ i_arch = "x86_64" } ->
+ 17
+
+ | { i_type = "windows"; i_major_version = 6; i_minor_version = 2;
+ i_arch = "i386" } ->
+ 20
+
+ | { i_type = "windows"; i_major_version = 6; i_minor_version = 2;
+ i_arch = "x86_64"; i_product_variant = "Client" } ->
+ 21
+
+ | { i_type = "windows"; i_major_version = 6; i_minor_version = 2;
+ i_arch = "x86_64" } ->
+ 23
+
+ (* Treat Windows 8.1 client like Windows 8. See:
+ * https://bugzilla.redhat.com/show_bug.cgi?id=1309580#c4
+ *)
+ | { i_type = "windows"; i_major_version = 6; i_minor_version = 3;
+ i_arch = "i386"; i_product_variant = "Client" } ->
+ 20
+
+ | { i_type = "windows"; i_major_version = 6; i_minor_version = 3;
+ i_arch = "x86_64"; i_product_variant = "Client" } ->
+ 21
+
+ | { i_type = "windows"; i_major_version = 6; i_minor_version = 3;
+ i_arch = "x86_64" } ->
+ 23
+
+ | { i_type = "windows"; i_major_version = 10; i_minor_version = 0;
+ i_arch = "i386" } ->
+ 26
+
+ | { i_type = "windows"; i_major_version = 10; i_minor_version = 0;
+ i_arch = "x86_64"; i_product_variant = "Client" } ->
+ 27
+
+ | { i_type = "windows"; i_major_version = 10; i_minor_version = 0;
+ i_arch = "x86_64" } ->
+ 29
+
+ | { i_type = typ; i_distro = distro;
+ i_major_version = major; i_minor_version = minor; i_arch = arch;
+ i_product_name = product } ->
+ warning (f_"unknown guest operating system: %s %s %d.%d %s (%s)")
+ typ distro major minor arch product;
+ 0
+
(* Set the <Origin/> element based on the source hypervisor.
* https://bugzilla.redhat.com/show_bug.cgi?id=1342398#c6
* https://gerrit.ovirt.org/#/c/59147/
@@ -295,6 +492,7 @@ let rec create_ovf source targets guestcaps inspect
"xmlns:vssd", "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettin...";
"xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance";
"xmlns:ovf", "http://schemas.dmtf.org/ovf/envelope/1/";
+ "xmlns:ovirt", "http://ovirt.org/vm/tune/1.0";
"ovf:version", "0.9"
] [
Comment generated_by;
@@ -357,8 +555,10 @@ let rec create_ovf source targets guestcaps inspect
] in
(match ovf_flavour with
| OVirt ->
+ let ovirt_osid = get_ovirt_osid inspect in
e "OperatingSystemSection" ["ovf:id", vm_uuid;
- "ovf:required", "false"]
+ "ovf:required", "false";
+ "ovirt:id", string_of_int ovirt_osid]
osinfo_subnodes
| RHVExportStorageDomain ->
e "Section" ["ovf:id", vm_uuid; "ovf:required", "false";
--
2.14.3
6 years, 7 months
[PATCH] v2v: OVF: map CentOS as RHEL
by Pino Toscano
Since oVirt has no CentOS OS mappings, and that CentOS is derived from
RHEL, then map CentOS as RHEL for the OS.
---
v2v/create_ovf.ml | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/v2v/create_ovf.ml b/v2v/create_ovf.ml
index 87245fdc8..64edd2b86 100644
--- a/v2v/create_ovf.ml
+++ b/v2v/create_ovf.ml
@@ -53,17 +53,17 @@ let iso_time =
(* Guess vmtype based on the guest inspection data. *)
let get_vmtype = function
(* Special cases for RHEL 3 & RHEL 4. *)
- | { i_type = "linux"; i_distro = "rhel"; i_major_version = (3|4);
+ | { i_type = "linux"; i_distro = ("rhel"|"centos"); i_major_version = (3|4);
i_product_name = product }
when String.find product "ES" >= 0 ->
`Server
- | { i_type = "linux"; i_distro = "rhel"; i_major_version = (3|4);
+ | { i_type = "linux"; i_distro = ("rhel"|"centos"); i_major_version = (3|4);
i_product_name = product }
when String.find product "AS" >= 0 ->
`Server
- | { i_type = "linux"; i_distro = "rhel"; i_major_version = (3|4) } ->
+ | { i_type = "linux"; i_distro = ("rhel"|"centos"); i_major_version = (3|4) } ->
`Desktop
(* For Windows (and maybe Linux in future, but it is not set now),
@@ -89,19 +89,19 @@ let get_vmtype = function
* https://bugzilla.redhat.com/show_bug.cgi?id=1219857#c9
*)
and get_ostype = function
- | { i_type = "linux"; i_distro = "rhel"; i_major_version = v;
+ | { i_type = "linux"; i_distro = ("rhel"|"centos"); i_major_version = v;
i_arch = "i386" } when v <= 6 ->
sprintf "RHEL%d" v
- | { i_type = "linux"; i_distro = "rhel"; i_major_version = v;
+ | { i_type = "linux"; i_distro = ("rhel"|"centos"); i_major_version = v;
i_arch = "x86_64" } when v <= 6 ->
sprintf "RHEL%dx64" v
- | { i_type = "linux"; i_distro = "rhel"; i_major_version = v;
+ | { i_type = "linux"; i_distro = ("rhel"|"centos"); i_major_version = v;
i_arch = "x86_64" } (* when v >= 7 *) ->
sprintf "rhel_%dx64" v
- | { i_type = "linux"; i_distro = "rhel"; i_major_version = 7;
+ | { i_type = "linux"; i_distro = ("rhel"|"centos"); i_major_version = 7;
i_arch = "ppc64" | "ppc64le" } ->
"rhel_7_ppc64"
--
2.14.3
6 years, 7 months