'This method iterate via the affinity VM assignnments and datech the VMs
which should not be attached to affinity and attach VMs which should be
attached to affinity.'

def update_vms(self, affinity_group):

    assigned_vms = self.assigned_vms(affinity_group)
    to_remove = [vm for vm in assigned_vms if (vm not in self._vm_ids)]
    to_add = [vm for vm in self._vm_ids if (vm not in assigned_vms)]
    ag_service = self._service.group_service(affinity_group.id)
    for vm in to_remove:
        ag_service.vms_service().vm_service(vm).remove()
    for vm in to_add:
        try:
            ag_service.vms_service().add(otypes.Vm(id=vm))
        except ValueError as ex:
            if ('complete' not in str(ex)):
                raise ex
