From 0a1b01b8b7802ddaa7e0a22f487b62521769591d Mon Sep 17 00:00:00 2001 From: venkat-cliqr Date: Mon, 14 Oct 2013 09:33:08 -0700 Subject: [PATCH 1/4] Fixed missing leading slash for ExtensionsResource --- .../java/com/woorea/openstack/nova/api/ExtensionsResource.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/ExtensionsResource.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/ExtensionsResource.java index 46e16c440..73761d664 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/api/ExtensionsResource.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/ExtensionsResource.java @@ -21,7 +21,7 @@ public List list(boolean detail) { public class List extends OpenStackRequest { public List(boolean detail) { - super(CLIENT, HttpMethod.GET, detail ? "extensions/detail" : "extensions", null, Extensions.class); + super(CLIENT, HttpMethod.GET, detail ? "/extensions/detail" : "/extensions", null, Extensions.class); } } From 2ac6aa48600420e02557b096d118bb18a067cd97 Mon Sep 17 00:00:00 2001 From: venkat-cliqr Date: Tue, 8 Jul 2014 08:47:39 -0700 Subject: [PATCH 2/4] Fixex min and max count properties --- .../openstack/nova/model/ServerForCreate.java | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/ServerForCreate.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/ServerForCreate.java index 9f28a8113..6b6d8b3a2 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/ServerForCreate.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/ServerForCreate.java @@ -38,6 +38,49 @@ public void setName(String name) { this.name = name; } + } + + public static final class BlockDeviceMapping implements Serializable { + + @JsonProperty("device_name") + private String deviceName; + + @JsonProperty("volume_id") + private String volumeId; + + @JsonProperty("delete_on_termination") + private boolean deleteOnTermination; + + public BlockDeviceMapping() { + } + + public String getDeviceName() { + return deviceName; + } + + public void setDeviceName(String deviceName) { + this.deviceName = deviceName; + } + + public String getVolumeId() { + return volumeId; + } + + public void setVolumeId(String volumeId) { + this.volumeId = volumeId; + } + + public boolean isDeleteOnTermination() { + return deleteOnTermination; + } + + public void setDeleteOnTermination(boolean deleteOnTermination) { + this.deleteOnTermination = deleteOnTermination; + } + + + + } private String name; @@ -52,8 +95,10 @@ public void setName(String name) { private String accessIPv6; + @JsonProperty("min_count") private Integer min; + @JsonProperty("max_count") private Integer max; private String diskConfig; @@ -79,6 +124,9 @@ public void setName(String name) { @JsonProperty("networks") private List networks = new ArrayList(); + + @JsonProperty("block_device_mapping") + private List blockDeviceMappings; /** * @return the name @@ -316,11 +364,21 @@ public void setNetworks(List networks) { this.networks = networks; } + public void addNetworks(String id, String fixedIp) { NetworkForCreate net = new NetworkForCreate(); net.setId(id); net.setFixedIp(fixedIp); this.networks.add(net); } + + public List getBlockDeviceMappings() { + return blockDeviceMappings; + } + + public void setBlockDeviceMappings(List blockDeviceMappings) { + this.blockDeviceMappings = blockDeviceMappings; + } + } From 61059fdd394c9a191df2fc41bace457748b3395e Mon Sep 17 00:00:00 2001 From: venkat-cliqr Date: Wed, 11 Mar 2015 10:44:06 -0700 Subject: [PATCH 3/4] Added apis to add and remove security groups on existing instances --- .../openstack/nova/api/ServersResource.java | 27 ++++++++ .../openstack/nova/model/ServerAction.java | 65 +++++++++++++++++++ 2 files changed, 92 insertions(+) diff --git a/nova-client/src/main/java/com/woorea/openstack/nova/api/ServersResource.java b/nova-client/src/main/java/com/woorea/openstack/nova/api/ServersResource.java index ca48b6fc4..9db068e90 100644 --- a/nova-client/src/main/java/com/woorea/openstack/nova/api/ServersResource.java +++ b/nova-client/src/main/java/com/woorea/openstack/nova/api/ServersResource.java @@ -536,6 +536,33 @@ public ListVolumeAttachments listVolumeAttachments(String serverId) { public ShowVolumeAttachment showVolumeAttachment(String serverId, String volumeAttachmentId) { return new ShowVolumeAttachment(serverId, volumeAttachmentId); } + + public class AddSecurityGroup extends OpenStackRequest { + + public AddSecurityGroup(String id, com.woorea.openstack.nova.model.ServerAction.AddSecurityGroup action) { + super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(action), Void.class); + } + + } + + public class RemoveSecurityGroup extends OpenStackRequest { + + public RemoveSecurityGroup(String id, com.woorea.openstack.nova.model.ServerAction.RemoveSecurityGroup action) { + super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(id).append("/action"), Entity.json(action), Void.class); + } + + } + + public AddSecurityGroup addSecurityGroup(String serverId, String securityGroupName) { + com.woorea.openstack.nova.model.ServerAction.AddSecurityGroup securityGroupAddAction = new com.woorea.openstack.nova.model.ServerAction.AddSecurityGroup(securityGroupName); + return new AddSecurityGroup(serverId, securityGroupAddAction); + } + + public RemoveSecurityGroup removeSecurityGroup(String serverId, String securityGroupName) { + com.woorea.openstack.nova.model.ServerAction.RemoveSecurityGroup securityGroupRemoveAction = new com.woorea.openstack.nova.model.ServerAction.RemoveSecurityGroup(securityGroupName); + return new RemoveSecurityGroup(serverId, securityGroupRemoveAction); + } + } diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/ServerAction.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/ServerAction.java index 26fa5a4a6..f2147d5d1 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/ServerAction.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/ServerAction.java @@ -607,4 +607,69 @@ public void setMetadata(Map metadata) { } + @JsonRootName("addSecurityGroup") + public static final class AddSecurityGroup implements ServerAction { + + private String name; + + public AddSecurityGroup() { + super(); + // TODO Auto-generated constructor stub + } + + public AddSecurityGroup(String securityGroupName) { + super(); + this.name = securityGroupName; + } + + + + /** + * @return the security group name + */ + public String getName() { + return name; + } + + /** + * @param name the security group name to set + */ + public void setName(String name) { + this.name = name; + } + + } + + @JsonRootName("removeSecurityGroup") + public static final class RemoveSecurityGroup implements ServerAction { + + private String name; + + public RemoveSecurityGroup() { + super(); + } + + public RemoveSecurityGroup(String securityGroupName) { + super(); + this.name = securityGroupName; + } + + + + /** + * @return the security group name + */ + public String getName() { + return name; + } + + /** + * @param name the security group name to set + */ + public void setName(String name) { + this.name = name; + } + + } + } From 243ba606672eadece7020246df951b1385fdafd0 Mon Sep 17 00:00:00 2001 From: venkat-cliqr Date: Mon, 30 Mar 2015 15:13:31 -0700 Subject: [PATCH 4/4] Added portid support for attaching network ports instead of networkids --- .../openstack/nova/model/NetworkForCreate.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/nova-model/src/main/java/com/woorea/openstack/nova/model/NetworkForCreate.java b/nova-model/src/main/java/com/woorea/openstack/nova/model/NetworkForCreate.java index f5785393b..f0501d01d 100644 --- a/nova-model/src/main/java/com/woorea/openstack/nova/model/NetworkForCreate.java +++ b/nova-model/src/main/java/com/woorea/openstack/nova/model/NetworkForCreate.java @@ -9,6 +9,9 @@ public class NetworkForCreate { private String id; @JsonProperty("fixed_ip") private String fixedIp; + @JsonProperty("port") + private String portId; + public String getId() { return id; @@ -26,4 +29,14 @@ public void setFixedIp(String fixedIp) { this.fixedIp = fixedIp; } + public String getPortId() { + return portId; + } + + public void setPortId(String portId) { + this.portId = portId; + } + + + }