From 84bce22f5baaaa99124b4ee52445192994c306f2 Mon Sep 17 00:00:00 2001 From: Mihaela Stoica Date: Wed, 11 Feb 2015 10:21:48 +0000 Subject: [PATCH] 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 --- XenModel/DockerContainer.cs | 6 ++++-- XenModel/DockerContainers.cs | 8 ++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/XenModel/DockerContainer.cs b/XenModel/DockerContainer.cs index aa70123bf..ad0608c17 100644 --- a/XenModel/DockerContainer.cs +++ b/XenModel/DockerContainer.cs @@ -48,7 +48,9 @@ namespace XenAdmin.Model this.parent = parent; this.Connection = parent.Connection; 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_description = description; this.status = status; @@ -258,7 +260,7 @@ namespace XenAdmin.Model parent = update.parent; Connection = update.parent.Connection; 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_description = update.name_description; status = update.status; diff --git a/XenModel/DockerContainers.cs b/XenModel/DockerContainers.cs index 2c9d8a1a3..ff648c85d 100644 --- a/XenModel/DockerContainers.cs +++ b/XenModel/DockerContainers.cs @@ -232,17 +232,17 @@ namespace XenAdmin.Model if (propertyNode != null) 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 - DockerContainer existingContainer = vm.Connection.Resolve(new XenRef(id)); + DockerContainer existingContainer = vm.Connection.Resolve(new XenRef(newContainer)); if (existingContainer != null) { - existingContainer.UpdateFrom(dockerContainer); + existingContainer.UpdateFrom(newContainer); containers.Add(existingContainer); } else - containers.Add(dockerContainer); + containers.Add(newContainer); } } return containers;