Various fixes.
This commit is contained in:
parent
5208d3d091
commit
26aaf5f53c
@ -283,7 +283,7 @@ class MappedCollection
|
|||||||
getAll: ->
|
getAll: ->
|
||||||
items = {}
|
items = {}
|
||||||
|
|
||||||
for ruleName, ruleItems in @_byRule
|
for ruleName, ruleItems of @_byRule
|
||||||
rule = @_rules[ruleName]
|
rule = @_rules[ruleName]
|
||||||
|
|
||||||
# Items of private rules are not exported.
|
# Items of private rules are not exported.
|
||||||
@ -317,7 +317,7 @@ class MappedCollection
|
|||||||
$_.extend(itemsToRemove, @_byKey)
|
$_.extend(itemsToRemove, @_byKey)
|
||||||
|
|
||||||
$_.each items, (value, key) =>
|
$_.each items, (value, key) =>
|
||||||
key = @_key key
|
key = @_key value, key
|
||||||
|
|
||||||
# If the item already existed.
|
# If the item already existed.
|
||||||
if @_byKey[key]
|
if @_byKey[key]
|
||||||
|
19
src/xo.js
19
src/xo.js
@ -227,7 +227,12 @@ Xo.prototype.start = function (data) {
|
|||||||
// 'VMPP',
|
// 'VMPP',
|
||||||
// 'VTPM',
|
// 'VTPM',
|
||||||
];
|
];
|
||||||
xo.xobjs = createMappedCollection(require('./spec'));
|
|
||||||
|
// XAPI uses both opaque references and UUIDs, XO uses UUIDs where
|
||||||
|
// possible.
|
||||||
|
var refsToUUIDs = {};
|
||||||
|
|
||||||
|
xo.xobjs = createMappedCollection(require('./spec')(refsToUUIDs));
|
||||||
|
|
||||||
var connect = function (server) {
|
var connect = function (server) {
|
||||||
var pool_id = server.id;
|
var pool_id = server.id;
|
||||||
@ -241,9 +246,14 @@ Xo.prototype.start = function (data) {
|
|||||||
return Q.all(_.map(xclasses, function (xclass) {
|
return Q.all(_.map(xclasses, function (xclass) {
|
||||||
return xapi.call(xclass +'.get_all_records')
|
return xapi.call(xclass +'.get_all_records')
|
||||||
.then(function (records) {
|
.then(function (records) {
|
||||||
_.each(records, function (record) {
|
_.each(records, function (record, ref) {
|
||||||
record.$type = xclass;
|
record.$type = xclass;
|
||||||
record.$pool = pool_id;
|
record.$pool = pool_id;
|
||||||
|
|
||||||
|
if (record.uuid)
|
||||||
|
{
|
||||||
|
refsToUUIDs[ref] = record.uuid;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return xobjs.set(records);
|
return xobjs.set(records);
|
||||||
@ -271,6 +281,11 @@ Xo.prototype.start = function (data) {
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (record.uuid)
|
||||||
|
{
|
||||||
|
refsToUUIDs[ref] = record.uuid;
|
||||||
|
}
|
||||||
|
|
||||||
xobjs.set({ref: record}, {remove: false});
|
xobjs.set({ref: record}, {remove: false});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user