VMs actions work.

This commit is contained in:
Julien Fontanet 2013-12-28 14:59:06 +01:00
parent 6a6dddfef1
commit 1de8f9a92a
3 changed files with 14 additions and 8 deletions

View File

@ -322,8 +322,8 @@ class $MappedCollection
if remove
$_.extend(itemsToRemove, @_byKey)
$_.each items, (value, key) =>
key = @_key value, key
$_.each items, (value, generatorKey) =>
key = @_key value, generatorKey
# If the item already existed.
if @_byKey[key]?
@ -336,6 +336,7 @@ class $MappedCollection
# Compute the new value.
item.generator = value
item.generatorKey = generatorKey
$computeValue this, rule, item
# Runs related hooks.
@ -352,11 +353,13 @@ class $MappedCollection
return unless rule
# Adds the item.
item = @_byKey[key] = @_byRule[rule.name][key] =
item = @_byKey[key] = @_byRule[rule.name][key] = {
_ruleName: rule.name
key: key
key
value: undefined
generator: value
generatorKey
}
# Computes the value.
$computeValue this, rule, item

View File

@ -162,13 +162,13 @@ var $register = function (path, fn) {
}
var current = Api.fn;
for (var i = 0, n = path.length; i < n; ++i)
for (var i = 0, n = path.length - 1; i < n; ++i)
{
var component = path[i];
current = (current[component] || (current[component] = {}));
}
current.fn = fn;
current[path[n]] = fn;
};
//--------------------------------------------------------------------
@ -543,9 +543,9 @@ _.each({
}
// Gets the corresponding connection.
var xapi = this.xo.connections[vm.$pool];
var xapi = this.xo.xapis[vm.$pool];
xapi.call('VM.'+ method, p_id);
xapi.call('VM.'+ method, vm.$ref);
return true;
});

View File

@ -403,6 +403,9 @@ module.exports = (refsToUUIDs) ->
}
}
# The reference is necessary for operations with the XAPI.
$ref: -> @generatorKey
'VM-controller':
extends: 'VM'