xcat2 / xcat-inventory

An inventory tool for xcat cluster
8 stars 16 forks source link

Request support for exporting/importing xCAT groups #54

Open whowutwut opened 6 years ago

whowutwut commented 6 years ago

It seems like this function is missing. We do have some differences between groups that display via lsdef and groups that show on nodegroup dump... seems like grouptype=static is required..

[root@boston01 ~]# tabdump nodegroup
#groupname,grouptype,members,membergroups,wherevals,comments,disable
"mid_switch","static",,,,,
"cn_regex_p8le","static",,,,,
"edge_switch","static",,,,,
[root@boston01 ~]# lsdef -t group
all  (group)
boston  (group)
cn_regex_p8le  (group)
edge_switch  (group)
firestone  (group)
garrison  (group)
mid_switch  (group)
p8le  (group)
switch  (group)

But exporting does not work...

[root@boston01 ~]# xcat-inventory export -t group
Error: Invalid object type: "group"
[root@boston01 ~]# xcat-inventory export -t nodegroup
Error: Invalid object type: "nodegroup"
[root@boston01 ~]#
immarvin commented 6 years ago

hi, @whowutwut , currently, the node and group in def commands are all node in xcat-inventory since most of the attributes of them are the same, there are differentiated by the "obj_type": "group", in the xcat-inventory exported inventory file.

[root@c910f03c05k21 xcat_clusters]# xcat-inventory export -t node -o service
{
    "node": {
        "service": {
            "device_type": "server",
            "engines": {
                "netboot_engine": {
                    "engine_info": {
                        "postscripts": "servicenode"
                    }
                }
            },
            "obj_type": "group",
            "role": "compute"
        }
    },
    "schema_version": "1.0"
}
#Version 2.14.1 (git commit 2f87973517231a694fe813f75338ab47da0a9575, built Mon May 28 04:29:58 EDT 2018)
[root@c910f03c05k21 xcat_clusters]# xcat-inventory export -t node -o sn01
{
    "node": {
        "sn01": {
            "device_info": {
                "arch": "ppc64le",
                "characteristics": "mp",
                "cpucount": "128",
                "cputype": "POWER8NVL (raw), altivec supported",
                "disksize": "sda:1000GB,sdb:1000GB",
                "memory": "130686MB",
                "mtm": "8335-GTB",
                "serial": "100470A",
                "supportedarchs": "ppc64",
                "uuid": "8335-gtb-100470a-70e2841409f6"
            },
            "device_type": "server",
            "engines": {
                "netboot_engine": {
                    "engine_info": {
                        "chain": "runcmd=bmcsetup,osimage=rhels7.4-snap2-ppc64le-netboot-service-mlnx",
                        "osimage": "rhels7.4-snap2-ppc64le-netboot-service-mlnx"
                    },
                    "engine_type": "petitboot"
                }
            },
            "network_info": {
                "primarynic": {
                    "ip": "172.10.254.1",
                    "mac": [
                        "70:e2:84:14:09:f6!*NOIP*",
                        "98:be:94:67:60:40!*NOIP*",
                        "70:e2:84:14:09:f7"
                    ],
                    "switch": "mgmtsw01",
                    "switchport": "3"
                }
            },
            "obj_info": {
                "groups": "all,coral_sn_regex,service"
            },
            "obj_type": "node",
            "role": "compute"
        }
    },
    "schema_version": "1.0"
}
#Version 2.14.1 (git commit 2f87973517231a694fe813f75338ab47da0a9575, built Mon May 28 04:29:58 EDT 2018)

will take a look how to separate them with different type in xcat-inventory -t

whowutwut commented 6 years ago

@immarvin Thank for that... interesting..

I'm trying to figure out how one would be able to add/remove machines from the group easily by modifying the files in the source control.. If we had static groups, would we be able to just add nodes to it? Or we would have to create these obj_info for each node object and add them into the group?

This is not a requirement but I'm just trying to see how we could easily manage a cluster directly from source control instead of xCAT commands.