-
Notifications
You must be signed in to change notification settings - Fork 76
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 the localdisk.partitionInfo.path not display correctly #1199
Conversation
…getStorageNodeMigrateOperations Signed-off-by: lancerxiu <1377004871@qq.com>
…getStorageNodeMigrateOperations Signed-off-by: lancerxiu <1377004871@qq.com>
Codecov Report
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. @@ Coverage Diff @@
## main #1199 +/- ##
==========================================
- Coverage 38.13% 35.81% -2.32%
==========================================
Files 25 28 +3
Lines 1980 2178 +198
==========================================
+ Hits 755 780 +25
- Misses 1125 1295 +170
- Partials 100 103 +3
... and 2 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall lgtm, just some nits
"testing" | ||
) | ||
|
||
func TestDevice_ParseDeviceInfo_UnPartition(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these 2 test cases may be merged into one TestFunc, that may be better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I try to modify it
@@ -29,4 +29,7 @@ type PartitionInfo struct { | |||
|
|||
// Filesystem | |||
Filesystem string | |||
|
|||
// Path | |||
Path string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this path represent the partition-path like /dev/sda1
,/dev/sda2
?
i'm wondering if it's a mount-path, but I think the partition-path should be more meaningful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes,its format turly like /dev/sda1
. It comes from the field DEVNAME
of udevadm info
command.
udevInfo_unPartition := "P: /devices/pci0000:00/0000:00:07.1/ata1/host1/target1:0:0/1:0:0:0/block/sdb\nN: sdb\nS: disk/by-id/ata-VMware_Virtual_IDE_Hard_Drive_00000000000000000001\nS: disk/by-id/wwn-0x5000c298825951d9\nS: disk/by-path/pci-0000:00:07.1-ata-1.0\nE: DEVLINKS=/dev/disk/by-id/ata-VMware_Virtual_IDE_Hard_Drive_00000000000000000001 /dev/disk/by-id/wwn-0x5000c298825951d9 /dev/disk/by-path/pci-0000:00:07.1-ata-1.0\nE: DEVNAME=/dev/sdb\nE: DEVPATH=/devices/pci0000:00/0000:00:07.1/ata1/host1/target1:0:0/1:0:0:0/block/sdb\nE: DEVTYPE=disk\nE: ID_ATA=1\nE: ID_ATA_FEATURE_SET_APM=1\nE: ID_ATA_FEATURE_SET_APM_ENABLED=0\nE: ID_ATA_FEATURE_SET_PM=1\nE: ID_ATA_FEATURE_SET_PM_ENABLED=1\nE: ID_BUS=ata\nE: ID_MODEL=VMware_Virtual_IDE_Hard_Drive\nE: ID_MODEL_ENC=VMware\\x20Virtual\\x20IDE\\x20Hard\\x20Drive\\x20\\x20\\x20\\x20\\x20\\x20\\x20\\x20\\x20\\x20\\x20\nE: ID_PART_TABLE_TYPE=dos\nE: ID_PATH=pci-0000:00:07.1-ata-1.0\nE: ID_PATH_TAG=pci-0000_00_07_1-ata-1_0\nE: ID_REVISION=00000001\nE: ID_SERIAL=VMware_Virtual_IDE_Hard_Drive_00000000000000000001\nE: ID_SERIAL_SHORT=00000000000000000001\nE: ID_TYPE=disk\nE: ID_WWN=0x5000c298825951d9\nE: ID_WWN_WITH_EXTENSION=0x5000c298825951d9\nE: MAJOR=8\nE: MINOR=16\nE: SUBSYSTEM=block\nE: TAGS=:systemd:\nE: USEC_INITIALIZED=645583\n" | ||
udevInfo_partition := "P: /devices/pci0000:00/0000:00:07.1/ata1/host1/target1:0:0/1:0:0:0/block/sdb/sdb1\nN: sdb1\nS: disk/by-id/ata-VMware_Virtual_IDE_Hard_Drive_00000000000000000001-part1\nS: disk/by-id/lvm-pv-uuid-QKLBih-32Tt-0JP7-uQKr-GzjD-cx0C-I8Vnno\nS: disk/by-id/wwn-0x5000c298825951d9-part1\nS: disk/by-path/pci-0000:00:07.1-ata-1.0-part1\nE: DEVLINKS=/dev/disk/by-id/ata-VMware_Virtual_IDE_Hard_Drive_00000000000000000001-part1 /dev/disk/by-id/lvm-pv-uuid-QKLBih-32Tt-0JP7-uQKr-GzjD-cx0C-I8Vnno /dev/disk/by-id/wwn-0x5000c298825951d9-part1 /dev/disk/by-path/pci-0000:00:07.1-ata-1.0-part1\nE: DEVNAME=/dev/sdb1\nE: DEVPATH=/devices/pci0000:00/0000:00:07.1/ata1/host1/target1:0:0/1:0:0:0/block/sdb/sdb1\nE: DEVTYPE=partition\nE: ID_ATA=1\nE: ID_ATA_FEATURE_SET_APM=1\nE: ID_ATA_FEATURE_SET_APM_ENABLED=0\nE: ID_ATA_FEATURE_SET_PM=1\nE: ID_ATA_FEATURE_SET_PM_ENABLED=1\nE: ID_BUS=ata\nE: ID_FS_TYPE=LVM2_member\nE: ID_FS_USAGE=raid\nE: ID_FS_UUID=QKLBih-32Tt-0JP7-uQKr-GzjD-cx0C-I8Vnno\nE: ID_FS_UUID_ENC=QKLBih-32Tt-0JP7-uQKr-GzjD-cx0C-I8Vnno\nE: ID_FS_VERSION=LVM2 001\nE: ID_MODEL=VMware_Virtual_IDE_Hard_Drive\nE: ID_MODEL_ENC=VMware\\x20Virtual\\x20IDE\\x20Hard\\x20Drive\\x20\\x20\\x20\\x20\\x20\\x20\\x20\\x20\\x20\\x20\\x20\nE: ID_PART_ENTRY_DISK=8:16\nE: ID_PART_ENTRY_NUMBER=1\nE: ID_PART_ENTRY_OFFSET=2048\nE: ID_PART_ENTRY_SCHEME=dos\nE: ID_PART_ENTRY_SIZE=31455232\nE: ID_PART_ENTRY_TYPE=0x83\nE: ID_PART_TABLE_TYPE=dos\nE: ID_PATH=pci-0000:00:07.1-ata-1.0\nE: ID_PATH_TAG=pci-0000_00_07_1-ata-1_0\nE: ID_REVISION=00000001\nE: ID_SERIAL=VMware_Virtual_IDE_Hard_Drive_00000000000000000001\nE: ID_SERIAL_SHORT=00000000000000000001\nE: ID_TYPE=disk\nE: ID_WWN=0x5000c298825951d9\nE: ID_WWN_WITH_EXTENSION=0x5000c298825951d9\nE: MAJOR=8\nE: MINOR=17\nE: SUBSYSTEM=block\nE: SYSTEMD_ALIAS=/dev/block/8:17\nE: SYSTEMD_READY=1\nE: SYSTEMD_WANTS=lvm2-pvscan@8:17.service\nE: TAGS=:systemd:" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can use a struct to represent all test cases like
testCases := []struct { |
bb3d3d9
to
5b3f000
Compare
info := parseUdevInfo(testCase.UdevInfo) | ||
d := &Device{} | ||
d.ParseDiskAttribute(info) | ||
fmt.Printf("PartName: %v\n", d.PartName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this print log is unnecessry here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok,I remove it!
@hikariwo lgtm, can you rebase the commit and repush |
I try to clean it!
|
… the bug about device.PartName and PartitionInfo.Path not to be assigned a value Signed-off-by: lancerxiu <1377004871@qq.com> add udev_test file to test parsing the UdevInfo work properly and fix the bug about device.PartName and PartitionInfo.Path not to be assigned a value Signed-off-by: lancerxiu <1377004871@qq.com> combine two TestFunc into one TestFunc Signed-off-by: lancerxiu <1377004871@qq.com> modify test file Signed-off-by: lancerxiu <1377004871@qq.com> modify test file Signed-off-by: lancerxiu <1377004871@qq.com>
@SSmallMonster done, commit-tree has been cleaned! |
What this PR does / why we need it:
fix #1198
Special notes for your reviewer:
Does this PR introduce a user-facing change?