Skip to content

Commit

Permalink
not to start service if the disk was failed to umount or not found
Browse files Browse the repository at this point in the history
Signed-off-by: Lijin Xiong <[email protected]>
  • Loading branch information
Lijin Xiong committed Mar 10, 2023
1 parent 7058a7b commit ad5f649
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions internal/configure/disks/disk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ func TestDiskConfigInvalidFormatPercent(t *testing.T) {

}

// tservice_mount_device is a boolean,
// It accepts 1, t, T, TRUE, true, True, 0, f, F, FALSE, false, False
// the disk config service_mount_device is a boolean,
// it accepts 1, t, T, TRUE, true, True, 0, f, F, FALSE, false, False
func TestDiskConfigInvalidServiceMount(t *testing.T) {
assert := assert.New(t)
_, err := ParseDisks(disksDataInvalidServiceMount)
Expand Down
7 changes: 4 additions & 3 deletions internal/task/task/common/start_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,10 @@ func NewStartServiceTask(curveadm *cli.CurveAdm, dc *topology.DeployConfig) (*ta
t := task.NewTask("Start Service", subname, hc.GetSSHConfig())

// add step to task
var out, device string
var out string
var success bool

device := ""
if len(curveadm.DiskRecords()) > 0 {
disks, err := curveadm.Storage().GetDisk(common.DISK_FILTER_SERVICE, serviceId)
if err != nil {
Expand Down Expand Up @@ -123,8 +124,8 @@ func NewStartServiceTask(curveadm *cli.CurveAdm, dc *topology.DeployConfig) (*ta
if device != "" {
t.AddStep(&step.UmountFilesystem{
Directorys: []string{device},
IgnoreUmounted: true,
IgnoreNotFound: true,
IgnoreUmounted: false, // service should not be started if failed to unmount disk(for data security)
IgnoreNotFound: false, // service should not be started if disk was not found
ExecOptions: curveadm.ExecOptions(),
})
}
Expand Down

0 comments on commit ad5f649

Please sign in to comment.