summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--nova-client/src/main/java/com/woorea/openstack/nova/Nova.java8
-rw-r--r--nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/HypervisorsExtension.java44
-rw-r--r--nova-model/src/main/java/com/woorea/openstack/nova/model/CpuInfo.java104
-rw-r--r--nova-model/src/main/java/com/woorea/openstack/nova/model/Hypervisor.java265
-rw-r--r--nova-model/src/main/java/com/woorea/openstack/nova/model/Hypervisors.java60
-rw-r--r--nova-model/src/main/java/com/woorea/openstack/nova/model/Service.java79
-rw-r--r--nova-model/src/main/java/com/woorea/openstack/nova/model/Topology.java79
-rw-r--r--pom.xml10
-rw-r--r--version.properties2
9 files changed, 649 insertions, 2 deletions
diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/Nova.java b/nova-client/src/main/java/com/woorea/openstack/nova/Nova.java
index 0125179..908e1e9 100644
--- a/nova-client/src/main/java/com/woorea/openstack/nova/Nova.java
+++ b/nova-client/src/main/java/com/woorea/openstack/nova/Nova.java
@@ -27,6 +27,7 @@ import com.woorea.openstack.nova.api.ServersResource;
import com.woorea.openstack.nova.api.extensions.AggregatesExtension;
import com.woorea.openstack.nova.api.extensions.FloatingIpsExtension;
import com.woorea.openstack.nova.api.extensions.HostsExtension;
+import com.woorea.openstack.nova.api.extensions.HypervisorsExtension;
import com.woorea.openstack.nova.api.extensions.KeyPairsExtension;
import com.woorea.openstack.nova.api.extensions.SecurityGroupsExtension;
import com.woorea.openstack.nova.api.extensions.SnapshotsExtension;
@@ -58,6 +59,8 @@ public class Nova extends OpenStackClient {
private final HostsExtension hosts;
+ private final HypervisorsExtension hypervisor;
+
public Nova(String endpoint, OpenStackClientConnector connector) {
super(endpoint, connector);
extensions = new ExtensionsResource(this);
@@ -72,6 +75,7 @@ public class Nova extends OpenStackClient {
aggregates = new AggregatesExtension(this);
quotaSets = new QuotaSetsResource(this);
hosts = new HostsExtension(this);
+ hypervisor = new HypervisorsExtension(this);
}
public Nova(String endpoint) {
@@ -125,4 +129,8 @@ public class Nova extends OpenStackClient {
public HostsExtension hosts() {
return hosts;
}
+
+ public HypervisorsExtension hypervisors() {
+ return hypervisor;
+ }
}
diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/HypervisorsExtension.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/HypervisorsExtension.java
index b092b0c..a785971 100644
--- a/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/HypervisorsExtension.java
+++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/extensions/HypervisorsExtension.java
@@ -16,6 +16,48 @@
package com.woorea.openstack.nova.api.extensions;
-public interface HypervisorsExtension {
+import com.woorea.openstack.base.client.HttpMethod;
+import com.woorea.openstack.base.client.OpenStackClient;
+import com.woorea.openstack.base.client.OpenStackRequest;
+import com.woorea.openstack.nova.model.Hypervisor;
+import com.woorea.openstack.nova.model.Hypervisors;
+public class HypervisorsExtension {
+
+ private final OpenStackClient client;
+
+ public HypervisorsExtension(OpenStackClient client) {
+ this.client = client;
+ }
+
+ public List list() {
+ return new List();
+ }
+
+ public ListDetail listDetail() {
+ return new ListDetail();
+ }
+
+ public Show show(String id) {
+ return new Show(id);
+ }
+
+ public class List extends OpenStackRequest<Hypervisors> {
+ public List() {
+ super(client, HttpMethod.GET, "/os-hypervisors", null, Hypervisors.class);
+ }
+ }
+
+ public class ListDetail extends OpenStackRequest<Hypervisors> {
+ public ListDetail() {
+ super(client, HttpMethod.GET, "/os-hypervisors/detail", null, Hypervisors.class);
+ }
+ }
+
+ public class Show extends OpenStackRequest<Hypervisor> {
+ public Show(String id) {
+ super(client, HttpMethod.GET, new StringBuffer("/hypervisors").append(id).toString(), null,
+ Hypervisor.class);
+ }
+ }
}
diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/CpuInfo.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/CpuInfo.java
new file mode 100644
index 0000000..bf52fb7
--- /dev/null
+++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/CpuInfo.java
@@ -0,0 +1,104 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package com.woorea.openstack.nova.model;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class CpuInfo {
+
+ @JsonProperty("arch")
+ private String arch;
+ @JsonProperty("model")
+ private String model;
+ @JsonProperty("vendor")
+ private String vendor;
+ @JsonProperty("features")
+ private List<String> features = null;
+ @JsonProperty("topology")
+ private Topology topology;
+ @JsonIgnore
+ private Map<String, Object> additionalProperties = new HashMap<String, Object>();
+
+ @JsonProperty("arch")
+ public String getArch() {
+ return arch;
+ }
+
+ @JsonProperty("arch")
+ public void setArch(String arch) {
+ this.arch = arch;
+ }
+
+ @JsonProperty("model")
+ public String getModel() {
+ return model;
+ }
+
+ @JsonProperty("model")
+ public void setModel(String model) {
+ this.model = model;
+ }
+
+ @JsonProperty("vendor")
+ public String getVendor() {
+ return vendor;
+ }
+
+ @JsonProperty("vendor")
+ public void setVendor(String vendor) {
+ this.vendor = vendor;
+ }
+
+ @JsonProperty("features")
+ public List<String> getFeatures() {
+ return features;
+ }
+
+ @JsonProperty("features")
+ public void setFeatures(List<String> features) {
+ this.features = features;
+ }
+
+ @JsonProperty("topology")
+ public Topology getTopology() {
+ return topology;
+ }
+
+ @JsonProperty("topology")
+ public void setTopology(Topology topology) {
+ this.topology = topology;
+ }
+
+ @JsonAnyGetter
+ public Map<String, Object> getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ @JsonAnySetter
+ public void setAdditionalProperty(String name, Object value) {
+ this.additionalProperties.put(name, value);
+ }
+
+}
diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Hypervisor.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Hypervisor.java
new file mode 100644
index 0000000..fb5d9d2
--- /dev/null
+++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Hypervisor.java
@@ -0,0 +1,265 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package com.woorea.openstack.nova.model;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class Hypervisor {
+
+ @JsonProperty("cpu_info")
+ private CpuInfo cpuInfo;
+ @JsonProperty("current_workload")
+ private Integer currentWorkload;
+ @JsonProperty("status")
+ private String status;
+ @JsonProperty("state")
+ private String state;
+ @JsonProperty("disk_available_least")
+ private Integer diskAvailableLeast;
+ @JsonProperty("host_ip")
+ private String hostIp;
+ @JsonProperty("free_disk_gb")
+ private Integer freeDiskGb;
+ @JsonProperty("free_ram_mb")
+ private Integer freeRamMb;
+ @JsonProperty("hypervisor_hostname")
+ private String hypervisorHostname;
+ @JsonProperty("hypervisor_type")
+ private String hypervisorType;
+ @JsonProperty("hypervisor_version")
+ private Integer hypervisorVersion;
+ @JsonProperty("id")
+ private Integer id;
+ @JsonProperty("local_gb")
+ private Integer localGb;
+ @JsonProperty("local_gb_used")
+ private Integer localGbUsed;
+ @JsonProperty("memory_mb")
+ private Integer memoryMb;
+ @JsonProperty("memory_mb_used")
+ private Integer memoryMbUsed;
+ @JsonProperty("running_vms")
+ private Integer runningVms;
+ @JsonProperty("service")
+ private Service service;
+ @JsonProperty("vcpus")
+ private Integer vcpus;
+ @JsonProperty("vcpus_used")
+ private Integer vcpusUsed;
+
+ @JsonProperty("cpu_info")
+ public CpuInfo getCpuInfo() {
+ return cpuInfo;
+ }
+
+ @JsonProperty("cpu_info")
+ public void setCpuInfo(CpuInfo cpuInfo) {
+ this.cpuInfo = cpuInfo;
+ }
+
+ @JsonProperty("current_workload")
+ public Integer getCurrentWorkload() {
+ return currentWorkload;
+ }
+
+ @JsonProperty("current_workload")
+ public void setCurrentWorkload(Integer currentWorkload) {
+ this.currentWorkload = currentWorkload;
+ }
+
+ @JsonProperty("status")
+ public String getStatus() {
+ return status;
+ }
+
+ @JsonProperty("status")
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ @JsonProperty("state")
+ public String getState() {
+ return state;
+ }
+
+ @JsonProperty("state")
+ public void setState(String state) {
+ this.state = state;
+ }
+
+ @JsonProperty("disk_available_least")
+ public Integer getDiskAvailableLeast() {
+ return diskAvailableLeast;
+ }
+
+ @JsonProperty("disk_available_least")
+ public void setDiskAvailableLeast(Integer diskAvailableLeast) {
+ this.diskAvailableLeast = diskAvailableLeast;
+ }
+
+ @JsonProperty("host_ip")
+ public String getHostIp() {
+ return hostIp;
+ }
+
+ @JsonProperty("host_ip")
+ public void setHostIp(String hostIp) {
+ this.hostIp = hostIp;
+ }
+
+ @JsonProperty("free_disk_gb")
+ public Integer getFreeDiskGb() {
+ return freeDiskGb;
+ }
+
+ @JsonProperty("free_disk_gb")
+ public void setFreeDiskGb(Integer freeDiskGb) {
+ this.freeDiskGb = freeDiskGb;
+ }
+
+ @JsonProperty("free_ram_mb")
+ public Integer getFreeRamMb() {
+ return freeRamMb;
+ }
+
+ @JsonProperty("free_ram_mb")
+ public void setFreeRamMb(Integer freeRamMb) {
+ this.freeRamMb = freeRamMb;
+ }
+
+ @JsonProperty("hypervisor_hostname")
+ public String getHypervisorHostname() {
+ return hypervisorHostname;
+ }
+
+ @JsonProperty("hypervisor_hostname")
+ public void setHypervisorHostname(String hypervisorHostname) {
+ this.hypervisorHostname = hypervisorHostname;
+ }
+
+ @JsonProperty("hypervisor_type")
+ public String getHypervisorType() {
+ return hypervisorType;
+ }
+
+ @JsonProperty("hypervisor_type")
+ public void setHypervisorType(String hypervisorType) {
+ this.hypervisorType = hypervisorType;
+ }
+
+ @JsonProperty("hypervisor_version")
+ public Integer getHypervisorVersion() {
+ return hypervisorVersion;
+ }
+
+ @JsonProperty("hypervisor_version")
+ public void setHypervisorVersion(Integer hypervisorVersion) {
+ this.hypervisorVersion = hypervisorVersion;
+ }
+
+ @JsonProperty("id")
+ public Integer getId() {
+ return id;
+ }
+
+ @JsonProperty("id")
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ @JsonProperty("local_gb")
+ public Integer getLocalGb() {
+ return localGb;
+ }
+
+ @JsonProperty("local_gb")
+ public void setLocalGb(Integer localGb) {
+ this.localGb = localGb;
+ }
+
+ @JsonProperty("local_gb_used")
+ public Integer getLocalGbUsed() {
+ return localGbUsed;
+ }
+
+ @JsonProperty("local_gb_used")
+ public void setLocalGbUsed(Integer localGbUsed) {
+ this.localGbUsed = localGbUsed;
+ }
+
+ @JsonProperty("memory_mb")
+ public Integer getMemoryMb() {
+ return memoryMb;
+ }
+
+ @JsonProperty("memory_mb")
+ public void setMemoryMb(Integer memoryMb) {
+ this.memoryMb = memoryMb;
+ }
+
+ @JsonProperty("memory_mb_used")
+ public Integer getMemoryMbUsed() {
+ return memoryMbUsed;
+ }
+
+ @JsonProperty("memory_mb_used")
+ public void setMemoryMbUsed(Integer memoryMbUsed) {
+ this.memoryMbUsed = memoryMbUsed;
+ }
+
+ @JsonProperty("running_vms")
+ public Integer getRunningVms() {
+ return runningVms;
+ }
+
+ @JsonProperty("running_vms")
+ public void setRunningVms(Integer runningVms) {
+ this.runningVms = runningVms;
+ }
+
+ @JsonProperty("service")
+ public Service getService() {
+ return service;
+ }
+
+ @JsonProperty("service")
+ public void setService(Service service) {
+ this.service = service;
+ }
+
+ @JsonProperty("vcpus")
+ public Integer getVcpus() {
+ return vcpus;
+ }
+
+ @JsonProperty("vcpus")
+ public void setVcpus(Integer vcpus) {
+ this.vcpus = vcpus;
+ }
+
+ @JsonProperty("vcpus_used")
+ public Integer getVcpusUsed() {
+ return vcpusUsed;
+ }
+
+ @JsonProperty("vcpus_used")
+ public void setVcpusUsed(Integer vcpusUsed) {
+ this.vcpusUsed = vcpusUsed;
+ }
+}
diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Hypervisors.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Hypervisors.java
new file mode 100644
index 0000000..c75d871
--- /dev/null
+++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Hypervisors.java
@@ -0,0 +1,60 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package com.woorea.openstack.nova.model;
+
+import java.io.Serializable;
+import java.util.Iterator;
+import java.util.List;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+
+public class Hypervisors implements Iterable<Hypervisor>, Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 3609243147419561496L;
+
+ @JsonProperty("hypervisors")
+ private List<Hypervisor> list;
+
+ @JsonProperty("hypervisors_links")
+ private List<Link> links;
+
+ /**
+ * @return the list
+ */
+ public List<Hypervisor> getList() {
+ return list;
+ }
+
+ @Override
+ public Iterator<Hypervisor> iterator() {
+ return list.iterator();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return "Hypervisor [list=" + list + "]";
+ }
+
+}
diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Service.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Service.java
new file mode 100644
index 0000000..f1aeb14
--- /dev/null
+++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Service.java
@@ -0,0 +1,79 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package com.woorea.openstack.nova.model;
+
+import java.util.HashMap;
+import java.util.Map;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class Service {
+
+ @JsonProperty("host")
+ private String host;
+ @JsonProperty("id")
+ private Integer id;
+ @JsonProperty("disabled_reason")
+ private Object disabledReason;
+ @JsonIgnore
+ private Map<String, Object> additionalProperties = new HashMap<String, Object>();
+
+ @JsonProperty("host")
+ public String getHost() {
+ return host;
+ }
+
+ @JsonProperty("host")
+ public void setHost(String host) {
+ this.host = host;
+ }
+
+ @JsonProperty("id")
+ public Integer getId() {
+ return id;
+ }
+
+ @JsonProperty("id")
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ @JsonProperty("disabled_reason")
+ public Object getDisabledReason() {
+ return disabledReason;
+ }
+
+ @JsonProperty("disabled_reason")
+ public void setDisabledReason(Object disabledReason) {
+ this.disabledReason = disabledReason;
+ }
+
+ @JsonAnyGetter
+ public Map<String, Object> getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ @JsonAnySetter
+ public void setAdditionalProperty(String name, Object value) {
+ this.additionalProperties.put(name, value);
+ }
+
+}
diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/Topology.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/Topology.java
new file mode 100644
index 0000000..c083357
--- /dev/null
+++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/Topology.java
@@ -0,0 +1,79 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package com.woorea.openstack.nova.model;
+
+import java.util.HashMap;
+import java.util.Map;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class Topology {
+
+ @JsonProperty("cores")
+ private Integer cores;
+ @JsonProperty("threads")
+ private Integer threads;
+ @JsonProperty("sockets")
+ private Integer sockets;
+ @JsonIgnore
+ private Map<String, Object> additionalProperties = new HashMap<String, Object>();
+
+ @JsonProperty("cores")
+ public Integer getCores() {
+ return cores;
+ }
+
+ @JsonProperty("cores")
+ public void setCores(Integer cores) {
+ this.cores = cores;
+ }
+
+ @JsonProperty("threads")
+ public Integer getThreads() {
+ return threads;
+ }
+
+ @JsonProperty("threads")
+ public void setThreads(Integer threads) {
+ this.threads = threads;
+ }
+
+ @JsonProperty("sockets")
+ public Integer getSockets() {
+ return sockets;
+ }
+
+ @JsonProperty("sockets")
+ public void setSockets(Integer sockets) {
+ this.sockets = sockets;
+ }
+
+ @JsonAnyGetter
+ public Map<String, Object> getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ @JsonAnySetter
+ public void setAdditionalProperty(String name, Object value) {
+ this.additionalProperties.put(name, value);
+ }
+
+}
diff --git a/pom.xml b/pom.xml
index 8ca6378..b194098 100644
--- a/pom.xml
+++ b/pom.xml
@@ -174,6 +174,16 @@
<artifactId>jackson-databind</artifactId>
<version>2.9.8</version>
</dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-core</artifactId>
+ <version>2.9.8</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-annotations</artifactId>
+ <version>2.9.8</version>
+ </dependency>
</dependencies>
<reporting>
<plugins>
diff --git a/version.properties b/version.properties
index 825dd23..33b298d 100644
--- a/version.properties
+++ b/version.properties
@@ -5,7 +5,7 @@
major_version=1
minor_version=5
-sprint_number=1
+sprint_number=2
base_version=${major_version}.${minor_version}.${sprint_number}