From 468bf66b0c58d1f1117e1094ef061f25705c7973 Mon Sep 17 00:00:00 2001 From: Pawan Date: Tue, 17 Mar 2020 22:27:35 +0530 Subject: [PATCH] fix(xfs): fixing xfs duplicate uuid for cloned volumes for mounting the cloned volume for xfs, a new UUID has to be generated. We are generating a new UUID for the cloned volumes which are formatted as xfs using xfs_admin command. Signed-off-by: Pawan --- pkg/zfs/zfs_util.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/zfs/zfs_util.go b/pkg/zfs/zfs_util.go index d6b77388..bcae0207 100644 --- a/pkg/zfs/zfs_util.go +++ b/pkg/zfs/zfs_util.go @@ -361,6 +361,16 @@ func CreateClone(vol *apis.ZFSVolume) error { logrus.Infof("using existing clone volume %v", volume) } + if vol.Spec.FsType == "xfs" { + // for mounting the cloned volume for xfs, a new UUID has to be generated + device := ZFS_DEVPATH + volume + cmd := exec.Command("xfs_admin", "-U", "generate", device) + out, err := cmd.CombinedOutput() + if err != nil { + logrus.Errorf("zfspv: Clone XFS uuid generate failed error: %s", string(out)) + return err + } + } return nil }