Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support IPDU(severtech-CWG-16H2C454) power control(power on/off) #533

Merged
merged 1 commit into from
Oct 27, 2017

Conversation

kellylu2sym
Copy link

Background:
test and implement IPDU power control of rackhd , model is CWG-16H2C454.

Details:
code change in :lib/services/servertech-obm-service.js .

test : Do manual test of power on and power off with rackhd api

code review : @anhou @bbcyyb @pengz1 @panpan0000

if (_.contains(result.stdout.contains, 'INTEGER: on') ||
_.contains(result.stdout.contains, 'INTEGER: idleOn')) {
if (_.contains(result.stdout, 'INTEGER: on') ||
_.contains(result.stdout, 'INTEGER: idleOn')) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure result.stdout.contains is incorrect data path? If you are not sure about this, you should find the old devices and try on it. Otherwise, below lines are safer.

_.contains(result.stdout, 'INTEGER: on') ||
_.contains(result.stdout, 'INTEGER: idleOn' ||
_.contains(result.stdout.contains, 'INTEGER: on' ||
_.contains(result.stdout.contains, 'INTEGER: idleOn'

Copy link
Author

@kellylu2sym kellylu2sym Oct 25, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok,I will find a old one to do some test

if (_.contains(result.stdout.contains, 'INTEGER: off') ||
_.contains(result.stdout.contains, 'INTEGER: idleOff')) {
if (_.contains(result.stdout, 'INTEGER: off') ||
_.contains(result.stdout, 'INTEGER: idleOff')) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same as above comment.

@anhou
Copy link
Member

anhou commented Oct 25, 2017

Confused by 'PowerControllByRackhd', a more meaningful or specific title is better

@@ -23,27 +23,27 @@ function serverTechObmServiceFactory(Promise, BaseObmService, _) {
util.inherits(ServerTechObmService, BaseObmService);

ServerTechObmService.prototype.reboot = function() {
return this._runInternal(this.mibPowerCommand + '.' + this.options.config.port, 'i', '3');
return this._runInternal([this.mibPowerCommand + '.' + this.options.config.port, 'i', '3']);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the background of changing it to array, it does't work in old way?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ServerTechObmService.prototype._runInternal this function allow to accept 2 arguments : command and file (file can be null).
however , "return this._runInternal(this.mibPowerCommand + '.' + this.options.config.port, 'i', '3')" without the brackets actually send 3 arguments to the function ,and it will consider the string "i " as file value, it is not a available snmp command and will run failed . so we need the brackets to make all the arguments value as the first arguments "command".

@kellylu2sym kellylu2sym changed the title PowerControllByRackhd support IPDU(severtech-CWG-16H2C454) power control(power on/off) Oct 25, 2017
@anhou anhou merged commit 56cfaac into RackHD:master Oct 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants