Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix GetStatus(), GetTable() to return multi-line tables #39834

Closed
wants to merge 1 commit into from

Conversation

trgill
Copy link

@trgill trgill commented Aug 30, 2019

fixes #39833

Device mapper target tables may have multiple lines. When the table has
multiple lines, it is required that dm_get_next_target(ptr) be called
until the returned pointer is Nil. Examples of using dm_get_next_target()
can be found in libdm/dm-tools/dmsetup.c

- What I did

Update GetStatus and GetTable to fetch and return more than just the first
line of the DM table.

- How I did it

Added TargetLine type to represent a single line of the DM table. An
array of TargetLine is used to return the full table.

Update getThinPoolDataMetaMajMin() to hanle an array of TargetLine.

- How to verify it

Create a multi-line DM target
Call GetStatus() and GetTable() with/without the fix

- Description for the changelog
Fix GetStatus(), GetTable() to return multi-line tables

@thaJeztah
Copy link
Member

/cc @rhvgoyal ptal

@thaJeztah
Copy link
Member

ping @kolyshkin PTAL

@thaJeztah
Copy link
Member

@trgill looks like build is failing;

# github.com/docker/docker/pkg/devicemapper
pkg/devicemapper/devmapper.go:558:29: syntax error: mixed named and unnamed function parameters

@trgill trgill force-pushed the add_dm_multiline_target_support branch from a82da7f to daf43da Compare September 30, 2019 17:58
@kolyshkin
Copy link
Contributor

@trgill this code is not compileable, please fix:

kir@kd:~/go/src/github.com/docker/docker$ ./hack/make.sh dynbinary

Removing bundles/

---> Making bundle: dynbinary (in bundles/dynbinary)
Building: bundles/dynbinary-daemon/dockerd-dev
GOOS="" GOARCH="" GOARM=""
# github.com/docker/docker/pkg/devicemapper
pkg/devicemapper/devmapper.go:562:3: too many arguments to return
	have (number, number, string, string, error)
	want ([]TargetLine, error)
pkg/devicemapper/devmapper.go:566:3: too many arguments to return
	have (number, number, string, string, error)
	want ([]TargetLine, error)
pkg/devicemapper/devmapper.go:572:3: too many arguments to return
	have (number, number, string, string, error)
	want ([]TargetLine, error)
pkg/devicemapper/devmapper.go:576:3: too many arguments to return
	have (number, number, string, string, error)
	want ([]TargetLine, error)
pkg/devicemapper/devmapper.go:618:10: tl.start undefined (type *TargetLine has no field or method start, but does have Start)
pkg/devicemapper/devmapper.go:618:20: tl.length undefined (type *TargetLine has no field or method length, but does have Length)
pkg/devicemapper/devmapper.go:618:31: tl.targetType undefined (type *TargetLine has no field or method targetType, but does have TargetType)
pkg/devicemapper/devmapper.go:618:46: tl.params undefined (type *TargetLine has no field or method params, but does have Params)

@trgill trgill force-pushed the add_dm_multiline_target_support branch from daf43da to 764a1a3 Compare September 30, 2019 19:50
Device mapper target tables may have multiple lines. When the table has
multiple lines, it is required  that dm_get_next_target(ptr) be called
until the returned pointer is Nil.  Examples of using dm_get_next_target()
can be found in libdm/dm-tools/dmsetup.c

Update GetStatus and GetTable to fetch and return more than just the first
line of the DM table.

Added TargetLine type to represent a single line of the DM table.  An
array of TargetLine is used to return the full table.

Update getThinPoolDataMetaMajMin() to hanle an array of TargetLine.

Signed-off-by: Todd Gill <tgill@redhat.com>
@trgill trgill force-pushed the add_dm_multiline_target_support branch from 764a1a3 to 01a003c Compare September 30, 2019 21:19
@trgill
Copy link
Author

trgill commented Oct 1, 2019

@kolyshkin fixed.

Looks like a couple unit tests TestDevmapperReduceLoopBackSize and TestDevmapperIncreaseLoopBackSize are failing. I'll have a look to see if I introduced the problem.

@trgill
Copy link
Author

trgill commented Oct 2, 2019

I don't think the test failures are related to this change. The log entries after the failures indicate:

[2019-09-30T21:38:12.450Z] time="2019-09-30T21:36:38Z" level=error msg="Udev sync is not supported. This will lead to data loss and unexpected behavior. Install a more recent version of libdevmapper or select a different storage driver. For more information, see https://docs.docker.com/engine/reference/commandline/dockerd/#storage-driver-options" storage-driver=devicemapper

@thaJeztah
Copy link
Member

The devicemapper storage-driver was deprecated, and has been removed, so closing issues related to this storage-driver. See;

@thaJeztah thaJeztah closed this Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

devicemapper: GetTable() and GetStatus return only first line of the DM table
5 participants