Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

OS-2346: vmadm crash on us-east-3 during update

  • Loading branch information...
commit 5baa6494d414f6b0e7af89f6b33c43f279156ca5 1 parent 0cc95ec
@rgulewich rgulewich authored
View
3  src/fw/lib/fw.js
@@ -1082,7 +1082,8 @@ function lookupVMs(allVMs, vms, callback) {
return;
}
if (!allVMs.all.hasOwnProperty(vm.uuid)) {
- errs.push(new verror.VError('Could not find VM "%s" in VM list'));
+ errs.push(new verror.VError('Could not find VM "%s" in VM list',
+ vm.uuid));
return;
}
toReturn[vm.uuid] = allVMs.all[vm.uuid];
View
11 src/fw/lib/util/log.js
@@ -83,9 +83,14 @@ function ruleSerializer(rules) {
*/
function vmSerializer(vms) {
// Returning from add, update, etc, vms is a list of VM UUIDs
- if (typeof (vms) === 'object' && vms.length
- && typeof (vms[0]) === 'string') {
- return vms;
+ if (util.isArray(vms)) {
+ if (typeof (vms[0]) === 'string') {
+ return vms;
+ }
+
+ return vms.map(function (v) {
+ return v.hasOwnProperty('uuid') ? v.uuid : v;
+ });
}
return Object.keys(vms);
View
16 src/fw/test/unit/fw.test.js
@@ -63,6 +63,22 @@ exports['add: no rules or VMs'] = function (t) {
};
+exports['add: localVM not in list'] = function (t) {
+ var vm = helpers.generateVM();
+ var payload = {
+ localVMs: [ vm ],
+ vms: [ ]
+ };
+
+ fw.add(payload, function (err, res) {
+ t.ok(err, 'error returned');
+ t.equal(err.message, util.format('Could not find VM "%s" in VM list',
+ vm.uuid), 'error message');
+ t.done();
+ });
+};
+
+
exports['add / update: vm to IP: BLOCK'] = function (t) {
var vm = helpers.generateVM();
var payload = {
View
16 src/fw/test/unit/update.test.js
@@ -126,6 +126,22 @@ exports['update non-existent rule'] = function (t) {
};
+exports['localVM not in list'] = function (t) {
+ var vm = helpers.generateVM();
+ var payload = {
+ localVMs: [ vm ],
+ vms: [ ]
+ };
+
+ fw.update(payload, function (err, res) {
+ t.ok(err, 'error returned');
+ t.equal(err.message, util.format('Could not find VM "%s" in VM list',
+ vm.uuid), 'error message');
+ t.done();
+ });
+};
+
+
// --- Teardown
Please sign in to comment.
Something went wrong with that request. Please try again.