Merge pull request #1808 from ogayot/early-v2-orig-config
filesystem: don't crash if v2/orig_config is called early
This commit is contained in:
commit
f951146d6a
|
@ -1435,7 +1435,8 @@ class FilesystemModel:
|
||||||
# use on the V2 storage API.
|
# use on the V2 storage API.
|
||||||
orig_model = FilesystemModel(self.bootloader, root=self.root)
|
orig_model = FilesystemModel(self.bootloader, root=self.root)
|
||||||
orig_model.target = self.target
|
orig_model.target = self.target
|
||||||
orig_model.load_probe_data(self._probe_data)
|
if self._probe_data is not None:
|
||||||
|
orig_model.load_probe_data(self._probe_data)
|
||||||
return orig_model
|
return orig_model
|
||||||
|
|
||||||
def process_probe_data(self):
|
def process_probe_data(self):
|
||||||
|
|
|
@ -328,6 +328,15 @@ class TestFilesystemModel(unittest.TestCase):
|
||||||
self.assertFalse(lv.ok_for_raid)
|
self.assertFalse(lv.ok_for_raid)
|
||||||
self.assertFalse(lv.ok_for_lvm_vg)
|
self.assertFalse(lv.ok_for_lvm_vg)
|
||||||
|
|
||||||
|
def test_get_orig_model_no_probe_data(self):
|
||||||
|
# When v2/get_orig_data gets called early, model._probe_data is still
|
||||||
|
# None. Ensure get_orig_model() does not fail.
|
||||||
|
model = make_model()
|
||||||
|
|
||||||
|
model._probe_data = None
|
||||||
|
orig_model = model.get_orig_model()
|
||||||
|
self.assertIsNone(orig_model._probe_data)
|
||||||
|
|
||||||
|
|
||||||
def fake_up_blockdata_disk(disk, **kw):
|
def fake_up_blockdata_disk(disk, **kw):
|
||||||
model = disk._m
|
model = disk._m
|
||||||
|
|
Loading…
Reference in New Issue