Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Coulon2015-12-09 15:43:46 +0000
committerJeff Johnston2015-12-09 23:01:13 +0000
commit67552c81a66d7382d9fdfe0987ed087e6ad8bec3 (patch)
tree2656b7a33c874bdbc4618f7e0526f9646a1b67c7 /containers/org.eclipse.linuxtools.docker.core/src/org/eclipse
parent6c110f1d42feecd797c1640a084e9bf83854f770 (diff)
downloadorg.eclipse.linuxtools-67552c81a66d7382d9fdfe0987ed087e6ad8bec3.tar.gz
org.eclipse.linuxtools-67552c81a66d7382d9fdfe0987ed087e6ad8bec3.tar.xz
org.eclipse.linuxtools-67552c81a66d7382d9fdfe0987ed087e6ad8bec3.zip
Bug 483796 - Missing settings when re-using launch configuration
Saving and restoring memory limit and CPU shares in the launch config Setting the UI widgets to the initial value from the model loaded from the launch config Actually using the memory limit and cpu shares in the DockerHostConfig when creating the container (was not implemented) Change-Id: I4d4f3ad09644f57decaf47276d32add2bbc2eb9a Signed-off-by: Xavier Coulon <xcoulon@redhat.com> Reviewed-on: https://git.eclipse.org/r/62253 Tested-by: Hudson CI Reviewed-by: Jeff Johnston <jjohnstn@redhat.com> (cherry picked from commit 6f9fdd5a3003bdc92d0cadeb3c84869cc0e934d2) Reviewed-on: https://git.eclipse.org/r/62351
Diffstat (limited to 'containers/org.eclipse.linuxtools.docker.core/src/org/eclipse')
-rw-r--r--containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerConnection.java18
-rw-r--r--containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerContainerConfig.java10
-rw-r--r--containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerHostConfig.java64
3 files changed, 49 insertions, 43 deletions
diff --git a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerConnection.java b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerConnection.java
index ffa20b85f8..0addcfdf5f 100644
--- a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerConnection.java
+++ b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerConnection.java
@@ -1056,14 +1056,24 @@ public class DockerConnection implements IDockerConnection, Closeable {
}
hbuilder.portBindings(realBindings);
}
- if (hc.volumesFrom() != null)
+ if (hc.volumesFrom() != null) {
hbuilder.volumesFrom(hc.volumesFrom());
+ }
+ // FIXME: add the 'memory()' method in the IDockerHostConfig
+ // interface
+ if (((DockerHostConfig) hc).memory() != null) {
+ hbuilder.memory(((DockerHostConfig) hc).memory());
+ }
+ // FIXME: add the 'cpuShares()' method in the IDockerHostConfig
+ // interface
+ if (((DockerHostConfig) hc).cpuShares() != null
+ && ((DockerHostConfig) hc).cpuShares().longValue() > 0) {
+ hbuilder.cpuShares(((DockerHostConfig) hc).cpuShares());
+ }
ContainerConfig.Builder builder = ContainerConfig.builder()
.hostname(c.hostname()).domainname(c.domainname())
- .user(c.user()).memory(c.memory())
- .memorySwap(c.memorySwap()).cpuShares(c.cpuShares())
- .cpuset(c.cpuset()).attachStdin(c.attachStdin())
+ .user(c.user()).attachStdin(c.attachStdin())
.attachStdout(c.attachStdout())
.attachStderr(c.attachStderr()).tty(c.tty())
.openStdin(c.openStdin()).stdinOnce(c.stdinOnce())
diff --git a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerContainerConfig.java b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerContainerConfig.java
index caa4d39378..5cd8a90aa0 100644
--- a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerContainerConfig.java
+++ b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerContainerConfig.java
@@ -143,21 +143,31 @@ public class DockerContainerConfig implements IDockerContainerConfig {
return user;
}
+ /**
+ * @see DockerHostConfig#memory()
+ */
+ @Deprecated
@Override
public Long memory() {
return memory;
}
+ @Deprecated
@Override
public Long memorySwap() {
return memorySwap;
}
+ /**
+ * @see DockerHostConfig#cpuShares()
+ */
+ @Deprecated
@Override
public Long cpuShares() {
return cpuShares;
}
+ @Deprecated
@Override
public String cpuset() {
return cpuset;
diff --git a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerHostConfig.java b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerHostConfig.java
index 28696080f7..228154c3be 100644
--- a/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerHostConfig.java
+++ b/containers/org.eclipse.linuxtools.docker.core/src/org/eclipse/linuxtools/internal/docker/core/DockerHostConfig.java
@@ -38,6 +38,8 @@ public class DockerHostConfig implements IDockerHostConfig {
private final List<String> dnsSearch;
private final List<String> volumesFrom;
private final String networkMode;
+ private final Long memory;
+ private final Long cpuShares;
public DockerHostConfig(final HostConfig hostConfig) {
this.binds = hostConfig.binds();
@@ -67,6 +69,8 @@ public class DockerHostConfig implements IDockerHostConfig {
this.dnsSearch = hostConfig.dnsSearch();
this.volumesFrom = hostConfig.volumesFrom();
this.networkMode = hostConfig.networkMode();
+ this.memory = hostConfig.memory();
+ this.cpuShares = hostConfig.cpuShares();
}
private DockerHostConfig(final Builder builder) {
@@ -83,6 +87,9 @@ public class DockerHostConfig implements IDockerHostConfig {
this.dnsSearch = builder.dnsSearch;
this.volumesFrom = builder.volumesFrom;
this.networkMode = builder.networkMode;
+ this.memory = builder.memory;
+ this.cpuShares = builder.cpuShares;
+
}
@Override
@@ -140,6 +147,14 @@ public class DockerHostConfig implements IDockerHostConfig {
return networkMode;
}
+ public Long memory() {
+ return memory;
+ }
+
+ public Long cpuShares() {
+ return cpuShares;
+ }
+
public static Builder builder() {
return new Builder();
}
@@ -157,7 +172,8 @@ public class DockerHostConfig implements IDockerHostConfig {
private List<String> dnsSearch;
private List<String> volumesFrom;
private String networkMode;
-
+ private Long memory;
+ private Long cpuShares;
public Builder binds(final List<String> binds) {
this.binds = new ArrayList<>(binds);
@@ -178,10 +194,6 @@ public class DockerHostConfig implements IDockerHostConfig {
return this;
}
- public String containerIDFile() {
- return containerIDFile;
- }
-
public Builder lxcConf(final List<IDockerConfParameter> lxcConf) {
this.lxcConf = new ArrayList<>(lxcConf);
return this;
@@ -192,29 +204,17 @@ public class DockerHostConfig implements IDockerHostConfig {
return this;
}
- public List<IDockerConfParameter> lxcConf() {
- return lxcConf;
- }
-
public Builder privileged(final Boolean privileged) {
this.privileged = privileged;
return this;
}
- public Boolean privileged() {
- return privileged;
- }
-
public Builder portBindings(
final Map<String, List<IDockerPortBinding>> portBindings) {
this.portBindings = portBindings;
return this;
}
- public Map<String, List<IDockerPortBinding>> portBindings() {
- return portBindings;
- }
-
public Builder links(final List<String> links) {
this.links = new ArrayList<>(links);
return this;
@@ -225,19 +225,11 @@ public class DockerHostConfig implements IDockerHostConfig {
return this;
}
- public List<String> links() {
- return links;
- }
-
public Builder publishAllPorts(final Boolean publishAllPorts) {
this.publishAllPorts = publishAllPorts;
return this;
}
- public Boolean publishAllPorts() {
- return publishAllPorts;
- }
-
public Builder dns(final List<String> dns) {
this.dns = new ArrayList<>(dns);
return this;
@@ -248,10 +240,6 @@ public class DockerHostConfig implements IDockerHostConfig {
return this;
}
- public List<String> dns() {
- return dns;
- }
-
public Builder dnsSearch(final List<String> dnsSearch) {
this.dnsSearch = new ArrayList<>(dnsSearch);
return this;
@@ -262,10 +250,6 @@ public class DockerHostConfig implements IDockerHostConfig {
return this;
}
- public List<String> dnsSearch() {
- return dnsSearch;
- }
-
public Builder volumesFrom(final List<String> volumesFrom) {
this.volumesFrom = new ArrayList<>(volumesFrom);
return this;
@@ -276,17 +260,19 @@ public class DockerHostConfig implements IDockerHostConfig {
return this;
}
- public List<String> volumesFrom() {
- return volumesFrom;
- }
-
public Builder networkMode(final String networkMode) {
this.networkMode = networkMode;
return this;
}
- public String networkMode() {
- return networkMode;
+ public Builder memory(final Long memory) {
+ this.memory = memory;
+ return this;
+ }
+
+ public Builder cpuShares(final Long cpuShares) {
+ this.cpuShares = cpuShares;
+ return this;
}
public IDockerHostConfig build() {

Back to the top