-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix label fatboot #513
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
Merged
Merged
Fix label fatboot #513
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
17d0358
Fixing the problem of the new name LABEL_FATBOOT in new SO, like Bust…
568d243
cla-signers
marlluslustosa 1926510
removing inadequate code space
marlluslustosa e4ac5ff
removing inadequate code space - ds-identify
marlluslustosa cf01c6a
Update ds-identify
marlluslustosa 71ecefb
Fix find_devs_with_freebsd and add tests
TheRealFalcon ab88b49
Merge branch 'master' into fix-label_fatboot
OddBloke File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -967,96 +967,125 @@ def test_get_proc_ppid(self): | |
| self.assertEqual(my_ppid, util.get_proc_ppid(my_pid)) | ||
|
|
||
|
|
||
| @mock.patch('cloudinit.subp.subp') | ||
| def test_find_devs_with_openbsd(m_subp): | ||
| m_subp.return_value = ( | ||
| 'cd0:,sd0:630d98d32b5d3759,sd1:,fd0:', '' | ||
| ) | ||
| devlist = util.find_devs_with_openbsd() | ||
| assert devlist == ['/dev/cd0a', '/dev/sd1i'] | ||
|
|
||
|
|
||
| @mock.patch('cloudinit.subp.subp') | ||
| def test_find_devs_with_openbsd_with_criteria(m_subp): | ||
| m_subp.return_value = ( | ||
| 'cd0:,sd0:630d98d32b5d3759,sd1:,fd0:', '' | ||
| ) | ||
| devlist = util.find_devs_with_openbsd(criteria="TYPE=iso9660") | ||
| assert devlist == ['/dev/cd0a'] | ||
|
|
||
|
|
||
| @mock.patch('glob.glob') | ||
| def test_find_devs_with_freebsd(m_glob): | ||
| def fake_glob(pattern): | ||
| msdos = ["/dev/msdosfs/EFISYS"] | ||
| iso9660 = ["/dev/iso9660/config-2"] | ||
| if pattern == "/dev/msdosfs/*": | ||
| return msdos | ||
| elif pattern == "/dev/iso9660/*": | ||
| return iso9660 | ||
| raise Exception | ||
| m_glob.side_effect = fake_glob | ||
|
|
||
| devlist = util.find_devs_with_freebsd() | ||
| assert set(devlist) == set([ | ||
| '/dev/iso9660/config-2', '/dev/msdosfs/EFISYS']) | ||
| devlist = util.find_devs_with_freebsd(criteria="TYPE=iso9660") | ||
| assert devlist == ['/dev/iso9660/config-2'] | ||
| devlist = util.find_devs_with_freebsd(criteria="TYPE=vfat") | ||
| assert devlist == ['/dev/msdosfs/EFISYS'] | ||
|
|
||
|
|
||
| @mock.patch("cloudinit.subp.subp") | ||
| def test_find_devs_with_netbsd(m_subp): | ||
| side_effect_values = [ | ||
| ("ld0 dk0 dk1 cd0", ""), | ||
| ( | ||
| class TestFindDevs: | ||
| @mock.patch('cloudinit.subp.subp') | ||
| def test_find_devs_with(self, m_subp): | ||
| m_subp.return_value = ( | ||
| '/dev/sda1: UUID="some-uuid" TYPE="ext4" PARTUUID="some-partid"', | ||
| '' | ||
| ) | ||
| devlist = util.find_devs_with() | ||
| assert devlist == [ | ||
| '/dev/sda1: UUID="some-uuid" TYPE="ext4" PARTUUID="some-partid"'] | ||
|
|
||
| devlist = util.find_devs_with("LABEL_FATBOOT=A_LABEL") | ||
| assert devlist == [ | ||
| '/dev/sda1: UUID="some-uuid" TYPE="ext4" PARTUUID="some-partid"'] | ||
|
|
||
| @mock.patch('cloudinit.subp.subp') | ||
| def test_find_devs_with_openbsd(self, m_subp): | ||
| m_subp.return_value = ( | ||
| 'cd0:,sd0:630d98d32b5d3759,sd1:,fd0:', '' | ||
| ) | ||
| devlist = util.find_devs_with_openbsd() | ||
| assert devlist == ['/dev/cd0a', '/dev/sd1i'] | ||
|
|
||
| @mock.patch('cloudinit.subp.subp') | ||
| def test_find_devs_with_openbsd_with_criteria(self, m_subp): | ||
| m_subp.return_value = ( | ||
| 'cd0:,sd0:630d98d32b5d3759,sd1:,fd0:', '' | ||
| ) | ||
| devlist = util.find_devs_with_openbsd(criteria="TYPE=iso9660") | ||
| assert devlist == ['/dev/cd0a'] | ||
|
|
||
| # lp: #1841466 | ||
| devlist = util.find_devs_with_openbsd(criteria="LABEL_FATBOOT=A_LABEL") | ||
| assert devlist == ['/dev/cd0a', '/dev/sd1i'] | ||
|
|
||
| @mock.patch('glob.glob') | ||
| def test_find_devs_with_freebsd(self, m_glob): | ||
| def fake_glob(pattern): | ||
| msdos = ["/dev/msdosfs/EFISYS"] | ||
| iso9660 = ["/dev/iso9660/config-2"] | ||
| if pattern == "/dev/msdosfs/*": | ||
| return msdos | ||
| elif pattern == "/dev/iso9660/*": | ||
| return iso9660 | ||
| raise Exception | ||
| m_glob.side_effect = fake_glob | ||
|
|
||
| devlist = util.find_devs_with_freebsd() | ||
| assert set(devlist) == set([ | ||
| '/dev/iso9660/config-2', '/dev/msdosfs/EFISYS']) | ||
|
|
||
| devlist = util.find_devs_with_freebsd(criteria="TYPE=iso9660") | ||
| assert devlist == ['/dev/iso9660/config-2'] | ||
|
|
||
| devlist = util.find_devs_with_freebsd(criteria="TYPE=vfat") | ||
| assert devlist == ['/dev/msdosfs/EFISYS'] | ||
|
|
||
| # lp: #1841466 | ||
| devlist = util.find_devs_with_freebsd(criteria="LABEL_FATBOOT=A_LABEL") | ||
| assert devlist == [] | ||
|
Comment on lines
+1017
to
+1029
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It'd be nice to see these tests parameterised. |
||
|
|
||
| @mock.patch("cloudinit.subp.subp") | ||
| def test_find_devs_with_netbsd(self, m_subp): | ||
| side_effect_values = [ | ||
| ("ld0 dk0 dk1 cd0", ""), | ||
| ( | ||
| "mscdlabel: CDIOREADTOCHEADER: " | ||
| "Inappropriate ioctl for device\n" | ||
| "track (ctl=4) at sector 0\n" | ||
| "disklabel not written\n" | ||
| ( | ||
| "mscdlabel: CDIOREADTOCHEADER: " | ||
| "Inappropriate ioctl for device\n" | ||
| "track (ctl=4) at sector 0\n" | ||
| "disklabel not written\n" | ||
| ), | ||
| "", | ||
| ), | ||
| "", | ||
| ), | ||
| ( | ||
| ( | ||
| "mscdlabel: CDIOREADTOCHEADER: " | ||
| "Inappropriate ioctl for device\n" | ||
| "track (ctl=4) at sector 0\n" | ||
| "disklabel not written\n" | ||
| ( | ||
| "mscdlabel: CDIOREADTOCHEADER: " | ||
| "Inappropriate ioctl for device\n" | ||
| "track (ctl=4) at sector 0\n" | ||
| "disklabel not written\n" | ||
| ), | ||
| "", | ||
| ), | ||
| "", | ||
| ), | ||
| ( | ||
| ( | ||
| "mscdlabel: CDIOREADTOCHEADER: " | ||
| "Inappropriate ioctl for device\n" | ||
| "track (ctl=4) at sector 0\n" | ||
| "disklabel not written\n" | ||
| ( | ||
| "mscdlabel: CDIOREADTOCHEADER: " | ||
| "Inappropriate ioctl for device\n" | ||
| "track (ctl=4) at sector 0\n" | ||
| "disklabel not written\n" | ||
| ), | ||
| "", | ||
| ), | ||
| "", | ||
| ), | ||
| ( | ||
| ( | ||
| "track (ctl=4) at sector 0\n" | ||
| 'ISO filesystem, label "config-2", ' | ||
| "creation time: 2020/03/31 17:29\n" | ||
| "adding as 'a'\n" | ||
| ( | ||
| "track (ctl=4) at sector 0\n" | ||
| 'ISO filesystem, label "config-2", ' | ||
| "creation time: 2020/03/31 17:29\n" | ||
| "adding as 'a'\n" | ||
| ), | ||
| "", | ||
| ), | ||
| "", | ||
| ), | ||
| ] | ||
| m_subp.side_effect = side_effect_values | ||
| devlist = util.find_devs_with_netbsd() | ||
| assert set(devlist) == set( | ||
| ["/dev/ld0", "/dev/dk0", "/dev/dk1", "/dev/cd0"] | ||
| ) | ||
| m_subp.side_effect = side_effect_values | ||
| devlist = util.find_devs_with_netbsd(criteria="TYPE=iso9660") | ||
| assert devlist == ["/dev/cd0"] | ||
| m_subp.side_effect = side_effect_values | ||
| devlist = util.find_devs_with_netbsd(criteria="TYPE=vfat") | ||
| assert devlist == ["/dev/ld0", "/dev/dk0", "/dev/dk1"] | ||
| ] | ||
| m_subp.side_effect = side_effect_values | ||
| devlist = util.find_devs_with_netbsd() | ||
| assert set(devlist) == set( | ||
| ["/dev/ld0", "/dev/dk0", "/dev/dk1", "/dev/cd0"] | ||
| ) | ||
|
|
||
| m_subp.side_effect = side_effect_values | ||
| devlist = util.find_devs_with_netbsd(criteria="TYPE=iso9660") | ||
| assert devlist == ["/dev/cd0"] | ||
|
|
||
| m_subp.side_effect = side_effect_values | ||
| devlist = util.find_devs_with_netbsd(criteria="TYPE=vfat") | ||
| assert devlist == ["/dev/ld0", "/dev/dk0", "/dev/dk1"] | ||
|
|
||
| # lp: #1841466 | ||
| m_subp.side_effect = side_effect_values | ||
| devlist = util.find_devs_with_netbsd(criteria="LABEL_FATBOOT=A_LABEL") | ||
| assert devlist == ['/dev/ld0', '/dev/dk0', '/dev/dk1', '/dev/cd0'] | ||
|
Comment on lines
+1073
to
+1089
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These too. |
||
|
|
||
| # vi: ts=4 expandtab | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,7 @@ dhensby | |
| eandersson | ||
| landon912 | ||
| lucasmoura | ||
| marlluslustosa | ||
| matthewruffell | ||
| nishigori | ||
| onitake | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
has anyone tried booting a freebsd image under these conditions to see what the result looks like, and what we could be looking for?
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.
@igalic Was that one of the BSD people you pinged on the last ticket? Should I ping them here too? If we make an effort to reach out but they're unavailable, do you think the unit test changes are sufficient?
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.
We have roughly 3 *BSD people currently active:
of those, @goneri is the most experienced when it comes to NoCloud
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.
Aloha,
Thank you @TheRealFalcon and @igalic, I will give a try to the patch.