Exemplo n.º 1
0
 def _make_partitions(parteds):
     for parted in parteds:
         pu.make_label(parted.name, parted.label)
         for prt in parted.partitions:
             pu.make_partition(prt.device, prt.begin, prt.end, prt.type,
                               alignment=CONF.partition_alignment)
             utils.udevadm_trigger_blocks()
             for flag in prt.flags:
                 pu.set_partition_flag(prt.device, prt.count, flag)
             if prt.guid:
                 pu.set_gpt_type(prt.device, prt.count, prt.guid)
             # If any partition to be created doesn't exist it's an error.
             # Probably it's again 'device or resource busy' issue.
             if not os.path.exists(prt.name):
                 raise errors.PartitionNotFoundError(
                     'Partition %s not found after creation' % prt.name)
Exemplo n.º 2
0
 def test_udevadm_trigger_blocks(self, mock_wait, mock_exec):
     utils.udevadm_trigger_blocks()
     mock_exec.assert_called_once_with("udevadm", "trigger", "--subsystem-match=block")
     self.assertTrue(mock_wait.called)