def reconfigure_vm(session, vm_ref, config_spec):
    """Reconfigure a VM according to the config spec."""
    reconfig_task = session._call_method(session.vim, 'ReconfigVM_Task',
        vm_ref, spec=config_spec)
    session._wait_for_task(reconfig_task)
