Пример #1
0
 function printNewItemTR()
 {
     $all_vswitches = getVLANSwitches();
     global $pageno;
     $hintcodes = array('prev_vdid' => 'DEFAULT_VDOM_ID', 'prev_vstid' => 'DEFAULT_VST_ID', 'prev_objid' => NULL);
     $focus = array();
     foreach ($hintcodes as $hint_code => $option_name) {
         if (array_key_exists($hint_code, $_REQUEST)) {
             assertUIntArg($hint_code);
             $focus[$hint_code] = $_REQUEST[$hint_code];
         } elseif ($option_name != NULL) {
             $focus[$hint_code] = getConfigVar($option_name);
         } else {
             $focus[$hint_code] = NULL;
         }
     }
     printOpFormIntro('add');
     echo '<tr>';
     if ($pageno != 'object') {
         echo '<td>';
         // hide any object that is already in the table
         $options = array();
         foreach (getNarrowObjectList('VLANSWITCH_LISTSRC') as $object_id => $object_dname) {
             if (!in_array($object_id, $all_vswitches)) {
                 $ctx = getContext();
                 spreadContext(spotEntity('object', $object_id));
                 $decision = permitted(NULL, NULL, 'del');
                 restoreContext($ctx);
                 if ($decision) {
                     $options[$object_id] = $object_dname;
                 }
             }
         }
         printSelect($options, array('name' => 'object_id', 'tabindex' => 101, 'size' => getConfigVar('MAXSELSIZE')), $focus['prev_objid']);
         echo '</td>';
     }
     if ($pageno != 'vlandomain') {
         echo '<td>' . getSelect(getVLANDomainOptions(), array('name' => 'vdom_id', 'tabindex' => 102, 'size' => getConfigVar('MAXSELSIZE')), $focus['prev_vdid']) . '</td>';
     }
     if ($pageno != 'vst') {
         $options = array();
         foreach (listCells('vst') as $nominee) {
             $ctx = getContext();
             spreadContext($nominee);
             $decision = permitted(NULL, NULL, 'add');
             restoreContext($ctx);
             if ($decision) {
                 $options[$nominee['id']] = niftyString($nominee['description'], 30, FALSE);
             }
         }
         echo '<td>' . getSelect($options, array('name' => 'vst_id', 'tabindex' => 103, 'size' => getConfigVar('MAXSELSIZE')), $focus['prev_vstid']) . '</td>';
     }
     echo '<td>' . getImageHREF('Attach', 'set', TRUE, 104) . '</td></tr></form>';
 }
Пример #2
0
        $do_push = FALSE;
        break;
    case 'pull':
        $do_push = FALSE;
        break;
    case 'push':
        $do_push = TRUE;
        break;
    default:
        usage();
}
$max = array_fetch($options, 'max', 0);
$nolock = array_key_exists('nolock', $options);
$switch_list = array();
if (!isset($options['vdid'])) {
    $switch_list = getVLANSwitches();
} else {
    try {
        $mydomain = getVLANDomain($options['vdid']);
        foreach ($mydomain['switchlist'] as $switch) {
            $switch_list[] = $switch['object_id'];
        }
    } catch (RackTablesError $e) {
        print_message_line("Cannot load domain data with ID {$options['vdid']}");
        print_message_line($e->getMessage());
        exit(1);
    }
}
$todo = array('pull' => array('sync_ready', 'resync_ready'), 'push' => array('sync_ready', 'resync_ready'), 'pullall' => array('sync_ready', 'resync_ready', 'sync_aging', 'resync_aging', 'done'));
if (!$nolock) {
    $domain_key = isset($options['vdid']) ? $options['vdid'] : 0;
Пример #3
0
function get8021QDeployQueues()
{
    global $dqtitle;
    $ret = array();
    foreach (array_keys($dqtitle) as $qcode) {
        if ($qcode != 'disabled') {
            $ret[$qcode] = array('enabled' => array(), 'disabled' => array());
        }
    }
    foreach (getVLANSwitches() as $object_id) {
        $vswitch = getVLANSwitchInfo($object_id);
        if ('' != ($qcode = detectVLANSwitchQueue($vswitch))) {
            $cell = spotEntity('object', $vswitch['object_id']);
            $enabled_key = considerConfiguredConstraint($cell, 'SYNC_802Q_LISTSRC') ? 'enabled' : 'disabled';
            $ret[$qcode][$enabled_key][] = $vswitch;
        }
    }
    return $ret;
}