'Set the vnc configuration of the VM.'

@utils.synchronized('vmware.get_and_set_vnc_port')
def _get_and_set_vnc_config(self, client_factory, instance, vm_ref):

    port = vm_util.get_vnc_port(self._session)
    vnc_config_spec = vm_util.get_vnc_config_spec(client_factory, port)
    LOG.debug('Reconfiguring    VM    instance    to    enable    vnc    on    port    -    %(port)s', {'port': port}, instance=instance)
    vm_util.reconfigure_vm(self._session, vm_ref, vnc_config_spec)
    LOG.debug('Reconfigured    VM    instance    to    enable    vnc    on    port    -    %(port)s', {'port': port}, instance=instance)
