From 950cff00671c2412b2bff0f88b699892783962e5 Mon Sep 17 00:00:00 2001
From: Pino Toscano <ptoscano@redhat.com>
Date: Mon, 5 Dec 2016 17:20:58 +0100
Subject: [PATCH] inspect: mark CoreOS /usr partitions with own USR role
Add a new inspect role for "/usr" partitions, and use that to mark the
/usr partition in CoreOS: this additional role allows to ease its lookup
later on, when merging its results into those of the root.
(cherry picked from commit e77e1ef95ed79d34dfcbaa08e26a333462471899)
---
src/guestfs-internal.h | 1 +
src/inspect-fs-unix.c | 2 ++
src/inspect.c | 2 +-
3 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/guestfs-internal.h b/src/guestfs-internal.h
index 6f31438..eb201aa 100644
--- a/src/guestfs-internal.h
+++ b/src/guestfs-internal.h
@@ -597,6 +597,7 @@ enum inspect_os_package_management {
enum inspect_os_role {
OS_ROLE_UNKNOWN = 0,
OS_ROLE_ROOT,
+ OS_ROLE_USR,
};
struct inspect_fs {
diff --git a/src/inspect-fs-unix.c b/src/inspect-fs-unix.c
index 149ad85..8e27ade 100644
--- a/src/inspect-fs-unix.c
+++ b/src/inspect-fs-unix.c
@@ -1055,6 +1055,8 @@ guestfs_int_check_coreos_usr (guestfs_h *g, struct inspect_fs *fs)
fs->type = OS_TYPE_LINUX;
fs->distro = OS_DISTRO_COREOS;
+ fs->role = OS_ROLE_USR;
+
if (guestfs_is_file_opts (g, "/share/coreos/lsb-release",
GUESTFS_IS_FILE_OPTS_FOLLOWSYMLINKS, 1, -1) > 0) {
r = parse_lsb_release (g, fs, "/share/coreos/lsb-release");
diff --git a/src/inspect.c b/src/inspect.c
index e82c476..e805291 100644
--- a/src/inspect.c
+++ b/src/inspect.c
@@ -115,7 +115,7 @@ collect_coreos_inspection_info (guestfs_h *g)
for (i = 0; i < g->nr_fses; ++i) {
struct inspect_fs *fs = &g->fses[i];
- if (fs->distro != OS_DISTRO_COREOS || fs->role == OS_ROLE_ROOT)
+ if (fs->distro != OS_DISTRO_COREOS || fs->role != OS_ROLE_USR)
continue;
/* CoreOS is designed to contain 2 /usr partitions (USR-A, USR-B):
--
2.7.4