diff --git a/zun_ui/api/client.py b/zun_ui/api/client.py
index a416c94..2cf4921 100644
--- a/zun_ui/api/client.py
+++ b/zun_ui/api/client.py
@@ -15,6 +15,7 @@ from horizon import exceptions
from horizon.utils.memoized import memoized
import logging
from openstack_dashboard.api import base
+from zunclient.common import utils
from zunclient.v1 import client as zun_client
@@ -52,6 +53,9 @@ def container_create(request, **kwargs):
elif key == "interactive":
args["interactive"] = value
continue
+ elif key == "restart_policy":
+ args[key] = utils.check_restart_policy(value)
+ continue
if key in CONTAINER_CREATE_ATTRS:
args[str(key)] = str(value)
diff --git a/zun_ui/static/dashboard/container/containers/create/container-model.js b/zun_ui/static/dashboard/container/containers/create/container-model.js
index e75ecb2..f2581fd 100644
--- a/zun_ui/static/dashboard/container/containers/create/container-model.js
+++ b/zun_ui/static/dashboard/container/containers/create/container-model.js
@@ -37,9 +37,13 @@
uuid: null,
name: null,
image: null,
+ image_driver: "docker",
+ image_pull_policy: null,
command: null,
cpu: null,
memory: null,
+ restart_policy: null,
+ restart_policy_max_retry: null,
environment: null,
workdir: null,
labels: null,
diff --git a/zun_ui/static/dashboard/container/containers/create/create.service.js b/zun_ui/static/dashboard/container/containers/create/create.service.js
index b783152..82e0313 100644
--- a/zun_ui/static/dashboard/container/containers/create/create.service.js
+++ b/zun_ui/static/dashboard/container/containers/create/create.service.js
@@ -80,6 +80,12 @@
}
function submit() {
+ if (model.newContainerSpec.restart_policy === "on-failure") {
+ model.newContainerSpec.restart_policy =
+ model.newContainerSpec.restart_policy + ":" +
+ model.newContainerSpec.restart_policy_max_retry;
+ }
+ delete model.newContainerSpec.restart_policy_max_retry;
return model.createContainer().then(success);
}
diff --git a/zun_ui/static/dashboard/container/containers/create/info/info.help.html b/zun_ui/static/dashboard/container/containers/create/info/info.help.html
index 2865b64..47d7cb5 100644
--- a/zun_ui/static/dashboard/container/containers/create/info/info.help.html
+++ b/zun_ui/static/dashboard/container/containers/create/info/info.help.html
@@ -3,6 +3,23 @@
An arbitrary human-readable name.
Image
Name or ID of container image.
+ Image Driver
+
+ The image driver to use to pull container image.
+
+ Docker: Pull the image from Docker Hub.
+ Glance: Pull the image from Glance.
+
+
+ Image Pull Policy
+
+ The policy which determines if the image should be pulled prior to starting the container.
+
+ If not present: only pull the image if it does not already exist on the node.
+ Always: Always pull the image from repository.
+ Never: never pull the image.
+
+
Command
Command sent to the container.
diff --git a/zun_ui/static/dashboard/container/containers/create/info/info.html b/zun_ui/static/dashboard/container/containers/create/info/info.html
index 3e3dc1d..b5d243a 100644
--- a/zun_ui/static/dashboard/container/containers/create/info/info.html
+++ b/zun_ui/static/dashboard/container/containers/create/info/info.html
@@ -20,6 +20,28 @@
placeholder="{$ 'Name or ID of the container image.'|translate $}">
+
+
+ Image Driver
+
+ Docker
+ Glance
+
+
+
+
+
+ Image Pull Policy
+
+ Select policy.
+ If not present
+ Always
+ Never
+
+
+
Command
diff --git a/zun_ui/static/dashboard/container/containers/create/spec/container.spec.controller.js b/zun_ui/static/dashboard/container/containers/create/spec/container.spec.controller.js
index aa621a4..7fe9e72 100644
--- a/zun_ui/static/dashboard/container/containers/create/spec/container.spec.controller.js
+++ b/zun_ui/static/dashboard/container/containers/create/spec/container.spec.controller.js
@@ -27,8 +27,15 @@
.controller('createContainerSpecController', createContainerSpecController);
createContainerSpecController.$inject = [
+ '$scope'
];
- function createContainerSpecController() {
+ function createContainerSpecController($scope) {
+ var ctrl = this;
+ ctrl.onChangeRestartPolicy = function () {
+ if ($scope.model.newContainerSpec.restart_policy !== 'on-failure') {
+ $scope.model.newContainerSpec.restart_policy_max_retry = null;
+ }
+ };
}
})();
diff --git a/zun_ui/static/dashboard/container/containers/create/spec/spec.help.html b/zun_ui/static/dashboard/container/containers/create/spec/spec.help.html
index 665ad28..95e13fc 100644
--- a/zun_ui/static/dashboard/container/containers/create/spec/spec.help.html
+++ b/zun_ui/static/dashboard/container/containers/create/spec/spec.help.html
@@ -3,4 +3,6 @@
The number of virtual cpus.
Memory
The container memory size in MiB.
+ Restart Policy
+ Restart policy to apply when a container exits.
diff --git a/zun_ui/static/dashboard/container/containers/create/spec/spec.html b/zun_ui/static/dashboard/container/containers/create/spec/spec.html
index a083de2..20db818 100644
--- a/zun_ui/static/dashboard/container/containers/create/spec/spec.html
+++ b/zun_ui/static/dashboard/container/containers/create/spec/spec.html
@@ -17,5 +17,29 @@
id="container-memory">
+
+
+ Restart Policy
+
+ Select policy.
+ No
+ On failure
+ Always
+ Unless Stopped
+
+
+
+