Hello,
Please find attached a patch that implements the "set FRU activation
policy" command. Feel free to adapt or recode it (i guess there's at
least a mess with tabulation/spaces mix). The command line then becomes:
Clear the deactivate locked bit:
ipmitool -H shelfman picmg policy set 22 deact:unlock
Clear the locked bit:
ipmitool -H shelfman picmg policy set 22 act:unlock
Set the locked bit:
ipmitool -H shelfman picmg policy set 22 act:lock
Combinate the settings:
ipmitool -H shelfman picmg policy set 22 act:lock deact:unlock
I'm not sure if this command interface is handy, but it gives an idea of
what can be done :-)
Regards,
--
BenoƮt Guillon [EMAIL PROTECTED]
TCT/3S tel. : 33 (0)4 98 16 33 90
THALES COMPUTERS
--- ipmitool-1.8.8/lib/ipmi_picmg.c 2006-03-19 22:15:05.000000000 +0100
+++ ../ipmitool-1.8.8/lib/ipmi_picmg.c 2007-02-08 17:37:34.000000000 +0100
@@ -4,6 +4,7 @@
*/
+#include <string.h>
#include <ipmitool/ipmi_intf.h>
#include <ipmitool/ipmi_picmg.h>
#include <ipmitool/ipmi_fru.h> /* for access to link descriptor defines */
@@ -192,8 +193,90 @@
}
printf("Activation Policy for FRU %x: ", atoi(argv[0]) );
- printf(" %s\n",(((*(rsp->data+3))&0x01) == 0x01)?"is locked":"is not locked");
+ printf("%s, ", (rsp->data[1] & 0x01) ? "is locked" : "is not locked");
+ printf("%s\n", (rsp->data[1] & 0x02) ? "deactivation locked"
+ : "deactivation not locked");
+ return 0;
+}
+
+static void
+policy_set_bit(unsigned char *mask, unsigned char *set, int bit, int lock)
+{
+ *mask = *mask | bit;
+ if (lock) {
+ *set = *set | bit;
+ } else {
+ *set = *set & ~bit;
+ }
+}
+
+int
+ipmi_picmg_fru_activation_policy_set(struct ipmi_intf * intf,
+ int argc, char ** argv)
+{
+ struct ipmi_rs * rsp;
+ struct ipmi_rq req;
+ int i;
+ int bit;
+ int lock;
+ char *sep;
+#define ACT_LOCKED_BIT 0x1
+#define DEACT_LOCKED_BIT 0x2
+
+ unsigned char msg_data[4];
+
+ memset(&req, 0, sizeof(req));
+ req.msg.netfn = IPMI_NETFN_PICMG;
+ req.msg.cmd = PICMG_SET_FRU_POLICY_CMD;
+ req.msg.data = msg_data;
+ req.msg.data_len = 4;
+
+ msg_data[0] = 0; /* PICMG identifier */
+ msg_data[1] = (unsigned char) atoi(argv[0]); /* FRU ID */
+ msg_data[2] = 0; /* Policy Mask Bits */
+ msg_data[3] = 0; /* Policy Set Bits */
+
+ for (i = 1; i < argc; i++) {
+ printf("%s\n", argv[i]);
+ sep = strchr(argv[i], ':');
+ if (! sep) {
+ printf("[act:lock|act:unlock] [deact:lock|deact:unlock]\n");
+ return -1;
+ }
+ *sep = 0;
+ if (strcmp(argv[i], "act") == 0) {
+ bit = ACT_LOCKED_BIT;
+ } else if (strcmp(argv[i], "deact") == 0) {
+ bit = DEACT_LOCKED_BIT;
+ } else {
+ printf("act|deact\n");
+ return -1;
+ }
+ if (strcmp(sep+1, "lock") == 0) {
+ lock = 1;
+ } else if (strcmp(sep+1, "unlock") == 0) {
+ lock = 0;
+ } else {
+ printf("lock|unlock\n");
+ return -1;
+ }
+ policy_set_bit(&msg_data[2], &msg_data[3], bit, lock);
+ }
+
+ if (msg_data[2] == 0)
+ return 0;
+
+ rsp = intf->sendrecv(intf, &req);
+
+ if (!rsp) {
+ printf("no response\n");
+ return -1;
+ }
+ if (rsp->ccode) {
+ printf("returned CC code 0x%02x\n", rsp->ccode);
+ return -1;
+ }
return 0;
}
@@ -608,11 +691,10 @@
else if (!strncmp(argv[0], "policy", 6)) {
if (argc > 2) {
if (!strncmp(argv[1], "get", 3)) {
- rc = ipmi_picmg_fru_activation_policy_get(intf, argc-1, &(argv[2]));
+ rc = ipmi_picmg_fru_activation_policy_get(intf, argc-2, &(argv[2]));
}
else if (!strncmp(argv[1], "set", 6)) {
- printf("tbd\n");
- return -1;
+ rc = ipmi_picmg_fru_activation_policy_set(intf, argc-2, &(argv[2]));
}
else {
printf("specify fru\n");
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Ipmitool-devel mailing list
Ipmitool-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipmitool-devel