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

Changes to support multiple appliances #114

Merged
merged 2 commits into from
Aug 2, 2017
Merged

Changes to support multiple appliances #114

merged 2 commits into from
Aug 2, 2017

Conversation

danielreed
Copy link
Member

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

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
Copy link
Contributor

@jesseolsen jesseolsen left a 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....

});
}
}
/*
Copy link
Contributor

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?

Copy link
Member Author

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!");
Copy link
Contributor

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?

Copy link
Member Author

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"));
Copy link
Contributor

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?

Copy link
Member Author

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)");
Copy link
Contributor

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...?"

Copy link
Member Author

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)");
Copy link
Contributor

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....

queue.subscribe({ack: true}, ::emitter.onMessage);
});
}
this.robot.logger.info('Connected to SCMB, waiting for messages');
Copy link
Contributor

Choose a reason for hiding this comment

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

2 sentences

Copy link
Member Author

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).');
Copy link
Contributor

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)"

Copy link
Member Author

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;
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove + ''

Copy link
Member Author

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;
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove + ''

Copy link
Member Author

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;
Copy link
Contributor

Choose a reason for hiding this comment

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

  • ''

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks.

Copy link
Member Author

@danielreed danielreed left a 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.

});
}
}
/*
Copy link
Member Author

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!");
Copy link
Member Author

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"));
Copy link
Member Author

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)");
Copy link
Member Author

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 + '>'
Copy link
Member Author

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.

queue.subscribe({ack: true}, ::emitter.onMessage);
});
}
this.robot.logger.info('Connected to SCMB, waiting for messages');
Copy link
Member Author

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).');
Copy link
Member Author

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;
Copy link
Member Author

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;
Copy link
Member Author

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;
Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks.

Copy link
Contributor

@jesseolsen jesseolsen left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks!

@jesseolsen jesseolsen merged commit 2e752c7 into master Aug 2, 2017
@jesseolsen jesseolsen deleted the multi branch August 2, 2017 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants