From 6a5b8b3bbc7ff73225b5508cd7ba95ce940750cb Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Thu, 9 Mar 2017 17:26:35 -0500 Subject: [PATCH] Handle bad return code from pdu commands --- .../admin-guides/references/man5/passwd.5.rst | 4 +- .../admin-guides/references/man5/pdu.5.rst | 28 ++++-- .../admin-guides/references/man5/xcatdb.5.rst | 4 + .../admin-guides/references/man7/group.7.rst | 10 ++- .../admin-guides/references/man7/node.7.rst | 10 ++- .../admin-guides/references/man7/pdu.7.rst | 85 +++++++++++++++++++ perl-xCAT/xCAT/Schema.pm | 26 +++--- xCAT-server/lib/xcat/plugins/pdu.pm | 61 ++++++++++--- 8 files changed, 189 insertions(+), 39 deletions(-) create mode 100644 docs/source/guides/admin-guides/references/man7/pdu.7.rst diff --git a/docs/source/guides/admin-guides/references/man5/passwd.5.rst b/docs/source/guides/admin-guides/references/man5/passwd.5.rst index 4123a9258..3438aa4b6 100644 --- a/docs/source/guides/admin-guides/references/man5/passwd.5.rst +++ b/docs/source/guides/admin-guides/references/man5/passwd.5.rst @@ -50,13 +50,13 @@ passwd Attributes: \ **password**\ - The default password for this type of component. On Linux, a crypted form could be provided. Hashes starting with $1$, $5$ and $6$ (md5, sha256 and sha512 respectively) are supported. + The default password for this type of component \ **cryptmethod**\ - Indicates the method to use to encrypt the password attribute. On AIX systems, if a value is provided for this attribute it indicates that the password attribute is encrypted. If the cryptmethod value is not set it indicates the password is a simple string value. On Linux systems, the cryptmethod can be set to md5, sha256 or sha512. If not set, sha256 will be used as default to encrypt plain-text passwords. + Indicates the method that was used to encrypt the password attribute. On AIX systems, if a value is provided for this attribute it indicates that the password attribute is encrypted. If the cryptmethod value is not set it indicates the password is a simple string value. On Linux systems, the cryptmethod can be set to md5, sha256 or sha512. If not set, sha256 will be used as default. diff --git a/docs/source/guides/admin-guides/references/man5/pdu.5.rst b/docs/source/guides/admin-guides/references/man5/pdu.5.rst index a77ea0b32..5d5076cfb 100644 --- a/docs/source/guides/admin-guides/references/man5/pdu.5.rst +++ b/docs/source/guides/admin-guides/references/man5/pdu.5.rst @@ -19,7 +19,7 @@ SYNOPSIS ******** -\ **pdu Attributes:**\ \ *pdu*\ , \ *machinetype*\ , \ *modelnum*\ , \ *serialnum*\ , \ *outletCount*\ , \ *comments*\ , \ *disable*\ +\ **pdu Attributes:**\ \ *node*\ , \ *nodetype*\ , \ *outlet*\ , \ *machinetype*\ , \ *modelnum*\ , \ *serialnum*\ , \ *comments*\ , \ *disable*\ *********** @@ -36,12 +36,24 @@ pdu Attributes: -\ **pdu**\ +\ **node**\ The hostname/address of the pdu to which the settings apply +\ **nodetype**\ + + The node type should be pdu + + + +\ **outlet**\ + + The pdu outlet count + + + \ **machinetype**\ The pdu machine type @@ -60,16 +72,16 @@ pdu Attributes: -\ **outletCount**\ - - - \ **comments**\ - + + Any user-written notes. + \ **disable**\ - + + Set to 'yes' or '1' to comment out this row. + diff --git a/docs/source/guides/admin-guides/references/man5/xcatdb.5.rst b/docs/source/guides/admin-guides/references/man5/xcatdb.5.rst index e95ece5c8..4f8be2d93 100644 --- a/docs/source/guides/admin-guides/references/man5/xcatdb.5.rst +++ b/docs/source/guides/admin-guides/references/man5/xcatdb.5.rst @@ -288,6 +288,10 @@ osimage(7)|osimage.7 +pdu(7)|pdu.7 + + + policy(7)|policy.7 diff --git a/docs/source/guides/admin-guides/references/man7/group.7.rst b/docs/source/guides/admin-guides/references/man7/group.7.rst index 4a9954df5..7e42304f6 100644 --- a/docs/source/guides/admin-guides/references/man7/group.7.rst +++ b/docs/source/guides/admin-guides/references/man7/group.7.rst @@ -19,7 +19,7 @@ SYNOPSIS ******** -\ **group Attributes:**\ \ *addkcmdline*\ , \ *arch*\ , \ *authdomain*\ , \ *bmc*\ , \ *bmcpassword*\ , \ *bmcport*\ , \ *bmcusername*\ , \ *bmcvlantag*\ , \ *cfgmgr*\ , \ *cfgmgtroles*\ , \ *cfgserver*\ , \ *chain*\ , \ *chassis*\ , \ *cmdmapping*\ , \ *cons*\ , \ *conserver*\ , \ *consoleondemand*\ , \ *cpucount*\ , \ *cputype*\ , \ *currchain*\ , \ *currstate*\ , \ *dhcpinterfaces*\ , \ *disksize*\ , \ *displayname*\ , \ *dockercpus*\ , \ *dockerflag*\ , \ *dockerhost*\ , \ *dockermemory*\ , \ *dockernics*\ , \ *domainadminpassword*\ , \ *domainadminuser*\ , \ *domaintype*\ , \ *getmac*\ , \ *groupname*\ , \ *grouptype*\ , \ *hcp*\ , \ *height*\ , \ *hostcluster*\ , \ *hostinterface*\ , \ *hostmanager*\ , \ *hostnames*\ , \ *hosttype*\ , \ *hwtype*\ , \ *id*\ , \ *initrd*\ , \ *installnic*\ , \ *interface*\ , \ *ip*\ , \ *iscsipassword*\ , \ *iscsiserver*\ , \ *iscsitarget*\ , \ *iscsiuserid*\ , \ *kcmdline*\ , \ *kernel*\ , \ *linkports*\ , \ *mac*\ , \ *machinetype*\ , \ *membergroups*\ , \ *members*\ , \ *memory*\ , \ *mgt*\ , \ *micbridge*\ , \ *michost*\ , \ *micid*\ , \ *miconboot*\ , \ *micpowermgt*\ , \ *micvlog*\ , \ *migrationdest*\ , \ *modelnum*\ , \ *monserver*\ , \ *mpa*\ , \ *mtm*\ , \ *nameservers*\ , \ *netboot*\ , \ *nfsdir*\ , \ *nfsserver*\ , \ *nicaliases*\ , \ *niccustomscripts*\ , \ *nicdevices*\ , \ *nicextraparams*\ , \ *nichostnameprefixes*\ , \ *nichostnamesuffixes*\ , \ *nicips*\ , \ *nicnetworks*\ , \ *nicsadapter*\ , \ *nictypes*\ , \ *nimserver*\ , \ *nodetype*\ , \ *ondiscover*\ , \ *os*\ , \ *osvolume*\ , \ *otherinterfaces*\ , \ *ou*\ , \ *outletcount*\ , \ *parent*\ , \ *passwd.HMC*\ , \ *passwd.admin*\ , \ *passwd.celogin*\ , \ *passwd.general*\ , \ *passwd.hscroot*\ , \ *password*\ , \ *pdu*\ , \ *postbootscripts*\ , \ *postscripts*\ , \ *power*\ , \ *pprofile*\ , \ *prescripts-begin*\ , \ *prescripts-end*\ , \ *primarynic*\ , \ *productkey*\ , \ *profile*\ , \ *protocol*\ , \ *provmethod*\ , \ *rack*\ , \ *room*\ , \ *routenames*\ , \ *serial*\ , \ *serialflow*\ , \ *serialnum*\ , \ *serialport*\ , \ *serialspeed*\ , \ *servicenode*\ , \ *setupconserver*\ , \ *setupdhcp*\ , \ *setupftp*\ , \ *setupipforward*\ , \ *setupldap*\ , \ *setupnameserver*\ , \ *setupnfs*\ , \ *setupnim*\ , \ *setupntp*\ , \ *setupproxydhcp*\ , \ *setuptftp*\ , \ *sfp*\ , \ *side*\ , \ *slot*\ , \ *slotid*\ , \ *slots*\ , \ *snmpauth*\ , \ *snmppassword*\ , \ *snmpprivacy*\ , \ *snmpusername*\ , \ *snmpversion*\ , \ *storagcontroller*\ , \ *storagetype*\ , \ *supernode*\ , \ *supportedarchs*\ , \ *supportproxydhcp*\ , \ *switch*\ , \ *switchinterface*\ , \ *switchport*\ , \ *switchtype*\ , \ *switchvlan*\ , \ *syslog*\ , \ *termport*\ , \ *termserver*\ , \ *tftpdir*\ , \ *tftpserver*\ , \ *unit*\ , \ *urlpath*\ , \ *usercomment*\ , \ *userid*\ , \ *username*\ , \ *vmbeacon*\ , \ *vmbootorder*\ , \ *vmcfgstore*\ , \ *vmcluster*\ , \ *vmcpus*\ , \ *vmhost*\ , \ *vmmanager*\ , \ *vmmaster*\ , \ *vmmemory*\ , \ *vmnicnicmodel*\ , \ *vmnics*\ , \ *vmothersetting*\ , \ *vmphyslots*\ , \ *vmstorage*\ , \ *vmstoragecache*\ , \ *vmstorageformat*\ , \ *vmstoragemodel*\ , \ *vmtextconsole*\ , \ *vmvirtflags*\ , \ *vmvncport*\ , \ *webport*\ , \ *wherevals*\ , \ *xcatmaster*\ +\ **group Attributes:**\ \ *addkcmdline*\ , \ *arch*\ , \ *authdomain*\ , \ *bmc*\ , \ *bmcpassword*\ , \ *bmcport*\ , \ *bmcusername*\ , \ *bmcvlantag*\ , \ *cfgmgr*\ , \ *cfgmgtroles*\ , \ *cfgserver*\ , \ *chain*\ , \ *chassis*\ , \ *cmdmapping*\ , \ *cons*\ , \ *conserver*\ , \ *consoleondemand*\ , \ *cpucount*\ , \ *cputype*\ , \ *currchain*\ , \ *currstate*\ , \ *dhcpinterfaces*\ , \ *disksize*\ , \ *displayname*\ , \ *dockercpus*\ , \ *dockerflag*\ , \ *dockerhost*\ , \ *dockermemory*\ , \ *dockernics*\ , \ *domainadminpassword*\ , \ *domainadminuser*\ , \ *domaintype*\ , \ *getmac*\ , \ *groupname*\ , \ *grouptype*\ , \ *hcp*\ , \ *height*\ , \ *hostcluster*\ , \ *hostinterface*\ , \ *hostmanager*\ , \ *hostnames*\ , \ *hosttype*\ , \ *hwtype*\ , \ *id*\ , \ *initrd*\ , \ *installnic*\ , \ *interface*\ , \ *ip*\ , \ *iscsipassword*\ , \ *iscsiserver*\ , \ *iscsitarget*\ , \ *iscsiuserid*\ , \ *kcmdline*\ , \ *kernel*\ , \ *linkports*\ , \ *mac*\ , \ *machinetype*\ , \ *membergroups*\ , \ *members*\ , \ *memory*\ , \ *mgt*\ , \ *micbridge*\ , \ *michost*\ , \ *micid*\ , \ *miconboot*\ , \ *micpowermgt*\ , \ *micvlog*\ , \ *migrationdest*\ , \ *modelnum*\ , \ *monserver*\ , \ *mpa*\ , \ *mtm*\ , \ *nameservers*\ , \ *netboot*\ , \ *nfsdir*\ , \ *nfsserver*\ , \ *nicaliases*\ , \ *niccustomscripts*\ , \ *nicdevices*\ , \ *nicextraparams*\ , \ *nichostnameprefixes*\ , \ *nichostnamesuffixes*\ , \ *nicips*\ , \ *nicnetworks*\ , \ *nicsadapter*\ , \ *nictypes*\ , \ *nimserver*\ , \ *nodetype*\ , \ *ondiscover*\ , \ *os*\ , \ *osvolume*\ , \ *otherinterfaces*\ , \ *ou*\ , \ *outlet*\ , \ *parent*\ , \ *passwd.HMC*\ , \ *passwd.admin*\ , \ *passwd.celogin*\ , \ *passwd.general*\ , \ *passwd.hscroot*\ , \ *password*\ , \ *pdu*\ , \ *postbootscripts*\ , \ *postscripts*\ , \ *power*\ , \ *pprofile*\ , \ *prescripts-begin*\ , \ *prescripts-end*\ , \ *primarynic*\ , \ *productkey*\ , \ *profile*\ , \ *protocol*\ , \ *provmethod*\ , \ *rack*\ , \ *room*\ , \ *routenames*\ , \ *serial*\ , \ *serialflow*\ , \ *serialnum*\ , \ *serialport*\ , \ *serialspeed*\ , \ *servicenode*\ , \ *setupconserver*\ , \ *setupdhcp*\ , \ *setupftp*\ , \ *setupipforward*\ , \ *setupldap*\ , \ *setupnameserver*\ , \ *setupnfs*\ , \ *setupnim*\ , \ *setupntp*\ , \ *setupproxydhcp*\ , \ *setuptftp*\ , \ *sfp*\ , \ *side*\ , \ *slot*\ , \ *slotid*\ , \ *slots*\ , \ *snmpauth*\ , \ *snmppassword*\ , \ *snmpprivacy*\ , \ *snmpusername*\ , \ *snmpversion*\ , \ *storagcontroller*\ , \ *storagetype*\ , \ *supernode*\ , \ *supportedarchs*\ , \ *supportproxydhcp*\ , \ *switch*\ , \ *switchinterface*\ , \ *switchport*\ , \ *switchtype*\ , \ *switchvlan*\ , \ *syslog*\ , \ *termport*\ , \ *termserver*\ , \ *tftpdir*\ , \ *tftpserver*\ , \ *unit*\ , \ *urlpath*\ , \ *usercomment*\ , \ *userid*\ , \ *username*\ , \ *vmbeacon*\ , \ *vmbootorder*\ , \ *vmcfgstore*\ , \ *vmcluster*\ , \ *vmcpus*\ , \ *vmhost*\ , \ *vmmanager*\ , \ *vmmaster*\ , \ *vmmemory*\ , \ *vmnicnicmodel*\ , \ *vmnics*\ , \ *vmothersetting*\ , \ *vmphyslots*\ , \ *vmstorage*\ , \ *vmstoragecache*\ , \ *vmstorageformat*\ , \ *vmstoragemodel*\ , \ *vmtextconsole*\ , \ *vmvirtflags*\ , \ *vmvncport*\ , \ *webport*\ , \ *wherevals*\ , \ *xcatmaster*\ *********** @@ -663,10 +663,14 @@ group Attributes: -\ **nodetype**\ (nodetype.nodetype) +\ **nodetype**\ (nodetype.nodetype, pdu.nodetype) A comma-delimited list of characteristics of this node. Valid values: ppc, blade, vm (virtual machine), osi (OS image), mm, mn, rsa, switch. + or + + The node type should be pdu + \ **ondiscover**\ (chain.ondiscover) @@ -707,7 +711,7 @@ group Attributes: -\ **outletcount**\ (pdu.outletcount) +\ **outlet**\ (pdu.outlet) The pdu outlet count diff --git a/docs/source/guides/admin-guides/references/man7/node.7.rst b/docs/source/guides/admin-guides/references/man7/node.7.rst index b06375b96..f1ae11918 100644 --- a/docs/source/guides/admin-guides/references/man7/node.7.rst +++ b/docs/source/guides/admin-guides/references/man7/node.7.rst @@ -19,7 +19,7 @@ SYNOPSIS ******** -\ **node Attributes:**\ \ *addkcmdline*\ , \ *appstatus*\ , \ *appstatustime*\ , \ *arch*\ , \ *authdomain*\ , \ *bmc*\ , \ *bmcpassword*\ , \ *bmcport*\ , \ *bmcusername*\ , \ *bmcvlantag*\ , \ *cfgmgr*\ , \ *cfgmgtroles*\ , \ *cfgserver*\ , \ *chain*\ , \ *chassis*\ , \ *cmdmapping*\ , \ *cons*\ , \ *conserver*\ , \ *consoleondemand*\ , \ *cpucount*\ , \ *cputype*\ , \ *currchain*\ , \ *currstate*\ , \ *dhcpinterfaces*\ , \ *disksize*\ , \ *displayname*\ , \ *dockercpus*\ , \ *dockerflag*\ , \ *dockerhost*\ , \ *dockermemory*\ , \ *dockernics*\ , \ *domainadminpassword*\ , \ *domainadminuser*\ , \ *domaintype*\ , \ *getmac*\ , \ *groups*\ , \ *hcp*\ , \ *height*\ , \ *hidden*\ , \ *hostcluster*\ , \ *hostinterface*\ , \ *hostmanager*\ , \ *hostnames*\ , \ *hosttype*\ , \ *hwtype*\ , \ *id*\ , \ *initrd*\ , \ *installnic*\ , \ *interface*\ , \ *ip*\ , \ *iscsipassword*\ , \ *iscsiserver*\ , \ *iscsitarget*\ , \ *iscsiuserid*\ , \ *kcmdline*\ , \ *kernel*\ , \ *linkports*\ , \ *mac*\ , \ *machinetype*\ , \ *memory*\ , \ *mgt*\ , \ *micbridge*\ , \ *michost*\ , \ *micid*\ , \ *miconboot*\ , \ *micpowermgt*\ , \ *micvlog*\ , \ *migrationdest*\ , \ *modelnum*\ , \ *monserver*\ , \ *mpa*\ , \ *mtm*\ , \ *nameservers*\ , \ *netboot*\ , \ *nfsdir*\ , \ *nfsserver*\ , \ *nicaliases*\ , \ *niccustomscripts*\ , \ *nicdevices*\ , \ *nicextraparams*\ , \ *nichostnameprefixes*\ , \ *nichostnamesuffixes*\ , \ *nicips*\ , \ *nicnetworks*\ , \ *nicsadapter*\ , \ *nictypes*\ , \ *nimserver*\ , \ *node*\ , \ *nodetype*\ , \ *ondiscover*\ , \ *os*\ , \ *osvolume*\ , \ *otherinterfaces*\ , \ *ou*\ , \ *outletcount*\ , \ *parent*\ , \ *passwd.HMC*\ , \ *passwd.admin*\ , \ *passwd.celogin*\ , \ *passwd.general*\ , \ *passwd.hscroot*\ , \ *password*\ , \ *pdu*\ , \ *postbootscripts*\ , \ *postscripts*\ , \ *power*\ , \ *pprofile*\ , \ *prescripts-begin*\ , \ *prescripts-end*\ , \ *primarynic*\ , \ *primarysn*\ , \ *productkey*\ , \ *profile*\ , \ *protocol*\ , \ *provmethod*\ , \ *rack*\ , \ *room*\ , \ *routenames*\ , \ *serial*\ , \ *serialflow*\ , \ *serialnum*\ , \ *serialport*\ , \ *serialspeed*\ , \ *servicenode*\ , \ *setupconserver*\ , \ *setupdhcp*\ , \ *setupftp*\ , \ *setupipforward*\ , \ *setupldap*\ , \ *setupnameserver*\ , \ *setupnfs*\ , \ *setupnim*\ , \ *setupntp*\ , \ *setupproxydhcp*\ , \ *setuptftp*\ , \ *sfp*\ , \ *side*\ , \ *slot*\ , \ *slotid*\ , \ *slots*\ , \ *snmpauth*\ , \ *snmppassword*\ , \ *snmpprivacy*\ , \ *snmpusername*\ , \ *snmpversion*\ , \ *status*\ , \ *statustime*\ , \ *storagcontroller*\ , \ *storagetype*\ , \ *supernode*\ , \ *supportedarchs*\ , \ *supportproxydhcp*\ , \ *switch*\ , \ *switchinterface*\ , \ *switchport*\ , \ *switchtype*\ , \ *switchvlan*\ , \ *syslog*\ , \ *termport*\ , \ *termserver*\ , \ *tftpdir*\ , \ *tftpserver*\ , \ *unit*\ , \ *updatestatus*\ , \ *updatestatustime*\ , \ *urlpath*\ , \ *usercomment*\ , \ *userid*\ , \ *username*\ , \ *vmbeacon*\ , \ *vmbootorder*\ , \ *vmcfgstore*\ , \ *vmcluster*\ , \ *vmcpus*\ , \ *vmhost*\ , \ *vmmanager*\ , \ *vmmaster*\ , \ *vmmemory*\ , \ *vmnicnicmodel*\ , \ *vmnics*\ , \ *vmothersetting*\ , \ *vmphyslots*\ , \ *vmstorage*\ , \ *vmstoragecache*\ , \ *vmstorageformat*\ , \ *vmstoragemodel*\ , \ *vmtextconsole*\ , \ *vmvirtflags*\ , \ *vmvncport*\ , \ *webport*\ , \ *xcatmaster*\ , \ *zonename*\ +\ **node Attributes:**\ \ *addkcmdline*\ , \ *appstatus*\ , \ *appstatustime*\ , \ *arch*\ , \ *authdomain*\ , \ *bmc*\ , \ *bmcpassword*\ , \ *bmcport*\ , \ *bmcusername*\ , \ *bmcvlantag*\ , \ *cfgmgr*\ , \ *cfgmgtroles*\ , \ *cfgserver*\ , \ *chain*\ , \ *chassis*\ , \ *cmdmapping*\ , \ *cons*\ , \ *conserver*\ , \ *consoleondemand*\ , \ *cpucount*\ , \ *cputype*\ , \ *currchain*\ , \ *currstate*\ , \ *dhcpinterfaces*\ , \ *disksize*\ , \ *displayname*\ , \ *dockercpus*\ , \ *dockerflag*\ , \ *dockerhost*\ , \ *dockermemory*\ , \ *dockernics*\ , \ *domainadminpassword*\ , \ *domainadminuser*\ , \ *domaintype*\ , \ *getmac*\ , \ *groups*\ , \ *hcp*\ , \ *height*\ , \ *hidden*\ , \ *hostcluster*\ , \ *hostinterface*\ , \ *hostmanager*\ , \ *hostnames*\ , \ *hosttype*\ , \ *hwtype*\ , \ *id*\ , \ *initrd*\ , \ *installnic*\ , \ *interface*\ , \ *ip*\ , \ *iscsipassword*\ , \ *iscsiserver*\ , \ *iscsitarget*\ , \ *iscsiuserid*\ , \ *kcmdline*\ , \ *kernel*\ , \ *linkports*\ , \ *mac*\ , \ *machinetype*\ , \ *memory*\ , \ *mgt*\ , \ *micbridge*\ , \ *michost*\ , \ *micid*\ , \ *miconboot*\ , \ *micpowermgt*\ , \ *micvlog*\ , \ *migrationdest*\ , \ *modelnum*\ , \ *monserver*\ , \ *mpa*\ , \ *mtm*\ , \ *nameservers*\ , \ *netboot*\ , \ *nfsdir*\ , \ *nfsserver*\ , \ *nicaliases*\ , \ *niccustomscripts*\ , \ *nicdevices*\ , \ *nicextraparams*\ , \ *nichostnameprefixes*\ , \ *nichostnamesuffixes*\ , \ *nicips*\ , \ *nicnetworks*\ , \ *nicsadapter*\ , \ *nictypes*\ , \ *nimserver*\ , \ *node*\ , \ *nodetype*\ , \ *ondiscover*\ , \ *os*\ , \ *osvolume*\ , \ *otherinterfaces*\ , \ *ou*\ , \ *outlet*\ , \ *parent*\ , \ *passwd.HMC*\ , \ *passwd.admin*\ , \ *passwd.celogin*\ , \ *passwd.general*\ , \ *passwd.hscroot*\ , \ *password*\ , \ *pdu*\ , \ *postbootscripts*\ , \ *postscripts*\ , \ *power*\ , \ *pprofile*\ , \ *prescripts-begin*\ , \ *prescripts-end*\ , \ *primarynic*\ , \ *primarysn*\ , \ *productkey*\ , \ *profile*\ , \ *protocol*\ , \ *provmethod*\ , \ *rack*\ , \ *room*\ , \ *routenames*\ , \ *serial*\ , \ *serialflow*\ , \ *serialnum*\ , \ *serialport*\ , \ *serialspeed*\ , \ *servicenode*\ , \ *setupconserver*\ , \ *setupdhcp*\ , \ *setupftp*\ , \ *setupipforward*\ , \ *setupldap*\ , \ *setupnameserver*\ , \ *setupnfs*\ , \ *setupnim*\ , \ *setupntp*\ , \ *setupproxydhcp*\ , \ *setuptftp*\ , \ *sfp*\ , \ *side*\ , \ *slot*\ , \ *slotid*\ , \ *slots*\ , \ *snmpauth*\ , \ *snmppassword*\ , \ *snmpprivacy*\ , \ *snmpusername*\ , \ *snmpversion*\ , \ *status*\ , \ *statustime*\ , \ *storagcontroller*\ , \ *storagetype*\ , \ *supernode*\ , \ *supportedarchs*\ , \ *supportproxydhcp*\ , \ *switch*\ , \ *switchinterface*\ , \ *switchport*\ , \ *switchtype*\ , \ *switchvlan*\ , \ *syslog*\ , \ *termport*\ , \ *termserver*\ , \ *tftpdir*\ , \ *tftpserver*\ , \ *unit*\ , \ *updatestatus*\ , \ *updatestatustime*\ , \ *urlpath*\ , \ *usercomment*\ , \ *userid*\ , \ *username*\ , \ *vmbeacon*\ , \ *vmbootorder*\ , \ *vmcfgstore*\ , \ *vmcluster*\ , \ *vmcpus*\ , \ *vmhost*\ , \ *vmmanager*\ , \ *vmmaster*\ , \ *vmmemory*\ , \ *vmnicnicmodel*\ , \ *vmnics*\ , \ *vmothersetting*\ , \ *vmphyslots*\ , \ *vmstorage*\ , \ *vmstoragecache*\ , \ *vmstorageformat*\ , \ *vmstoragemodel*\ , \ *vmtextconsole*\ , \ *vmvirtflags*\ , \ *vmvncport*\ , \ *webport*\ , \ *xcatmaster*\ , \ *zonename*\ *********** @@ -669,10 +669,14 @@ node Attributes: -\ **nodetype**\ (nodetype.nodetype) +\ **nodetype**\ (nodetype.nodetype, pdu.nodetype) A comma-delimited list of characteristics of this node. Valid values: ppc, blade, vm (virtual machine), osi (OS image), mm, mn, rsa, switch. + or + + The node type should be pdu + \ **ondiscover**\ (chain.ondiscover) @@ -713,7 +717,7 @@ node Attributes: -\ **outletcount**\ (pdu.outletcount) +\ **outlet**\ (pdu.outlet) The pdu outlet count diff --git a/docs/source/guides/admin-guides/references/man7/pdu.7.rst b/docs/source/guides/admin-guides/references/man7/pdu.7.rst new file mode 100644 index 000000000..1e2397a42 --- /dev/null +++ b/docs/source/guides/admin-guides/references/man7/pdu.7.rst @@ -0,0 +1,85 @@ + +##### +pdu.7 +##### + +.. highlight:: perl + + +**** +NAME +**** + + +\ **pdu**\ - a logical object definition in the xCAT database. + + +******** +SYNOPSIS +******** + + +\ **pdu Attributes:**\ \ *machinetype*\ , \ *modelnum*\ , \ *node*\ , \ *nodetype*\ , \ *outlet*\ , \ *serialnum*\ + + +*********** +DESCRIPTION +*********** + + +Logical objects of this type are stored in the xCAT database in one or more tables. Use the following commands +to manipulate the objects: \ **mkdef**\ , \ **chdef**\ , \ **lsdef**\ , and \ **rmdef**\ . These commands will take care of +knowing which tables the object attributes should be stored in. The attribute list below shows, in +parentheses, what tables each attribute is stored in. + + +*************** +pdu Attributes: +*************** + + + +\ **machinetype**\ (pdu.machinetype) + + The pdu machine type + + + +\ **modelnum**\ (pdu.modelnum) + + The pdu model number + + + +\ **node**\ (pdu.node) + + The hostname/address of the pdu to which the settings apply + + + +\ **nodetype**\ (pdu.nodetype) + + The node type should be pdu + + + +\ **outlet**\ (pdu.outlet) + + The pdu outlet count + + + +\ **serialnum**\ (pdu.serialnum) + + The pdu serial number + + + + +******** +SEE ALSO +******** + + +\ **mkdef(1)**\ , \ **chdef(1)**\ , \ **lsdef(1)**\ , \ **rmdef(1)**\ + diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index 8a0639ea4..0e6852fc0 100755 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -679,17 +679,19 @@ passed as argument rather than by table value', }, }, pdu => { - cols => [qw(node nodetype machinetype modelnum serialnum outletCount comments disable)], + cols => [qw(node nodetype outlet machinetype modelnum serialnum comments disable)], keys => [qw(node)], nodecol => "node", table_desc => 'Parameters to use when interrogating pdus', descriptions => { node => 'The hostname/address of the pdu to which the settings apply', nodetype => 'The node type should be pdu ', + outlet => 'The pdu outlet count', machinetype => 'The pdu machine type', modelnum => 'The pdu model number', serialnum => 'The pdu serial number', - outletcount => 'The pdu outlet count', + comments => 'Any user-written notes.', + disable => "Set to 'yes' or '1' to comment out this row.", }, }, switches => { @@ -2859,6 +2861,11 @@ my @nodeattrs = ( tabentry => 'pdu.nodetype', access_tabentry => 'pdu.node=attr:node', }, + { attr_name => 'outlet', + only_if => 'nodetype=pdu', + tabentry => 'pdu.outlet', + access_tabentry => 'pdu.node=attr:node', + }, { attr_name => 'machinetype', only_if => 'nodetype=pdu', tabentry => 'pdu.machinetype', @@ -2874,11 +2881,6 @@ my @nodeattrs = ( tabentry => 'pdu.serialnum', access_tabentry => 'pdu.node=attr:node', }, - { attr_name => 'outletcount', - only_if => 'nodetype=pdu', - tabentry => 'pdu.outletcount', - access_tabentry => 'pdu.node=attr:node', - }, ######################### ## switches table # @@ -4100,6 +4102,11 @@ push(@{ $defspec{group}->{'attrs'} }, @nodeattrs); tabentry => 'pdu.nodetype', access_tabentry => 'pdu.node=attr:node', }, + { attr_name => 'outlet', + only_if => 'nodetype=pdu', + tabentry => 'pdu.outlet', + access_tabentry => 'pdu.node=attr:node', + }, { attr_name => 'machinetype', only_if => 'nodetype=pdu', tabentry => 'pdu.machinetype', @@ -4115,11 +4122,6 @@ push(@{ $defspec{group}->{'attrs'} }, @nodeattrs); tabentry => 'pdu.serialnum', access_tabentry => 'pdu.node=attr:node', }, - { attr_name => 'outletcount', - only_if => 'nodetype=pdu', - tabentry => 'pdu.outletcount', - access_tabentry => 'pdu.node=attr:node', - }, ); diff --git a/xCAT-server/lib/xcat/plugins/pdu.pm b/xCAT-server/lib/xcat/plugins/pdu.pm index 578733ed6..92d3c3350 100644 --- a/xCAT-server/lib/xcat/plugins/pdu.pm +++ b/xCAT-server/lib/xcat/plugins/pdu.pm @@ -40,6 +40,10 @@ use SNMP; my $VERBOSE = 0; my %allerrornodes = (); my $callback; +my $pdutab; +my @pduents; +my $pdunodes; + #------------------------------------------------------- @@ -126,6 +130,11 @@ sub process_request @exargs = @$extrargs; } + #fill in the total outlet count for each pdu + $pdutab = xCAT::Table->new('pdu'); + @pduents = $pdutab->getAllNodeAttribs(['node', 'outlet']); + fill_outletCount(\@pduents, $callback); + if( $command eq "rinv") { #for higher performance, handle node in batch return powerstat($noderange, $callback); @@ -154,8 +163,8 @@ sub process_request if(($subcmd eq 'on') || ($subcmd eq 'off') || ($subcmd eq 'stat') || ($subcmd eq 'state')){ return powerpdu(\@allpdunodes, $subcmd, $callback); } else { - my $pdunodes = join (",", @allpdunodes); - $callback->({ errorcode => [1],error => "The option $subcmd is not support for pdu node(s) $pdunodes."}); + my $pdunode = join (",", @allpdunodes); + $callback->({ errorcode => [1],error => "The option $subcmd is not support for pdu node(s) $pdunode."}); } } } @@ -168,6 +177,31 @@ sub process_request return; } +sub fill_outletCount { + my $pduentries = shift; + my $callback = shift; + my $outletoid = ".1.3.6.1.4.1.2.6.223.8.2.1.0"; + my $pdutab = xCAT::Table->new('pdu'); + + foreach my $pdu (@$pduentries) { + my $cur_pdu = $pdu->{node}; + my $count = $pdu->{outlet}; + #get total outlet number for the pdu + if (!$count) { + my $session = connectTopdu($cur_pdu,$callback); + #will not log this error to output + if (!$session) { + next; + } + $count = $session->get("$outletoid"); + if ($count) { + $pdutab->setNodeAttribs($cur_pdu, {outlet => $count}); + } + } + $pdunodes->{$cur_pdu}->{outlet}=$count; + } +} + #------------------------------------------------------- =head3 powerpdu @@ -181,7 +215,6 @@ sub powerpdu { my $noderange = shift; my $subcmd = shift; my $callback = shift; - my $outletnum = ".1.3.6.1.4.1.2.6.223.8.2.1.0"; if (($subcmd eq "stat") || ($subcmd eq "state")){ return powerstat($noderange, $callback); @@ -190,9 +223,10 @@ sub powerpdu { foreach my $node (@$noderange) { my $session = connectTopdu($node,$callback); if (!$session) { + $callback->({ errorcode => [1],error => "Couldn't connect to $node"}); next; } - my $count = $session->get("$outletnum"); + my $count = $pdunodes->{$node}->{outlet}; my $value; my $statstr; if ($subcmd eq "off") { @@ -207,7 +241,7 @@ sub powerpdu { { outletpower($session, $outlet, $value); if ($session->{ErrorStr}) { - $callback->({ error => "$session->{ErrorStr}"}); + $callback->({ errorcode => [1],error => "Failed to get outlet status for $node"}); } else { my $output = " outlet $outlet is $statstr"; xCAT::SvrUtils::sendmsg($output, $callback, $node, %allerrornodes); @@ -252,6 +286,11 @@ sub powerpduoutlet { my ($pdu, $outlet) = split /:/, $pdu_outlet; my $session = connectTopdu($pdu,$callback); if (!$session) { + $callback->({ errorcode => [1],error => "Couldn't connect to $pdu"}); + next; + } + if ($outlet > $pdunodes->{$pdu}->{outlet} ) { + $callback->({ errorcode => [1],error => "outlet number $outlet is invalid for $pdu"}); next; } my $cmd; @@ -270,7 +309,7 @@ sub powerpduoutlet { } if ($session->{ErrorStr}) { - $callback->({ error => "$session->{ErrorStr}"}); + $callback->({ errorcode => [1],error => "$session->{ErrorStr} for $pdu outlet $outlet"}); } else { $output = "$pdu outlet $outlet is $statstr"; xCAT::SvrUtils::sendmsg($output, $callback, $node, %allerrornodes); @@ -314,13 +353,13 @@ sub powerstat { my $callback = shift; my $output; - my $outletnum = ".1.3.6.1.4.1.2.6.223.8.2.1.0"; foreach my $pdu (@$noderange) { my $session = connectTopdu($pdu,$callback); if (!$session) { + $callback->({ errorcode => [1],error => "Couldn't connect to $pdu"}); next; } - my $count = $session->get("$outletnum"); + my $count = $pdunodes->{$pdu}->{outlet}; for (my $outlet =1; $outlet <= $count; $outlet++) { my $statstr = outletstat($session, $outlet); @@ -350,8 +389,10 @@ sub outletstat { $output = $session->get("$oid.$outlet"); if ($output eq 1) { $statstr = "on"; - } else { + } elsif ($output eq 0) { $statstr = "off"; + } else { + return; } return $statstr; } @@ -381,8 +422,6 @@ sub connectTopdu { UseSprintValue => 1, ); unless ($session) { - $msg = "Failed to connect to $pdu"; - xCAT::SvrUtils::sendmsg($msg, $callback, $pdu, %allerrornodes); return; } return $session;