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 } 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 } } diff --git a/internal/pkg/filesystem_impl/mount_test.go b/internal/pkg/filesystem_impl/mount_test.go index 99f48651..8adff553 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 } @@ -183,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{ @@ -200,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) { @@ -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]) }