Permalink
Browse files

Merge remote-tracking branch 'origin/testing' into dev/juphoff/migration

Conflicts:
	node/handlers.c
	node/handlers_kvm.c
  • Loading branch information...
juphoff committed May 8, 2013
2 parents cf66456 + e538727 commit cf0fd715e3a5090c154ece9228a40567bf6c3883
Showing with 11,422 additions and 1,805 deletions.
  1. +1 −0 .gitignore
  2. +14 −7 clc/.classpath
  3. +2 −1 ...ules/autoscaling/src/main/java/com/eucalyptus/autoscaling/configurations/LaunchConfiguration.java
  4. +1 −0 clc/modules/cluster-manager/src/main/java/com/eucalyptus/blockstorage/SnapshotManager.java
  5. +0 −22 clc/modules/cluster-manager/src/main/java/com/eucalyptus/vm/VmBootRecord.java
  6. +3 −3 clc/modules/cluster-manager/src/main/java/com/eucalyptus/vm/VmInstances.java
  7. +13 −0 clc/modules/core/src/main/java/edu/ucsb/eucalyptus/cloud/entities/LVMVolumeInfo.java
  8. +34 −57 clc/modules/core/src/main/java/edu/ucsb/eucalyptus/cloud/entities/VolumeInfo.java
  9. +30 −1 clc/modules/core/src/main/java/edu/ucsb/eucalyptus/cloud/entities/VolumeToken.java
  10. +9 −1 clc/modules/core/src/main/java/edu/ucsb/eucalyptus/util/SystemUtil.java
  11. +2 −2 clc/modules/dns/src/main/java/com/eucalyptus/cloud/ws/DNSControl.java
  12. +27 −0 clc/modules/dns/src/main/java/com/eucalyptus/cloud/ws/ZoneManager.java
  13. +0 −3 clc/modules/loadbalancing/src/main/java/com/eucalyptus/loadbalancing/LoadBalancer.java
  14. +66 −7 ...modules/loadbalancing/src/main/java/com/eucalyptus/loadbalancing/LoadBalancerBackendInstance.java
  15. +3 −0 clc/modules/loadbalancing/src/main/java/com/eucalyptus/loadbalancing/LoadBalancerCwatchMetrics.java
  16. +31 −3 clc/modules/loadbalancing/src/main/java/com/eucalyptus/loadbalancing/LoadBalancers.java
  17. +56 −49 clc/modules/loadbalancing/src/main/java/com/eucalyptus/loadbalancing/LoadBalancingService.java
  18. +32 −0 .../loadbalancing/src/main/java/com/eucalyptus/loadbalancing/activities/EventHandlerChainDelete.java
  19. +25 −3 ...balancing/src/main/java/com/eucalyptus/loadbalancing/activities/EventHandlerChainDisableZone.java
  20. +69 −0 ...dbalancing/src/main/java/com/eucalyptus/loadbalancing/activities/EventHandlerChainEnableZone.java
  21. +36 −7 ...les/loadbalancing/src/main/java/com/eucalyptus/loadbalancing/activities/EventHandlerChainNew.java
  22. +3 −0 ...alancing/src/main/java/com/eucalyptus/loadbalancing/activities/EventHandlerChainNewListeners.java
  23. +181 −0 ...oadbalancing/src/main/java/com/eucalyptus/loadbalancing/activities/LoadBalancerServoInstance.java
  24. +96 −0 clc/modules/msgs/src/main/java/com/eucalyptus/crypto/util/BCSslSetup.java
  25. +1 −0 clc/modules/msgs/src/main/java/com/eucalyptus/crypto/util/SslSetup.java
  26. +17 −16 clc/modules/msgs/src/main/java/com/eucalyptus/ws/protocol/SoapHandler.java
  27. +3 −1 clc/modules/msgs/src/main/java/com/eucalyptus/ws/server/ServiceContextHandler.java
  28. +4 −0 clc/modules/msgs/src/main/java/edu/ucsb/eucalyptus/msgs/Walrus.groovy
  29. +422 −0 clc/modules/msgs/src/main/java/generate-xsd.groovy
  30. +36 −0 clc/modules/msgs/src/test/java/com/eucalyptus/crypto/util/BCSslSetupTest.java
  31. +42 −22 clc/modules/msgs/src/test/java/com/eucalyptus/reporting/event/ReportingEventTest.java
  32. +28 −10 ...rting/src/test/java/com/eucalyptus/reporting/modules/address/AddressUsageEventListenerTest.groovy
  33. +62 −72 clc/modules/storage-controller/src/main/java/com/eucalyptus/storage/DASManager.java
  34. +138 −230 clc/modules/storage-controller/src/main/java/com/eucalyptus/storage/ISCSIManager.java
  35. +0 −1 clc/modules/storage-controller/src/main/java/com/eucalyptus/storage/LogicalStorageManager.java
  36. +78 −111 clc/modules/storage-controller/src/main/java/com/eucalyptus/storage/OverlayManager.java
  37. +677 −0 clc/modules/storage-controller/src/main/java/com/eucalyptus/storage/TGTWrapper.java
  38. +0 −109 clc/modules/storage-controller/src/main/java/com/eucalyptus/storage/VolumeExports.java
  39. +114 −66 clc/modules/storage-controller/src/main/java/edu/ucsb/eucalyptus/cloud/ws/BlockStorage.java
  40. +22 −0 ...les/storage-controller/src/test/java/com/eucalyptus/storage/tests/LogicalStorageManagerTests.java
  41. +289 −0 clc/modules/storage-controller/src/test/java/com/eucalyptus/storage/tests/NoOpStorageManager.java
  42. +277 −0 ...age-controller/src/test/java/com/eucalyptus/storage/tests/ProbabalisticFailureStorageManager.java
  43. +42 −0 ...ules/storage-controller/src/test/java/com/eucalyptus/storage/tests/StorageExportManagerTests.java
  44. +32 −0 clc/modules/storage-controller/src/test/java/com/eucalyptus/storage/tests/VolumeTokensTests.java
  45. +5 −0 ...modules/storage-controller/src/test/java/edu/ucsb/eucalyptus/cloud/ws/tests/BlockStorageTest.java
  46. +0 −3 clc/modules/walrus/src/main/java/edu/ucsb/eucalyptus/cloud/ws/WalrusManager.java
  47. +5 −0 cluster/handlers.c
  48. +1 −2 console/euca-console-server
  49. +5 −1 console/eucaconsole/botoclcinterface.py
  50. +10 −6 console/eucaconsole/cachingclcinterface.py
  51. +31 −29 console/static/css/eucalyptus.css
  52. +4 −0 console/static/custom/Messages.properties
  53. +2,022 −1 console/static/custom/Messages_FI.properties
  54. +721 −18 console/static/custom/Messages_es_ES.properties
  55. +725 −16 console/static/custom/Messages_fi_FI.properties
  56. +725 −18 console/static/custom/Messages_fr_FR.properties
  57. +725 −18 console/static/custom/Messages_it_IT.properties
  58. +725 −18 console/static/custom/Messages_ja.properties
  59. +725 −18 console/static/custom/Messages_ko_KR.properties
  60. +725 −18 console/static/custom/Messages_ru.properties
  61. +725 −16 console/static/custom/Messages_zh_CN.properties
  62. +1 −1 console/static/help/en/console_create_instances.html
  63. +1 −0 console/static/index.html
  64. +1 −1 console/static/js/dashboard.js
  65. +39 −29 console/static/js/image.js
  66. +1 −0 console/static/js/instance.js
  67. +6 −6 console/static/js/launcher.js
  68. +1 −1 console/static/js/models/tag.js
  69. +1 −1 console/static/js/models/volume.js
  70. +17 −3 console/static/js/newinstance.js
  71. +8 −2 console/static/js/sgroup.js
  72. +4 −1 console/static/js/snapshot.js
  73. +1 −1 console/static/js/support.js
  74. +14 −5 console/static/js/template/eucatable.js
  75. +1 −2 console/static/js/views/dialogs/attach_volume_dialog.html
  76. +32 −19 console/static/js/views/dialogs/attach_volume_dialog.js
  77. +1 −1 console/static/js/views/dialogs/create_security_group.html
  78. +1 −1 console/static/js/views/dialogs/create_snapshot_dialog.html
  79. +23 −2 console/static/js/views/dialogs/create_snapshot_dialog.js
  80. +1 −1 console/static/js/views/dialogs/create_volume_dialog.html
  81. +13 −18 console/static/js/views/dialogs/create_volume_dialog.js
  82. +19 −4 console/static/js/views/dialogs/delete_snapshot_dialog.js
  83. +9 −5 console/static/js/views/dialogs/delete_volume_dialog.js
  84. +11 −6 console/static/js/views/dialogs/detach_volume_dialog.js
  85. +9 −0 console/static/js/views/dialogs/eucadialogview.js
  86. +2 −2 console/static/js/views/dialogs/register_snapshot_dialog.html
  87. +7 −2 console/static/js/views/dialogs/register_snapshot_dialog.js
  88. +0 −22 console/static/js/views/eantest/index.js
  89. +0 −36 console/static/js/views/eantest/template.html
  90. +22 −21 console/static/js/views/expandos/image.html
  91. +2 −2 console/static/js/views/expandos/image.js
  92. +1 −2 console/static/js/views/expandos/instance.html
  93. +25 −27 console/static/js/views/expandos/sgroup.html
  94. +1 −1 console/static/js/views/expandos/snapshot.html
  95. +1 −2 console/static/js/views/expandos/volume.html
  96. +8 −0 console/static/js/views/newinstance/template.html
  97. +0 −234 console/static/js/views/rivetstest/index.js
  98. +0 −4 console/static/js/views/rivetstest/leaktemplate.html
  99. +0 −18 console/static/js/views/rivetstest/leaktest.js
  100. +0 −102 console/static/js/views/rivetstest/template.html
  101. +2 −2 console/static/js/views/shared/advanced.js
  102. +2 −1 console/static/js/views/shared/security.js
  103. +5 −2 console/static/js/views/shared/type.html
  104. +2 −0 console/static/js/views/ui/button/index.js
  105. +1 −1 console/static/js/views/ui/button/template.html
  106. +51 −70 console/static/js/views/ui/edittags/index.js
  107. +5 −13 console/static/js/views/ui/edittags/template.html
  108. +4 −3 console/static/lib/rivetsbase.js
  109. +1 −0 gatherlog/handlers.c
  110. +6 −6 net/vnetwork.c
  111. +2 −1 node/handlers.h
  112. +53 −16 node/handlers_default.c
  113. +17 −77 node/handlers_kvm.c
  114. +4 −3 storage/blobstore.c
  115. +25 −17 storage/ebs_utils.c
  116. +0 −1 storage/ebs_utils.h
  117. +59 −20 storage/vbr.c
  118. +1 −0 tools/iscsitarget_common.pl
  119. +1 −1 util/adb-helpers.h
View
@@ -52,6 +52,7 @@ clc/modules/www/test-gwt/*
clc/modules/www/test-gwt/war/*
clc/modules/www/test-gwt/war/WEB-INF/*
clc/modules/www/webapps
+clc/modules/www/gwt-unitCache/
clc/target
config.log
config.status
View
@@ -1,6 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="modules/autoscaling/build" path="modules/autoscaling/src/main/java"/>
+ <classpathentry kind="src" path="modules/storage-controller/src/test/java"/>
+ <classpathentry kind="src" path="modules/bootstrap/src/test/java"/>
+ <classpathentry kind="src" path="modules/datawarehouse/src/test/java"/>
+ <classpathentry kind="src" path="modules/authentication/src/main/java"/>
+ <classpathentry kind="src" path="modules/bootstrap/src/main/java"/>
+ <classpathentry kind="src" path="modules/authentication/src/test/java"/>
<classpathentry kind="src" output="modules/autoscaling-common/build" path="modules/autoscaling-common/src/main/java"/>
<classpathentry kind="src" output="modules/cloud/build" path="modules/cloud/src/main/java"/>
<classpathentry kind="src" output="modules/cloudwatch/build" path="modules/cloudwatch/src/main/java"/>
@@ -87,12 +93,6 @@
<classpathentry kind="lib" path="lib/groovy-all-1.7.2.jar" sourcepath="/git/third-party/groovy-1.7.1"/>
<classpathentry kind="lib" path="lib/guava-14.0.1-gwt.jar"/>
<classpathentry kind="lib" path="lib/guava-14.0.1.jar"/>
- <classpathentry kind="lib" path="lib/gwt-api-checker-2.2.jar"/>
- <classpathentry kind="lib" path="lib/gwt-dev-2.2.jar"/>
- <classpathentry kind="lib" path="lib/gwt-servlet-2.2.jar"/>
- <classpathentry kind="lib" path="lib/gwt-servlet-deps-2.2.jar"/>
- <classpathentry kind="lib" path="lib/gwt-soyc-vis-2.2.jar"/>
- <classpathentry kind="lib" path="lib/gwt-user-2.2.jar"/>
<classpathentry kind="lib" path="lib/ha-jdbc-2.0.16-rc-1-jdk1.6.jar" sourcepath="/git/third-party/ha-jdbc-2.0.16-rc-1"/>
<classpathentry kind="lib" path="lib/hamcrest-all-1.2.jar"/>
<classpathentry kind="lib" path="lib/hibernate-3.5.6-Final.jar"/>
@@ -143,7 +143,6 @@
<classpathentry kind="lib" path="lib/jul-to-slf4j-1.5.2.jar"/>
<classpathentry kind="lib" path="lib/junit-4.11.jar"/>
<classpathentry kind="lib" path="lib/kahadb-5.4.1.jar"/>
- <classpathentry kind="lib" path="lib/log4j-1.2.15.jar"/>
<classpathentry kind="lib" path="lib/manageontap.jar"/>
<classpathentry kind="lib" path="lib/mule-core-2.0.1.jar"/>
<classpathentry kind="lib" path="lib/mule-module-builders-2.0.1.jar"/>
@@ -185,5 +184,13 @@
<classpathentry kind="lib" path="lib/xmlsec-1.4.7.jar"/>
<classpathentry kind="lib" path="lib/xom-1.2.9.jar"/>
<classpathentry kind="lib" path="lib/xpp3-1.1.4c.jar"/>
+ <classpathentry kind="lib" path="lib/gwt-api-checker-2.4.jar"/>
+ <classpathentry kind="lib" path="lib/gwt-dev-2.4.jar"/>
+ <classpathentry kind="lib" path="lib/gwt-servlet-2.4.jar"/>
+ <classpathentry kind="lib" path="lib/gwt-servlet-deps-2.4.jar"/>
+ <classpathentry kind="lib" path="lib/gwt-soyc-vis-2.4.jar"/>
+ <classpathentry kind="lib" path="lib/gwt-user-2.4.jar"/>
+ <classpathentry kind="lib" path="lib/log4j-1.2.17.jar"/>
+ <classpathentry kind="lib" path="lib/validation-api-1.0.0.GA.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
@@ -37,6 +37,7 @@
import org.hibernate.annotations.Type;
import com.eucalyptus.autoscaling.metadata.AbstractOwnedPersistent;
import com.eucalyptus.util.OwnerFullName;
+import com.google.common.base.Objects;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
@@ -319,7 +320,7 @@ protected LaunchConfiguration build() {
configuration.setRamdiskId( ramdiskId );
configuration.setKeyName( keyName );
configuration.setUserData( userData );
- configuration.setInstanceMonitoring( instanceMonitoring );
+ configuration.setInstanceMonitoring( Objects.firstNonNull( instanceMonitoring, Boolean.TRUE ) );
configuration.setIamInstanceProfile( iamInstanceProfile );
configuration.setSecurityGroups( Lists.newArrayList( securityGroups ) );
configuration.setBlockDeviceMappings( Lists.newArrayList( blockDeviceMappings ) );
@@ -256,6 +256,7 @@ public boolean apply( ServiceConfiguration arg0 ) {
public DescribeSnapshotsResponseType describe( final DescribeSnapshotsType request ) throws EucalyptusCloudException {
final DescribeSnapshotsResponseType reply = ( DescribeSnapshotsResponseType ) request.getReply( );
+ if(!request.getRestorableBySet().isEmpty()) { return reply; } //TODO:KEN EUCA-5759 Need to implement RestorableBy, for now ignore
final Context ctx = Contexts.lookup( );
final boolean showAll = request.getSnapshotSet( ).remove( "verbose" );
final AccountFullName ownerFullName = ( ctx.hasAdministrativePrivileges( ) && showAll ) ?
@@ -347,26 +347,4 @@ private String getSshKeyString( ) {
private void setSshKeyString( String sshKeyString ) {
this.sshKeyString = sshKeyString;
}
-
- @EntityUpgrade( entities = { VmBootRecord.class }, since = Version.v3_2_2, value = com.eucalyptus.component.id.Eucalyptus.class )
- public enum VmBootRecordUpgrade implements Predicate<Class> {
- INSTANCE;
- private static Logger LOG = Logger.getLogger( VmBootRecord.VmBootRecordUpgrade.class );
- @Override
- public boolean apply( Class arg0 ) {
- EntityTransaction db = Entities.get( VmInstance.class );
- try {
- List<VmInstance> entities = Entities.query( new VmInstance( ) );
- for ( VmInstance entry : entities ) {
- LOG.debug( "Upgrading BootRecord: " + entry.toString() );
- Entities.persist(entry);
- }
- db.commit( );
- return true;
- } catch ( Exception ex ) {
- db.rollback();
- throw Exceptions.toUndeclared( ex );
- }
- }
- }
}
@@ -588,9 +588,9 @@ public boolean apply( final VmVolumeAttachment arg0 ) {
}
try {
- //TODO: zhill - still send a cleanup to SC to guarantee cleanup?
- final ServiceConfiguration sc = Topology.lookup( Storage.class, vm.lookupPartition( ) );
- AsyncRequests.sendSync( sc, new DetachStorageVolumeType( arg0.getVolumeId( ) ) );
+ //Send forcible detach. Detach is idempotent so calling on already detached volume should be no problem
+ //final ServiceConfiguration sc = Topology.lookup( Storage.class, vm.lookupPartition( ) );
+ //AsyncRequests.sendSync( sc, new DetachStorageVolumeType( arg0.getVolumeId( ) ) );
} catch ( Exception ex ) {
LOG.debug( ex );
Logs.extreme( ).debug( ex, ex );
@@ -107,6 +107,19 @@
@Column(name = "cleanup")
private Boolean cleanup;
+ public static final String LVM_ROOT_DIRECTORY = "/dev";
+ public static final String PATH_SEPARATOR = "/";
+
+ /**
+ * Returns a string representation of the path to this resource. Null if not available.
+ * @return
+ */
+ public String getAbsoluteLVPath() {
+ if(this.getVgName() != null && this.getLvName() != null)
+ return LVM_ROOT_DIRECTORY + PATH_SEPARATOR + this.getVgName() + PATH_SEPARATOR + this.getLvName();
+ return null;
+ }
+
public String toString() {
return volumeId + "," + scName + "," + loDevName + "," + loFileName + "," + pvName + "," + vgName + "," + lvName + "," + size + "," + status + "," + snapshotOf + "," + cleanup;
}
@@ -229,9 +229,6 @@ public void setAttachmentTokens(List<VolumeToken> attachmentTokens) {
* @throws EucalyptusCloudException
*/
public VolumeToken getAttachmentTokenIfValid(String tokenValue) throws EucalyptusCloudException {
- //Note: an alternate implementation is to lookup the token directly and check its volume relation and valid status directly.
- //This is preferable because we use a consistent way to lookup the currently valid token for the volume
- EntityTransaction db = Entities.get(VolumeInfo.class);
try {
VolumeToken tok = getCurrentValidToken();
if(tok == null) {
@@ -242,43 +239,37 @@ public VolumeToken getAttachmentTokenIfValid(String tokenValue) throws Eucalyptu
LOG.warn("Token requested is not the current valid token for volume " + this.getVolumeId() + " request token: " + tokenValue + " current token: " + tok.getToken());
throw new EucalyptusCloudException("Requested token is not the current valid token");
} else {
- db.commit();
return tok;
}
}
} catch(Exception e) {
LOG.error("Error checking for valid attachment token",e);
throw new EucalyptusCloudException(e);
- } finally {
- if(db.isActive()) {
- db.rollback();
- }
}
}
/**
* Return the valid token if it exists or null if not.
* @return
*/
- public VolumeToken getCurrentValidToken() throws EucalyptusCloudException {
- EntityTransaction db = Entities.get(VolumeInfo.class);
- try {
- VolumeInfo volEntity = Entities.merge(this);
- for(VolumeToken tok : volEntity.getAttachmentTokens()) {
- if(tok.getIsValid()) {
- db.commit();
- return tok;
+ public VolumeToken getCurrentValidToken() throws EucalyptusCloudException {
+ Function<VolumeInfo, VolumeToken> getValidToken = new Function<VolumeInfo, VolumeToken>() {
+ @Override
+ public VolumeToken apply(VolumeInfo src) {
+ try {
+ VolumeInfo volEntity = Entities.merge(src);
+ for(VolumeToken tok : volEntity.getAttachmentTokens()) {
+ if(tok.getIsValid()) {
+ return tok;
+ }
+ }
+ } catch(Exception e) {
+ LOG.trace("Failed while looking up valid token found for volume " + src.getVolumeId(), e);
}
+ return null;
}
- db.commit();
- } catch(Exception e) {
- LOG.trace("Failed to lookup valid token found for volume " + this.getVolumeId());
- } finally {
- if(db.isActive()) {
- db.rollback();
- }
- }
- return null;
+ };
+ return Entities.asTransaction(VolumeInfo.class, getValidToken).apply(this);
}
/**
@@ -326,39 +317,25 @@ public VolumeToken apply(VolumeInfo src) {
* @param nodeIp - the node IP to use for lookup of export record
* @param nodeIqn - the iqn for the lookup of export record
*/
- public void invalidateExport(String tokenValue, String nodeIp, String nodeIqn) throws EucalyptusCloudException {
- EntityTransaction db = Entities.get(VolumeInfo.class);
- try {
- VolumeInfo volEntity = Entities.merge(this);
- volEntity.getAttachmentTokenIfValid(tokenValue).invalidateExport(nodeIp, nodeIqn);
- db.commit();
- } catch(Exception e) {
- LOG.error("Could not invalidate requested export with token " + tokenValue + " to " + nodeIp + " with iqn " + nodeIqn);
- throw new EucalyptusCloudException(e);
- } finally {
- if(db.isActive()) {
- db.rollback();
+ public void invalidateExport(final String tokenValue, final String nodeIp, final String nodeIqn) throws EucalyptusCloudException {
+ Function<VolumeInfo, VolumeToken> invalidateToken = new Function<VolumeInfo, VolumeToken>() {
+ @Override
+ public VolumeToken apply(VolumeInfo src) {
+ try {
+ VolumeInfo volEntity = Entities.merge(src);
+ VolumeToken token = volEntity.getAttachmentTokenIfValid(tokenValue);
+ token.invalidateExport(nodeIp, nodeIqn);
+ Entities.flush(token);
+ return token;
+ } catch(Exception e) {
+ LOG.error("Could not invalidate requested export with token " + tokenValue + " to " + nodeIp + " with iqn " + nodeIqn);
+ }
+ return null;
}
- }
- }
-
- /**
- * Checks validity of the token and its active status as well as doing a lookup on the
- * ip and iqn passed to verify an active export record. Returns true IFF the token is valid
- * and there is an active export for the given ip,iqn pair
- * @param tokenValue
- * @param nodeIp
- * @param nodeIqn
- * @return
- * @throws EucalyptusCloudException
- */
- public boolean canInvalidateExport(String tokenValue, String nodeIp, String nodeIqn) throws EucalyptusCloudException {
- try {
- VolumeToken tok = this.getAttachmentTokenIfValid(tokenValue);
- return (tok != null) && (tok.getValidExport(nodeIp, nodeIqn) != null);
- } catch(Exception e) {
- LOG.error("Could not invalidate requested export with token " + tokenValue + " to " + nodeIp + " with iqn " + nodeIqn);
- return false;
+ };
+
+ if(Entities.asTransaction(VolumeInfo.class, invalidateToken).apply(this) == null) {
+ throw new EucalyptusCloudException("Failed on invalidation of token");
}
}
}
@@ -257,10 +257,11 @@ public boolean apply(VolumeExportRecord record) {
//Invalidate the token as well.
tok.setIsValid(Boolean.FALSE);
}
+ Entities.flush(tokenEntity);
return tokenEntity;
} catch(Exception e) {
LOG.error("Could not invalidate export record for volume " + tok.getVolume().getVolumeId() + " token " + tok.getToken() + " ip " + ip + " iqn " + iqn, e);
- }
+ }
return null;
}
};
@@ -314,4 +315,32 @@ public VolumeToken apply(VolumeToken token) {
LOG.error("Failed to add export");
}
}
+
+ public void invalidateAllExportsAndToken() throws EucalyptusCloudException {
+ Function<VolumeToken, VolumeToken> invalidateToken = new Function<VolumeToken, VolumeToken>() {
+ @Override
+ public VolumeToken apply(VolumeToken tok){
+ VolumeToken tokenEntity = Entities.merge(tok);
+ try {
+ for(VolumeExportRecord rec : tokenEntity.getExportRecords()) {
+ rec.setIsActive(Boolean.FALSE);
+ }
+ tok.setIsValid(Boolean.FALSE);
+ return tokenEntity;
+ } catch(Exception e) {
+ LOG.error("Could not invalidate export record for volume " + tok.getVolume().getVolumeId() + " token " + tok.getToken(), e);
+ }
+ return null;
+ }
+ };
+
+ try {
+ if(Entities.asTransaction(VolumeExportRecord.class, invalidateToken).apply(this) == null) {
+ throw new Exception("Failed to invalidate export, got null result from deactivation");
+ }
+ } catch(Exception e) {
+ LOG.error("Failed to invalidate export: " + e.getMessage(),e);
+ throw new EucalyptusCloudException("Failed to invalidate export");
+ }
+ }
}
@@ -142,7 +142,15 @@ public String toString() {
}
return sb.toString();
}
- }
+
+ /**
+ * True if command returned non-zero return code
+ * @return
+ */
+ public boolean failed() {
+ return this.returnValue != 0;
+ }
+ }
public static CommandOutput runWithRawOutput(String[] command) throws Exception {
//System.out.println(Joiner.on(" ").skipNulls().join(command));
@@ -311,7 +311,7 @@ public RemoveMultiARecordResponseType RemoveMultiARecord(RemoveMultiARecordType
addrInfo = Entities.uniqueResult(ARecordAddressInfo.named(nameInfo, address));
ARecord arecord = new ARecord(Name.fromString(name), DClass.IN, nameInfo.getTtl(), Address.getByAddress(addrInfo.getAddress()));
- ZoneManager.deleteRecord(zone, arecord);
+ ZoneManager.deleteARecord(zone, arecord);
Entities.delete(addrInfo);
db.commit();
}catch(NoSuchElementException ex){
@@ -357,7 +357,7 @@ public RemoveMultiANameResponseType RemoveMultiAName(RemoveMultiANameType reques
for(ARecordAddressInfo addr : addresses){
try{
ARecord arecord = new ARecord(Name.fromString(name), DClass.IN, nameInfo.getTtl(), Address.getByAddress(addr.getAddress()));
- ZoneManager.deleteRecord(zone, arecord);
+ ZoneManager.deleteARecord(zone, arecord);
}catch(Exception ex){
throw new EucalyptusCloudException("Failed to delete the record from zone", ex);
}
@@ -301,6 +301,33 @@ public static void updateCNAMERecord(String zoneName, CNAMERecord record) {
LOG.error(ex);
}
}
+
+ public static void deleteARecord(String zoneName, ARecord record){
+ try {
+ Zone zone = getZone(zoneName);
+ if(zone == null)
+ return;
+ RRset rrSet = zone.findExactMatch(record.getName(), record.getDClass());
+ if(rrSet != null) {
+ Iterator<Record> rrIterator = rrSet.rrs();
+ Record recordToRemove = null;
+ while(rrIterator.hasNext()) {
+ final Record rec = rrIterator.next();
+ if(rec instanceof ARecord){
+ ARecord aRec = (ARecord)rec;
+ if(aRec.getName().equals(record.getName()) &&
+ aRec.getAddress().equals(record.getAddress())){
+ recordToRemove = rec;
+ }
+ }
+ }
+ if(recordToRemove != null)
+ zone.removeRecord(recordToRemove);
+ }
+ } catch(Exception ex) {
+ LOG.error(ex);
+ }
+ }
public static void deleteRecord(String zoneName, Record record) {
try {
@@ -132,13 +132,10 @@ static LoadBalancer namedByAccount(final String accountName, final String lbName
@Column( name = "loadbalancer_scheme", nullable=true)
private String scheme = null; // only available for LoadBalancers attached to an Amazon VPC
-// @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, orphanRemoval = true, mappedBy = "loadbalancer")
-// @OneToMany(fetch = FetchType.LAZY, mappedBy = "loadbalancer")
@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.REMOVE, mappedBy = "loadbalancer")
@Cache( usage = CacheConcurrencyStrategy.TRANSACTIONAL )
private Collection<LoadBalancerBackendInstance> backendInstances = null;
-// @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, orphanRemoval = true, mappedBy = "loadbalancer")
@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.REMOVE, mappedBy = "loadbalancer")
@Cache( usage= CacheConcurrencyStrategy.TRANSACTIONAL )
private Collection<LoadBalancerListener> listeners = null;
Oops, something went wrong.

0 comments on commit cf0fd71

Please sign in to comment.