Example #1
0
def test_create_configdrive_partition(mocker, node, disk_attrs):
    name = 'disk1'
    node.mock_add_spec(['get_attribute'])
    node.data = {"id": "1"}
    node.get_attribute.return_value = disk_attrs
    mock_create_part = mocker.patch("octane.util.disk.create_partition")
    if disk_attrs:
        disk_util.create_configdrive_partition(node)
        mock_create_part.assert_called_once_with(
            name, magic_consts.CONFIGDRIVE_PART_SIZE, node)
    else:
        with pytest.raises(disk_util.NoDisksInfoError):
            disk_util.create_configdrive_partition(node)
Example #2
0
def move_nodes(env, nodes, provision=True, roles=None):
    env_id = env.data['id']
    cmd = ["move", "node"]
    if not provision:
        cmd += ['--no-provision']
    if roles:
        cmd += ['--roles', ','.join(roles)]
    cmd.append(str(env_id))
    for node in nodes:
        node_id = node.data['id']
        cmd.append(str(node_id))
        if provision and incompatible_provision_method(env):
            disk.create_configdrive_partition(node)
    fuel2_env_call(cmd)
    if provision:
        LOG.info("Nodes provision started. Please wait...")
        wait_for_nodes(nodes, "provisioned")