mirror of https://github.com/apache/jclouds.git
Support availability zone in NovaTemplateOptions.
This commit is contained in:
parent
2c790c897e
commit
cf95033b1a
|
@ -109,6 +109,7 @@ public class NovaComputeServiceAdapter implements
|
|||
options.userData(templateOptions.getUserData());
|
||||
options.diskConfig(templateOptions.getDiskConfig());
|
||||
options.configDrive(templateOptions.getConfigDrive());
|
||||
options.availabilityZone(templateOptions.getAvailabilityZone());
|
||||
if (templateOptions.getNovaNetworks() != null) {
|
||||
options.novaNetworks(templateOptions.getNovaNetworks());
|
||||
}
|
||||
|
|
|
@ -78,6 +78,7 @@ public class NovaTemplateOptions extends TemplateOptions implements Cloneable {
|
|||
|
||||
eTo.configDrive(getConfigDrive());
|
||||
eTo.novaNetworks(getNovaNetworks());
|
||||
eTo.availabilityZone(getAvailabilityZone());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -89,6 +90,7 @@ public class NovaTemplateOptions extends TemplateOptions implements Cloneable {
|
|||
protected String diskConfig;
|
||||
protected boolean configDrive;
|
||||
protected Set<Network> novaNetworks;
|
||||
protected String availabilityZone;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
|
@ -104,12 +106,14 @@ public class NovaTemplateOptions extends TemplateOptions implements Cloneable {
|
|||
&& Arrays.equals(this.userData, that.userData)
|
||||
&& equal(this.diskConfig, that.diskConfig)
|
||||
&& equal(this.configDrive, that.configDrive)
|
||||
&& equal(this.novaNetworks, that.novaNetworks);
|
||||
&& equal(this.novaNetworks, that.novaNetworks)
|
||||
&& equal(this.availabilityZone, that.availabilityZone);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(super.hashCode(), autoAssignFloatingIp, floatingIpPoolNames, generateKeyPair, keyPairName, userData, diskConfig, configDrive, novaNetworks);
|
||||
return Objects.hashCode(super.hashCode(), autoAssignFloatingIp, floatingIpPoolNames, generateKeyPair, keyPairName,
|
||||
userData, diskConfig, configDrive, novaNetworks, availabilityZone);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -126,6 +130,7 @@ public class NovaTemplateOptions extends TemplateOptions implements Cloneable {
|
|||
toString.add("diskConfig", diskConfig);
|
||||
toString.add("configDrive", configDrive);
|
||||
toString.add("novaNetworks", novaNetworks);
|
||||
toString.add("availabilityZone", availabilityZone);
|
||||
return toString;
|
||||
}
|
||||
|
||||
|
@ -206,6 +211,14 @@ public class NovaTemplateOptions extends TemplateOptions implements Cloneable {
|
|||
return autoAssignFloatingIp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see CreateServerOptions#getAvailabilityZone()
|
||||
*/
|
||||
public NovaTemplateOptions availabilityZone(String availabilityZone) {
|
||||
this.availabilityZone = availabilityZone;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The floating IP pool name(s) to use when allocating a FloatingIP. Applicable
|
||||
* only if #shouldAutoAssignFloatingIp() returns true. If not set will attempt to
|
||||
|
@ -275,6 +288,13 @@ public class NovaTemplateOptions extends TemplateOptions implements Cloneable {
|
|||
return novaNetworks;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see CreateServerOptions#getAvailabilityZone()
|
||||
*/
|
||||
public String getAvailabilityZone() {
|
||||
return availabilityZone;
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
|
||||
/**
|
||||
|
@ -467,6 +487,14 @@ public class NovaTemplateOptions extends TemplateOptions implements Cloneable {
|
|||
NovaTemplateOptions options = new NovaTemplateOptions();
|
||||
return NovaTemplateOptions.class.cast(options.novaNetworks(novaNetworks));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see NovaTemplateOptions#getAvailabilityZone()
|
||||
*/
|
||||
public static NovaTemplateOptions availabilityZone(String availabilityZone) {
|
||||
NovaTemplateOptions options = new NovaTemplateOptions();
|
||||
return options.availabilityZone(availabilityZone);
|
||||
}
|
||||
}
|
||||
|
||||
// methods that only facilitate returning the correct object type
|
||||
|
|
|
@ -345,6 +345,11 @@ public class CreateServerOptions implements MapBinder {
|
|||
return keyName;
|
||||
}
|
||||
|
||||
/**
|
||||
* The availability zone in which to launch the server.
|
||||
*
|
||||
* @return the availability zone to be used
|
||||
*/
|
||||
public String getAvailabilityZone() {
|
||||
return availabilityZone;
|
||||
}
|
||||
|
|
|
@ -195,6 +195,13 @@ public class NovaTemplateOptionsTest {
|
|||
assertEquals(new String(options.getUserData()), "test");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAvailabilityZone() {
|
||||
NovaTemplateOptions options = new NovaTemplateOptions();
|
||||
options.availabilityZone("nova");
|
||||
assertEquals(options.getAvailabilityZone(), "nova");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDiskConfig() {
|
||||
NovaTemplateOptions options = new NovaTemplateOptions();
|
||||
|
|
Loading…
Reference in New Issue