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