View Issue Details

IDProjectCategoryView StatusLast Update
631RackTablesdefaultpublic2012-11-11 07:47
Reporterjames.tutton@redstone.com Assigned Toandriyanov  
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionno change required 
Summary631: Abbility to associate Attributes with Dictionary Values
DescriptionWe are currently going through an exercise of recording the maximum weight and heat output of all equipment in our data centres. As part of this there is quickly becoming a vast duplication of data. For example all HP DL380 G6's have a max weight of 27.22Kg. It would make much more sense to link the weight in this case to all "HP DL380 G6's" via hardware type and not the actual rack object itself.

Would this feature be useful to other community members?

If so do the lead developers have any guidance on a preferred implementation method. As am happy to submit a patch but various options are available. The most obvious being to move the dictionary to the object table, as another special case object like racks and rows are.
TagsNo tags attached.

Activities

infrastation

infrastation

2012-10-09 17:36

administrator   ~0000867

Nobody probably wants ~2000 objects right after RackTables is installed. The solution should be something else (I don't know which one is best right now).
andriyanov

andriyanov

2012-10-10 20:38

reporter   ~0000873

Should it work like "auto-calculated" read-only data fields in object's view?

Say, you configure "Weight" field to have the value of 22.27Kg for objects matching this filter: "{$typeid_8} and {$attr_2_105}", which means "object type is server and HW model is HP DL380".
james.tutton@redstone.com

james.tutton@redstone.com

2012-11-01 11:28

reporter   ~0000959

That would make a lot of sense. Does a read-only data field already exist?
andriyanov

andriyanov

2012-11-01 13:52

reporter   ~0000961

Last edited: 2012-11-01 13:53

This tiny plug-in does the trick: (put it in plugins/ dir)

<?php

registerHook ('modifyEntitySummary', 'getAutoAttr', 'chain');

$custom_attrs = array
(
    'Server weight' => array
    (
        '{$typeid_4} and {$attr_2_105}' => '22.27 Kg', // HP DL380
        '{$typeid_4}' => 'unknown', // other servers
    ),
);

function getAutoAttr ($summary, $cell, $dummy)
{
    global $custom_attrs;
    if ($cell['realm'] != 'object')
        return $summary;
    foreach ($custom_attrs as $name => $attr)
        foreach ($attr as $filter => $value)
            if (considerGivenConstraint ($cell, $filter))
                $summary[$name] = $value;
    return $summary;
}

?>

Issue History

Date Modified Username Field Change
2012-10-09 15:13 james.tutton@redstone.com New Issue
2012-10-09 17:36 infrastation Note Added: 0000867
2012-10-10 20:38 andriyanov Note Added: 0000873
2012-11-01 11:28 james.tutton@redstone.com Note Added: 0000959
2012-11-01 13:52 andriyanov Note Added: 0000961
2012-11-01 13:53 andriyanov Note Edited: 0000961
2012-11-01 16:02 infrastation Assigned To => andriyanov
2012-11-01 16:02 infrastation Status new => assigned
2012-11-11 07:47 andriyanov Status assigned => closed
2012-11-11 07:47 andriyanov Resolution open => no change required
2012-11-11 07:47 andriyanov Product Version 0.20.1 =>