CA-159907: Fix more refresh issues on containers

- set container's opaque_ref to parent.opaque_ref + uuid, to make it unique inside a connection (the uuid is only unique inside a VM)

Signed-off-by: Mihaela Stoica <mihaela.stoica@citrix.com>
This commit is contained in:
Mihaela Stoica 2015-02-11 10:21:48 +00:00
parent 787ed2cf2d
commit 84bce22f5b
2 changed files with 8 additions and 6 deletions

View File

@ -48,7 +48,9 @@ namespace XenAdmin.Model
this.parent = parent; this.parent = parent;
this.Connection = parent.Connection; this.Connection = parent.Connection;
this.uuid = uuid; this.uuid = uuid;
this.opaque_ref = uuid; //using uuid, because opaque_ref does not exist at server side // Containers don't have opaque_ref at server side;
// We want to have an opaque_ref that is unique per connection, so we use parent.opaque_ref + uuid (container's id is only unique per VM)
this.opaque_ref = parent.opaque_ref + uuid;
this.name_label = name; this.name_label = name;
this.name_description = description; this.name_description = description;
this.status = status; this.status = status;
@ -258,7 +260,7 @@ namespace XenAdmin.Model
parent = update.parent; parent = update.parent;
Connection = update.parent.Connection; Connection = update.parent.Connection;
uuid = update.uuid; uuid = update.uuid;
opaque_ref = update.uuid; //using uuid, because opaque_ref does not exist at server side opaque_ref = parent.opaque_ref + uuid; //using parent.opaque_ref + uuid, because opaque_ref does not exist at server side
name_label = update.name_label; name_label = update.name_label;
name_description = update.name_description; name_description = update.name_description;
status = update.status; status = update.status;

View File

@ -232,17 +232,17 @@ namespace XenAdmin.Model
if (propertyNode != null) if (propertyNode != null)
ports = propertyNode.InnerText; ports = propertyNode.InnerText;
DockerContainer dockerContainer = new DockerContainer(vm, id, name, string.Empty, status, container, created, image, command, ports); DockerContainer newContainer = new DockerContainer(vm, id, name, string.Empty, status, container, created, image, command, ports);
// update existing container or add a new one // update existing container or add a new one
DockerContainer existingContainer = vm.Connection.Resolve(new XenRef<DockerContainer>(id)); DockerContainer existingContainer = vm.Connection.Resolve(new XenRef<DockerContainer>(newContainer));
if (existingContainer != null) if (existingContainer != null)
{ {
existingContainer.UpdateFrom(dockerContainer); existingContainer.UpdateFrom(newContainer);
containers.Add(existingContainer); containers.Add(existingContainer);
} }
else else
containers.Add(dockerContainer); containers.Add(newContainer);
} }
} }
return containers; return containers;