Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

UB-1475: returning the actual error from the Discover instead of masking it as Volume not found #236

Conversation

olgashtivelman
Copy link
Collaborator

@olgashtivelman olgashtivelman commented Aug 16, 2018

This PR will return the actual error that is returned from sg_inq and not mask it as a volume not found error .
this is important because if we mask the error from sg_inq we might stumble into an idempotent case and continue the umount even thought we should not and we will be stuck.
(this can happen when there is a faulty device so sg_inq returns an error and we return a volume not found error in this case, and after that because we know to continue with the unmount in case of a volume not found we will continue the umount even though other steps did not happen and this is not really the case of a volume not found because it was already unmounted.)


This change is Reviewable

@coveralls
Copy link

coveralls commented Aug 16, 2018

Coverage Status

Coverage decreased (-3.8%) to 48.144% when pulling 015b4af on fix/UB-1475_umount_is_stuck_when_umounting_a_pod_with_faulty_device into dacf163 on dev.

@beckmani
Copy link
Contributor


remote/mounter/block_device_utils/mpath.go, line 137 at r1 (raw file):

			wwn, err := b.GetWwnByScsiInq(mpathFullPath)
			if err != nil {
				return "", b.logger.ErrorRet(err, "failed")				

Extra spaces?

@beckmani
Copy link
Contributor


remote/mounter/block_device_utils/mpath.go, line 259 at r1 (raw file):

	}
	if err := b.exec.IsExecutable(multipathCmd); err != nil {
		return b.logger.ErrorRet(&commandNotFoundError{multipathCmd, err}, "failed")

Don't you want to rename this as well? (To start with capital 'C')

@beckmani
Copy link
Contributor


remote/mounter/block_device_utils/mpath.go, line 127 at r1 (raw file):

	}
	dev := ""
	

remove this empty line

@beckmani
Copy link
Contributor


remote/mounter/block_device_utils/block_device_utils_test.go, line 207 at r1 (raw file):

							- 34:0:0:1 sdc 8:32 active ready running`
			fakeExec.ExecuteReturnsOnCall(0, []byte(mpathOutput),
				nil)

No need for new line here.

Copy link
Contributor

@beckmani beckmani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 5 of 5 files at r1.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @olgashtivelman and @shay-berman)

Copy link
Collaborator Author

@olgashtivelman olgashtivelman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @beckmani, @olgashtivelman, and @shay-berman)


remote/mounter/block_device_utils/block_device_utils_test.go, line 207 at r1 (raw file):

Previously, beckmani (Isaac Beckman) wrote…

No need for new line here.

Done.


remote/mounter/block_device_utils/mpath.go, line 127 at r1 (raw file):

Previously, beckmani (Isaac Beckman) wrote…

remove this empty line

Done.


remote/mounter/block_device_utils/mpath.go, line 137 at r1 (raw file):

Previously, beckmani (Isaac Beckman) wrote…

Extra spaces?

Done.


remote/mounter/block_device_utils/mpath.go, line 259 at r1 (raw file):

Previously, beckmani (Isaac Beckman) wrote…

Don't you want to rename this as well? (To start with capital 'C')

I change the CommandExecuteError, because that was the one I used. there are many other errors in the code that are in small letters (and cannot be exported) , I think we can change this one when we will need to.

Copy link
Contributor

@beckmani beckmani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 2 of 2 files at r2.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @shay-berman)

Copy link
Contributor

@beckmani beckmani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @shay-berman)

@olgashtivelman olgashtivelman merged commit 382fc6e into dev Aug 19, 2018
@olgashtivelman olgashtivelman deleted the fix/UB-1475_umount_is_stuck_when_umounting_a_pod_with_faulty_device branch August 19, 2018 13:27
Copy link
Contributor

@shay-berman shay-berman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @olgashtivelman)


remote/mounter/block_device_utils/block_device_utils_test.go, line 199 at r2 (raw file):

			Expect(err).To(HaveOccurred())
		})
		FIt("should return actual error when sg_inq command fails", func() {

Olga, please remove the FIt and put It instead. So it will not run only this unit test all the time.


remote/mounter/block_device_utils/mpath.go, line 136 at r2 (raw file):

			wwn, err := b.GetWwnByScsiInq(mpathFullPath)
			if err != nil {
				return "", b.logger.ErrorRet(&VolumeNotFoundError{volumeWwn}, "failed")

are you sure its better for you to move the identification of the error to the upper level?

could you please specific the ubiqutiy-k8s PR that will do that instead?

@shay-berman shay-berman added the idempotency Improve Flex API idempotency aspects label Aug 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
idempotency Improve Flex API idempotency aspects
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants