common/populate: remember multi-device configurations
authorDarrick J. Wong <darrick.wong@oracle.com>
Fri, 30 Jun 2017 04:12:04 +0000 (21:12 -0700)
committerEryu Guan <eguan@redhat.com>
Mon, 3 Jul 2017 12:25:01 +0000 (20:25 +0800)
Record the external log and realtime device configurations when we
create a sample filesystem.  ext4 tightly binds to external logs,
so we have to preserve that too.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <eguan@redhat.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
common/populate

index e99ce68..498151f 100644 (file)
@@ -713,7 +713,18 @@ _scratch_populate_cached() {
        rm -rf "$(find "${POPULATE_METADUMP}" -mtime +2 2>/dev/null)"
 
        # Throw away cached image if it doesn't match our spec.
-       meta_descr="FSTYP ${FSTYP} MKFS_OPTIONS ${MKFS_OPTIONS} SIZE $(blockdev --getsz "${SCRATCH_DEV}") ARGS $@"
+       case "${FSTYP}" in
+       "ext4")
+               extra_descr="LOGDEV ${SCRATCH_LOGDEV} USE_EXTERNAL ${USE_EXTERNAL}"
+               # ext4 cannot e2image external logs, so we cannot restore
+               test -n "${SCRATCH_LOGDEV}" && rm -f "${POPULATE_METADUMP}"
+               ;;
+       "xfs")
+               extra_descr="LOGDEV ${SCRATCH_LOGDEV} USE_EXTERNAL ${USE_EXTERNAL} RTDEV ${SCRATCH_RTDEV}";;
+       *)
+               extra_descr="";;
+       esac
+       meta_descr="FSTYP ${FSTYP} MKFS_OPTIONS ${MKFS_OPTIONS} SIZE $(blockdev --getsz "${SCRATCH_DEV}") ${extra_descr} ARGS $@"
        cmp -s "${POPULATE_METADUMP_DESCR}" <(echo "${meta_descr}") || rm -rf "${POPULATE_METADUMP}"
 
        # Do we have a cached image?