Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'maint/3.2/testing' into testing

  • Loading branch information...
commit 4473918a3ebf68e32780704bf757de5c597fc25f 2 parents 3a7a061 + 51a01cd
@viglesiasce viglesiasce authored
Showing with 7,516 additions and 1,407 deletions.
  1. +49 −0 clc/eucadmin/eucadmin/patched_gzip.py
  2. +44 −2 clc/modules/cluster-manager/src/main/java/com/eucalyptus/address/Address.java
  3. +1 −1  clc/modules/cluster-manager/src/main/java/com/eucalyptus/address/Addresses.java
  4. +4 −0 clc/modules/cluster-manager/src/main/java/com/eucalyptus/cloud/ResourceToken.java
  5. +1 −1  clc/modules/cluster-manager/src/main/java/com/eucalyptus/cloud/run/Allocations.java
  6. +7 −4 clc/modules/cluster-manager/src/main/java/com/eucalyptus/cluster/callback/DescribeSensorCallback.java
  7. +1 −11 clc/modules/cluster-manager/src/main/java/com/eucalyptus/cluster/callback/UnassignAddressCallback.java
  8. +1 −0  clc/modules/cluster-manager/src/main/java/com/eucalyptus/cluster/callback/VmStateCallback.java
  9. +3 −1 clc/modules/cluster-manager/src/main/java/com/eucalyptus/network/NetworkGroup.java
  10. +91 −15 clc/modules/cluster-manager/src/main/java/com/eucalyptus/vm/VmInstance.java
  11. +59 −11 clc/modules/cluster-manager/src/main/java/com/eucalyptus/vm/VmInstances.java
  12. +28 −5 clc/modules/cluster-manager/src/main/java/com/eucalyptus/vm/VmRuntimeState.java
  13. +20 −3 clc/modules/core/src/main/java/edu/ucsb/eucalyptus/cloud/HeadAccessDeniedException.java
  14. +20 −3 clc/modules/core/src/main/java/edu/ucsb/eucalyptus/cloud/HeadExceptionInterface.java
  15. +20 −3 clc/modules/core/src/main/java/edu/ucsb/eucalyptus/cloud/HeadNoSuchBucketException.java
  16. +20 −3 clc/modules/core/src/main/java/edu/ucsb/eucalyptus/cloud/HeadNoSuchEntityException.java
  17. +4 −0 clc/modules/core/src/main/java/edu/ucsb/eucalyptus/cloud/entities/ISCSIVolumeInfo.java
  18. +4 −0 clc/modules/core/src/main/java/edu/ucsb/eucalyptus/cloud/entities/LVMVolumeInfo.java
  19. +4 −14 clc/modules/dns/src/main/java/com/eucalyptus/dns/TransientZone.java
  20. +4 −4 clc/modules/msgs/src/main/java/com/eucalyptus/bootstrap/Databases.java
  21. +1 −2  clc/modules/msgs/src/main/java/com/eucalyptus/component/ServiceTransitions.java
  22. +10 −0 clc/modules/msgs/src/main/java/com/eucalyptus/configurable/PropertyDirectory.java
  23. +20 −0 clc/modules/msgs/src/main/java/com/eucalyptus/system/log/EucaHierarchy.java
  24. +20 −0 clc/modules/msgs/src/main/java/com/eucalyptus/system/log/EucaLogger.java
  25. +20 −1 clc/modules/msgs/src/main/java/com/eucalyptus/system/log/EucaLoggerFactory.java
  26. +20 −0 clc/modules/msgs/src/main/java/com/eucalyptus/system/log/EucaLoggingEvent.java
  27. +20 −0 clc/modules/msgs/src/main/java/com/eucalyptus/system/log/EucaLoggingOutputStream.java
  28. +20 −1 clc/modules/msgs/src/main/java/com/eucalyptus/system/log/EucaPatternLayout.java
  29. +21 −2 clc/modules/msgs/src/main/java/com/eucalyptus/system/log/EucaPatternParser.java
  30. +20 −0 clc/modules/msgs/src/main/java/com/eucalyptus/system/log/EucaRootLogger.java
  31. +20 −0 clc/modules/msgs/src/main/java/com/eucalyptus/system/log/NullEucaLogger.java
  32. +52 −65 clc/modules/msgs/src/main/java/com/eucalyptus/util/UniqueIds.java
  33. +9 −0 clc/modules/msgs/src/main/java/com/eucalyptus/util/async/Callbacks.java
  34. +65 −0 clc/modules/msgs/src/main/java/com/eucalyptus/util/async/DelegatingRemoteCallback.java
  35. +11 −18 clc/modules/msgs/src/main/java/com/eucalyptus/util/async/RemoteCallback.java
  36. +2 −2 clc/modules/msgs/src/main/java/com/eucalyptus/ws/handlers/QueryTimestampHandler.java
  37. +2 −2 clc/modules/msgs/src/main/java/com/eucalyptus/ws/protocol/BaseQueryBinding.java
  38. +2 −1  clc/modules/msgs/src/main/java/edu/ucsb/eucalyptus/msgs/Messages.groovy
  39. +4 −12 clc/modules/msgs/src/main/resources/cc-sensors.xml
  40. +20 −0 clc/modules/reporting/src/main/java/com/eucalyptus/reporting/ReportType.java
  41. +20 −0 clc/modules/reporting/src/main/java/com/eucalyptus/reporting/art/generator/ArtGenerator.java
  42. +20 −0 clc/modules/reporting/src/main/java/com/eucalyptus/reporting/art/generator/ElasticIpArtGenerator.java
  43. +5 −3 clc/modules/reporting/src/main/java/com/eucalyptus/reporting/art/generator/InstanceArtGenerator.java
  44. +20 −1 clc/modules/reporting/src/main/java/com/eucalyptus/reporting/art/renderer/ElasticIpRenderer.java
  45. +1 −1  clc/modules/reporting/src/main/java/com/eucalyptus/reporting/art/renderer/InstanceRenderer.java
  46. +20 −3 clc/modules/reporting/src/main/java/com/eucalyptus/reporting/art/renderer/document/CsvDocument.java
  47. +21 −1 clc/modules/reporting/src/main/java/com/eucalyptus/reporting/art/renderer/document/Document.java
  48. +26 −2 clc/modules/reporting/src/main/java/com/eucalyptus/reporting/modules/backend/DescribeSensorsListener.java
  49. +20 −0 clc/modules/reporting/src/test/java/com/eucalyptus/reporting/FalseDataGenerator.java
  50. +23 −20 clc/modules/storage-controller/src/main/java/com/eucalyptus/storage/ISCSIManager.java
  51. +2 −1  clc/modules/storage-controller/src/main/java/com/eucalyptus/storage/OverlayManager.java
  52. +1 −0  clc/modules/storage-controller/src/main/java/edu/ucsb/eucalyptus/cloud/ws/BlockStorage.java
  53. +20 −1 ...s/troubleshooting/src/main/java/com/eucalyptus/troubleshooting/changelisteners/DBCheckPollTimeListener.java
  54. +20 −0 .../troubleshooting/src/main/java/com/eucalyptus/troubleshooting/changelisteners/DBCheckThresholdListener.java
  55. +20 −1 ...shooting/src/main/java/com/eucalyptus/troubleshooting/changelisteners/LogFileDiskCheckPollTimeListener.java
  56. +20 −1 ...hooting/src/main/java/com/eucalyptus/troubleshooting/changelisteners/LogFileDiskCheckThresholdListener.java
  57. +20 −0 clc/modules/troubleshooting/src/main/java/com/eucalyptus/troubleshooting/changelisteners/LogLevelListener.java
  58. +20 −1 ...oubleshooting/src/main/java/com/eucalyptus/troubleshooting/changelisteners/MemoryCheckPollTimeListener.java
  59. +20 −1 .../troubleshooting/src/main/java/com/eucalyptus/troubleshooting/changelisteners/MemoryCheckRatioListener.java
  60. +20 −1 ...ooting/src/main/java/com/eucalyptus/troubleshooting/changelisteners/PermGenMemoryCheckPollTimeListener.java
  61. +20 −1 ...eshooting/src/main/java/com/eucalyptus/troubleshooting/changelisteners/PermGenMemoryCheckRatioListener.java
  62. +20 −0 ...ules/troubleshooting/src/main/java/com/eucalyptus/troubleshooting/changelisteners/TriggerFaultListener.java
  63. +20 −0 clc/modules/troubleshooting/src/main/java/com/eucalyptus/troubleshooting/checker/DBResourceCheck.java
  64. +20 −0 clc/modules/troubleshooting/src/main/java/com/eucalyptus/troubleshooting/checker/DiskResourceCheck.java
  65. +20 −0 clc/modules/troubleshooting/src/main/java/com/eucalyptus/troubleshooting/checker/MemoryCheck.java
  66. +20 −0 clc/modules/troubleshooting/src/main/java/com/eucalyptus/troubleshooting/checker/PermGenMemoryCheck.java
  67. +20 −0 ...modules/troubleshooting/src/main/java/com/eucalyptus/troubleshooting/checker/schedule/DBCheckScheduler.java
  68. +20 −0 ...roubleshooting/src/main/java/com/eucalyptus/troubleshooting/checker/schedule/LogFileDiskCheckScheduler.java
  69. +20 −0 ...les/troubleshooting/src/main/java/com/eucalyptus/troubleshooting/checker/schedule/MemoryCheckScheduler.java
  70. +20 −0 ...ubleshooting/src/main/java/com/eucalyptus/troubleshooting/checker/schedule/PermGenMemoryCheckScheduler.java
  71. +1 −1  clc/modules/walrus/src/main/java/edu/ucsb/eucalyptus/storage/fs/DRBDStorageManager.java
  72. +4 −0 cluster/Makefile
  73. +42 −11 cluster/handlers.c
  74. +13 −11 cluster/server-marshal.c
  75. +5 −0 console/euca-console-server
  76. +25 −0 console/eucaconsole/__init__.py
  77. +47 −8 console/eucaconsole/api.py
  78. +45 −16 console/eucaconsole/botoclcinterface.py
  79. +25 −0 console/eucaconsole/botojsonencoder.py
  80. +35 −0 console/eucaconsole/cache.py
  81. +55 −13 console/eucaconsole/cachingclcinterface.py
  82. +25 −0 console/eucaconsole/clcinterface.py
  83. +25 −0 console/eucaconsole/configloader.py
  84. +3 −3 console/eucaconsole/console.ini
  85. +28 −0 console/eucaconsole/mockclcinterface.py
  86. +25 −0 console/eucaconsole/response.py
  87. +25 −2 console/eucaconsole/threads.py
  88. +25 −0 console/eucaconsole/token.py
  89. +24 −0 console/setup.py
  90. +22 −9 console/static/css/eucalyptus.css
  91. +10 −5 console/static/custom/Messages.properties
  92. +41 −9 console/static/custom/Messages_es_ES.properties
  93. +41 −9 console/static/custom/Messages_fr_FR.properties
  94. +41 −9 console/static/custom/Messages_it_IT.properties
  95. +721 −0 console/static/custom/Messages_ja.properties
  96. +1 −0  console/static/custom/Messages_ja_JP.properties
  97. +68 −38 console/static/custom/Messages_ko_KR.properties
  98. +55 −24 console/static/custom/Messages_ru.properties
  99. +669 −605 console/static/custom/Messages_zh_CN.properties
  100. +89 −0 console/static/custom/format_properties.py
  101. +1 −1  console/static/help/en/console_about.html
  102. +115 −0 console/static/help/zh/console_about.html
  103. +55 −0 console/static/help/zh/console_allocate_eip.html
  104. +51 −0 console/static/help/zh/console_associate_eip.html
  105. +56 −0 console/static/help/zh/console_attach_volume.html
  106. +196 −0 console/static/help/zh/console_create_instances.html
  107. +78 −0 console/static/help/zh/console_create_keypair.html
  108. +90 −0 console/static/help/zh/console_create_security_group.html
  109. +50 −0 console/static/help/zh/console_create_snapshot.html
  110. +69 −0 console/static/help/zh/console_create_volume.html
  111. +129 −0 console/static/help/zh/console_dashboard.html
  112. +50 −0 console/static/help/zh/console_delete_keypair.html
  113. +50 −0 console/static/help/zh/console_delete_security_group.html
  114. +50 −0 console/static/help/zh/console_delete_snapshot.html
  115. +50 −0 console/static/help/zh/console_delete_volumes.html
  116. +50 −0 console/static/help/zh/console_detach_volume.html
  117. +53 −0 console/static/help/zh/console_disassociate_eip.html
  118. +91 −0 console/static/help/zh/console_edit_security_group.html
  119. +45 −0 console/static/help/zh/console_get_console_output.html
  120. +53 −0 console/static/help/zh/console_import_keypair.html
  121. +125 −0 console/static/help/zh/console_launch_more_instances.html
  122. +61 −0 console/static/help/zh/console_login.html
  123. +153 −0 console/static/help/zh/console_manage_eips.html
  124. +92 −0 console/static/help/zh/console_manage_images.html
  125. +195 −0 console/static/help/zh/console_manage_instances.html
  126. +115 −0 console/static/help/zh/console_manage_keypairs.html
  127. +97 −0 console/static/help/zh/console_manage_security_groups.html
  128. +112 −0 console/static/help/zh/console_manage_snapshots.html
  129. +165 −0 console/static/help/zh/console_manage_volumes.html
  130. +50 −0 console/static/help/zh/console_reboot_instances.html
  131. +50 −0 console/static/help/zh/console_release_eip.html
  132. +50 −0 console/static/help/zh/console_stop_instances.html
  133. +50 −0 console/static/help/zh/console_terminate_instances.html
  134. +1 −0  console/static/help/zh_CN
  135. BIN  console/static/images/eng_team_2012_11.jpg
  136. BIN  console/static/images/koalas.jpeg
  137. +6 −6 console/static/index.html
  138. +2 −1  console/static/js/eip.js
  139. +1 −0  console/static/js/image.js
  140. +6 −6 console/static/js/instance.js
  141. +1 −0  console/static/js/keypair.js
  142. +4 −3 console/static/js/login.js
  143. +0 −2  console/static/js/main_container.js
  144. +1 −0  console/static/js/notification.js
  145. +104 −61 console/static/js/sgroup.js
  146. +66 −7 console/static/js/snapshot.js
  147. +34 −8 console/static/js/support.js
  148. +15 −1 console/static/js/template/eucadialog.js
  149. +4 −0 console/static/js/template/eucatable.js
  150. +1 −0  console/static/js/volume.js
  151. +25 −0 console/tests/proxy/addresstests.py
  152. +25 −0 console/tests/proxy/grouptests.py
  153. +57 −0 console/tests/proxy/image_registration.py
  154. +25 −0 console/tests/proxy/imagetests.py
  155. +25 −0 console/tests/proxy/instancetests.py
  156. +25 −0 console/tests/proxy/keypairtests.py
  157. +25 −0 console/tests/proxy/loadtest.py
  158. +25 −0 console/tests/proxy/snapshottests.py
  159. +32 −0 console/tests/proxy/uiproxyclient.py
  160. +25 −0 console/tests/proxy/volumetests.py
  161. +25 −0 console/tests/proxy/zonetests.py
  162. +19 −0 devel/groovy.sh
  163. +4 −0 net/Makefile
  164. +4 −0 node/Makefile
  165. +1 −0  node/handlers.c
  166. +16 −4 node/handlers_default.c
  167. +17 −12 node/server-marshal.c
  168. +4 −0 storage/Makefile
  169. +1 −1  storage/backing.c
  170. +6 −2 storage/blobstore.c
  171. +4 −0 storage/diskutil.c
  172. +2 −2 tools/Makefile
  173. +2 −1  tools/eucalyptus-cloud.in
  174. +1 −1  tools/eucalyptus.conf
  175. +1 −1  tools/getstats.pl
  176. +6 −6 tools/getstats_net.pl
  177. +112 −0 tools/multipath.conf.example
  178. +20 −2 tools/nc-hooks/libvirt-check.sh
  179. +6 −1 util/Makefile
  180. +11 −0 util/eucalyptus.h
  181. +4 −4 util/faults/en_US/1002.xml
  182. +3 −3 util/faults/en_US/1003.xml
  183. +11 −6 util/faults/en_US/1004.xml
  184. +9 −5 util/faults/en_US/1005.xml
  185. +0 −45 util/faults/en_US/1007.xml
  186. +3 −3 util/faults/en_US/1008.xml
  187. +1 −1  util/faults/en_US/1009.xml
  188. +1 −1  util/faults/en_US/1010.xml
  189. +464 −199 util/sensor.c
  190. +8 −12 util/sensor.h
View
49 clc/eucadmin/eucadmin/patched_gzip.py
@@ -8,6 +8,55 @@
# based on Andrew Kuchling's minigzip.py distributed with the zlib module
+# Original copyright statement:
+# PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
+# --------------------------------------------
+#
+# 1. This LICENSE AGREEMENT is between the Python Software Foundation
+# ("PSF"), and the Individual or Organization ("Licensee") accessing
+# and otherwise using this software ("Python") in source or binary
+# form and its associated documentation.
+#
+# 2. Subject to the terms and conditions of this License Agreement,
+# PSF hereby grants Licensee a nonexclusive, royalty-free, world-wide
+# license to reproduce, analyze, test, perform and/or display
+# publicly, prepare derivative works, distribute, and otherwise
+# use Python alone or in any derivative version, provided, however,
+# that PSF's License Agreement and PSF's notice of copyright, i.e.,
+# "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+# 2009 Python Software Foundation; All Rights Reserved" are retained
+# in Python alone or in any derivative version prepared by Licensee.
+#
+# 3. In the event Licensee prepares a derivative work that is based
+# on or incorporates Python or any part thereof, and wants to make
+# the derivative work available to others as provided herein, then
+# Licensee hereby agrees to include in any such work a brief summary
+# of the changes made to Python.
+#
+# 4. PSF is making Python available to Licensee on an "AS IS" basis.
+# PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED.
+# BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND DISCLAIMS
+# ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS FOR
+# ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT INFRINGE
+# ANY THIRD PARTY RIGHTS.
+#
+# 5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
+# FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
+# A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON, OR
+# ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
+#
+# 6. This License Agreement will automatically terminate upon a
+# material breach of its terms and conditions.
+#
+# 7. Nothing in this License Agreement shall be deemed to create any
+# relationship of agency, partnership, or joint venture between PSF
+# and Licensee. This License Agreement does not grant permission to
+# use PSF trademarks or trade name in a trademark sense to endorse
+# or promote products or services of Licensee, or any third party.
+#
+# 8. By copying, installing or otherwise using Python, Licensee agrees
+# to be bound by the terms and conditions of this License Agreement.
+
import struct, sys, time
import zlib
import __builtin__
View
46 clc/modules/cluster-manager/src/main/java/com/eucalyptus/address/Address.java
@@ -462,11 +462,34 @@ public boolean isAllocated( ) {
public boolean isSystemOwned( ) {
return Principals.systemFullName( ).equals( ( UserFullName ) this.getOwner( ) );
}
-
+
+ /**
+ * Is the instance assigned or with an impending assignment.
+ *
+ * <P>WARNING! in this state the instance ID may not be a valid instance
+ * identifier.</P>
+ *
+ * @return True if assigned or assignment impending.
+ * @see #getInstanceId()
+ * @see #getInstanceUuid()
+ */
public boolean isAssigned( ) {
return this.atomicState.getReference( ).ordinal( ) > State.allocated.ordinal( );
}
-
+
+ /**
+ * Is it really assigned? Really?
+ *
+ * <P>In this state the instance ID and UUID are expected to be valid.</P>
+ *
+ * @return True if assigned to an instance.
+ * @see #getInstanceId()
+ * @see #getInstanceUuid()
+ */
+ public boolean isReallyAssigned( ) {
+ return this.atomicState.getReference( ).ordinal( ) > State.impending.ordinal( );
+ }
+
public boolean isPending( ) {
return this.atomicState.isMarked( );
}
@@ -497,10 +520,29 @@ private static void addAddress( final Address address ) {
}
}
+ /**
+ * Get the instance ID for the instance using this address.
+ *
+ * <P>The instance ID is only a valid identifier when the address is
+ * assigned. In other states the value describes the state of the address
+ * (e.g. "available" or "pending") </P>
+ *
+ * @return The instance ID
+ * @see #isReallyAssigned()
+ */
public String getInstanceId( ) {
return this.instanceId;
}
+ /**
+ * Get the instance UUID for the instance using this address.
+ *
+ * <P>The instance ID is only a valid identifier when the address is
+ * assigned.</P>
+ *
+ * @return The instance UUID
+ * @see #isReallyAssigned()
+ */
public String getInstanceUuid( ) {
return this.instanceUuid;
}
View
2  clc/modules/cluster-manager/src/main/java/com/eucalyptus/address/Addresses.java
@@ -235,7 +235,7 @@ public static void system( final VmInstance vm ) {
public static void release( final Address addr ) {
try {
final String instanceId = addr.getInstanceId( );
- if ( addr.isAssigned( ) ) {
+ if ( addr.isReallyAssigned() ) {
try {
final VmInstance vm = VmInstances.lookup( instanceId );
if ( VmStateSet.RUN.apply( vm ) ) {
View
4 clc/modules/cluster-manager/src/main/java/com/eucalyptus/cloud/ResourceToken.java
@@ -102,6 +102,7 @@
@Nullable
private VmInstance vmInst;
private final Cluster cluster;
+ private boolean aborted;
public ResourceToken( final Allocation allocInfo, final int resourceAllocationSequenceNumber, final int launchIndex ) {
this.allocation = allocInfo;
@@ -161,6 +162,9 @@ public Integer getLaunchIndex( ) {
}
public void abort( ) {
+ if ( aborted ) return;
+ aborted = true;
+
LOG.debug( this );
try {
this.release( );
View
2  clc/modules/cluster-manager/src/main/java/com/eucalyptus/cloud/run/Allocations.java
@@ -124,7 +124,7 @@
private final List<ResourceToken> allocationTokens = Lists.newArrayList( );
private final Long reservationIndex;
private final Map<Integer, String> instanceIds;
- private Date expiration = new Date( 32503708800000l );
+ private Date expiration;
private Allocation( final RunInstancesType request ) {
super( );
View
11 clc/modules/cluster-manager/src/main/java/com/eucalyptus/cluster/callback/DescribeSensorCallback.java
@@ -20,6 +20,7 @@
package com.eucalyptus.cluster.callback;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
@@ -60,15 +61,17 @@
private static final String RESOURCE_TYPE_INSTANCE = "instance";
private final int historySize;
private final int collectionIntervalTimeMs;
+ private final ArrayList<String> instanceIds;
private final ListenerRegistry listener = ListenerRegistry.getInstance();
public DescribeSensorCallback( final int historySize,
- final int collectionIntervalTimeMS ) {
+ final int collectionIntervalTimeMS, final ArrayList<String> instanceIds) {
this.historySize = historySize;
this.collectionIntervalTimeMs = collectionIntervalTimeMS;
-
+ this.instanceIds = instanceIds;
+
final DescribeSensorsType msg =
- new DescribeSensorsType( this.historySize, this.collectionIntervalTimeMs );
+ new DescribeSensorsType( this.historySize, this.collectionIntervalTimeMs, this.instanceIds);
try {
msg.setUser( Accounts.lookupSystemAdmin() );
@@ -85,7 +88,7 @@ public void initialize( final DescribeSensorsType msg ) {
@Override
public BroadcastCallback<DescribeSensorsType, DescribeSensorsResponse> newInstance() {
- return new DescribeSensorCallback( this.historySize, this.collectionIntervalTimeMs );
+ return new DescribeSensorCallback( this.historySize, this.collectionIntervalTimeMs, this.instanceIds);
}
@Override
View
12 clc/modules/cluster-manager/src/main/java/com/eucalyptus/cluster/callback/UnassignAddressCallback.java
@@ -69,23 +69,15 @@
import com.eucalyptus.address.Addresses;
import edu.ucsb.eucalyptus.msgs.ClusterAddressInfo;
import com.eucalyptus.address.Address.Transition;
-import com.eucalyptus.component.Partition;
-import com.eucalyptus.component.Partitions;
-import com.eucalyptus.component.ServiceConfiguration;
-import com.eucalyptus.component.Topology;
-import com.eucalyptus.component.id.ClusterController;
import com.eucalyptus.records.EventRecord;
import com.eucalyptus.records.EventType;
import com.eucalyptus.records.Logs;
import com.eucalyptus.util.Expendable;
import com.eucalyptus.util.LogUtil;
-import com.eucalyptus.util.async.AsyncRequests;
import com.eucalyptus.util.async.MessageCallback;
import com.eucalyptus.vm.VmInstance;
import com.eucalyptus.vm.VmInstances;
import com.eucalyptus.vm.VmNetworkConfig;
-import com.eucalyptus.vm.VmInstances.TerminatedInstanceException;
-import edu.ucsb.eucalyptus.msgs.AssignAddressType;
import edu.ucsb.eucalyptus.msgs.UnassignAddressResponseType;
import edu.ucsb.eucalyptus.msgs.UnassignAddressType;
@@ -198,9 +190,7 @@ public void fireException( Throwable e ) {
}
/**
- * @see com.eucalyptus.util.Expendable#duplicateOf(com.eucalyptus.cluster.callback.UnassignAddressCallback)
- * @param that
- * @return
+ * @see com.eucalyptus.util.Expendable#duplicateOf
*/
@Override
public boolean duplicateOf( UnassignAddressCallback that ) {
View
1  clc/modules/cluster-manager/src/main/java/com/eucalyptus/cluster/callback/VmStateCallback.java
@@ -278,6 +278,7 @@ private static boolean handleRestore( final VmInfo runVm ) {
Logs.extreme( ).error( ex, ex );
}
try {
+ LOG.debug( "Instance " + runVm.getInstanceId( ) + " " + runVm );
return VmInstance.RestoreAllocation.INSTANCE.apply( runVm );
} catch ( Throwable ex ) {
LOG.error( ex );
View
4 clc/modules/cluster-manager/src/main/java/com/eucalyptus/network/NetworkGroup.java
@@ -261,7 +261,9 @@ public ExtantNetwork reclaim( Integer i ) throws NotEnoughResourcesException, Tr
} else if ( !Entities.isPersistent( this ) ) {
throw new TransientEntityException( this.toString( ) );
} else {
- return Entities.persist( ExtantNetwork.create( this, i ) );
+ ExtantNetwork exNet = Entities.persist( ExtantNetwork.create( this, i ) );
+ this.setExtantNetwork( exNet );
+ return this.getExtantNetwork( );
}
}
View
106 clc/modules/cluster-manager/src/main/java/com/eucalyptus/vm/VmInstance.java
@@ -128,6 +128,7 @@
import com.eucalyptus.keys.SshKeyPair;
import com.eucalyptus.network.ExtantNetwork;
import com.eucalyptus.network.NetworkGroup;
+import com.eucalyptus.network.NetworkGroups;
import com.eucalyptus.network.PrivateNetworkIndex;
import com.eucalyptus.records.Logs;
import com.eucalyptus.reporting.event.InstanceCreationEvent;
@@ -141,6 +142,7 @@
import com.eucalyptus.vm.VmVolumeAttachment.AttachmentState;
import com.eucalyptus.ws.StackConfiguration;
import com.google.common.base.Function;
+import com.google.common.base.Joiner;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.base.Strings;
@@ -148,6 +150,7 @@
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
+import edu.ucsb.eucalyptus.cloud.VirtualBootRecord;
import edu.ucsb.eucalyptus.cloud.VmInfo;
import edu.ucsb.eucalyptus.msgs.AttachedVolume;
import edu.ucsb.eucalyptus.msgs.InstanceBlockDeviceMapping;
@@ -253,7 +256,7 @@ public boolean apply( final VmVolumeAttachment input ) {
TERM( VmState.SHUTTING_DOWN, VmState.TERMINATED ),
NOT_RUNNING( VmState.STOPPING, VmState.STOPPED, VmState.SHUTTING_DOWN, VmState.TERMINATED ),
DONE( VmState.TERMINATED, VmState.BURIED );
-
+
private Set<VmState> states;
VmStateSet( final VmState... states ) {
@@ -325,6 +328,37 @@ public boolean apply( final VmInstance arg0 ) {
}
}
+ private enum ValidateVmInfo implements Predicate<VmInfo> {
+ INSTANCE;
+
+ @Override
+ public boolean apply( VmInfo arg0 ) {
+ if ( arg0.getGroupNames( ).isEmpty( ) ) {
+ LOG.warn( "Instance " + arg0.getInstanceId( ) + " reported no groups: " + arg0.getGroupNames( ) );
+ }
+ if ( arg0.getInstanceType( ).getName( ) == null ) {
+ LOG.warn( "Instance " + arg0.getInstanceId( ) + " reported no instance type: " + arg0.getInstanceType( ) );
+ }
+ if ( arg0.getInstanceType( ).getVirtualBootRecord( ).isEmpty( ) ) {
+ LOG.warn( "Instance " + arg0.getInstanceId( ) + " reported no vbr entries: " + arg0.getInstanceType( ).getVirtualBootRecord( ) );
+ return false;
+ }
+ try {
+ VirtualBootRecord vbr = arg0.getInstanceType( ).lookupRoot( );
+ } catch ( NoSuchElementException ex ) {
+ LOG.warn( "Instance " + arg0.getInstanceId( ) + " reported no root vbr entry: " + arg0.getInstanceType( ).getVirtualBootRecord( ) );
+ return false;
+ }
+ try {
+ Topology.lookup( ClusterController.class, Clusters.getInstance( ).lookup( arg0.getPlacement( ) ).lookupPartition( ) );
+ } catch ( NoSuchElementException ex ) {
+ return false;//GRZE:ARG: skip restoring while cluster is enabling since Builder.placement() depends on a running cluster...
+ }
+ return true;
+ }
+
+ }
+
public enum RestoreAllocation implements Predicate<VmInfo> {
INSTANCE;
@@ -363,9 +397,10 @@ public boolean apply( final VmInfo input ) {
final VmState inputState = VmState.Mapper.get( input.getStateName( ) );
if ( !VmStateSet.RUN.contains( inputState ) ) {
return false;
+ } else if ( !ValidateVmInfo.INSTANCE.apply( input ) ) {
+ return false;
} else {
final UserFullName userFullName = UserFullName.getInstance( input.getOwnerId( ) );
-
final EntityTransaction db = Entities.get( VmInstance.class );
boolean building = false;
try {
@@ -444,9 +479,43 @@ private static PrivateNetworkIndex restoreNetworkIndex( final VmInfo input, fina
}
private static List<NetworkGroup> restoreNetworks( final VmInfo input, final UserFullName userFullName ) {
- final List<NetworkGroup> networks = Lists.newArrayList( );
- networks.addAll( Lists.transform( input.getGroupNames( ), transformNetworkNames( userFullName ) ) );
- return networks;
+ final List<NetworkGroup> networks = Lists.newArrayList( );
+ networks.addAll( Lists.transform( input.getGroupNames( ), transformNetworkNames( userFullName ) ) );
+ Iterables.removeIf(networks, Predicates.isNull());
+
+ if ( networks.isEmpty() ) {
+ final EntityTransaction restore = Entities.get( NetworkGroup.class );
+ int index = input.getGroupNames().get(0).lastIndexOf("-");
+ String truncatedSecGroup = (String) input.getGroupNames().get(0).subSequence(0, index);
+ String orphanedSecGrp = truncatedSecGroup.concat("-orphaned");
+
+ try {
+ NetworkGroup found = NetworkGroups.lookup(userFullName,
+ orphanedSecGrp);
+ networks.add(found);
+ restore.commit();
+ } catch (NoSuchMetadataException ex) {
+
+ try {
+ NetworkGroup restoredGroup = NetworkGroups.create(userFullName,
+ orphanedSecGrp,
+ orphanedSecGrp);
+ networks.add(restoredGroup);
+ } catch (Exception e) {
+ LOG.debug("Failed to restored security group : " + orphanedSecGrp);
+ restore.rollback();
+ }
+
+ } catch (Exception e) {
+ LOG.debug("Failed to restore security group : " + orphanedSecGrp);
+ restore.rollback();
+ } finally {
+ if ( restore.isActive( ) ) {
+ restore.rollback( );
+ }
+ }
+ }
+ return networks;
}
private static void restoreAddress( final VmInfo input, final VmInstance vmInst ) {
@@ -459,17 +528,22 @@ private static void restoreAddress( final VmInfo input, final VmInstance vmInst
vmInst.updateAddresses( input.getNetParams( ).getIpAddress( ), input.getNetParams( ).getIgnoredPublicIp( ) );
} else if ( !addr.isAssigned( ) && addr.isAllocated( ) && ( addr.isSystemOwned( ) || addr.getOwner( ).equals( userFullName ) ) ) {
vmInst.updateAddresses( input.getNetParams( ).getIpAddress( ), input.getNetParams( ).getIgnoredPublicIp( ) );
+ if ( addr.isPending() ) try {
+ addr.clearPending();
+ } catch ( Exception e ) {
+ }
addr.assign( vmInst ).clearPending();
- } else {
- vmInst.updateAddresses( input.getNetParams( ).getIpAddress( ), input.getNetParams( ).getIpAddress( ) );
+ } else { // the public address used by the instance is not available
+ vmInst.updateAddresses( input.getNetParams( ).getIpAddress( ), input.getNetParams( ).getIpAddress() );
}
} catch ( NoSuchElementException e ) { // Address disabled
try {
- final Address addr = Addresses.getInstance( ).lookupDisabled( input.getNetParams( ).getIgnoredPublicIp( ) );
- vmInst.updateAddresses( input.getNetParams( ).getIpAddress( ), input.getNetParams( ).getIgnoredPublicIp( ) );
- addr.pendingAssignment().assign( vmInst ).clearPending();
+ final Address addr = Addresses.getInstance( ).lookupDisabled( input.getNetParams( ).getIgnoredPublicIp( ) );
+ vmInst.updateAddresses( input.getNetParams( ).getIpAddress( ), input.getNetParams( ).getIgnoredPublicIp( ) );
+ addr.pendingAssignment().assign( vmInst ).clearPending();
+
} catch ( final Exception ex2 ) {
- LOG.error( "Failed to restore address state (from disabled) " + input.getNetParams( )
+ LOG.error( "Failed to restore address state (from disabled) " + input.getNetParams( )
+ " for instance "
+ input.getInstanceId( )
+ " because of: "
@@ -485,7 +559,7 @@ private static void restoreAddress( final VmInfo input, final VmInstance vmInst
Logs.extreme( ).error( ex2, ex2 );
}
}
-
+
private static byte[] restoreUserData( final VmInfo input ) {
byte[] userData;
try {
@@ -848,7 +922,7 @@ public VmInstance apply( final ResourceToken token ) {
private PrivateNetworkIndex networkIndex;
private Boolean usePrivateAddressing;
private OwnerFullName owner;
- private Date expiration;
+ private Date expiration = new Date( 32503708800000l ); // 3000
public Builder owner( final OwnerFullName owner ) {
this.owner = owner;
@@ -856,7 +930,9 @@ public Builder owner( final OwnerFullName owner ) {
}
public Builder expiresOn( final Date expirationTime ) {
- this.expiration = expirationTime;
+ if ( expirationTime != null ) {
+ this.expiration = expirationTime;
+ }
return this;
}
@@ -1131,7 +1207,7 @@ public VmBundleTask resetBundleTask( ) {
}
public String getImageId( ) {
- return this.bootRecord.getMachine( ) == null ? "-" : this.bootRecord.getMachine( ).getDisplayName( );
+ return this.bootRecord.getMachine( ) == null ? "emi-00000000" : this.bootRecord.getMachine( ).getDisplayName( );
}
public String getRamdiskId( ) {
View
70 clc/modules/cluster-manager/src/main/java/com/eucalyptus/vm/VmInstances.java
@@ -112,11 +112,17 @@
import com.eucalyptus.records.EventType;
import com.eucalyptus.records.Logs;
import com.eucalyptus.reporting.event.ResourceAvailabilityEvent;
+import com.eucalyptus.util.Callback;
import com.eucalyptus.util.HasNaturalId;
+import com.eucalyptus.util.LogUtil;
import com.eucalyptus.util.OwnerFullName;
import com.eucalyptus.util.RestrictedTypes.QuantityMetricFunction;
import com.eucalyptus.util.RestrictedTypes.Resolver;
import com.eucalyptus.util.async.AsyncRequests;
+import com.eucalyptus.util.async.Callbacks;
+import com.eucalyptus.util.async.DelegatingRemoteCallback;
+import com.eucalyptus.util.async.RemoteCallback;
+import com.eucalyptus.util.async.Request;
import com.eucalyptus.vm.VmInstance.Transitions;
import com.eucalyptus.vm.VmInstance.VmState;
import com.eucalyptus.vm.VmInstance.VmStateSet;
@@ -127,7 +133,6 @@
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
-import edu.ucsb.eucalyptus.msgs.AttachedVolume;
import edu.ucsb.eucalyptus.msgs.DeleteStorageVolumeType;
import edu.ucsb.eucalyptus.msgs.DetachStorageVolumeType;
import edu.ucsb.eucalyptus.msgs.RunningInstancesItemType;
@@ -376,8 +381,17 @@ public boolean apply( final VmInstance vm ) {
public static VmInstance lookupByBundleId( final String bundleId ) throws NoSuchElementException {
return Iterables.find( list( ), withBundleId( bundleId ) );
}
-
+
+ public static void tryCleanUp( final VmInstance vm ) {
+ cleanUp( vm, true );
+ }
+
public static void cleanUp( final VmInstance vm ) {
+ cleanUp( vm, false );
+ }
+
+ private static void cleanUp( final VmInstance vm,
+ final boolean rollbackNetworkingOnFailure ) {
VmState vmLastState = vm.getLastState( );
VmState vmState = vm.getState( );
RuntimeException logEx = new RuntimeException( "Cleaning up instance: " + vm.getInstanceId( ) + " " + vmLastState + " -> " + vmState );
@@ -394,14 +408,14 @@ public static void cleanUp( final VmInstance vm ) {
} else {
EventRecord.caller( VmInstances.class, EventType.VM_TERMINATING, "USER_ADDRESS", address.toString( ) ).debug( );
}
- AsyncRequests.newRequest( address.unassign( ).getCallback( ) ).dispatch( vm.getPartition( ) );
+ unassignAddress( vm, address, rollbackNetworkingOnFailure );
}
} catch ( final NoSuchElementException e ) {
//PENDING->SHUTTINGDOWN might happen before address info reported in describe instances by CC, need to try finding address
if ( VmState.PENDING.equals( vmLastState ) ) {
for ( Address addr : Addresses.getInstance( ).listValues( ) ) {
if ( addr.getInstanceId( ).equals( vm.getInstanceId( ) ) ) {
- AsyncRequests.newRequest( addr.unassign( ).getCallback( ) ).dispatch( vm.getPartition( ) );
+ unassignAddress( vm, addr, rollbackNetworkingOnFailure );
break;
}
}
@@ -427,13 +441,47 @@ public static void cleanUp( final VmInstance vm ) {
Logs.extreme( ).error( ex, ex );
}
}
-
- private static final Predicate<AttachedVolume> anyVolumePred = new Predicate<AttachedVolume>( ) {
- @Override
- public boolean apply( final AttachedVolume arg0 ) {
- return true;
- }
- };
+
+ private static void unassignAddress( final VmInstance vm,
+ final Address address,
+ final boolean rollbackNetworkingOnFailure ) {
+ RemoteCallback<?,?> callback = address.unassign().getCallback();
+ Callback.Failure failureHander;
+ if ( rollbackNetworkingOnFailure ) {
+ callback = DelegatingRemoteCallback.suppressException( callback );
+ failureHander = new Callback.Failure<java.lang.Object>() {
+ @Override
+ public void fireException( final Throwable t ) {
+ // Revert the cloud state change
+ LOG.info( "Unable to assign address " + address.getName() + " for " + vm.getInstanceId() + ", will retry." );
+ if ( address.isPending( ) ) {
+ try {
+ address.clearPending( );
+ } catch ( Exception ex ) {
+ }
+ }
+ try {
+ if ( !address.isAllocated() ) {
+ address.pendingAssignment();
+ }
+ address.assign( vm ).clearPending();
+ } catch ( Exception e ) {
+ LOG.error( e, e );
+ LOG.warn( "Address potentially in an inconsistent state: " + LogUtil.dumpObject( address ) );
+ }
+ }
+ };
+ } else {
+ failureHander = Callbacks.noopFailure();
+ }
+ final Request request = AsyncRequests.newRequest( callback ).then( failureHander );
+ try {
+ request.dispatch( vm.getPartition() );
+ } catch ( NoSuchElementException e ) {
+ // No message was sent, so handle failure manually
+ request.getCallback().fireException( e );
+ }
+ }
private static void cleanUpAttachedVolumes( final VmInstance vm ) {
try {
View
33 clc/modules/cluster-manager/src/main/java/com/eucalyptus/vm/VmRuntimeState.java
@@ -193,7 +193,9 @@ public void setState( final VmState newState, Reason reason, final String... ext
if ( VmStateSet.RUN.contains( oldState )
&& VmStateSet.NOT_RUNNING.contains( newState ) ) {
this.getVmInstance( ).setState( newState );
- action = this.cleanUpRunnable( );
+ action = VmState.SHUTTING_DOWN.equals( newState ) ?
+ this.tryCleanUpRunnable() : // try cleanup now, will try again when moving to final state
+ this.cleanUpRunnable( );
} else if ( VmState.PENDING.equals( oldState )
&& VmState.RUNNING.equals( newState ) ) {
this.getVmInstance( ).setState( newState );
@@ -296,18 +298,39 @@ public Boolean call( ) {
}
}
}
-
+
+ private Callable<Boolean> tryCleanUpRunnable( ) {
+ return this.cleanUpRunnable( null, new Predicate<VmInstance>(){
+ @Override
+ public boolean apply( final VmInstance vmInstance ) {
+ VmInstances.tryCleanUp( vmInstance );
+ return true;
+ }
+ } );
+ }
+
private Callable<Boolean> cleanUpRunnable( ) {
return this.cleanUpRunnable( null );
}
-
- private Callable<Boolean> cleanUpRunnable( final String reason ) {
+
+ private Callable<Boolean> cleanUpRunnable( @Nullable final String reason ) {
+ return this.cleanUpRunnable( reason, new Predicate<VmInstance>(){
+ @Override
+ public boolean apply( final VmInstance vmInstance ) {
+ VmInstances.cleanUp( vmInstance );
+ return true;
+ }
+ } );
+ }
+
+ private Callable<Boolean> cleanUpRunnable( @Nullable final String reason,
+ final Predicate<VmInstance> cleaner ) {
Logs.extreme( ).info( "Preparing to clean-up instance: " + this.getVmInstance( ).getInstanceId( ),
Exceptions.filterStackTrace( new RuntimeException( ) ) );
return new Callable<Boolean>( ) {
@Override
public Boolean call( ) {
- VmInstances.cleanUp( VmRuntimeState.this.getVmInstance( ) );
+ cleaner.apply( VmRuntimeState.this.getVmInstance( ) );
if ( ( reason != null ) && !VmRuntimeState.this.reasonDetails.contains( reason ) ) {
VmRuntimeState.this.addReasonDetail( reason );
}
View
23 clc/modules/core/src/main/java/edu/ucsb/eucalyptus/cloud/HeadAccessDeniedException.java
@@ -1,10 +1,27 @@
+/*************************************************************************
+ * 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 edu.ucsb.eucalyptus.cloud;
/**
* Fix for EUCA-2782. Exception type to be used by HEAD requests when access to the specified entity is forbidden
- *
- * @author Swathi Gangisetty
- *
*/
@SuppressWarnings("serial")
public class HeadAccessDeniedException extends AccessDeniedException implements HeadExceptionInterface {
View
23 clc/modules/core/src/main/java/edu/ucsb/eucalyptus/cloud/HeadExceptionInterface.java
@@ -1,11 +1,28 @@
+/*************************************************************************
+ * 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 edu.ucsb.eucalyptus.cloud;
/**
* Fix for EUCA-2782. Interface for exceptions generated by HEAD requests in Walrus. Exceptions originating from the Walrus HEAD requests should implement this
* interface. The purpose of this interface is to detect the type of exception in Walrus Outbound Handler before constructing the HTTP response body.
- *
- * @author Swathi Gangisetty
- *
*/
public interface HeadExceptionInterface {
View
23 clc/modules/core/src/main/java/edu/ucsb/eucalyptus/cloud/HeadNoSuchBucketException.java
@@ -1,10 +1,27 @@
+/*************************************************************************
+ * 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 edu.ucsb.eucalyptus.cloud;
/**
* Fix for EUCA-2782. Exception type to be used by HEAD requests when the specified bucket does not exist
- *
- * @author Swathi Gangisetty
- *
*/
@SuppressWarnings("serial")
public class HeadNoSuchBucketException extends NoSuchBucketException implements HeadExceptionInterface {
View
23 clc/modules/core/src/main/java/edu/ucsb/eucalyptus/cloud/HeadNoSuchEntityException.java
@@ -1,10 +1,27 @@
+/*************************************************************************
+ * 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 edu.ucsb.eucalyptus.cloud;
/**
* Fix for EUCA-2782. Exception type to be used by HEAD requests when the specified entity does not exist
- *
- * @author Swathi Gangisetty
- *
*/
@SuppressWarnings("serial")
public class HeadNoSuchEntityException extends NoSuchEntityException implements HeadExceptionInterface {
View
4 clc/modules/core/src/main/java/edu/ucsb/eucalyptus/cloud/entities/ISCSIVolumeInfo.java
@@ -84,6 +84,10 @@
@Type(type="org.hibernate.type.StringClobType")
private String encryptedPassword;
+ public String toString() {
+ return storeName + "," + tid + "," + lun + "," + storeUser + "," + super.toString();
+ }
+
public ISCSIVolumeInfo() {}
public ISCSIVolumeInfo(String volumeId) {
View
4 clc/modules/core/src/main/java/edu/ucsb/eucalyptus/cloud/entities/LVMVolumeInfo.java
@@ -106,6 +106,10 @@
@Column(name = "cleanup")
private Boolean cleanup;
+ public String toString() {
+ return volumeId + "," + scName + "," + loDevName + "," + loFileName + "," + pvName + "," + vgName + "," + lvName + "," + size + "," + status + "," + snapshotOf + "," + cleanup;
+ }
+
public LVMVolumeInfo() {
super();
this.scName = StorageProperties.NAME;
View
18 clc/modules/dns/src/main/java/com/eucalyptus/dns/TransientZone.java
@@ -93,7 +93,6 @@
private static int ttl = 604800;
private static Zone INSTANCE_EXTERNAL = null;
private static Zone INSTANCE_INTERNAL = null;
- private static Name internalName;
public TransientZone( Name name, Record[] records ) throws IOException {
super(name,records);
@@ -121,7 +120,7 @@ public static Zone getInstanceExternalZone( ) {
}
public static Name getExternalName( ) throws TextParseException {
- String externalNameString = /*"eucalyptus." +*/SystemConfiguration.getSystemConfiguration( ).getDnsDomain( ) + ".";
+ String externalNameString = SystemConfiguration.getSystemConfiguration( ).getDnsDomain( ) + ".";
Name externalName = Name.fromString( externalNameString );
return externalName;
}
@@ -148,19 +147,10 @@ public static Zone getInstanceInternalZone( ) {
}
public static Name getInternalName( ) throws TextParseException {
- if( internalName != null ) {
+ String internalNameString = VmInstances.INSTANCE_SUBDOMAIN + ".internal.";
+ internalNameString = internalNameString.startsWith(".") ? internalNameString.replaceFirst("\\.", "") : internalNameString;
+ Name internalName = Name.fromString( internalNameString );
return internalName;
- } else {
- synchronized ( TransientZone.class ) {
- if( internalName != null ) {
- return internalName;
- } else {
- String internalNameString = "eucalyptus.internal.";
- internalName = Name.fromString( internalNameString );
- return internalName;
- }
- }
- }
}
/* (non-Javadoc)
View
8 clc/modules/msgs/src/main/java/com/eucalyptus/bootstrap/Databases.java
@@ -257,14 +257,14 @@ public boolean isCurrent( ) {
@Override
public boolean load( ) throws Exception {
-
- if( SubDirectory.DB.getChildFile("data", "disabled.lock" ).exists() ) {
- Faults.forComponent(Eucalyptus.class).havingId(1010).withVar("DISABLED_CLC", "disable.lock" ).log();
+ Hosts.awaitDatabases( );
+ File dbLockFile = SubDirectory.DB.getChildFile("data", "disabled.lock" );
+ if( dbLockFile.exists() && Hosts.isCoordinator( ) ) {
+ Faults.forComponent(Eucalyptus.class).havingId(1010).withVar("DB_LOCK_FILE", dbLockFile.getAbsolutePath()).log();
LOG.error("WARNING : DISABLED CLC STARTED OUT OF ORDER, REMOVE THE disabled.lock FILE TO PROCEED WITH RISK");
System.exit(1);
}
- Hosts.awaitDatabases( );
Groovyness.run( "setup_dbpool.groovy" );
OrderedShutdown.registerShutdownHook( Empyrean.class, new Runnable( ) {
View
3  clc/modules/msgs/src/main/java/com/eucalyptus/component/ServiceTransitions.java
@@ -834,10 +834,9 @@ public void fire( final ServiceConfiguration config ) {
@Override
public void fire( final ServiceConfiguration config ) {
if ( Bootstrap.isFinished( ) ) {
- for ( Entry<String, ConfigurableProperty> entry : Iterables.filter( PropertyDirectory.getPendingPropertyEntries( ),
+ for ( ConfigurableProperty prop : Iterables.filter( PropertyDirectory.getPendingPropertyValues( ),
Predicates.instanceOf( StaticPropertyEntry.class ) ) ) {
try {
- ConfigurableProperty prop = entry.getValue( );
PropertyDirectory.addProperty( prop );
try {
prop.getValue( );
View
10 clc/modules/msgs/src/main/java/com/eucalyptus/configurable/PropertyDirectory.java
@@ -215,6 +215,15 @@ public static ConfigurableProperty getPropertyEntry( String fq ) throws IllegalA
}
}
+ public static Collection<ConfigurableProperty> getPendingPropertyValues( ) {
+ fqLock.readLock().lock();
+ try {
+ return fqPendingPrefixMap.values();
+ } finally {
+ fqLock.readLock().unlock();
+ }
+ }
+
public static List<ConfigurableProperty> getPendingPropertyEntrySet( String prefix ) {
fqLock.readLock().lock();
try {
@@ -276,4 +285,5 @@ public static void removeProperty( ConfigurableProperty prop ) {
}
return componentProps;
}
+
}
View
20 clc/modules/msgs/src/main/java/com/eucalyptus/system/log/EucaHierarchy.java
@@ -1,3 +1,23 @@
+/*************************************************************************
+ * 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.system.log;
import org.apache.log4j.Hierarchy;
View
20 clc/modules/msgs/src/main/java/com/eucalyptus/system/log/EucaLogger.java
@@ -1,3 +1,23 @@
+/*************************************************************************
+ * 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.system.log;
import org.apache.log4j.Logger;
View
21 clc/modules/msgs/src/main/java/com/eucalyptus/system/log/EucaLoggerFactory.java
@@ -1,3 +1,23 @@
+/*************************************************************************
+ * 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.system.log;
import org.apache.log4j.Logger;
@@ -11,5 +31,4 @@ public EucaLoggerFactory() {
public Logger makeNewLoggerInstance(String name) {
return new EucaLogger(name);
}
-
}
View
20 clc/modules/msgs/src/main/java/com/eucalyptus/system/log/EucaLoggingEvent.java
@@ -1,3 +1,23 @@
+/*************************************************************************
+ * 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.system.log;
import java.util.Map;
View
20 clc/modules/msgs/src/main/java/com/eucalyptus/system/log/EucaLoggingOutputStream.java
@@ -1,3 +1,23 @@
+/*************************************************************************
+ * 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.system.log;
import java.io.IOException;
View
21 clc/modules/msgs/src/main/java/com/eucalyptus/system/log/EucaPatternLayout.java
@@ -1,3 +1,23 @@
+/*************************************************************************
+ * 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.system.log;
import org.apache.log4j.PatternLayout;
@@ -16,5 +36,4 @@ public EucaPatternLayout(String pattern) {
protected PatternParser createPatternParser(String pattern) {
return new EucaPatternParser(pattern);
}
-
}
View
23 clc/modules/msgs/src/main/java/com/eucalyptus/system/log/EucaPatternParser.java
@@ -1,3 +1,23 @@
+/*************************************************************************
+ * 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.system.log;
import java.text.DecimalFormat;
@@ -58,5 +78,4 @@ public String convert(LoggingEvent event) {
}
}
}
-
-}
+}
View
20 clc/modules/msgs/src/main/java/com/eucalyptus/system/log/EucaRootLogger.java
@@ -1,3 +1,23 @@
+/*************************************************************************
+ * 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.system.log;
import org.apache.log4j.Level;
View
20 clc/modules/msgs/src/main/java/com/eucalyptus/system/log/NullEucaLogger.java
@@ -1,3 +1,23 @@
+/*************************************************************************
+ * 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.system.log;
import java.util.Enumeration;
View
117 clc/modules/msgs/src/main/java/com/eucalyptus/util/UniqueIds.java
@@ -63,8 +63,8 @@
package com.eucalyptus.util;
import java.io.Serializable;
+import java.util.Map;
import javax.persistence.Column;
-import javax.persistence.EntityTransaction;
import javax.persistence.PersistenceContext;
import javax.persistence.Table;
import javax.persistence.Transient;
@@ -76,43 +76,38 @@
import com.eucalyptus.crypto.Digest;
import com.eucalyptus.entities.AbstractPersistent;
import com.eucalyptus.entities.Entities;
+import com.eucalyptus.util.UniqueIds.PersistedCounter.Transaction;
import com.google.common.base.Function;
+import com.google.common.collect.MapMaker;
public class UniqueIds implements Serializable {
private static final long serialVersionUID = 1L;
private static Logger LOG = Logger.getLogger( UniqueIds.class );
private static final Long BLOCK_SIZE = 1000L;
- public interface UniqueIdProducer {
- public String nextId( );
-
- public Long nextIndex( Long extent );
-
- public Long nextIndex( );
- }
-
@Entity
@javax.persistence.Entity
@PersistenceContext( name = "eucalyptus_config" )
@Table( name = "config_unique_ids" )
@Cache( usage = CacheConcurrencyStrategy.TRANSACTIONAL )
- public static class PersistedCounter extends AbstractPersistent implements UniqueIdProducer {
- enum Transaction implements Function<PersistedCounter, Long> {
- NEXT_ID {
+ public static class PersistedCounter extends AbstractPersistent {
+ enum Transaction implements Function<Long, String> {
+ NEXT_INDEX {
@Override
- public Long apply( PersistedCounter input ) {
- final PersistedCounter entity = Entities.merge( input );
- return entity.nextBlock( 1L );
+ public String apply( Long arg0 ) {
+ return Crypto.getDigestBase64( Long.toString( arg0 ), Digest.SHA512 ).replaceAll( "\\.", "" );
}
- };
+
+ }
+
}
@Transient
private static final long serialVersionUID = 1L;
@Column( name = "config_unique_ids_current_base" )
private Long currentBase;
- @Column( name = "config_unique_ids_name" )
+ @Column( name = "config_unique_ids_set_name", unique = true )
private String idSetName;
private PersistedCounter( ) {
@@ -125,8 +120,9 @@ private PersistedCounter( final Long counter, final String counterName ) {
}
private Long nextBlock( Long size ) {
- this.setCurrentBase( this.currentBase + size );
- return this.getCurrentBase( );
+ Long oldBase = this.getCurrentBase( ) + 1;
+ this.setCurrentBase( oldBase + size );
+ return oldBase;
}
private Long getCurrentBase( ) {
@@ -145,63 +141,54 @@ private void setIdSetName( String idSetName ) {
this.idSetName = idSetName;
}
- @Override
- public String nextId( ) {
- return Crypto.getDigestBase64( Long.toString( this.nextIndex( ) ), Digest.SHA512 ).replaceAll( "\\.", "" );
- }
-
- @Override
- public Long nextIndex( ) {
- return Entities.asTransaction( PersistedCounter.class, Transaction.NEXT_ID ).apply( this );
- }
-
- @Override
- public Long nextIndex( final Long extent ) {
- Long ret = nextIndex( );
- Entities.asTransaction( PersistedCounter.class, new Function<PersistedCounter, Long>( ) {
-
- @Override
- public Long apply( PersistedCounter input ) {
- final PersistedCounter entity = Entities.merge( input );
- return entity.nextBlock( extent );
- }
- } ).apply( this );
- return ret;
- }
-
}
public static Long nextIndex( Class c, long extent ) {
- return named( c.toString( ) ).nextIndex( extent );
+ return nextIndex( c.toString( ), extent );
}
public static String nextId( Class c ) {
- return named( c.toString( ) ).nextId( );
+ return nextId( c.toString( ) );
}
public static String nextId( ) {
- return named( "SYSTEM" ).nextId( );
+ return nextId( "SYSTEM" );
}
- private static UniqueIdProducer named( final String counterName ) {
- final EntityTransaction db = Entities.get( PersistedCounter.class );
- try {
- final PersistedCounter entity = Entities.uniqueResult( new PersistedCounter( null, counterName ) );
- db.commit( );
- return entity;
- } catch ( final Exception ex ) {
- db.rollback( );
- final EntityTransaction saveDb = Entities.get( PersistedCounter.class );
- try {
- final PersistedCounter entity = Entities.persist( new PersistedCounter( 0L, counterName ) );
- saveDb.commit( );
- return entity;
- } catch ( final Exception ex1 ) {
- saveDb.rollback( );
- LOG.error( ex1, ex1 );
- throw Exceptions.toUndeclared( "Failed to initialize counter for: " + counterName + " because of: " + ex.getMessage( ), ex );
- }
- }
+ private static String nextId( final String counterName ) {
+ return Transaction.NEXT_INDEX.apply( nextIndex( counterName, 1 ) );
+ }
+
+ private static final Map<String,Function<Long, Long>> counterMap = new MapMaker( ).makeComputingMap( new Function<String,Function<Long, Long>>(){
+
+ @Override
+ public Function<Long, Long> apply( final String counterName ) {
+ return new Function<Long, Long>( ) {
+
+ @Override
+ public Long apply( Long arg0 ) {
+ Long ret = 0l;
+ try {
+ final PersistedCounter entity = Entities.uniqueResult( new PersistedCounter( null, counterName ) );
+ ret = entity.nextBlock( arg0 );
+ return ret;
+ } catch ( final Exception ex ) {
+ try {
+ final PersistedCounter entity = Entities.persist( new PersistedCounter( 0L, counterName ) );
+ ret = entity.nextBlock( arg0 );
+ return ret;
+ } catch ( final Exception ex1 ) {
+ LOG.error( ex1, ex1 );
+ throw Exceptions.toUndeclared( "Failed to initialize counter for: " + counterName + " because of: " + ex.getMessage( ), ex );
+ }
+ }
+ }
+ };
+ }} );
+
+ private static Long nextIndex( final String counterName, long extent ) {
+ return Entities.asTransaction( PersistedCounter.class, counterMap.get( counterName ), 1000 ).apply( extent );
+
}
}
View
9 clc/modules/msgs/src/main/java/com/eucalyptus/util/async/Callbacks.java
@@ -108,11 +108,20 @@ public void fire( final Object t ) {
public static <T> Callback<T> noop( ) {
return new NoopCallback<T>( );
}
+
+ public static <R> Callback.Failure<R> noopFailure() {
+ return new NoopFailure<R>();
+ }
private static final class NoopCallback<T> implements Callback<T> {
@Override
public final void fire( final T t ) {}
}
+
+ private static final class NoopFailure<R> extends Callback.Failure<R> {
+ @Override
+ public void fireException( final Throwable t ) {}
+ }
static class BasicCallbackProcessor<R extends BaseMessage> implements Runnable {
private final Callback<R> callback;
View
65 clc/modules/msgs/src/main/java/com/eucalyptus/util/async/DelegatingRemoteCallback.java
@@ -0,0 +1,65 @@
+/*************************************************************************
+ * 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.util.async;
+
+import edu.ucsb.eucalyptus.msgs.BaseMessage;
+
+/**
+ * Remote callback implementation that delegates all methods.
+ */
+public class DelegatingRemoteCallback<Q extends BaseMessage, R extends BaseMessage> implements RemoteCallback<Q,R>{
+
+ private final RemoteCallback<Q,R> delegate;
+
+ public DelegatingRemoteCallback( final RemoteCallback<Q,R> delegate ) {
+ this.delegate = delegate;
+ }
+
+ @Override
+ public Q getRequest() {
+ return delegate.getRequest();
+ }
+
+ @Override
+ public void initialize( final Q request ) throws Exception {
+ delegate.initialize( request );
+ }
+
+ @Override
+ public void fire( final R msg ) {
+ delegate.fire( msg );
+ }
+
+ @Override
+ public void fireException( final Throwable t ) {
+ delegate.fireException( t );
+ }
+
+ public static <Q extends BaseMessage, R extends BaseMessage> RemoteCallback<Q,R> suppressException(
+ final RemoteCallback<Q,R> delegate
+ ) {
+ return new DelegatingRemoteCallback<Q,R>( delegate ){
+ @Override
+ public void fireException( final Throwable t ) {
+ // ignored
+ }
+ };
+ }
+}
View
29 clc/modules/msgs/src/main/java/com/eucalyptus/util/async/RemoteCallback.java
@@ -69,12 +69,12 @@
* An asynchronous callback which involves remote communication (read: possibly long lasting). Implementors of this interface are guaranteed that:
*
* <ul>
- * <li>{@#initialize(BaseMessage)} will be invoked before communication begins.</li>
- * <li>Should the invokation of {@#initialize(BaseMessage)} terminate prematurely the callback will be disposed of -- preconditions
+ * <li>{@link #initialize(BaseMessage)} will be invoked before communication begins.</li>
+ * <li>Should the invokation of {@link #initialize(BaseMessage)} terminate prematurely the callback will be disposed of -- preconditions
* caused a failure.</li>
- * <li>Otherwise, either {@#fire(BaseMessage)} <b>OR</b> {@#fireException(Throwable)} will be called exactly
+ * <li>Otherwise, either {@link #fire(BaseMessage)} <b>OR</b> {@link #fireException(Throwable)} will be called exactly
* one time.</li>
- * <li>The argument to {@#fire(BaseMessage)}/{@#fireException(Throwable)} will be the outcome of the remote
+ * <li>The argument to {@link #fire(BaseMessage)}/{@link #fireException(Throwable)} will be the outcome of the remote
* operation.</li>
* </ul>
* @see Callback
@@ -87,34 +87,27 @@
/**
* Get the request being made by this callback.
- *
- * @return
*/
- public abstract Q getRequest( );
+ Q getRequest( );
/**
* Initialize (e.g., check preconditions) before proceeding with the
* connection and sending of <tt>request</tt>. Guaranteed to be called only
* once per corresponding dispatch.
- *
- * @param request
- * @throws Exception
*/
- public abstract void initialize( Q request ) throws Exception;
+ @Override
+ void initialize( Q request ) throws Exception;
/**
* The operation completed with a response: <tt>msg</tt>.
- *
- * @param msg
- * @throws Exception
*/
- public abstract void fire( R msg );
+ @Override
+ void fire( R msg );
/**
* The operation completed with an exception.
- *
- * @param t
*/
- public abstract void fireException( Throwable t );
+ @Override
+ void fireException( Throwable t );
}
View
4 clc/modules/msgs/src/main/java/com/eucalyptus/ws/handlers/QueryTimestampHandler.java
@@ -134,10 +134,10 @@ public void incomingMessage( MessageEvent event ) throws AuthenticationException
if ( now.after( expires ) ) {
expires.setTimeZone( TimeZone.getTimeZone( "GMT" ) );
- String expiryTime = String.format( "%4d-%02d-%02d'T'%02d:%02d:%02d",
+ String expiryTime = String.format( "%4d-%02d-%02dT%02d:%02d:%02d",
expires.get( Calendar.YEAR ),
expires.get( Calendar.MONTH ) + 1,
- expires.get( Calendar.DAY_OF_MONTH ) + 1,
+ expires.get( Calendar.DAY_OF_MONTH ),
expires.get( Calendar.HOUR_OF_DAY ),
expires.get( Calendar.MINUTE ),
expires.get( Calendar.SECOND ) );
View
4 clc/modules/msgs/src/main/java/com/eucalyptus/ws/protocol/BaseQueryBinding.java 100644 → 100755
@@ -341,10 +341,10 @@ else if ( declaredType.equals( Long.class ) )
final List<String> keys = Lists.newArrayList( params.keySet( ) );
final Map<String,String> subParams = Maps.newConcurrentMap( );
for ( final String k : keys ) {
- if ( k.contains( paramFieldPair.getKey( ) + ".1." ) ) {
+ if ( k.contains( paramFieldPair.getKey( )) ) {
//theList.add( params.remove(k) );
final String currentValue = params.remove( k );
- final String newKey = k.replaceAll( paramFieldPair.getKey( ) + ".1.", "" );
+ final String newKey = k.replaceAll( paramFieldPair.getKey( ) + "\\.\\d\\." , "" );
subParams.put( newKey, currentValue );
}
}
View
3  clc/modules/msgs/src/main/java/edu/ucsb/eucalyptus/msgs/Messages.groovy
@@ -269,9 +269,10 @@ public class DescribeSensorsType extends CloudClusterMessage {
DescribeSensorsType(){}
- DescribeSensorsType (Integer historySize, Integer collectionIntervalTimeMs ) {
+ DescribeSensorsType (Integer historySize, Integer collectionIntervalTimeMs, ArrayList<String> instanceIds ) {
this.historySize = historySize;
this.collectionIntervalTimeMs = collectionIntervalTimeMs;
+ this.instanceIds = instanceIds;
}
}
View
16 clc/modules/msgs/src/main/resources/cc-sensors.xml
@@ -21,21 +21,13 @@
<value name="collectionIntervalTimeMs" field="collectionIntervalTimeMs"
type="java.lang.Integer" />
<structure usage="optional">
- <collection name="instanceIds"
- factory="org.jibx.runtime.Utility.arrayListFactory" field="instanceIds"
- item-type="java.lang.String">
- <structure name="item">
- <value name="instanceId" />
- </structure>
+ <collection factory="org.jibx.runtime.Utility.arrayListFactory" field="instanceIds">
+ <value name="instanceIds" type="java.lang.String" />
</collection>
</structure>
<structure usage="optional">
- <collection name="sensorIds"
- factory="org.jibx.runtime.Utility.arrayListFactory" field="sensorIds"
- item-type="java.lang.String">
- <structure name="item">
- <value name="sensorId" />
- </structure>
+ <collection factory="org.jibx.runtime.Utility.arrayListFactory" field="sensorIds">
+ <value name="sensorIds" type="java.lang.String" />
</collection>
</structure>
</mapping>
View
20 clc/modules/reporting/src/main/java/com/eucalyptus/reporting/ReportType.java
@@ -1,3 +1,23 @@
+/*************************************************************************
+ * 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.reporting;
import com.eucalyptus.reporting.art.generator.*;
View
20 clc/modules/reporting/src/main/java/com/eucalyptus/reporting/art/generator/ArtGenerator.java
@@ -1,3 +1,23 @@
+/*************************************************************************
+ * 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.reporting.art.generator;
import com.eucalyptus.reporting.art.entity.ReportArtEntity;
View
20 clc/modules/reporting/src/main/java/com/eucalyptus/reporting/art/generator/ElasticIpArtGenerator.java
@@ -1,3 +1,23 @@
+/*************************************************************************
+ * 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.reporting.art.generator;
import java.util.List;
View
8 clc/modules/reporting/src/main/java/com/eucalyptus/reporting/art/generator/InstanceArtGenerator.java
@@ -77,6 +77,8 @@
/* Metric names */
public static final String METRIC_NET_IN_BYTES = "NetworkIn";
public static final String METRIC_NET_OUT_BYTES = "NetworkOut";
+ public static final String METRIC_NET_EXT_IN_BYTES = "NetworkInExternal";
+ public static final String METRIC_NET_EXT_OUT_BYTES = "NetworkOutExternal";
public static final String METRIC_DISK_IN_BYTES = "DiskReadBytes";
public static final String METRIC_DISK_OUT_BYTES = "DiskWriteBytes";
public static final String METRIC_DISK_READ_OPS = "DiskReadOps";
@@ -285,11 +287,11 @@ private static void addMetricValueToUsageEntity( InstanceUsageArtEntity usage, S
usage.addNetTotalInBytes( value );
} else if ( metric.equals( METRIC_NET_OUT_BYTES ) && dim.equals( DIM_TOTAL ) ) {
usage.addNetTotalOutBytes( value );
- } else if ( metric.equals( METRIC_NET_IN_BYTES ) && dim.equals( DIM_EXTERNAL ) ) {
+ } else if ( metric.equals( METRIC_NET_EXT_IN_BYTES ) && dim.equals( DIM_DEFAULT ) ) {
usage.addNetExternalInBytes( value );
- } else if ( metric.equals( METRIC_NET_OUT_BYTES ) && dim.equals( DIM_EXTERNAL ) ) {
+ } else if ( metric.equals( METRIC_NET_EXT_OUT_BYTES ) && dim.equals( DIM_DEFAULT ) ) {
usage.addNetExternalOutBytes( value );
- } else if ( metric.equals( METRIC_DISK_IN_BYTES ) ) {
+ } else if ( metric.equals( METRIC_DISK_IN_BYTES ) ) {
usage.addDiskReadBytes( value );
} else if ( metric.equals( METRIC_DISK_OUT_BYTES ) ) {
usage.addDiskWriteBytes( value );
View
21 clc/modules/reporting/src/main/java/com/eucalyptus/reporting/art/renderer/ElasticIpRenderer.java
@@ -1,3 +1,23 @@
+/*************************************************************************
+ * 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.reporting.art.renderer;
import java.io.IOException;
@@ -79,5 +99,4 @@ public static Document addUsageCols(Document doc, ElasticIpUsageArtEntity entity
doc.addValCol(UnitUtil.convertTime(entity.getDurationMs(), TimeUnit.MS, units.getTimeUnit()));
return doc;
}
-
}
View
2  clc/modules/reporting/src/main/java/com/eucalyptus/reporting/art/renderer/InstanceRenderer.java
@@ -186,7 +186,7 @@ public static Document addUsageCols( final Document doc,
doc.addValCol((long)entity.getInstanceCnt());
doc.addValCol(UnitUtil.convertTime(entity.getDurationMs(), TimeUnit.MS, units.getTimeUnit()));
if (entity.getDurationMs()>0) {
- doc.addValCol(entity.getCpuUtilizationMs()