bugfix: switches stucked in 'disabled' queue
authorAlexey Andriyanov <alan@al-an.info>
Tue, 21 Jan 2014 10:29:29 +0000 (14:29 +0400)
committerAlexey Andriyanov <alan@al-an.info>
Tue, 21 Jan 2014 10:32:15 +0000 (14:32 +0400)
one of the previous commits broke the queue transition logic in syncdomain.php
Once the switch entered the 'disabled' state, it had no chance to return back
into 'noerror'.

This change fixes the issue

scripts/syncdomain.php

index 3218e99886836ea032b19436159a78cfdea7fb9d..6fb5e7f63343e0e926ba376c803449e6adcbe274 100755 (executable)
@@ -104,11 +104,11 @@ foreach ($switch_list as $object_id)
        $cell = spotEntity ('object', $object_id);
        $new_disabled = ! considerConfiguredConstraint ($cell, 'SYNC_802Q_LISTSRC');
        $queue = detectVLANSwitchQueue (getVLANSwitchInfo ($object_id));
-       if ($queue != 'disabled' && $new_disabled)
+       if ($queue == 'disabled' xor $new_disabled)
                usePreparedExecuteBlade
                (
                        'UPDATE VLANSwitch SET out_of_sync="yes", last_error_ts=NOW(), last_errno=? WHERE object_id=?',
-                       array (E_8021Q_SYNC_DISABLED, $object_id)
+                       array ($new_disabled ? E_8021Q_SYNC_DISABLED : E_8021Q_NOERROR, $object_id)
                );
        elseif (in_array ($queue, $todo[$options['mode']]))
                $switch_queue[] = $cell;