コード例 #1
0
    def test_do_partitioning_with_keep_data_flag(self, mock_fu, mock_lbd,
                                                 mock_image_meta):
        mock_lbd.return_value = test_nailgun.LIST_BLOCK_DEVICES_SAMPLE
        data = copy.deepcopy(test_nailgun.PROVISION_SAMPLE_DATA)

        for disk in data['ks_meta']['pm_data']['ks_spaces']:
            for volume in disk['volumes']:
                if volume['type'] == 'pv' and volume['vg'] == 'image':
                    volume['keep_data'] = True

        self.drv = nailgun.Nailgun(data)
        self.action = partitioning.PartitioningAction(self.drv)
        self.action.execute()
        mock_fu_mf_expected_calls = [
            mock.call('ext2', '', '', '/dev/sda3'),
            mock.call('ext2', '', '', '/dev/sda4'),
            mock.call('swap', '', '', '/dev/mapper/os-swap')]
        self.assertEqual(mock_fu_mf_expected_calls,
                         mock_fu.make_fs.call_args_list)
コード例 #2
0
    def setup(self, policy, cmp_mock, keep_data_flag_present=False):
        cmp_mock().configure_mock(_mock_unsafe=True)
        cmp_mock().assert_no_diff.return_value = True
        self.driver = mock.Mock(
            partitions_policy=policy,
            partition_scheme=mock.Mock(
                **{
                    'to_dict.return_value': {
                        "test": 1
                    },
                    'skip_partitioning': keep_data_flag_present
                }),
            hw_partition_scheme=mock.Mock(
                **{'to_dict.return_value': {
                    "test": 2
                }}),
        )

        self.pp = generic.PolicyPartitioner(self.driver)
        self.pp.partitioning = partitioning.PartitioningAction(self.driver)
        self.pp.partitioning._do_clean_filesystems = mock.Mock()
        self.pp.partitioning._do_partitioning = mock.Mock()
        self.clean_fs_mock = self.pp.partitioning._do_clean_filesystems
        self.part_mock = self.pp.partitioning._do_partitioning
コード例 #3
0
 def setUp(self, mock_lbd, mock_image_meta):
     super(TestPartitioningAction, self).setUp()
     mock_lbd.return_value = test_nailgun.LIST_BLOCK_DEVICES_SAMPLE
     self.drv = nailgun.Nailgun(test_nailgun.PROVISION_SAMPLE_DATA)
     self.action = partitioning.PartitioningAction(self.drv)
コード例 #4
0
ファイル: generic.py プロジェクト: mmalchuk/openstack-bareon
 def __init__(self, driver):
     self.driver = driver
     self.partitioning = partitioning.PartitioningAction(self.driver)
コード例 #5
0
 def do_partitioning(self):
     partitioning.PartitioningAction(self.driver).execute()