support docker 1.4.1 (API v1.16)

This commit is contained in:
Andrea Turli 2014-12-21 17:35:02 +01:00
parent 14da3d680a
commit f1bf27bfaf
5 changed files with 73 additions and 29 deletions

View File

@ -67,7 +67,7 @@ public class DockerApiMetadata extends BaseHttpApiMetadata<DockerApi> {
.identityName("Path to certificate .pem file")
.credentialName("Password to key .pem file")
.documentation(URI.create("https://docs.docker.com/reference/api/docker_remote_api/"))
.version("1.15")
.version("1.16")
.defaultEndpoint("https://127.0.0.1:2376")
.defaultProperties(DockerApiMetadata.defaultProperties())
.view(typeToken(ComputeServiceContext.class))

View File

@ -18,6 +18,7 @@ package org.jclouds.docker.domain;
import java.util.List;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.json.SerializedNames;
import com.google.auto.value.AutoValue;
@ -59,20 +60,49 @@ public abstract class Info {
public abstract int swapLimit();
public abstract String dockerRootDir();
/**
* @return a list of daemon labels
*/
@Nullable public abstract List<String> labels();
/**
* @return total memory available
*/
public abstract long memTotal();
/**
* @return the number of CPUs available on the machine
*/
public abstract int ncpu();
/**
* @return a unique ID identifying the daemon
*/
public abstract String id();
/**
* @return a user-friendly name describing the running Docker daemon
*/
public abstract String name();
Info() {
}
@SerializedNames({
"Containers", "Debug", "Driver", "DriverStatus", "ExecutionDriver", "IPv4Forwarding", "Images",
"IndexServerAddress", "InitPath", "InitSha1", "KernelVersion", "MemoryLimit", "NEventsListener",
"NFd", "NGoroutines", "OperatingSystem", "SwapLimit"
"NFd", "NGoroutines", "OperatingSystem", "SwapLimit", "DockerRootDir", "Labels", "MemTotal", "NCPU",
"ID", "Name"
})
public static Info create(int containers, int debug, String driver, List<List<String>> driverStatus,
String executionDriver, int iPv4Forwarding, int images, String indexServerAddress,
String initPath, String initSha1, String kernelVersion, int memoryLimit,
int nEventsListener, int nFd, int nGoroutines, String operatingSystem, int swapLimit) {
int nEventsListener, int nFd, int nGoroutines, String operatingSystem, int swapLimit,
String dockerRootDir, List<String> labels, long memTotal, int ncpu, String id, String name) {
return new AutoValue_Info(containers, debug, driver, driverStatus, executionDriver, iPv4Forwarding, images,
indexServerAddress, initPath, initSha1, kernelVersion, memoryLimit, nEventsListener, nFd, nGoroutines,
operatingSystem, swapLimit);
operatingSystem, swapLimit, dockerRootDir, labels, memTotal, ncpu, id, name);
}
}

View File

@ -32,9 +32,9 @@ import com.google.common.collect.Iterables;
@Test(groups = "live", testName = "MiscApiLiveTest", singleThreaded = true)
public class MiscApiLiveTest extends BaseDockerApiLiveTest {
private static final String API_VERSION = "1.15";
private static final String VERSION = "1.3.2";
private static final String GIT_COMMIT = "39fa2fa";
private static final String API_VERSION = "1.16";
private static final String VERSION = "1.4.1";
private static final String GIT_COMMIT = "5bc2ff8";
private static final String GO_VERSION = "go1.3.3";
private static final String KERNEL_VERSION = "3.16.7-tinycore64";
private static final String ARCH = "amd64";

View File

@ -38,25 +38,33 @@ public class InfoParseTest extends BaseDockerParseTest<Info> {
@Override
@Consumes(MediaType.APPLICATION_JSON)
public Info expected() {
return Info.create(0,
1,
"aufs",
return Info.create(
0, // containers
1, // debug
"aufs", // driver
ImmutableList.<List<String>>of(
ImmutableList.of("Root Dir", "/mnt/sda1/var/lib/docker/aufs"),
ImmutableList.of("Dirs", "15")
),
"native-0.2",
1,
15,
"https://index.docker.io/v1/",
"/usr/local/bin/docker",
"",
"3.16.4-tinycore64",
1,
0,
10,
11,
"Boot2Docker 1.3.0 (TCL 5.4); master : a083df4 - Thu Oct 16 17:05:03 UTC 2014",
1);
ImmutableList.of("Dirs", "46")
), // driverStatus
"native-0.2", // ExecutionDriver
1, // IPv4Forwarding
46, // Images
"https://index.docker.io/v1/", // IndexServerAddress
"/usr/local/bin/docker", // InitPath
"", // InitSha1
"3.16.7-tinycore64", // KernelVersion
1, // MemoryLimit
0, // NEventsListener
10, // NFd
11, // NGoroutines
"Boot2Docker 1.3.0 (TCL 5.4); master : a083df4 - Thu Oct 16 17:05:03 UTC 2014", // OperatingSystem
1, // SwapLimit
"/mnt/sda1/var/lib/docker", // DockerRootDir
null, // Labels
2105585664, // MemTotal
8, // NCPU
"7V5Y:IQ2M:HWIL:AZJV:HKRD:Q7OZ:3EQA:ZHMO:4LAD:OSIY:YBAA:BSX6", // ID
"boot2docker" // name
);
}
}

View File

@ -1,6 +1,7 @@
{
"Containers": 0,
"Debug": 1,
"DockerRootDir": "/mnt/sda1/var/lib/docker",
"Driver": "aufs",
"DriverStatus": [
[
@ -9,20 +10,25 @@
],
[
"Dirs",
"15"
"46"
]
],
"ExecutionDriver": "native-0.2",
"ID": "7V5Y:IQ2M:HWIL:AZJV:HKRD:Q7OZ:3EQA:ZHMO:4LAD:OSIY:YBAA:BSX6",
"IPv4Forwarding": 1,
"Images": 15,
"Images": 46,
"IndexServerAddress": "https://index.docker.io/v1/",
"InitPath": "/usr/local/bin/docker",
"InitSha1": "",
"KernelVersion": "3.16.4-tinycore64",
"KernelVersion": "3.16.7-tinycore64",
"Labels": null,
"MemTotal": 2105585664,
"MemoryLimit": 1,
"NCPU": 8,
"NEventsListener": 0,
"NFd": 10,
"NGoroutines": 11,
"OperatingSystem": "Boot2Docker 1.3.0 (TCL 5.4); master : a083df4 - Thu Oct 16 17:05:03 UTC 2014",
"Name": "boot2docker",
"OperatingSystem": "Boot2Docker 1.4.1 (TCL 5.4); master : 86f7ec8 - Tue Dec 16 23:11:29 UTC 2014",
"SwapLimit": 1
}