From 48f1a14d1ae684b108ba8a6cfc5a9402a0b71d8c Mon Sep 17 00:00:00 2001 From: John Garbutt Date: Tue, 10 Sep 2019 10:58:36 +0100 Subject: [PATCH 1/4] Ensure filesystem mount gets correct persistent mount path --- internal/pkg/filesystem_impl/mount_test.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/pkg/filesystem_impl/mount_test.go b/internal/pkg/filesystem_impl/mount_test.go index 99f48651..f599bc64 100644 --- a/internal/pkg/filesystem_impl/mount_test.go +++ b/internal/pkg/filesystem_impl/mount_test.go @@ -21,6 +21,9 @@ func (f *fakeRunner) Execute(hostname string, cmdStr string) error { if cmdStr == "grep /mnt/dac/job1_job /etc/mtab" { return errors.New("trigger mount") } + if cmdStr == "grep /mnt/dac/job1_persistent_asdf /etc/mtab" { + return errors.New("trigger mount") + } return f.err } @@ -227,10 +230,12 @@ func Test_Mount_multi(t *testing.T) { owner, group, false) assert.Nil(t, err) - assert.Equal(t, 2, fake.calls) + assert.Equal(t, 3, fake.calls) assert.Equal(t, "client1", fake.hostnames[0]) assert.Equal(t, "mkdir -p /mnt/dac/job1_persistent_asdf", fake.cmdStrs[0]) assert.Equal(t, "client1", fake.hostnames[1]) assert.Equal(t, "grep /mnt/dac/job1_persistent_asdf /etc/mtab", fake.cmdStrs[1]) + assert.Equal(t, "client1", fake.hostnames[2]) + assert.Equal(t, "mount -t lustre -o flock,nodev,nosuid host1:/uuidasdf /mnt/dac/job1_persistent_asdf", fake.cmdStrs[2]) } From 4676386267d75b314cd5814fe1538d2ca6e53334 Mon Sep 17 00:00:00 2001 From: John Garbutt Date: Tue, 10 Sep 2019 11:36:17 +0100 Subject: [PATCH 2/4] Do fake mount in the test env --- internal/pkg/filesystem_impl/mount.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/pkg/filesystem_impl/mount.go b/internal/pkg/filesystem_impl/mount.go index c059b3a7..371ca53f 100644 --- a/internal/pkg/filesystem_impl/mount.go +++ b/internal/pkg/filesystem_impl/mount.go @@ -224,7 +224,7 @@ func mountRemoteFilesystem(fsType FSType, hostname string, lnetSuffix string, mg func mountLustre(hostname string, lnetSuffix string, mgtHost string, fsname string, directory string) error { // We assume modprobe -v lustre is already done // First check if we are mounted already - if err := runner.Execute(hostname, fmt.Sprintf("grep %s /etc/mtab", directory)); err != nil { + if err := runner.Execute(hostname, fmt.Sprintf("grep %s /etc/mtab", directory)); err != nil || conf.SkipAnsible { if err := runner.Execute(hostname, fmt.Sprintf( "mount -t lustre -o flock,nodev,nosuid %s%s:/%s %s", mgtHost, lnetSuffix, fsname, directory)); err != nil { @@ -282,7 +282,8 @@ func (*run) Execute(hostname string, cmdStr string) error { log.Println(string(output)) return nil } else { - log.Println("Error in remove ssh run:", string(output)) + log.Printf("Error in remote ssh run: '%s' error: %s\n", cmdStr, err.Error()) + log.Println(string(output)) return err } } From e6d9e9fc1358f620c1a0332ecd587046f0194897 Mon Sep 17 00:00:00 2001 From: John Garbutt Date: Tue, 10 Sep 2019 12:00:31 +0100 Subject: [PATCH 3/4] Don't skip create when we have persistent mounts Before we skipped create for any job without a per job buffer. However we need to do create for jobs where there only mount persistent buffers. --- internal/pkg/dacctl/workflow_impl/session.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/pkg/dacctl/workflow_impl/session.go b/internal/pkg/dacctl/workflow_impl/session.go index 0e9eee1d..bcbd934e 100644 --- a/internal/pkg/dacctl/workflow_impl/session.go +++ b/internal/pkg/dacctl/workflow_impl/session.go @@ -111,7 +111,7 @@ func (s sessionFacade) CreateSession(session datamodel.Session) error { if err != nil { return session, err } - if session.ActualSizeBytes == 0 { + if session.ActualSizeBytes == 0 && len(session.MultiJobAttachments) == 0 { // Skip creating an empty filesystem return datamodel.Session{}, nil } From 40a618af5c9bc0bc8d7908e84a61d99c615fd093 Mon Sep 17 00:00:00 2001 From: John Garbutt Date: Tue, 10 Sep 2019 12:07:32 +0100 Subject: [PATCH 4/4] Fix unit tests --- internal/pkg/filesystem_impl/mount_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/pkg/filesystem_impl/mount_test.go b/internal/pkg/filesystem_impl/mount_test.go index f599bc64..8adff553 100644 --- a/internal/pkg/filesystem_impl/mount_test.go +++ b/internal/pkg/filesystem_impl/mount_test.go @@ -186,7 +186,7 @@ func Test_Umount_multi(t *testing.T) { fake := &fakeRunner{} runner = fake - sessionName := datamodel.SessionName("asdf") + sessionName := datamodel.SessionName("asdf2") internalName := "uuidasdf" primaryBrickHost := datamodel.BrickHostName("host1") attachment := datamodel.AttachmentSession{ @@ -203,9 +203,9 @@ func Test_Umount_multi(t *testing.T) { assert.Equal(t, 3, fake.calls) assert.Equal(t, "client1", fake.hostnames[0]) - assert.Equal(t, "grep /mnt/dac/job1_persistent_asdf /etc/mtab", fake.cmdStrs[0]) - assert.Equal(t, "umount /mnt/dac/job1_persistent_asdf", fake.cmdStrs[1]) - assert.Equal(t, "rm -df /mnt/dac/job1_persistent_asdf", fake.cmdStrs[2]) + assert.Equal(t, "grep /mnt/dac/job1_persistent_asdf2 /etc/mtab", fake.cmdStrs[0]) + assert.Equal(t, "umount /mnt/dac/job1_persistent_asdf2", fake.cmdStrs[1]) + assert.Equal(t, "rm -df /mnt/dac/job1_persistent_asdf2", fake.cmdStrs[2]) } func Test_Mount_multi(t *testing.T) {