Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

merging in Jeff's network sensor for CC

  • Loading branch information...
commit e389d606a8529ec09e32c07668a94dc8c263b349 1 parent f4134b6
@dmitrii dmitrii authored
Showing with 8,011 additions and 2,939 deletions.
  1. +9 −1 .gitignore
  2. +1 −63 clc/.classpath
  3. +1 −1  clc/modules/cluster-manager/src/main/java/com/eucalyptus/blockstorage/VolumeManager.java
  4. +32 −1 clc/modules/cluster-manager/src/main/java/com/eucalyptus/vm/Bundles.java
  5. +8 −0 clc/modules/cluster-manager/src/main/java/com/eucalyptus/vm/Bundling.groovy
  6. +1 −1  clc/modules/cluster-manager/src/main/java/com/eucalyptus/vm/VmBundleTask.java
  7. +14 −11 clc/modules/cluster-manager/src/main/java/com/eucalyptus/vm/VmInstance.java
  8. +60 −18 clc/modules/cluster-manager/src/main/java/com/eucalyptus/vm/VmRuntimeState.java
  9. +4 −1 clc/modules/core/src/main/java/com/eucalyptus/util/StorageProperties.java
  10. +115 −26 ...geControllerConfiguration.groovy → core/src/main/java/edu/ucsb/eucalyptus/cloud/entities/DASInfo.java}
  11. +1 −1  clc/modules/core/src/main/java/edu/ucsb/eucalyptus/cloud/entities/ISCSIVolumeInfo.java
  12. +10 −0 clc/modules/core/src/main/java/edu/ucsb/eucalyptus/cloud/entities/LVMVolumeInfo.java
  13. +6 −5 clc/modules/core/src/main/java/edu/ucsb/eucalyptus/cloud/entities/StorageInfo.java
  14. +33 −14 clc/modules/module-inc.groovy
  15. +1 −60 clc/modules/module-inc.order
  16. +3 −1 clc/modules/msgs/src/main/java/com/eucalyptus/auth/login/HmacLoginModuleSupport.java
  17. +3 −0  clc/modules/msgs/src/main/java/com/eucalyptus/component/AbstractServiceBuilder.java
  18. +4 −1 clc/modules/msgs/src/main/java/com/eucalyptus/component/DummyServiceBuilder.java
  19. +15 −0 clc/modules/msgs/src/main/java/com/eucalyptus/component/Faults.java
  20. +1 −0  clc/modules/msgs/src/main/java/com/eucalyptus/component/ServiceBuilder.java
  21. +1 −0  clc/modules/msgs/src/main/java/com/eucalyptus/component/ServiceTransitions.java
  22. +1 −1  .../eucalyptus/troubleshooting/fault/xml → msgs/src/main/java/com/eucalyptus/component/fault}/Common.java
  23. +1 −1  ...tus/troubleshooting/fault/xml → msgs/src/main/java/com/eucalyptus/component/fault}/EffectiveValue.java
  24. +1 −1  ...m/eucalyptus/troubleshooting/fault/xml → msgs/src/main/java/com/eucalyptus/component/fault}/Fault.java
  25. +7 −7 ...s/troubleshooting/fault/xml → msgs/src/main/java/com/eucalyptus/component/fault}/FaultBuilderImpl.java
  26. +1 −1  ...alyptus/troubleshooting/fault/xml → msgs/src/main/java/com/eucalyptus/component/fault}/FaultField.java
  27. +1 −1  ...tus/troubleshooting/fault/xml → msgs/src/main/java/com/eucalyptus/component/fault}/FaultFieldName.java
  28. +1 −1  ...lyptus/troubleshooting/fault/xml → msgs/src/main/java/com/eucalyptus/component/fault}/FaultLogger.java
  29. +1 −1  ...yptus/troubleshooting/fault/xml → msgs/src/main/java/com/eucalyptus/component/fault}/FaultMessage.java
  30. +1 −1  ...ptus/troubleshooting/fault/xml → msgs/src/main/java/com/eucalyptus/component/fault}/FaultRegistry.java
  31. +5 −8 ...ubleshooting/fault/xml → msgs/src/main/java/com/eucalyptus/component/fault}/FaultSubsystemManager.java
  32. +2 −2 clc/modules/msgs/src/main/java/com/eucalyptus/component/id/Storage.java
  33. +27 −10 clc/modules/msgs/src/main/java/com/eucalyptus/configurable/AbstractConfigurableProperty.java
  34. +1 −24 clc/modules/msgs/src/main/java/com/eucalyptus/context/Context.java
  35. +1 −195 clc/modules/msgs/src/main/java/com/eucalyptus/crypto/util/SslSetup.java
  36. +222 −0 clc/modules/msgs/src/main/java/com/eucalyptus/crypto/util/SslUtils.java
  37. +29 −3 clc/modules/msgs/src/main/java/com/eucalyptus/crypto/util/WSSecurity.java
  38. +1 −0  clc/modules/msgs/src/main/java/com/eucalyptus/records/EventType.java
  39. +11 −1 clc/modules/msgs/src/main/java/com/eucalyptus/records/Logs.java
  40. +2 −2 clc/modules/msgs/src/main/java/com/eucalyptus/system/EucaLayout.java
  41. +3 −2 ...va/com/eucalyptus/troubleshooting → msgs/src/main/java/com/eucalyptus/system/log}/LoggingResetter.java
  42. +47 −2 clc/modules/msgs/src/main/java/com/eucalyptus/ws/Handlers.java
  43. +15 −3 clc/modules/msgs/src/main/java/com/eucalyptus/ws/handlers/BindingHandler.java
  44. +5 −0 clc/modules/msgs/src/main/java/com/eucalyptus/ws/handlers/WsSecHandler.java
  45. +7 −1 clc/modules/msgs/src/main/java/com/eucalyptus/ws/server/NioServerHandler.java
  46. +7 −1 clc/modules/msgs/src/main/resources/cc-vms.xml
  47. +414 −0 clc/modules/msgs/src/main/resources/xml-security-config.xml
  48. +2 −2 clc/modules/msgs/src/test/java/com/eucalyptus/crypto/util/{SslSetupTest.java → SslUtilsTest.java}
  49. +1 −1  clc/modules/postgresql/src/main/java/com/eucalyptus/postgresql/PostgreSQLSSLSocketFactory.java
  50. +8 −5 ...ooting/fault/FaultBuilder.java → storage-common/src/main/java/com/eucalyptus/storage/CheckerTask.java}
  51. +1 −0  clc/modules/storage-controller/build.xml
  52. +12 −2 clc/modules/storage-controller/native/Makefile
  53. +83 −0 clc/modules/storage-controller/native/com_eucalyptus_storage_DASManager.c
  54. +0 −2  clc/modules/storage-controller/src/main/java/com/eucalyptus/bootstrap/BlockStorageBootstrapper.java
  55. +25 −2 ...{configuration → storage-controller}/src/main/java/com/eucalyptus/config/StorageControllerBuilder.java
  56. +173 −0 clc/modules/storage-controller/src/main/java/com/eucalyptus/config/StorageControllerConfiguration.java
  57. +6 −0 clc/modules/storage-controller/src/main/java/com/eucalyptus/storage/AOEManager.java
  58. +44 −7 clc/modules/storage-controller/src/main/java/com/eucalyptus/storage/BlockStorageManagerFactory.java
  59. +1,185 −0 clc/modules/storage-controller/src/main/java/com/eucalyptus/storage/DASManager.java
  60. +61 −31 clc/modules/storage-controller/src/main/java/com/eucalyptus/storage/ISCSIManager.java
  61. +5 −2 clc/modules/storage-controller/src/main/java/com/eucalyptus/storage/LogicalStorageManager.java
  62. +219 −90 clc/modules/storage-controller/src/main/java/com/eucalyptus/storage/OverlayManager.java
  63. +2 −0  clc/modules/storage-controller/src/main/java/com/eucalyptus/storage/StorageExportManager.java
  64. +190 −0 clc/modules/storage-controller/src/main/java/com/eucalyptus/storage/StorageManagers.java
  65. +34 −13 clc/modules/storage-controller/src/main/java/edu/ucsb/eucalyptus/cloud/ws/BlockStorage.java
  66. +109 −0 clc/modules/storage-controller/src/main/java/edu/ucsb/eucalyptus/cloud/ws/VolumeStateChecker.java
  67. +37 −10 ...system.java → storage-controller/src/main/java/edu/ucsb/eucalyptus/storage/StorageCheckerService.java}
  68. +65 −182 clc/modules/troubleshooting/src/main/java/com/eucalyptus/bootstrap/TroubleshootingBootstrapper.java
  69. +3 −3 clc/modules/troubleshooting/src/main/java/com/eucalyptus/troubleshooting/TestFaultTrigger.java
  70. +37 −0 ...s/troubleshooting/src/main/java/com/eucalyptus/troubleshooting/changelisteners/DBCheckPollTimeListener.java
  71. +54 −0 .../troubleshooting/src/main/java/com/eucalyptus/troubleshooting/changelisteners/DBCheckThresholdListener.java
  72. +33 −0 ...g/src/main/java/com/eucalyptus/troubleshooting/changelisteners/GarbageCollectionCountCheckNameListener.java
  73. +37 −0 ...c/main/java/com/eucalyptus/troubleshooting/changelisteners/GarbageCollectionCountCheckPollTimeListener.java
  74. +43 −0 .../main/java/com/eucalyptus/troubleshooting/changelisteners/GarbageCollectionCountCheckThresholdListener.java
  75. +37 −0 ...shooting/src/main/java/com/eucalyptus/troubleshooting/changelisteners/LogFileDiskCheckPollTimeListener.java
  76. +54 −0 ...hooting/src/main/java/com/eucalyptus/troubleshooting/changelisteners/LogFileDiskCheckThresholdListener.java
  77. +80 −0 clc/modules/troubleshooting/src/main/java/com/eucalyptus/troubleshooting/changelisteners/LogLevelListener.java
  78. +37 −0 ...hooting/src/main/java/com/eucalyptus/troubleshooting/changelisteners/MXBeanMemoryCheckPollTimeListener.java
  79. +54 −0 ...ooting/src/main/java/com/eucalyptus/troubleshooting/changelisteners/MXBeanMemoryCheckThresholdListener.java
  80. +37 −0 ...hooting/src/main/java/com/eucalyptus/troubleshooting/changelisteners/SimpleMemoryCheckPollTimeListener.java
  81. +54 −0 ...ooting/src/main/java/com/eucalyptus/troubleshooting/changelisteners/SimpleMemoryCheckThresholdListener.java
  82. +71 −0 ...ules/troubleshooting/src/main/java/com/eucalyptus/troubleshooting/changelisteners/TriggerFaultListener.java
  83. +16 −25 ...eshooting/src/main/java/com/eucalyptus/troubleshooting/{resourcefaults → checker}/DBResourceCheck.java
  84. +15 −13 ...hooting/src/main/java/com/eucalyptus/troubleshooting/{resourcefaults → checker}/DiskResourceCheck.java
  85. +162 −0 ...oubleshooting/src/main/java/com/eucalyptus/troubleshooting/checker/GarbageCollectionCountResourceCheck.java
  86. +120 −0 ...modules/troubleshooting/src/main/java/com/eucalyptus/troubleshooting/checker/MXBeanMemoryResourceCheck.java
  87. +108 −0 ...modules/troubleshooting/src/main/java/com/eucalyptus/troubleshooting/checker/SimpleMemoryResourceCheck.java
  88. +44 −0 ...modules/troubleshooting/src/main/java/com/eucalyptus/troubleshooting/checker/schedule/DBCheckScheduler.java
  89. +26 −0 ...ing/src/main/java/com/eucalyptus/troubleshooting/checker/schedule/GarbageCollectionCountCheckScheduler.java
  90. +32 −0 ...roubleshooting/src/main/java/com/eucalyptus/troubleshooting/checker/schedule/LogFileDiskCheckScheduler.java
  91. +29 −0 ...oubleshooting/src/main/java/com/eucalyptus/troubleshooting/checker/schedule/MXBeanMemoryCheckScheduler.java
  92. +29 −0 ...oubleshooting/src/main/java/com/eucalyptus/troubleshooting/checker/schedule/SimpleMemoryCheckScheduler.java
  93. +0 −47 .../troubleshooting/src/main/java/com/eucalyptus/troubleshooting/resourcefaults/MXBeanMemoryResourceCheck.java
  94. +0 −47 .../troubleshooting/src/main/java/com/eucalyptus/troubleshooting/resourcefaults/SimpleMemoryResourceCheck.java
  95. +7 −0 clc/modules/walrus/build.xml
  96. +4 −4 clc/modules/walrus/src/main/java/edu/ucsb/eucalyptus/cloud/ws/WalrusControl.java
  97. +6 −2 clc/modules/walrus/src/main/java/edu/ucsb/eucalyptus/storage/fs/DRBDStorageManager.java
  98. +1 −0  clc/modules/walrus/udev/65-drbd-owner.rules
  99. +1 −0  clc/modules/walrus/udev/rules.d/65-drbd-owner.rules
  100. +6 −1 clc/modules/wsstack/src/main/java/com/eucalyptus/ws/server/EucalyptusSoapPipeline.java
  101. +8 −1 clc/modules/wsstack/src/main/java/com/eucalyptus/ws/server/WalrusSoapPipeline.java
  102. +1 −2  clc/modules/www/src/main/java/com/eucalyptus/bootstrap/HttpServerBootstrapper.java
  103. +305 −293 cluster/CCclient.c
  104. +3 −4 cluster/Makefile
  105. +42 −3 cluster/cc-client-marshal-adb.c
  106. +1 −0  cluster/cc-client-marshal.h
  107. +62 −66 cluster/handlers-state.c
  108. +391 −319 cluster/handlers.c
  109. +4 −3 cluster/handlers.h
  110. +39 −2 cluster/server-marshal.c
  111. +1 −0  cluster/server-marshal.h
  112. +5 −0 cluster/shutdownCC.c
  113. +169 −170 net/vnetwork.c
  114. +8 −7 node/Makefile
  115. +10 −0 node/NCclient.c
  116. +87 −48 node/client-marshal-adb.c
  117. +4 −0 node/client-marshal-fake.c
  118. +4 −0 node/client-marshal-local.c
  119. +1 −0  node/client-marshal.h
  120. +388 −147 node/handlers.c
  121. +6 −1 node/handlers.h
  122. +483 −370 node/handlers_default.c
  123. +17 −17 node/handlers_kvm.c
  124. +7 −7 node/handlers_xen.c
  125. +11 −9 node/hooks.c
  126. +61 −22 node/server-marshal.c
  127. +1 −0  node/server-marshal.h
  128. +9 −7 node/test.c
  129. +31 −29 node/test_nc.c
  130. +8 −8 node/xml.c
  131. +0 −1  project/cluster
  132. +1 −0  project/cluster
  133. +23 −7 storage/backing.c
  134. +1 −1  storage/backing.h
  135. +4 −3 storage/blobstore.c
  136. +4 −0 storage/blobstore.h
  137. +68 −166 storage/iscsi.c
  138. +5 −2 storage/walrus.c
  139. +1 −0  tools/Makefile
  140. +7 −0 tools/connect_iscsitarget_main.pl
  141. +13 −7 tools/disconnect_iscsitarget_main.pl
  142. +9 −0 tools/eucalyptus-nc.in
  143. +4 −4 tools/getstats.pl
  144. +182 −0 tools/getstats_net.pl
  145. +8 −4 tools/nc-hooks/example.sh
  146. +74 −0 tools/nc-hooks/libvirt-check.sh
  147. +6 −6 util/config.c
  148. +1 −0  util/data.h
  149. +18 −18 util/euca_auth.c
  150. +9 −2 util/euca_axis.c
  151. +15 −9 util/eucalyptus.h
  152. +64 −13 util/fault.c
  153. +45 −0 util/faults/en_US/1007.xml
  154. +1 −1  util/faults/en_US/{1234.xml → 1008.xml}
  155. +14 −10 util/faults/en_US/{1235.xml → 1009.xml}
  156. +1 −1  util/hash.c
  157. +1 −1  util/ipc.c
  158. +2 −2 util/ipc.h
  159. +2 −0  util/log.c
  160. +10 −6 util/log.h
  161. +229 −47 util/misc.c
  162. +10 −1 util/misc.h
  163. +249 −110 util/sensor.c
  164. +14 −3 util/sensor.h
  165. +14 −12 util/test.c
  166. +0 −1  util/windows-bundle.c
  167. +1 −1  util/windows-bundle.h
  168. +49 −0 wsdl/eucalyptus_cc.wsdl
  169. +49 −0 wsdl/eucalyptus_nc.wsdl
View
10 .gitignore
@@ -32,8 +32,14 @@ clc/modules/msgs/src/main/resources/msgs-binding.xml
clc/modules/postgresql/src/main/resources/postgresql-binaries.properties
clc/modules/storage-controller/include/**
clc/modules/storage-controller/lib
-clc/modules/storage-san
+clc/modules/storage-san-common
+clc/modules/storage-san-emc-libs
+clc/modules/storage-san-emc
+clc/modules/storage-san-equallogic
+clc/modules/storage-san-netapp
+clc/modules/storage-san-netapp-libs
clc/modules/vmware-broker
+clc/modules/storage-san
clc/modules/www/build-war
clc/modules/www/conf/eucalyptus-web.properties
clc/modules/www/src/main/java/com/eucalyptus/webui/public/themes/active
@@ -61,6 +67,7 @@ util/euca_rootwrap
util/test_misc
util/test_fault
util/test_wc
+util/euca-generate-fault
clc/.settings/org.eclipse.jdt.core.prefs
clc/eucadmin/eucadmin/__init__.py
storage/euca-blobs
@@ -81,3 +88,4 @@ node/test
node/test_hooks
node/test_nc
tags
+util/euca-generate-fault
View
64 clc/.classpath
@@ -1,67 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright 2009-2012 Eucalyptus Systems, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 3 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see http://www.gnu.org/licenses/.
-
- Please contact Eucalyptus Systems, Inc., 6755 Hollister Ave., Goleta
- CA 93117, USA or visit http://www.eucalyptus.com/licenses/ if you need
- additional information or have any questions.
-
- This file may incorporate work covered under the following copyright
- and permission notice:
-
- Software License Agreement (BSD License)
-
- Copyright (c) 2008, Regents of the University of California
- All rights reserved.
-
- Redistribution and use of this software in source and binary forms,
- with or without modification, are permitted provided that the
- following conditions are met:
-
- Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer
- in the documentation and/or other materials provided with the
- distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE. USERS OF THIS SOFTWARE ACKNOWLEDGE
- THE POSSIBLE PRESENCE OF OTHER OPEN SOURCE LICENSED MATERIAL,
- COPYRIGHTED MATERIAL OR PATENTED MATERIAL IN THIS SOFTWARE,
- AND IF ANY SUCH MATERIAL IS DISCOVERED THE PARTY DISCOVERING
- IT MAY INFORM DR. RICH WOLSKI AT THE UNIVERSITY OF CALIFORNIA,
- SANTA BARBARA WHO WILL THEN ASCERTAIN THE MOST APPROPRIATE REMEDY,
- WHICH IN THE REGENTS' DISCRETION MAY INCLUDE, WITHOUT LIMITATION,
- REPLACEMENT OF THE CODE SO IDENTIFIED, LICENSING OF THE CODE SO
- IDENTIFIED, OR WITHDRAWAL OF THE CODE CAPABILITY TO THE EXTENT
- NEEDED TO COMPLY WITH ANY SUCH LICENSES OR RIGHTS.
- -->
-
<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="src" path="modules/authentication/src/main/java"/>
<classpathentry kind="src" path="modules/cloud/src/main/java"/>
<classpathentry kind="src" path="modules/cluster-manager/src/main/java"/>
@@ -254,6 +193,5 @@
<classpathentry kind="lib" path="lib/xom-1.1.jar"/>
<classpathentry kind="lib" path="lib/xpp3-1.1.3.4.O.jar"/>
<classpathentry exported="true" kind="con" path="GROOVY_DSL_SUPPORT"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>
View
2  clc/modules/cluster-manager/src/main/java/com/eucalyptus/blockstorage/VolumeManager.java
@@ -450,7 +450,6 @@ public DetachVolumeResponseType detach( DetachVolumeType request ) throws Eucaly
request.setDevice( volume.getDevice( ).replaceAll( "unknown,requested:", "" ) );
request.setInstanceId( vm.getInstanceId( ) );
VolumeDetachCallback ncDetach = new VolumeDetachCallback( request );
- AsyncRequests.newRequest( ncDetach ).dispatch( cluster.getConfiguration( ) );
try {
AsyncRequests.sendSync( scVm, new DetachStorageVolumeType( volume.getVolumeId( ) ) );
} catch ( Exception e ) {
@@ -458,6 +457,7 @@ public DetachVolumeResponseType detach( DetachVolumeType request ) throws Eucaly
Logs.extreme( ).debug( e, e );
//GRZE: attach is idempotent, failure here is ok, throw new EucalyptusCloudException( e.getMessage( ) );
}
+ AsyncRequests.newRequest( ncDetach ).dispatch( cluster.getConfiguration( ) );
}
volume.setStatus( "detaching" );
reply.setDetachedVolume( volume );
View
33 clc/modules/cluster-manager/src/main/java/com/eucalyptus/vm/Bundles.java
@@ -131,6 +131,35 @@ public void fire( CancelBundleTaskResponseType reply ) {
}
}
+ public static MessageCallback bundleRestartInstanceCallback( BundleRestartInstanceType request ) {
+ return new BundleRestartInstanceCallback( request );
+ }
+
+ public static class BundleRestartInstanceCallback extends MessageCallback<BundleRestartInstanceType, BundleRestartInstanceResponseType> {
+ private BundleRestartInstanceCallback( BundleRestartInstanceType request ) {
+ super( request );
+ }
+
+ @Override
+ public void fire( BundleRestartInstanceResponseType reply ) {
+ if ( !reply.get_return( ) ) {
+ LOG.info( "Attempt to restart bundle instance " + this.getRequest( ).getInstanceId( ) + " has failed." );
+ } else {
+ EntityTransaction db = Entities.get( VmInstance.class );
+ try {
+ VmInstance vm = VmInstances.lookup( this.getRequest( ).getInstanceId( ) );
+ vm.getRuntimeState( ).restartBundleTask( );
+ EventRecord.here( CancelBundleCallback.class, EventType.BUNDLE_RESTART, this.getRequest( ).toSimpleString( ), vm.getRuntimeState( ).getBundleTask( ).getBundleId( ),
+ vm.getInstanceId( ) ).info( );
+ db.commit( );
+ } catch ( Exception ex ) {
+ Logs.exhaust( ).error( ex, ex );
+ db.rollback( );
+ }
+ }
+ }
+ }
+
public static class BundleCallback extends MessageCallback<BundleInstanceType, BundleInstanceResponseType> {
private BundleCallback( BundleInstanceType request ) {
super( request );
@@ -163,7 +192,9 @@ public static BundleTask transform( final VmBundleTask bundleTask ) {
public static VmBundleTask create( VmInstance v, String bucket, String prefix, String policy ) throws AuthException {
verifyPolicy( policy, bucket );
- verifyBucket( bucket );
+ // TODO: this was removed to get bundle-instance to work we still need to resolve the
+ // permissions issue see EUCA-3665
+ //verifyBucket( bucket );
verifyPrefix( prefix );
return VmBundleTask.create( v, bucket, prefix, policy );
}
View
8 clc/modules/cluster-manager/src/main/java/com/eucalyptus/vm/Bundling.groovy
@@ -103,6 +103,14 @@ public class BundleInstanceType extends VmBundleMessage {
public class BundleInstanceResponseType extends VmBundleMessage {
BundleTask task;
}
+
+public class BundleRestartInstanceType extends VmBundleMessage {
+ String instanceId;
+}
+public class BundleRestartInstanceResponseType extends VmBundleMessage {
+ BundleTask task;
+}
+
public class CancelBundleTaskType extends VmBundleMessage {
String bundleId;
String instanceId;
View
2  clc/modules/cluster-manager/src/main/java/com/eucalyptus/vm/VmBundleTask.java
@@ -73,7 +73,7 @@
@Embeddable
public class VmBundleTask {
public enum BundleState {
- none( "none" ), pending( null ), storing( "bundling" ), canceling( null ), complete( "succeeded" ), failed( "failed" );
+ none( "none" ), pending( null ), storing( "bundling" ), canceling( null ), cancelled( "cancelled" ), complete( "succeeded" ), failed( "failed" );
private String mappedState;
BundleState( final String mappedState ) {
View
25 clc/modules/cluster-manager/src/main/java/com/eucalyptus/vm/VmInstance.java
@@ -1635,18 +1635,21 @@ public RunningInstancesItemType apply( final VmInstance v ) {
runningInstance.setRamdisk( input.getBootRecord( ).getRamdisk( ).getDisplayName( ) );
}
if ( dns ) {
- String publicDnsName = input.getPublicDnsName( );
- String privateDnsName = input.getPrivateDnsName( );
- publicDnsName = ( publicDnsName == null
- ? VmNetworkConfig.DEFAULT_IP
- : publicDnsName );
- privateDnsName = ( privateDnsName == null
+ String publicDnsName = input.getPublicDnsName( );
+ String publicAddress = input.getPublicAddress( );
+ String privateDnsName = input.getPrivateDnsName( );
+ String privateAddress = input.getPrivateAddress( );
+
+ publicDnsName = ( publicDnsName == null
? VmNetworkConfig.DEFAULT_IP
- : privateDnsName );
- runningInstance.setDnsName( publicDnsName );
- runningInstance.setIpAddress( publicDnsName );
- runningInstance.setPrivateDnsName( privateDnsName );
- runningInstance.setPrivateIpAddress( privateDnsName );
+ : publicDnsName );
+ privateDnsName = ( privateDnsName == null
+ ? VmNetworkConfig.DEFAULT_IP
+ : privateDnsName );
+ runningInstance.setDnsName( publicDnsName );
+ runningInstance.setIpAddress( publicAddress );
+ runningInstance.setPrivateDnsName( privateDnsName );
+ runningInstance.setPrivateIpAddress( privateAddress );
} else {
String publicDnsName = input.getPublicAddress( );
String privateDnsName = input.getPrivateAddress( );
View
78 clc/modules/cluster-manager/src/main/java/com/eucalyptus/vm/VmRuntimeState.java
@@ -102,6 +102,7 @@
import com.eucalyptus.util.Exceptions;
import com.eucalyptus.util.async.AsyncRequests;
import com.eucalyptus.util.async.CheckedListenableFuture;
+import com.eucalyptus.vm.Bundles.BundleCallback;
import com.eucalyptus.vm.VmBundleTask.BundleState;
import com.eucalyptus.vm.VmInstance.Reason;
import com.eucalyptus.vm.VmInstance.VmState;
@@ -396,24 +397,36 @@ public Boolean cancelBundleTask( ) {
}
}
- public Boolean submittedBundleTask( ) {
- if ( this.getBundleTask( ) != null && this.getBundleTask( ).getState( ).ordinal( ) >= BundleState.storing.ordinal( ) ) {
- this.getBundleTask( ).setState( BundleState.storing );
- EventRecord.here( VmRuntimeState.class, EventType.BUNDLE_STARTING,
- this.vmInstance.getOwner( ).toString( ),
- this.getBundleTask( ).getBundleId( ),
- this.getVmInstance( ).getInstanceId( ),
- "" + this.getBundleTask( ).getState( ) ).info( );
- return true;
- } else if ( BundleState.canceling.equals( this.getBundleTaskState( ) ) ) {
- EventRecord.here( VmRuntimeState.class, EventType.BUNDLE_CANCELLED, this.vmInstance.getOwner( ).toString( ), this.getBundleTask( ).getBundleId( ),
+ public Boolean restartBundleTask( ) {
+ if ( this.getBundleTask( ) != null ) {
+ this.getBundleTask( ).setState( BundleState.none );
+ EventRecord.here( VmRuntimeState.class, EventType.BUNDLE_RESTART, this.vmInstance.getOwner( ).toString( ), this.getBundleTask( ).getBundleId( ),
this.getVmInstance( ).getInstanceId( ),
"" + this.getBundleTask( ).getState( ) ).info( );
- this.resetBundleTask( );
return true;
- } else {
- return false;
}
+ return false;
+ }
+
+ public Boolean submittedBundleTask( ) {
+ if ( this.getBundleTask( ) != null ) {
+ if ( BundleState.cancelled.equals( this.getBundleTaskState( ) ) ) {
+ EventRecord.here( VmRuntimeState.class, EventType.BUNDLE_CANCELLED, this.vmInstance.getOwner( ).toString( ), this.getBundleTask( ).getBundleId( ),
+ this.getVmInstance( ).getInstanceId( ),
+ "" + this.getBundleTask( ).getState( ) ).info( );
+ this.resetBundleTask( );
+ return true;
+ } else if ( this.getBundleTask( ).getState( ).ordinal( ) >= BundleState.storing.ordinal( ) ) {
+ this.getBundleTask( ).setState( BundleState.storing );
+ EventRecord.here( VmRuntimeState.class, EventType.BUNDLE_STARTING,
+ this.vmInstance.getOwner( ).toString( ),
+ this.getBundleTask( ).getBundleId( ),
+ this.getVmInstance( ).getInstanceId( ),
+ "" + this.getBundleTask( ).getState( ) ).info( );
+ return true;
+ }
+ }
+ return false;
}
public Boolean startBundleTask( final VmBundleTask task ) {
@@ -421,7 +434,7 @@ public Boolean startBundleTask( final VmBundleTask task ) {
this.bundleTask = task;
return true;
} else {
- if ( ( this.getBundleTask( ) != null ) && ( BundleState.failed.equals( task.getState() ) || BundleState.canceling.equals( task.getState() ) ) ) {
+ if ( ( this.getBundleTask( ) != null ) && ( BundleState.failed.equals( task.getState() ) || BundleState.canceling.equals( task.getState() ) || BundleState.cancelled.equals( task.getState() ) ) ) {
this.resetBundleTask( );
this.bundleTask = task;
return true;
@@ -496,14 +509,43 @@ public void updateBundleTaskState( String state ) {
updateBundleTaskState( next );
}
+ public void bundleRestartInstance(VmBundleTask bundleTask) {
+ BundleState state = bundleTask.getState();
+ if(BundleState.complete.equals(state) || BundleState.failed.equals(state) || BundleState.cancelled.equals(state)) {
+ final BundleRestartInstanceType request = new BundleRestartInstanceType();
+ final BundleRestartInstanceResponseType reply = request.getReply();
+
+ reply.set_return(true);
+ try {
+ LOG.info(EventRecord.here(BundleCallback.class, EventType.BUNDLE_RESTART, vmInstance.getOwner().getUserName(),
+ bundleTask.getBundleId(),
+ vmInstance.getInstanceId()));
+
+ ServiceConfiguration ccConfig = Topology.lookup(ClusterController.class, vmInstance.lookupPartition());
+ final Cluster cluster = Clusters.lookup(ccConfig );
+
+ request.setInstanceId(vmInstance.getInstanceId());
+ reply.setTask(Bundles.transform(bundleTask));
+ AsyncRequests.newRequest(Bundles.bundleRestartInstanceCallback(request)).dispatch(cluster.getConfiguration());
+ } catch (final Exception e) {
+ Logs.extreme().trace("Failed to find bundle task: " + bundleTask.getBundleId());
+ }
+ }
+ }
+
public void updateBundleTaskState( BundleState state ) {
if ( this.getBundleTask( ) != null ) {
final BundleState current = this.getBundleTask( ).getState( );
- if ( BundleState.complete.equals( state ) && !BundleState.complete.equals( current ) ) {
+ if ( BundleState.complete.equals( state ) && !BundleState.complete.equals( current ) && !BundleState.none.equals( current )) {
+ this.getBundleTask( ).setState( state );
+ bundleRestartInstance(this.getBundleTask());
+ } else if ( BundleState.failed.equals( state ) && !BundleState.failed.equals( current ) && !BundleState.none.equals( current )) {
this.getBundleTask( ).setState( state );
- } else if ( BundleState.failed.equals( state ) && !BundleState.failed.equals( current ) ) {
+ bundleRestartInstance(this.getBundleTask());
+ } else if ( BundleState.cancelled.equals( state ) && !BundleState.cancelled.equals( current ) && !BundleState.none.equals( current )) {
this.getBundleTask( ).setState( state );
- } else if ( BundleState.canceling.equals( current ) || BundleState.canceling.equals( state ) ) {
+ bundleRestartInstance(this.getBundleTask());
+ } else if ( BundleState.canceling.equals( state ) || BundleState.canceling.equals( current ) ) {
//
} else if ( BundleState.pending.equals( current ) && !BundleState.none.equals( state ) ) {
this.getBundleTask( ).setState( state );
View
5 clc/modules/core/src/main/java/com/eucalyptus/util/StorageProperties.java
@@ -110,6 +110,9 @@
public static String SC_INITIATOR_IQN = null;
public static final String EUCA_ROOT_WRAPPER = BaseDirectory.LIBEXEC.toString() + "/euca_rootwrap";
public static final String blockSize = "1M";
+ public static final String DEFAULT_EBS_MANAGER = "OverlayManager";
+ public static String DAS_DEVICE = "/dev/blockdev";
+ public static final String STORAGE_CLASS_PREFIX = "com.eucalyptus.storage.";
static { Groovyness.loadConfig("storageprops.groovy"); }
@@ -176,7 +179,7 @@ public static void updateWalrusUrl() {
}
public enum Status {
- creating, available, pending, completed, failed
+ creating, available, pending, completed, failed, error
}
public enum StorageParameters {
View
141 ...ptus/config/StorageControllerConfiguration.groovy → ...a/edu/ucsb/eucalyptus/cloud/entities/DASInfo.java
@@ -60,34 +60,123 @@
* NEEDED TO COMPLY WITH ANY SUCH LICENSES OR RIGHTS.
************************************************************************/
-package com.eucalyptus.config
+/*
+ * Author: chris grzegorczyk <grze@eucalyptus.com>
+ */
+package edu.ucsb.eucalyptus.cloud.entities;
-import java.io.Serializable
-import javax.persistence.DiscriminatorValue;
-import javax.persistence.PersistenceContext
-import javax.persistence.Table
-import javax.persistence.Transient
-import org.hibernate.annotations.Cache
-import org.hibernate.annotations.CacheConcurrencyStrategy
-import org.hibernate.annotations.Entity
-import com.eucalyptus.component.ComponentId.ComponentPart
-import com.eucalyptus.component.id.Storage
+import javax.persistence.Column;
+import javax.persistence.PersistenceContext;
+import javax.persistence.Table;
+import org.apache.log4j.Logger;
+import org.hibernate.annotations.Cache;
+import org.hibernate.annotations.CacheConcurrencyStrategy;
+import org.hibernate.annotations.Entity;
+import com.eucalyptus.configurable.ConfigurableClass;
+import com.eucalyptus.configurable.ConfigurableField;
+import com.eucalyptus.configurable.ConfigurableIdentifier;
+import com.eucalyptus.entities.AbstractPersistent;
+import com.eucalyptus.entities.EntityWrapper;
+import com.eucalyptus.util.EucalyptusCloudException;
+import com.eucalyptus.util.StorageProperties;
@Entity @javax.persistence.Entity
-@PersistenceContext(name="eucalyptus_config")
-@Table( name = "config_sc" )
+@PersistenceContext(name="eucalyptus_storage")
+@Table( name = "das_info" )
@Cache( usage = CacheConcurrencyStrategy.TRANSACTIONAL )
-@ComponentPart(Storage.class)
-public class StorageControllerConfiguration extends ComponentConfiguration implements Serializable {
- @Transient
- private static String DEFAULT_SERVICE_PATH = "/services/Storage";
- public StorageControllerConfiguration( ) {
-
- }
- public StorageControllerConfiguration( String name ) {
- super.setName(name);
- }
- public StorageControllerConfiguration( String partition, String name, String hostName, Integer port ) {
- super( partition, name, hostName, port, DEFAULT_SERVICE_PATH );
- }
+@ConfigurableClass(root = "storage", alias = "das", description = "Basic storage controller configuration for DAS.", singleton=false, deferred = true)
+public class DASInfo extends AbstractPersistent {
+ private static Logger LOG = Logger.getLogger( DASInfo.class );
+
+ @ConfigurableIdentifier
+ @Column( name = "storage_name", unique=true)
+ private String name;
+ @ConfigurableField( description = "Direct attached storage device location", displayName = "Direct attached block device or volume group" )
+ @Column(name = "das_device")
+ private String DASDevice;
+
+ public DASInfo(){
+ this.name = StorageProperties.NAME;
+ }
+
+ public DASInfo( final String name )
+ {
+ this.name = name;
+ }
+
+ public DASInfo(final String name,
+ final String DASDevice) {
+ this.name = name;
+ this.DASDevice = DASDevice;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDASDevice() {
+ return DASDevice;
+ }
+
+ public void setDASDevice(String DASDevice) {
+ this.DASDevice = DASDevice;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ DASInfo other = (DASInfo) obj;
+ if (name == null) {
+ if (other.name != null)
+ return false;
+ } else if (!name.equals(other.name))
+ return false;
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ return result;
+ }
+
+ @Override
+ public String toString()
+ {
+ return this.name;
+ }
+
+ public static DASInfo getStorageInfo() {
+ EntityWrapper<DASInfo> storageDb = EntityWrapper.get(DASInfo.class);
+ DASInfo conf = null;
+ try {
+ conf = storageDb.getUnique(new DASInfo(StorageProperties.NAME));
+ storageDb.commit();
+ }
+ catch ( EucalyptusCloudException e ) {
+ LOG.warn("Failed to get storage info for: " + StorageProperties.NAME + ". Loading defaults.");
+ conf = new DASInfo(StorageProperties.NAME,
+ StorageProperties.DAS_DEVICE);
+ storageDb.add(conf);
+ storageDb.commit();
+ }
+ catch (Exception t) {
+ LOG.error("Unable to get storage info for: " + StorageProperties.NAME);
+ storageDb.rollback();
+ return new DASInfo(StorageProperties.NAME,
+ StorageProperties.DAS_DEVICE);
+ }
+ return conf;
+ }
}
View
2  clc/modules/core/src/main/java/edu/ucsb/eucalyptus/cloud/entities/ISCSIVolumeInfo.java
@@ -99,7 +99,7 @@ public void setStoreName(String storeName) {
}
public Integer getTid() {
- return tid;
+ return tid == null ? -1 : tid;
}
public void setTid(Integer tid) {
View
10 clc/modules/core/src/main/java/edu/ucsb/eucalyptus/cloud/entities/LVMVolumeInfo.java
@@ -95,6 +95,8 @@
private String status;
@Column(name = "snapshot_of")
private String snapshotOf;
+ @Column(name = "cleanup")
+ private Boolean cleanup;
public LVMVolumeInfo() {
super();
@@ -185,6 +187,14 @@ public void setSnapshotOf(String snapshotOf) {
this.snapshotOf = snapshotOf;
}
+ public Boolean getCleanup() {
+ return cleanup == null ? false : cleanup;
+ }
+
+ public void setCleanup(Boolean cleanup) {
+ this.cleanup = cleanup;
+ }
+
@Override
public int hashCode() {
final int prime = 31;
View
11 clc/modules/core/src/main/java/edu/ucsb/eucalyptus/cloud/entities/StorageInfo.java
@@ -64,8 +64,6 @@
import javax.persistence.Column;
import org.hibernate.annotations.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
import javax.persistence.PersistenceContext;
import javax.persistence.Table;
import org.apache.log4j.Logger;
@@ -75,6 +73,9 @@
import com.eucalyptus.configurable.ConfigurableField;
import com.eucalyptus.configurable.ConfigurableFieldType;
import com.eucalyptus.configurable.ConfigurableIdentifier;
+import com.eucalyptus.configurable.ConfigurableProperty;
+import com.eucalyptus.configurable.ConfigurablePropertyException;
+import com.eucalyptus.configurable.PropertyChangeListener;
import com.eucalyptus.entities.AbstractPersistent;
import com.eucalyptus.entities.EntityWrapper;
import com.eucalyptus.util.EucalyptusCloudException;
@@ -100,7 +101,7 @@
@ConfigurableField( description = "Should transfer snapshots", displayName = "Transfer snapshots to Walrus", type = ConfigurableFieldType.BOOLEAN )
@Column( name = "system_storage_transfer_snapshots")
private Boolean shouldTransferSnapshots;
-
+
public StorageInfo() {
this.name = StorageProperties.NAME;
}
@@ -127,7 +128,7 @@ public String getName() {
public void setName(String name) {
this.name = name;
}
-
+
public Integer getMaxTotalVolumeSizeInGb() {
return maxTotalVolumeSizeInGb;
}
@@ -205,7 +206,7 @@ public static StorageInfo getStorageInfo() {
return new StorageInfo(StorageProperties.NAME,
StorageProperties.MAX_TOTAL_VOLUME_SIZE,
StorageProperties.MAX_VOLUME_SIZE,
- true);
+ true);
}
return conf;
}
View
47 clc/modules/module-inc.groovy
@@ -73,24 +73,43 @@ def modulesBuild = []
def modulesIgnore = []
def buildOrder = []
def doBuild = { module ->
- if ( new File("${moduleBasePath}/${module}/build.xml").exists() ) {
- println ( "CALL-MODULE-TARGET ${module} ${antTarget}" )
- ant.ant(dir:"modules/${module}",inheritall:'false'){
- target(name:"${antTarget}")
- }
- } else {
- println ( "SKIP-MODULE-TARGET ${module} ${antTarget}" )
- }
+
+ if ( new File("${moduleBasePath}/${module}/build.xml").exists() ) {
+
+ println ( "CALL-MODULE-TARGET ${module} ${antTarget}" )
+ ant.ant(dir:"modules/${module}",inheritall:'false'){
+ target(name:"${antTarget}")
+ }
+ } else {
+ println ( "SKIP-MODULE-TARGET ${module} ${antTarget}" )
+ }
}
modulesList.eachLine{
- if ( it.startsWith("#") ) {
- moduleDirs.remove(it.substring(1).trim())
- } else {
- moduleDirs.remove(it)
- buildOrder += it;
- }
+ if ( it.startsWith("#") ) {
+ moduleDirs.remove(it.substring(1).trim())
+ } else {
+ moduleDirs.remove(it)
+ buildOrder += it;
+ //Do exactly one level of checks for further ordering in the module dir.
+ def submod = new File("${moduleBasePath}/${it}/module-inc.order");
+ if(submod.exists()) {
+ println ( "Processing module-inc.order in module dir ${it}" )
+ submod.eachLine{
+ if( it.startsWith("#") ) {
+ //Exclude
+ moduleDirs.remove(it.substring(1).trim())
+ }
+ else {
+ //Add to build order
+ moduleDirs.remove(it);
+ buildOrder += it;
+ }
+ }
+ }
+ }
}
+
buildOrder.addAll( moduleDirs )
println "==== BUILD ORDER ===="
buildOrder.each{ print "=> ${it} "}
View
61 clc/modules/module-inc.order
@@ -1,63 +1,3 @@
-# Copyright 2009-2012 Eucalyptus Systems, Inc.
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 3 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see http://www.gnu.org/licenses/.
-#
-# Please contact Eucalyptus Systems, Inc., 6755 Hollister Ave., Goleta
-# CA 93117, USA or visit http://www.eucalyptus.com/licenses/ if you need
-# additional information or have any questions.
-#
-# This file may incorporate work covered under the following copyright
-# and permission notice:
-#
-# Software License Agreement (BSD License)
-#
-# Copyright (c) 2008, Regents of the University of California
-# All rights reserved.
-#
-# Redistribution and use of this software in source and binary forms,
-# with or without modification, are permitted provided that the
-# following conditions are met:
-#
-# Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#
-# Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer
-# in the documentation and/or other materials provided with the
-# distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE. USERS OF THIS SOFTWARE ACKNOWLEDGE
-# THE POSSIBLE PRESENCE OF OTHER OPEN SOURCE LICENSED MATERIAL,
-# COPYRIGHTED MATERIAL OR PATENTED MATERIAL IN THIS SOFTWARE,
-# AND IF ANY SUCH MATERIAL IS DISCOVERED THE PARTY DISCOVERING
-# IT MAY INFORM DR. RICH WOLSKI AT THE UNIVERSITY OF CALIFORNIA,
-# SANTA BARBARA WHO WILL THEN ASCERTAIN THE MOST APPROPRIATE REMEDY,
-# WHICH IN THE REGENTS' DISCRETION MAY INCLUDE, WITHOUT LIMITATION,
-# REPLACEMENT OF THE CODE SO IDENTIFIED, LICENSING OF THE CODE SO
-# IDENTIFIED, OR WITHDRAWAL OF THE CODE CAPABILITY TO THE EXTENT
-# NEEDED TO COMPLY WITH ANY SUCH LICENSES OR RIGHTS.
-
# this file contains the list of module directories in the order they should be built.
# a line starting with a comment (#) can be used to explicitly ignore a directory in the build.
# modules which are not listed here will be built last in an undefined order.
@@ -79,5 +19,6 @@ reporting
troubleshooting
walrus
storage-controller
+storage-san-common
dns
www
View
4 clc/modules/msgs/src/main/java/com/eucalyptus/auth/login/HmacLoginModuleSupport.java
@@ -93,7 +93,9 @@ public void reset( ) {
protected AccessKey lookupAccessKey( final HmacCredentials credentials ) throws AuthException {
final String token = credentials.getParameters().get( SecurityParameter.SecurityToken.toString() );
- return AccessKeys.lookupAccessKey( credentials.getQueryId( ), token );
+ final AccessKey key = AccessKeys.lookupAccessKey( credentials.getQueryId( ), token );
+ if ( !key.isActive() ) throw new AuthException( "Invalid access key or token" );
+ return key;
}
protected void checkForReplay( final String signature ) throws AuthenticationException {
View
3  clc/modules/msgs/src/main/java/com/eucalyptus/component/AbstractServiceBuilder.java
@@ -71,6 +71,9 @@
import com.eucalyptus.util.Internets;
public abstract class AbstractServiceBuilder<T extends ServiceConfiguration> implements ServiceBuilder<T> {
+ @Override
+ public void fireLoad( ServiceConfiguration parent ) throws ServiceRegistrationException {}
+
private static Logger LOG = Logger.getLogger( AbstractServiceBuilder.class );
@Override
View
5 clc/modules/msgs/src/main/java/com/eucalyptus/component/DummyServiceBuilder.java
@@ -96,7 +96,10 @@ public ServiceConfiguration newInstance( ) {
ComponentId compId = this.getComponentId( );
return ServiceConfigurations.createEphemeral( compId );
}
-
+
+ @Override
+ public void fireLoad( ServiceConfiguration parent ) throws ServiceRegistrationException {}
+
@Override
public void fireStart( ServiceConfiguration config ) throws ServiceRegistrationException {
EventRecord.here( ServiceBuilder.class, EventType.COMPONENT_SERVICE_START, config.getFullName( ).toString( ), config.toString( ) ).exhaust( );
View
15 clc/modules/msgs/src/main/java/com/eucalyptus/component/Faults.java
@@ -104,6 +104,8 @@
import com.eucalyptus.bootstrap.Hosts;
import com.eucalyptus.component.Component.State;
import com.eucalyptus.component.Component.Transition;
+import com.eucalyptus.component.fault.FaultBuilderImpl;
+import com.eucalyptus.component.fault.FaultSubsystemManager;
import com.eucalyptus.component.id.Eucalyptus;
import com.eucalyptus.configurable.ConfigurableClass;
import com.eucalyptus.configurable.ConfigurableField;
@@ -760,4 +762,17 @@ public static void failstop( ServiceConfiguration key, CheckException checkEx )
public static boolean isFailstop( ) {
return !failstopExceptions.isEmpty( );
}
+
+ private static final FaultSubsystemManager faultSubsystemManager = new FaultSubsystemManager();
+ public static void init() {
+ faultSubsystemManager.init();
+ }
+ public static FaultBuilder forComponent(Class <? extends ComponentId> componentIdClass) {
+ return new FaultBuilderImpl(faultSubsystemManager, componentIdClass);
+ }
+ public interface FaultBuilder {
+ public FaultBuilder withVar(String name, String value);
+ public FaultBuilder havingId(int faultId);
+ public void log();
+ }
}
View
1  clc/modules/msgs/src/main/java/com/eucalyptus/component/ServiceBuilder.java
@@ -87,6 +87,7 @@
* @throws ServiceRegistrationException
*/
public abstract Boolean checkAdd( String partition, String name, String host, Integer port ) throws ServiceRegistrationException;
+ public abstract void fireLoad( ServiceConfiguration parent ) throws ServiceRegistrationException;
public abstract void fireStart( ServiceConfiguration config ) throws ServiceRegistrationException;
public abstract void fireStop( ServiceConfiguration config ) throws ServiceRegistrationException;
public abstract void fireEnable( ServiceConfiguration config ) throws ServiceRegistrationException;
View
1  clc/modules/msgs/src/main/java/com/eucalyptus/component/ServiceTransitions.java
@@ -590,6 +590,7 @@ public static ServiceTransitionCallback map( TransitionActions transition ) {
@Override
public void fire( final ServiceConfiguration parent ) throws Exception {
parent.lookupBootstrapper( ).load( );
+ ServiceBuilders.lookup( parent.getComponentId( ) ).fireLoad( parent );
}
},
View
2  .../eucalyptus/troubleshooting/fault/xml/Common.java → ...n/java/com/eucalyptus/component/fault/Common.java
@@ -59,7 +59,7 @@
* IDENTIFIED, OR WITHDRAWAL OF THE CODE CAPABILITY TO THE EXTENT
* NEEDED TO COMPLY WITH ANY SUCH LICENSES OR RIGHTS.
************************************************************************/
-package com.eucalyptus.troubleshooting.fault.xml;
+package com.eucalyptus.component.fault;
public class Common implements EffectiveValue {
View
2  ...tus/troubleshooting/fault/xml/EffectiveValue.java → ...om/eucalyptus/component/fault/EffectiveValue.java
@@ -59,7 +59,7 @@
* IDENTIFIED, OR WITHDRAWAL OF THE CODE CAPABILITY TO THE EXTENT
* NEEDED TO COMPLY WITH ANY SUCH LICENSES OR RIGHTS.
************************************************************************/
-package com.eucalyptus.troubleshooting.fault.xml;
+package com.eucalyptus.component.fault;
public interface EffectiveValue {
public String getEffectiveValue();
View
2  ...m/eucalyptus/troubleshooting/fault/xml/Fault.java → ...in/java/com/eucalyptus/component/fault/Fault.java
@@ -59,7 +59,7 @@
* IDENTIFIED, OR WITHDRAWAL OF THE CODE CAPABILITY TO THE EXTENT
* NEEDED TO COMPLY WITH ANY SUCH LICENSES OR RIGHTS.
************************************************************************/
-package com.eucalyptus.troubleshooting.fault.xml;
+package com.eucalyptus.component.fault;
import java.io.PrintWriter;
import java.io.StringWriter;
View
14 ...s/troubleshooting/fault/xml/FaultBuilderImpl.java → .../eucalyptus/component/fault/FaultBuilderImpl.java
@@ -59,14 +59,14 @@
* IDENTIFIED, OR WITHDRAWAL OF THE CODE CAPABILITY TO THE EXTENT
* NEEDED TO COMPLY WITH ANY SUCH LICENSES OR RIGHTS.
************************************************************************/
-package com.eucalyptus.troubleshooting.fault.xml;
+package com.eucalyptus.component.fault;
import java.util.ArrayList;
import org.apache.log4j.Logger;
import com.eucalyptus.component.ComponentId;
-import com.eucalyptus.troubleshooting.fault.FaultBuilder;
+import com.eucalyptus.component.Faults.FaultBuilder;
public class FaultBuilderImpl implements FaultBuilder {
private static final Logger LOG = Logger.getLogger(FaultBuilder.class);
@@ -87,13 +87,13 @@ public NameValuePair(String name, String value) {
}
private FaultSubsystemManager faultSubsystemManager;
- private ComponentId componentId;
+ private Class<? extends ComponentId> componentIdClass;
private ArrayList<NameValuePair> vars = new ArrayList<NameValuePair>();
private int faultId;
- public FaultBuilderImpl(FaultSubsystemManager faultSubsystemManager, ComponentId componentId) {
+ public FaultBuilderImpl(FaultSubsystemManager faultSubsystemManager, Class<? extends ComponentId> componentIdClass) {
this.faultSubsystemManager = faultSubsystemManager;
- this.componentId = componentId;
+ this.componentIdClass = componentIdClass;
}
@Override
public FaultBuilder withVar(String name, String value) {
@@ -110,7 +110,7 @@ public FaultBuilder havingId(int faultId) {
@Override
public void log() {
try {
- FaultLogger faultLogger = faultSubsystemManager.getFaultLogger(componentId);
+ FaultLogger faultLogger = faultSubsystemManager.getFaultLogger(componentIdClass);
Fault fault = faultSubsystemManager.getFaultRegistry().lookupFault(faultId);
if (fault == FaultRegistry.SUPPRESSED_FAULT) {
LOG.debug("Fault " + faultId + " detected, will not be logged because it has been configured to be suppressed.");
@@ -123,7 +123,7 @@ public void log() {
faultLogger.log(fault);
}
} catch (Exception ex) {
- LOG.error("Error writing fault with id " + faultId + " for component " + componentId);
+ LOG.error("Error writing fault with id " + faultId + " for component " + componentIdClass.getName());
ex.printStackTrace();
}
}
View
2  ...alyptus/troubleshooting/fault/xml/FaultField.java → ...va/com/eucalyptus/component/fault/FaultField.java
@@ -59,7 +59,7 @@
* IDENTIFIED, OR WITHDRAWAL OF THE CODE CAPABILITY TO THE EXTENT
* NEEDED TO COMPLY WITH ANY SUCH LICENSES OR RIGHTS.
************************************************************************/
-package com.eucalyptus.troubleshooting.fault.xml;
+package com.eucalyptus.component.fault;
public class FaultField implements EffectiveValue {
private FaultFieldName name;
View
2  ...tus/troubleshooting/fault/xml/FaultFieldName.java → ...om/eucalyptus/component/fault/FaultFieldName.java
@@ -59,7 +59,7 @@
* IDENTIFIED, OR WITHDRAWAL OF THE CODE CAPABILITY TO THE EXTENT
* NEEDED TO COMPLY WITH ANY SUCH LICENSES OR RIGHTS.
************************************************************************/
-package com.eucalyptus.troubleshooting.fault.xml;
+package com.eucalyptus.component.fault;
public enum FaultFieldName {
condition,
cause,
View
2  ...lyptus/troubleshooting/fault/xml/FaultLogger.java → ...a/com/eucalyptus/component/fault/FaultLogger.java
@@ -59,7 +59,7 @@
* IDENTIFIED, OR WITHDRAWAL OF THE CODE CAPABILITY TO THE EXTENT
* NEEDED TO COMPLY WITH ANY SUCH LICENSES OR RIGHTS.
************************************************************************/
-package com.eucalyptus.troubleshooting.fault.xml;
+package com.eucalyptus.component.fault;
import java.util.Enumeration;
View
2  ...yptus/troubleshooting/fault/xml/FaultMessage.java → .../com/eucalyptus/component/fault/FaultMessage.java
@@ -59,7 +59,7 @@
* IDENTIFIED, OR WITHDRAWAL OF THE CODE CAPABILITY TO THE EXTENT
* NEEDED TO COMPLY WITH ANY SUCH LICENSES OR RIGHTS.
************************************************************************/
-package com.eucalyptus.troubleshooting.fault.xml;
+package com.eucalyptus.component.fault;
public class FaultMessage implements EffectiveValue {
private String message;
View
2  ...ptus/troubleshooting/fault/xml/FaultRegistry.java → ...com/eucalyptus/component/fault/FaultRegistry.java
@@ -59,7 +59,7 @@
* IDENTIFIED, OR WITHDRAWAL OF THE CODE CAPABILITY TO THE EXTENT
* NEEDED TO COMPLY WITH ANY SUCH LICENSES OR RIGHTS.
************************************************************************/
-package com.eucalyptus.troubleshooting.fault.xml;
+package com.eucalyptus.component.fault;
import java.io.File;
import java.io.FileFilter;
View
13 ...ubleshooting/fault/xml/FaultSubsystemManager.java → ...lyptus/component/fault/FaultSubsystemManager.java
@@ -59,12 +59,9 @@
* IDENTIFIED, OR WITHDRAWAL OF THE CODE CAPABILITY TO THE EXTENT
* NEEDED TO COMPLY WITH ANY SUCH LICENSES OR RIGHTS.
************************************************************************/
-package com.eucalyptus.troubleshooting.fault.xml;
+package com.eucalyptus.component.fault;
-import java.io.File;
-import java.util.ArrayList;
import java.util.Enumeration;
-import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -144,9 +141,9 @@ no global getAppender() method, so every logger will be traversed. If it can no
*/
- public synchronized FaultLogger getFaultLogger(ComponentId componentId) {
-
-
+ public synchronized FaultLogger getFaultLogger(Class <? extends ComponentId> componentIdClass) {
+ if (componentIdClass == null) throw new IllegalArgumentException("componentIdClass is null");
+ ComponentId componentId = ComponentIds.lookup(componentIdClass);
if (componentId == null) throw new IllegalArgumentException("componentId is null");
String faultLogPrefix = componentId.getFaultLogPrefix();
FaultLogger logger = loggerMap.get(faultLogPrefix);
@@ -236,7 +233,7 @@ public void init() {
// preload as many appenders as we can right now...
for (ComponentId componentId: ComponentIds.list()) {
// TODO: don't forget to bridge the components
- getFaultLogger(componentId);
+ getFaultLogger(componentId.getClass());
}
}
View
4 clc/modules/msgs/src/main/java/com/eucalyptus/component/id/Storage.java
@@ -70,8 +70,8 @@
@Partition( value = { Eucalyptus.class } )
@GenerateKeys
@FaultLogPrefix( "sc" )
-public class Storage extends ComponentId {
-
+public class Storage extends ComponentId {
+
@Override
public Boolean hasCredentials( ) {
return true;
View
37 clc/modules/msgs/src/main/java/com/eucalyptus/configurable/AbstractConfigurableProperty.java
@@ -66,8 +66,14 @@
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
+import java.util.List;
+import java.util.NoSuchElementException;
+
+import javax.persistence.EntityTransaction;
+
import org.apache.log4j.Logger;
import com.eucalyptus.configurable.PropertyDirectory.NoopEventListener;
+import com.eucalyptus.entities.Entities;
import com.eucalyptus.entities.EntityWrapper;
import com.eucalyptus.records.Logs;
@@ -180,34 +186,45 @@ public String getDefaultValue( ) {
}
public String getValue( ) {
- EntityWrapper db = EntityWrapper.get( this.getDefiningClass( ) );
+ EntityTransaction trans = Entities.get( this.getDefiningClass( ) );
try {
- Object o = db.getUnique( this.getQueryObject( ) );
+ //Unique result gets first found value if multiple exist, should work if all are kept in sync
+ Object o = Entities.uniqueResult( this.getQueryObject( ) );
Object prop = this.getter.invoke( o );
String result = prop != null
? prop.toString( )
: "<unset>";
- db.commit( );
+ trans.commit( );
return result;
} catch ( Exception e ) {
Logs.exhaust( ).error( e, e );
- db.rollback( );
+ trans.rollback( );
return "<unset>";
}
}
public String setValue( String s ) {
- EntityWrapper db = EntityWrapper.get( this.getDefiningClass( ) );
+ EntityTransaction trans = Entities.get(this.getDefiningClass());
try {
- Object o = db.getUnique( this.getQueryObject( ) );
+ //This should return all matching objects
+ List<Object> resultList = Entities.query( this.getQueryObject( ) );
Object prop = this.getTypeParser( ).apply( s );
- this.fireChange( prop );
- this.setter.invoke( o, prop );
- db.commit( );
+
+ if(resultList == null || resultList.size() == 0) {
+ throw new NoSuchElementException("no entities found for property");
+ }
+
+ this.fireChange( prop ); //Fire change only once
+ LOG.debug("Running setters.");
+
+ for(Object obj : resultList) {
+ this.setter.invoke( obj, prop );
+ }
+ trans.commit( );
return s;
} catch ( Exception e ) {
Logs.exhaust( ).error( e, e );
- db.rollback( );
+ trans.rollback( );
return "Error: " + e.getMessage( );
}
}
View
25 clc/modules/msgs/src/main/java/com/eucalyptus/context/Context.java
@@ -177,31 +177,8 @@ public UserFullName getUserFullName( ) {
return UserFullName.getInstance( this.getUser( ) );
}
- public OwnerFullName getEffectiveUserFullName( ) {
- String effectiveUserId = this.getRequest( ).getEffectiveUserId( );
- if ( this.getRequest( ) != null && Principals.systemFullName( ).getUserName( ).equals( effectiveUserId ) ) {
- return Principals.systemFullName( );
- /** system **/
- } else if ( this.getRequest( ) == null || effectiveUserId == null ) {
- return Principals.nobodyFullName( );
- /** unset **/
- } else if ( !effectiveUserId.equals( this.getUserFullName( ).getUserName( ) ) ) {
- try {
- return UserFullName.getInstance( Accounts.lookupUserByName( effectiveUserId ) );
- } catch ( RuntimeException ex ) {
- LOG.error( ex );
- return UserFullName.getInstance( this.getUser( ) );
- } catch ( AuthException ex ) {
- LOG.error( ex, ex );
- return UserFullName.getInstance( this.getUser( ) );
- }
- } else {
- return UserFullName.getInstance( this.getUser( ) );
- }
- }
-
public boolean hasAdministrativePrivileges( ) {
- return Principals.systemFullName().equals( this.getEffectiveUserFullName( ) ) || this.getUser( ).isSystemAdmin( );
+ return this.getUser( ).isSystemAdmin( );
}
public User getUser( ) {
View
196 clc/modules/msgs/src/main/java/com/eucalyptus/crypto/util/SslSetup.java
@@ -62,23 +62,6 @@
package com.eucalyptus.crypto.util;
-import static java.util.Collections.singleton;
-import static java.util.regex.Pattern.compile;
-import static java.util.regex.Pattern.quote;
-import static com.eucalyptus.crypto.util.SslSetup.SslCipherBuilder.ciphers;
-import static com.eucalyptus.crypto.util.SslSetup.SslCipherSuiteBuilderParams.params;
-import static com.google.common.base.CharMatcher.anyOf;
-import static com.google.common.base.Predicates.and;
-import static com.google.common.base.Predicates.contains;
-import static com.google.common.base.Predicates.in;
-import static com.google.common.base.Predicates.not;
-import static com.google.common.collect.ImmutableList.copyOf;
-import static com.google.common.collect.Iterables.addAll;
-import static com.google.common.collect.Iterables.concat;
-import static com.google.common.collect.Iterables.filter;
-import static com.google.common.collect.Iterables.toArray;
-import static com.google.common.collect.Iterables.transform;
-import static com.google.common.collect.Lists.newArrayList;
import java.io.File;
import java.net.Socket;
import java.security.GeneralSecurityException;
@@ -92,10 +75,6 @@
import java.security.UnrecoverableKeyException;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
import java.util.concurrent.TimeUnit;
import javax.net.ssl.KeyManager;
import javax.net.ssl.KeyManagerFactorySpi;
@@ -115,15 +94,9 @@
import com.eucalyptus.configurable.ConfigurablePropertyException;
import com.eucalyptus.configurable.PropertyChangeListener;
import com.eucalyptus.system.SubDirectory;
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
-import com.google.common.base.Splitter;
import com.google.common.base.Supplier;
import com.google.common.base.Suppliers;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.MapMaker;
import com.google.common.collect.ObjectArrays;
-import com.google.common.collect.Sets;
import com.sun.net.ssl.internal.ssl.X509ExtendedTrustManager;
@ConfigurableClass( root = "bootstrap.webservices.ssl",
@@ -133,8 +106,6 @@
private static final String PROTOCOL = "TLS";
private static SSLContext SERVER_CONTEXT = null;
private static SSLContext CLIENT_CONTEXT = null;
- private static final Map<SslCipherSuiteBuilderParams,String[]> SSL_CIPHER_LOOKUP =
- new MapMaker().maximumSize(32).makeComputingMap( SslCipherSuiteBuilder.INSTANCE );
@ConfigurableField( description = "Alias of the certificate entry in euca.p12 to use for SSL for webservices.",
changeListener = SslCertChangeListener.class )
public static String SERVER_ALIAS = ComponentIds.lookup( Eucalyptus.class ).name( );
@@ -225,7 +196,7 @@ public static SSLEngine getServerEngine( ) {//TODO:GRZE: @Configurability
engine.setUseClientMode( false );
engine.setWantClientAuth( false );
engine.setNeedClientAuth( false );
- engine.setEnabledCipherSuites( getEnabledCipherSuites( SERVER_SSL_CIPHERS, engine.getSupportedCipherSuites() ) );
+ engine.setEnabledCipherSuites( SslUtils.getEnabledCipherSuites( SERVER_SSL_CIPHERS, engine.getSupportedCipherSuites() ) );
return engine;
}
@@ -233,10 +204,6 @@ public static SSLContext getClientContext( ) {
return CLIENT_CONTEXT;
}
- public static String[] getEnabledCipherSuites( final String cipherStrings, final String[] supportedCipherSuites ) {
- return SSL_CIPHER_LOOKUP.get( params(cipherStrings, supportedCipherSuites) );
- }
-
static class ClientKeyManager extends KeyManagerFactorySpi {
private static KeyManager singleton = new ClientPKCS12KeyManager( );
@@ -526,165 +493,4 @@ public void checkServerTrusted( X509Certificate[] arg0, String arg1, String arg2
}
}
-
- static final class SslCipherSuiteBuilderParams {
- private final String cipherStrings;
- private final String[] supportedCipherSuites;
-
- private SslCipherSuiteBuilderParams( final String cipherStrings,
- final String[] supportedCipherSuites ) {
- this.cipherStrings = cipherStrings;
- this.supportedCipherSuites = supportedCipherSuites.clone();
- }
-
- public String getCipherStrings() {
- return cipherStrings;
- }
-
- public String[] getSupportedCipherSuites() {
- return supportedCipherSuites;
- }
-
- @Override
- public boolean equals(final Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- final SslCipherSuiteBuilderParams that = (SslCipherSuiteBuilderParams) o;
-
- if (!cipherStrings.equals(that.cipherStrings)) return false;
- if (!Arrays.equals(supportedCipherSuites, that.supportedCipherSuites)) return false;
-
- return true;
- }
-
- @Override
- public int hashCode() {
- int result = cipherStrings.hashCode();
- result = 31 * result + Arrays.hashCode(supportedCipherSuites);
- return result;
- }
-
- static SslCipherSuiteBuilderParams params( final String cipherStrings,
- final String[] supportedCipherSuites ) {
- return new SslCipherSuiteBuilderParams( cipherStrings, supportedCipherSuites );
- }
- }
-
- private enum SslCipherSuiteBuilder implements Function<SslCipherSuiteBuilderParams,String[]>{
- INSTANCE;
-
- @Override
- public String[] apply( final SslCipherSuiteBuilderParams params ) {
- return ciphers()
- .with( params.getCipherStrings() )
- .enabledCipherSuites( params.getSupportedCipherSuites() );
- }
- }
-
- /**
- * Cipher suite builder that allows the OpenSSL syntax for cipher
- * exclusions (! prefix) and supports the ALL, NULL, and EXPORT lists.
- *
- * This also supports + to combine algorithms (e.g. "RSA+AES") and to
- * move ciphers to the end of the list (e.g. "+RC4")
- */
- static final class SslCipherBuilder {
- private final Set<String> cipherStringsSteps = Sets.newLinkedHashSet();
- private final Set<String> excludedCipherStrings = Sets.newHashSet();
-
- static SslCipherBuilder ciphers() {
- return new SslCipherBuilder();
- }
-
- SslCipherBuilder with( final String cipherStrings ) {
- return with( Splitter.on(anyOf(": ,") ).omitEmptyStrings().trimResults().split( cipherStrings ) );
- }
-
- SslCipherBuilder with( final Iterable<String> cipherStrings ) {
- addAll(cipherStringsSteps, filter(cipherStrings, not(CipherStringPrefixes.NOT)));
- addAll(excludedCipherStrings, transform(filter(cipherStrings, CipherStringPrefixes.NOT), CipherStringPrefixes.NOT.cleaner()));
- return this;
- }
-
- String[] enabledCipherSuites( final String[] supportedCipherSuiteArray ) {
- final ImmutableList<String> supportedCipherSuites = copyOf(supportedCipherSuiteArray);
- final ImmutableList<String> excludedCipherSuites = explodeCipherStrings(excludedCipherStrings, supportedCipherSuites);
- final List<String> cipherSuites = newArrayList();
- for ( final String cipherString : cipherStringsSteps ) {
- if ( CipherStringPrefixes.PLUS.apply(cipherString) ) {
- final String cipherStringToShift = CipherStringPrefixes.PLUS.cleaner().apply(cipherString);
- shift(cipherSuites, explodeCipherStrings(singleton(cipherStringToShift), supportedCipherSuites));
- } else {
- cipherSuites.addAll(explodeCipherStrings(singleton(cipherString), supportedCipherSuites));
- }
- }
- return toArray(filter(cipherSuites, and(in(supportedCipherSuites), not(in(excludedCipherSuites)))), String.class);
- }
-
- void shift( final List<String> cipherSuites,
- final List<String> ciphersSuitesToShift ) {
- // Shift ciphers to the end of the list
- for ( final String cipherSuite : ciphersSuitesToShift ) {
- if ( cipherSuites.remove( cipherSuite ) ) {
- cipherSuites.add( cipherSuite );
- }
- }
- }
-
-
- private ImmutableList<String> explodeCipherStrings( final Set<String> cipherStrings,
- final ImmutableList<String> supportedCipherSuites) {
- return copyOf(concat(transform(cipherStrings, cipherStringExploder(supportedCipherSuites))));
- }
-
- private Function<String,Iterable<String>> cipherStringExploder( final ImmutableList<String> supportedCipherSuites ) {
- return new Function<String,Iterable<String>>() {
- @Override
- public Iterable<String> apply( final String cipherString ) {
- if ( "ALL".equals( cipherString ) ) {
- return supportedCipherSuites;
- } else if ( cipherString.startsWith("TLS_") || cipherString.startsWith("SSL_") ) {
- return singleton(cipherString);
- } else {
- return filter( supportedCipherSuites, toPredicate(cipherString));
- }
- }
- };
- }
-
- private Predicate<CharSequence> toPredicate( final String cipherString ) {
- final List<Predicate<CharSequence>> predicates = newArrayList();
- for ( final String cipherStringPart : Splitter.on("+").split(cipherString) ) {
- predicates.add( contains(compile("_" + quote(cipherStringPart) + "(_|$)")) );
- }
- return and(predicates);
- }
-
- private enum CipherStringPrefixes implements Predicate<String> {
- NOT("!"),
- PLUS("+");
-
- private final String prefix;
-
- private CipherStringPrefixes( final String prefix ) {
- this.prefix = prefix;
- }
-
- @Override
- public boolean apply( final String value ) {
- return value.startsWith( prefix );
- }
-
- public Function<String,String> cleaner() {
- return new Function<String,String>(){
- @Override
- public String apply( final String value ) {
- return value.substring(1);
- }
- };
- }
- }
- }
-
}
View
222 clc/modules/msgs/src/main/java/com/eucalyptus/crypto/util/SslUtils.java
@@ -0,0 +1,222 @@
+/*************************************************************************
+ * Copyright 2009-2012 Eucalyptus Systems, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://www.gnu.org/licenses/.
+ *
+ * Please contact Eucalyptus Systems, Inc., 6755 Hollister Ave., Goleta
+ * CA 93117, USA or visit http://www.eucalyptus.com/licenses/ if you need
+ * additional information or have any questions.
+ ************************************************************************/
+package com.eucalyptus.crypto.util;
+
+import static java.util.Collections.singleton;
+import static java.util.regex.Pattern.compile;
+import static java.util.regex.Pattern.quote;
+import static com.eucalyptus.crypto.util.SslUtils.SslCipherBuilder.ciphers;
+import static com.eucalyptus.crypto.util.SslUtils.SslCipherSuiteBuilderParams.params;
+import static com.google.common.base.CharMatcher.anyOf;
+import static com.google.common.base.Predicates.and;
+import static com.google.common.base.Predicates.contains;
+import static com.google.common.base.Predicates.in;
+import static com.google.common.base.Predicates.not;
+import static com.google.common.collect.ImmutableList.copyOf;
+import static com.google.common.collect.Iterables.addAll;
+import static com.google.common.collect.Iterables.concat;
+import static com.google.common.collect.Iterables.filter;
+import static com.google.common.collect.Iterables.toArray;
+import static com.google.common.collect.Iterables.transform;
+import static com.google.common.collect.Lists.newArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import com.google.common.base.Function;
+import com.google.common.base.Predicate;
+import com.google.common.base.Splitter;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.MapMaker;
+import com.google.common.collect.Sets;
+
+/**
+ *
+ */
+public class SslUtils {
+
+ private static final Map<SslCipherSuiteBuilderParams,String[]> SSL_CIPHER_LOOKUP =
+ new MapMaker().maximumSize(32).makeComputingMap( SslCipherSuiteBuilder.INSTANCE );
+
+ public static String[] getEnabledCipherSuites( final String cipherStrings, final String[] supportedCipherSuites ) {
+ return SSL_CIPHER_LOOKUP.get( params(cipherStrings, supportedCipherSuites) );
+ }
+
+ static final class SslCipherSuiteBuilderParams {
+ private final String cipherStrings;
+ private final String[] supportedCipherSuites;
+
+ private SslCipherSuiteBuilderParams( final String cipherStrings,
+ final String[] supportedCipherSuites ) {
+ this.cipherStrings = cipherStrings;
+ this.supportedCipherSuites = supportedCipherSuites.clone();
+ }
+
+ public String getCipherStrings() {
+ return cipherStrings;
+ }
+
+ public String[] getSupportedCipherSuites() {
+ return supportedCipherSuites;
+ }
+
+ @SuppressWarnings( "RedundantIfStatement" )
+ @Override
+ public boolean equals(final Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ final SslCipherSuiteBuilderParams that = (SslCipherSuiteBuilderParams) o;
+
+ if (!cipherStrings.equals(that.cipherStrings)) return false;
+ if (!Arrays.equals( supportedCipherSuites, that.supportedCipherSuites )) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = cipherStrings.hashCode();
+ result = 31 * result + Arrays.hashCode(supportedCipherSuites);
+ return result;
+ }
+
+ static SslCipherSuiteBuilderParams params( final String cipherStrings,
+ final String[] supportedCipherSuites ) {
+ return new SslCipherSuiteBuilderParams( cipherStrings, supportedCipherSuites );
+ }
+ }
+
+ private enum SslCipherSuiteBuilder implements Function<SslCipherSuiteBuilderParams,String[]> {
+ INSTANCE;
+
+ @Override
+ public String[] apply( final SslCipherSuiteBuilderParams params ) {
+ return ciphers()
+ .with( params.getCipherStrings() )
+ .enabledCipherSuites( params.getSupportedCipherSuites() );
+ }
+ }
+
+ /**
+ * Cipher suite builder that allows the OpenSSL syntax for cipher
+ * exclusions (! prefix) and supports the ALL, NULL, and EXPORT lists.
+ *
+ * This also supports + to combine algorithms (e.g. "RSA+AES") and to
+ * move ciphers to the end of the list (e.g. "+RC4")
+ */
+ static final class SslCipherBuilder {
+ private final Set<String> cipherStringsSteps = Sets.newLinkedHashSet();
+ private final Set<String> excludedCipherStrings = Sets.newHashSet();
+
+ static SslCipherBuilder ciphers() {
+ return new SslCipherBuilder();
+ }
+
+ SslCipherBuilder with( final String cipherStrings ) {
+ return with( Splitter.on( anyOf( ": ," ) ).omitEmptyStrings().trimResults().split( cipherStrings ) );
+ }
+
+ SslCipherBuilder with( final Iterable<String> cipherStrings ) {
+ addAll(cipherStringsSteps, filter(cipherStrings, not(CipherStringPrefixes.NOT)));
+ addAll(excludedCipherStrings, transform(filter(cipherStrings, CipherStringPrefixes.NOT), CipherStringPrefixes.NOT.cleaner()));
+ return this;
+ }
+
+ String[] enabledCipherSuites( final String[] supportedCipherSuiteArray ) {
+ final ImmutableList<String> supportedCipherSuites = copyOf(supportedCipherSuiteArray);
+ final ImmutableList<String> excludedCipherSuites = explodeCipherStrings(excludedCipherStrings, supportedCipherSuites);
+ final List<String> cipherSuites = newArrayList();
+ for ( final String cipherString : cipherStringsSteps ) {
+ if ( CipherStringPrefixes.PLUS.apply(cipherString) ) {
+ final String cipherStringToShift = CipherStringPrefixes.PLUS.cleaner().apply(cipherString);
+ shift(cipherSuites, explodeCipherStrings(singleton(cipherStringToShift), supportedCipherSuites));
+ } else {
+ cipherSuites.addAll(explodeCipherStrings(singleton(cipherString), supportedCipherSuites));
+ }
+ }
+ return toArray(filter(cipherSuites, and(in(supportedCipherSuites), not(in(excludedCipherSuites)))), String.class);
+ }
+
+ void shift( final List<String> cipherSuites,
+ final List<String> ciphersSuitesToShift ) {
+ // Shift ciphers to the end of the list
+ for ( final String cipherSuite : ciphersSuitesToShift ) {
+ if ( cipherSuites.remove( cipherSuite ) ) {
+ cipherSuites.add( cipherSuite );
+ }
+ }
+ }
+
+
+ private ImmutableList<String> explodeCipherStrings( final Set<String> cipherStrings,
+ final ImmutableList<String> supportedCipherSuites) {
+ return copyOf(concat(transform(cipherStrings, cipherStringExploder(supportedCipherSuites))));
+ }
+
+ private Function<String,Iterable<String>> cipherStringExploder( final ImmutableList<String> supportedCipherSuites ) {
+ return new Function<String,Iterable<String>>() {
+ @Override
+ public Iterable<String> apply( final String cipherString ) {
+ if ( "ALL".equals( cipherString ) ) {
+ return supportedCipherSuites;
+ } else if ( cipherString.startsWith("TLS_") || cipherString.startsWith("SSL_") ) {
+ return singleton(cipherString);
+ } else {
+ return filter( supportedCipherSuites, toPredicate(cipherString));
+ }
+ }
+ };
+ }
+
+ private Predicate<CharSequence> toPredicate( final String cipherString ) {
+ final List<Predicate<CharSequence>> predicates = newArrayList();
+ for ( final String cipherStringPart : Splitter.on("+").split(cipherString) ) {
+ predicates.add( contains(compile("_" + quote(cipherStringPart) + "(_|$)")) );
+ }
+ return and(predicates);
+ }
+
+ private enum CipherStringPrefixes implements Predicate<String> {
+ NOT("!"),
+ PLUS("+");
+
+ private final String prefix;
+
+ private CipherStringPrefixes( final String prefix ) {
+ this.prefix = prefix;
+ }
+
+ @Override
+ public boolean apply( final String value ) {
+ return value.startsWith( prefix );
+ }
+
+ public Function<String,String> cleaner() {
+ return new Function<String,String>(){
+ @Override
+ public String apply( final String value ) {
+ return value.substring(1);
+ }
+ };
+ }
+ }
+ }
+}
View
32 clc/modules/msgs/src/main/java/com/eucalyptus/crypto/util/WSSecurity.java
@@ -87,6 +87,8 @@
import org.apache.ws.security.message.token.X509Security;
import org.apache.ws.security.processor.TimestampProcessor;
import org.apache.ws.security.util.WSSecurityUtil;
+import org.apache.xml.security.c14n.Canonicalizer;
+import org.apache.xml.security.c14n.InvalidCanonicalizerException;
import org.apache.xml.security.exceptions.XMLSecurityException;
import org.apache.xml.security.keys.KeyInfo;
import org.apache.xml.security.signature.SignedInfo;
@@ -109,14 +111,24 @@
public class WSSecurity {
private static Logger LOG = Logger.getLogger( WSSecurity.class );
private static CertificateFactory factory;
-
+ private static final String SYSTEM_PROPERTY_SKIP_SECURITY_CHECK = "com.eucalyptus.crypto.util.skipWsSecurityConfigurationChecks";
+
static {
+ System.setProperty( "org.apache.xml.security.resource.config", "/xml-security-config.xml" );
org.apache.xml.security.Init.init( );
+ if ( !acceptXmlSecurityConfiguration() ) {
+ LOG.fatal("XML Security configuration not applied, set system property "+SYSTEM_PROPERTY_SKIP_SECURITY_CHECK+"=true to skip check");
+ throw new RuntimeException("XML Security Configuration not applied");
+ }
WSSConfig.getDefaultWSConfig( ).addJceProvider( "BC", BouncyCastleProvider.class.getCanonicalName( ) );
WSSConfig.getDefaultWSConfig( ).setTimeStampStrict( true );
WSSConfig.getDefaultWSConfig( ).setEnableSignatureConfirmation( true );
}
-
+
+ public static void init() {
+ // currently the static initializer does the work
+ }
+
public static CertificateFactory getCertificateFactory( ) {
if ( factory == null ) {
try {
@@ -388,5 +400,19 @@ private static XMLSignature checkSignature( final Element securityNode ) throws
if ( sig.getKeyInfo( ) == null ) throw new WSSecurityException( WSSecurityException.SECURITY_TOKEN_UNAVAILABLE );
return sig;
}
-
+
+ private static boolean acceptXmlSecurityConfiguration() {
+ return
+ Boolean.parseBoolean(System.getProperty(SYSTEM_PROPERTY_SKIP_SECURITY_CHECK)) ||
+ isValidXmlSecurityConfiguration();
+ }
+
+ private static boolean isValidXmlSecurityConfiguration() {
+ try {
+ Canonicalizer.getInstance( "http://www.w3.org/2006/12/xml-c14n11" );
+ return false;
+ } catch (InvalidCanonicalizerException e) {
+ return true;
+ }
+ }
}
View
1  clc/modules/msgs/src/main/java/com/eucalyptus/records/EventType.java
@@ -112,6 +112,7 @@
BUNDLE_RESET,
BUNDLE_STARTED,
BUNDLE_STARTING,
+ BUNDLE_RESTART,
BUNDLE_TRANSITION,
CERTIFICATE_WRITE,
CHANNEL_WRITE,
View
12 clc/modules/msgs/src/main/java/com/eucalyptus/records/Logs.java
@@ -113,13 +113,23 @@
// Hence, we force the simplest initialization of the normal log4j. (creating only the root logger)
BasicConfigurator.configure();
+ // Hack: If we pass "EXTREME" or "EXHAUST" to the dom configurator,
+ // by default it will use the DEBUG level when we want it to use the trace level
+ // So we save the old level, change it back when we are done.
+ String logLevelProp = "euca.log.level";
+ String oldLogLevel = System.getProperty(logLevelProp);
+ if ("EXHAUST".equals(oldLogLevel) || "EXTREME".equals(oldLogLevel)) {
+ System.setProperty(logLevelProp, "TRACE");
+ }
// Then we run the DOMConfigurator on a new LoggerRepository
URL url = Thread.currentThread().getContextClassLoader().getResource("log4j.xml");
Hierarchy eucaHierarchy = new EucaHierarchy(new EucaRootLogger(Level.DEBUG));
new DOMConfigurator().doConfigure(url, eucaHierarchy);
-
// Then we hook the new logger repository into the LogManager.
LogManager.setRepositorySelector(new DefaultRepositorySelector(eucaHierarchy), null);
+
+ // Now set it back
+ System.setProperty(logLevelProp, oldLogLevel);
}
private static Logger LOG = Logger.getLogger( Logs.class );
/**
View
4 clc/modules/msgs/src/main/java/com/eucalyptus/system/EucaLayout.java
@@ -71,8 +71,8 @@
public class EucaLayout extends EucaPatternLayout {
private static final String DEFAULT_LOG_PATTERN = "%d{yyyy-MM-dd HH:mm:ss} %5.5p | %m%n";
- private static final String DEBUG_LOG_PATTERN = "%d{yyyy-MM-dd HH:mm:ss} %5.5p %9.9i %-23.23c{1} | %m%n";
- private static final String EXTREME_LOG_PATTERN = "%d{yyyy-MM-dd HH:mm:ss} %5.9p %9.9i %-23.23c{1} %-33.33f | %m%n";
+ private static final String DEBUG_LOG_PATTERN = "%d{yyyy-MM-dd HH:mm:ss} %5.5p %9.9i %-24.24c{1} | %m%n";
+ private static final String EXTREME_LOG_PATTERN = "%d{yyyy-MM-dd HH:mm:ss} %5.9p %9.9i %-24.24c{1} %-33.33f | %m%n";
private String CONTINUATION = "%m%n";
private EucaPatternLayout continuation = null;
private final EucaPatternLayout extremeLayout;
View
5 ...m/eucalyptus/troubleshooting/LoggingResetter.java → ...va/com/eucalyptus/system/log/LoggingResetter.java
@@ -60,7 +60,7 @@
* NEEDED TO COMPLY WITH ANY SUCH LICENSES OR RIGHTS.
************************************************************************/
-package com.eucalyptus.troubleshooting;
+package com.eucalyptus.system.log;
import java.io.IOException;
import java.io.InputStream;
@@ -114,6 +114,8 @@
public static synchronized void resetLoggingWithXML() {
LOG.info("Resetting log levels to " + System.getProperty("euca.log.level"));
+ // To avoid the value EXTREME in the log level, we "reset" it (for now)
+ Logs.reInit();
// This is a little evil. Due to issues with calling DOMConfigurator.configure()
// more than once, we re-read the log4j.xml file, query the Threshold level of all
// of the appenders and loggers and set them without creating additional items
@@ -156,7 +158,6 @@ public static synchronized void resetLoggingWithXML() {
}
}
}
- Logs.reInit();
}
private static void resetRootLogLevel(Logger rootLogger,
View
49 clc/modules/msgs/src/main/java/com/eucalyptus/ws/Handlers.java
@@ -62,6 +62,8 @@
package com.eucalyptus.ws;
+import static com.eucalyptus.component.ComponentId.ComponentMessage;
+import static com.eucalyptus.component.ComponentId.ComponentPart;
import java.net.URI;
import java.util.HashMap;
import java.util.List;
@@ -70,6 +72,7 @@
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
+import javax.annotation.Nullable;
import org.apache.log4j.Logger;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
@@ -122,6 +125,7 @@
import com.eucalyptus.http.MappingHttpRequest;
import com.eucalyptus.http.MappingHttpResponse;
import com.eucalyptus.records.Logs;
+import com.eucalyptus.system.Ats;
import com.eucalyptus.util.Exceptions;
import com.eucalyptus.ws.handlers.BindingHandler;
import com.eucalyptus.ws.handlers.InternalWsSecHandler;
@@ -415,7 +419,43 @@ public void handleUpstream( final ChannelHandlerContext ctx, final ChannelEvent
};
}
-
+
+ @ChannelPipelineCoverage( "one" )
+ private static final class ComponentMessageCheckHandler implements ChannelUpstreamHandler {
+ @Nullable
+ private final Class<? extends ComponentId> componentIdClass;
+
+ private ComponentMessageCheckHandler( final Class<? extends ComponentId> componentIdClass ) {
+ this.componentIdClass = componentIdClass;
+ }
+
+ @Override
+ public void handleUpstream( final ChannelHandlerContext channelHandlerContext,
+ final ChannelEvent channelEvent ) throws Exception {
+ if ( channelEvent instanceof MessageEvent && componentIdClass != null ) {
+ final BaseMessage message = BaseMessage.extractMessage( channelEvent );
+ final ComponentMessage componentMessage = message==null ? null :
+ Ats.inClassHierarchy( message ).get( ComponentMessage.class );
+ if ( message != null && (componentMessage == null || !componentIdClass.equals( componentMessage.value() ) ) ) {
+ LOG.warn( String.format("Message %s does not match pipeline component %s",
+ message.getClass(),
+ componentIdClass.getSimpleName() ) );
+
+ final MappingHttpMessage mappingHttpMessage = MappingHttpMessage.extractMessage( channelEvent );
+ final BaseMessage baseMessage = BaseMessage.extractMessage( channelEvent );
+ if ( baseMessage != null ) {
+ Contexts.clear( Contexts.lookup( baseMessage.getCorrelationId()) );
+ }
+ channelHandlerContext.getChannel( ).write( new MappingHttpResponse(
+ mappingHttpMessage==null ? HttpVersion.HTTP_1_1 : mappingHttpMessage.getProtocolVersion( ),
+ HttpResponseStatus.BAD_REQUEST ) );
+ return;
+ }
+ }
+ channelHandlerContext.sendUpstream( channelEvent );
+ }
+ }
+
static void sendRedirect( final ChannelHandlerContext ctx, final ChannelEvent e, final Class<? extends ComponentId> compClass, final MappingHttpRequest request ) {
e.getFuture( ).cancel( );
String redirectUri = null;
@@ -477,7 +517,12 @@ public void handleUpstream( final ChannelHandlerContext ctx, final ChannelEvent
}
}
-
+
+ public static void addComponentHandlers( final Class<? extends ComponentId> componentIdClass,
+ final ChannelPipeline pipeline ) {
+ pipeline.addLast( "msg-component-check", new ComponentMessageCheckHandler( componentIdClass ) );
+ }
+
public static void addSystemHandlers( final ChannelPipeline pipeline ) {
pipeline.addLast( "service-state-check", internalServiceStateHandler( ) );
pipeline.addLast( "service-specific-mangling", ServiceHackeryHandler.INSTANCE );