-
Notifications
You must be signed in to change notification settings - Fork 4
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
Changes to support multiple appliances #114
Conversation
OVClient will have a pool of connections now (a Map of appliance addr to connection) Each of the existing clients now will have to handle gathering responses from all connections or individual connections. The oneview-configuration.json takes a list of hosts now. Issue #10
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments, but if you are fine with it after reading through the comments, then I approve....
}); | ||
} | ||
} | ||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Files look identical. DOS vs. Unix line endings?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes just changing line endings to Unix, it looks weird in the diff.
} | ||
|
||
ShowOneViewDashboard(msg) { | ||
this.transform.send(msg, "Oh I'm sorry the dashboard is broken!"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it currently broken, or just with your change? TBD later on, with a follow-on commit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its broken for now. Will need to be fixed in a separate review.
ShowOneViewDashboard(msg) { | ||
this.transform.send(msg, "Oh I'm sorry the dashboard is broken!"); | ||
|
||
// this.transform.send(msg, "Ok " + msg.message.user.name + ", I am going to generate your dashboard. This might take a little while.\nFor a more comprehensive view, see " + this.transform.hyperlink("https://" + this.client.host + "/#/dashboard", "Dashboard")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBD? Or should these lines be removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Going to leave these for now. We will need them later when we fix it.
let templateHyperlink = nameAndHyperlink.hyperlink; | ||
this.transform.text(msg, msg.message.user.name + " I am going to fix the compliance issues for the profile template " + this.transform.hyperlink(templateHyperlink, templateName) + ". Are you sure you want to do this? (@" + this.robot.name + " yes/@" + this.robot.name + " no)"); | ||
let nameAndHyperlink = getDeviceNameAndHyperLink(host + "/rest/server-profile-templates/" + msg.templateId); | ||
this.transform.text(msg, msg.message.user.name + " I am going to fix the compliance issues for the profile template " + this.transform.hyperlink(nameAndHyperlink.hyperlink, nameAndHyperlink.deviceName) + ". Are you sure you want to do this? (@" + this.robot.name + " yes/@" + this.robot.name + " no)"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want to add: "... on host " + host + ". Are you sure...?"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm...good question. Not sure what to do about this now. We may have to think about changing lots of our messaging now.
let templateHyperlink = nameAndHyperlink.hyperlink; | ||
this.transform.text(msg, msg.message.user.name + " I am going to fix the compliance issues for the profile template " + this.transform.hyperlink(templateHyperlink, templateName) + ". Are you sure you want to do this? (@" + this.robot.name + " yes/@" + this.robot.name + " no)"); | ||
let nameAndHyperlink = getDeviceNameAndHyperLink(host + "/rest/server-profile-templates/" + msg.templateId); | ||
this.transform.text(msg, msg.message.user.name + " I am going to fix the compliance issues for the profile template " + this.transform.hyperlink(nameAndHyperlink.hyperlink, nameAndHyperlink.deviceName) + ". Are you sure you want to do this? (@" + this.robot.name + " yes/@" + this.robot.name + " no)"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, could add ... for host X....
src/oneview-sdk/notifications.js
Outdated
queue.subscribe({ack: true}, ::emitter.onMessage); | ||
}); | ||
} | ||
this.robot.logger.info('Connected to SCMB, waiting for messages'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 sentences
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed.
src/oneview.js
Outdated
robot.logger.info('Logged into OV appliance.'); | ||
|
||
client.login(false).then(() => { | ||
robot.logger.info('Logged into OV appliance(s).'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OV --> OneView.
Also, would be nice to say "appliance" or "appliances" vs. "appliance(s)"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That does sound better.
src/ov-brain.js
Outdated
resourcesMap.set(sh.uri, {name: sh.name, hyperlink: sh.hyperlink, model: sh.model}); | ||
robot.logger.info('Found server hardware: (Name: ' + sh.name + ', Serial Number: ' + sh.serialNumber + ', URI: ' + sh.uri + ')'); | ||
for (let member of res.members) { | ||
let uri = url.parse(member.hyperlink).hostname + '' + member.uri; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove + ''
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
src/ov-brain.js
Outdated
resourcesMap.set(spt.uri, {name: spt.name, hyperlink: spt.hyperlink, model: undefined}); | ||
robot.logger.info('Found server profile template: (Name: ' + spt.name + ', URI: ' + spt.uri + ')'); | ||
for (let member of res.members) { | ||
let uri = url.parse(member.hyperlink).hostname + '' + member.uri; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove + ''
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
src/ov-brain.js
Outdated
let auth = client.getAuthToken(host); | ||
|
||
let model = message.resource.model; | ||
let uri = host + '' + message.resource.uri; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- ''
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll update this PR to address your feedback.
}); | ||
} | ||
} | ||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes just changing line endings to Unix, it looks weird in the diff.
} | ||
|
||
ShowOneViewDashboard(msg) { | ||
this.transform.send(msg, "Oh I'm sorry the dashboard is broken!"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its broken for now. Will need to be fixed in a separate review.
ShowOneViewDashboard(msg) { | ||
this.transform.send(msg, "Oh I'm sorry the dashboard is broken!"); | ||
|
||
// this.transform.send(msg, "Ok " + msg.message.user.name + ", I am going to generate your dashboard. This might take a little while.\nFor a more comprehensive view, see " + this.transform.hyperlink("https://" + this.client.host + "/#/dashboard", "Dashboard")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Going to leave these for now. We will need them later when we fix it.
let templateHyperlink = nameAndHyperlink.hyperlink; | ||
this.transform.text(msg, msg.message.user.name + " I am going to fix the compliance issues for the profile template " + this.transform.hyperlink(templateHyperlink, templateName) + ". Are you sure you want to do this? (@" + this.robot.name + " yes/@" + this.robot.name + " no)"); | ||
let nameAndHyperlink = getDeviceNameAndHyperLink(host + "/rest/server-profile-templates/" + msg.templateId); | ||
this.transform.text(msg, msg.message.user.name + " I am going to fix the compliance issues for the profile template " + this.transform.hyperlink(nameAndHyperlink.hyperlink, nameAndHyperlink.deviceName) + ". Are you sure you want to do this? (@" + this.robot.name + " yes/@" + this.robot.name + " no)"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm...good question. Not sure what to do about this now. We may have to think about changing lots of our messaging now.
@@ -54,7 +54,7 @@ export default class ServerHardware extends Resource { | |||
fields.push({ | |||
title: 'Profile', | |||
short: true, | |||
value: '<' + this.serverProfileHyperlink + '|' + getDeviceNameAndHyperLink(this.serverProfileUri).deviceName + '>' | |||
value: '<' + this.serverProfileHyperlink + '|' + getDeviceNameAndHyperLink(host + '' + this.serverProfileUri).deviceName + '>' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch I probably don't need to concatenate the strings this way.
src/oneview-sdk/notifications.js
Outdated
queue.subscribe({ack: true}, ::emitter.onMessage); | ||
}); | ||
} | ||
this.robot.logger.info('Connected to SCMB, waiting for messages'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed.
src/oneview.js
Outdated
robot.logger.info('Logged into OV appliance.'); | ||
|
||
client.login(false).then(() => { | ||
robot.logger.info('Logged into OV appliance(s).'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That does sound better.
src/ov-brain.js
Outdated
resourcesMap.set(sh.uri, {name: sh.name, hyperlink: sh.hyperlink, model: sh.model}); | ||
robot.logger.info('Found server hardware: (Name: ' + sh.name + ', Serial Number: ' + sh.serialNumber + ', URI: ' + sh.uri + ')'); | ||
for (let member of res.members) { | ||
let uri = url.parse(member.hyperlink).hostname + '' + member.uri; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
src/ov-brain.js
Outdated
resourcesMap.set(spt.uri, {name: spt.name, hyperlink: spt.hyperlink, model: undefined}); | ||
robot.logger.info('Found server profile template: (Name: ' + spt.name + ', URI: ' + spt.uri + ')'); | ||
for (let member of res.members) { | ||
let uri = url.parse(member.hyperlink).hostname + '' + member.uri; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
src/ov-brain.js
Outdated
let auth = client.getAuthToken(host); | ||
|
||
let model = message.resource.model; | ||
let uri = host + '' + message.resource.uri; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thanks!
OVClient will have a pool of connections now (a Map of appliance addr
to connection)
Each of the existing clients now will have to handle gathering
responses from all connections or individual connections.
The oneview-configuration.json takes a list of hosts now.
Issue #10