コード例 #1
0
ファイル: compute.py プロジェクト: openstack/fuel-octane
 def create_configdrive_partition(self):
     disks = disk.get_node_disks(self.node)
     if not disks:
         raise Exception("No disks info was found "
                         "for node {0}".format(self.node["id"]))
     # it was agreed that 10MB is enough for config drive partition
     size = 10
     disk.create_partition(disks[0]['name'], size, self.node)
コード例 #2
0
def test_create_partition(mocker, mock_ssh_call, mock_ssh_call_output, node,
                          size, last_part, end_part, disk):
    mock_part_end = mocker.patch("octane.util.disk.parse_last_partition_end")
    mock_part_end.return_value = last_part

    disk_util.create_partition(disk, size, node)
    mock_ssh_call_output.assert_called_once_with(
        ['parted', '/dev/%s' % disk, 'unit', 'MB', 'print'], node=node)
    mock_ssh_call.assert_called_once_with(
        ['parted', '/dev/%s' % disk, 'unit', 'MB', 'mkpart',
         'custom', 'ext4', str(last_part + 1), str(end_part)], node=node)