3737import javax .mail .MessagingException ;
3838import javax .naming .ConfigurationException ;
3939
40- import com .cloud .dc .DataCenter ;
41- import com .cloud .dc .Pod ;
42- import com .cloud .org .Cluster ;
4340import org .apache .cloudstack .framework .config .ConfigDepot ;
4441import org .apache .cloudstack .framework .config .ConfigKey ;
4542import org .apache .cloudstack .framework .config .Configurable ;
5249import org .apache .cloudstack .utils .mailing .SMTPMailSender ;
5350import org .apache .commons .lang3 .ArrayUtils ;
5451import org .apache .commons .lang3 .math .NumberUtils ;
55- import org .apache .logging .log4j .Logger ;
5652import org .apache .logging .log4j .LogManager ;
53+ import org .apache .logging .log4j .Logger ;
54+ import org .jetbrains .annotations .Nullable ;
5755
5856import com .cloud .alert .dao .AlertDao ;
5957import com .cloud .api .ApiDBUtils ;
6664import com .cloud .configuration .Config ;
6765import com .cloud .configuration .ConfigurationManager ;
6866import com .cloud .dc .ClusterVO ;
67+ import com .cloud .dc .DataCenter ;
6968import com .cloud .dc .DataCenter .NetworkType ;
7069import com .cloud .dc .DataCenterVO ;
7170import com .cloud .dc .HostPodVO ;
71+ import com .cloud .dc .Pod ;
7272import com .cloud .dc .Vlan .VlanType ;
7373import com .cloud .dc .dao .ClusterDao ;
7474import com .cloud .dc .dao .DataCenterDao ;
8282import com .cloud .host .dao .HostDao ;
8383import com .cloud .network .Ipv6Service ;
8484import com .cloud .network .dao .IPAddressDao ;
85+ import com .cloud .org .Cluster ;
8586import com .cloud .org .Grouping .AllocationState ;
8687import com .cloud .resource .ResourceManager ;
8788import com .cloud .storage .StorageManager ;
8889import com .cloud .utils .Pair ;
8990import com .cloud .utils .component .ManagerBase ;
9091import com .cloud .utils .concurrency .NamedThreadFactory ;
9192import com .cloud .utils .db .SearchCriteria ;
92- import org .jetbrains .annotations .Nullable ;
93+ import com .cloud .utils .db .Transaction ;
94+ import com .cloud .utils .db .TransactionCallbackNoReturn ;
95+ import com .cloud .utils .db .TransactionStatus ;
9396
9497public class AlertManagerImpl extends ManagerBase implements AlertManager , Configurable {
9598 protected Logger logger = LogManager .getLogger (AlertManagerImpl .class .getName ());
@@ -105,7 +108,8 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager, Confi
105108 , AlertType .ALERT_TYPE_UPLOAD_FAILED
106109 , AlertType .ALERT_TYPE_OOBM_AUTH_ERROR
107110 , AlertType .ALERT_TYPE_HA_ACTION
108- , AlertType .ALERT_TYPE_CA_CERT );
111+ , AlertType .ALERT_TYPE_CA_CERT
112+ , AlertType .ALERT_TYPE_EXTENSION_PATH_NOT_READY );
109113
110114 private static final long INITIAL_CAPACITY_CHECK_DELAY = 30L * 1000L ; // Thirty seconds expressed in milliseconds.
111115
@@ -290,8 +294,13 @@ protected void recalculateHostCapacities() {
290294 Math .min (CapacityManager .CapacityCalculateWorkers .value (), hostIds .size ())));
291295 for (Long hostId : hostIds ) {
292296 futures .put (hostId , executorService .submit (() -> {
293- final HostVO host = hostDao .findById (hostId );
294- _capacityMgr .updateCapacityForHost (host );
297+ Transaction .execute (new TransactionCallbackNoReturn () {
298+ @ Override
299+ public void doInTransactionWithoutResult (TransactionStatus status ) {
300+ final HostVO host = hostDao .findById (hostId );
301+ _capacityMgr .updateCapacityForHost (host );
302+ }
303+ });
295304 return null ;
296305 }));
297306 }
@@ -316,13 +325,18 @@ protected void recalculateStorageCapacities() {
316325 Math .min (CapacityManager .CapacityCalculateWorkers .value (), storagePoolIds .size ())));
317326 for (Long poolId : storagePoolIds ) {
318327 futures .put (poolId , executorService .submit (() -> {
319- final StoragePoolVO pool = _storagePoolDao .findById (poolId );
320- long disk = _capacityMgr .getAllocatedPoolCapacity (pool , null );
321- if (pool .isShared ()) {
322- _storageMgr .createCapacityEntry (pool , Capacity .CAPACITY_TYPE_STORAGE_ALLOCATED , disk );
323- } else {
324- _storageMgr .createCapacityEntry (pool , Capacity .CAPACITY_TYPE_LOCAL_STORAGE , disk );
325- }
328+ Transaction .execute (new TransactionCallbackNoReturn () {
329+ @ Override
330+ public void doInTransactionWithoutResult (TransactionStatus status ) {
331+ final StoragePoolVO pool = _storagePoolDao .findById (poolId );
332+ long disk = _capacityMgr .getAllocatedPoolCapacity (pool , null );
333+ if (pool .isShared ()) {
334+ _storageMgr .createCapacityEntry (pool , Capacity .CAPACITY_TYPE_STORAGE_ALLOCATED , disk );
335+ } else {
336+ _storageMgr .createCapacityEntry (pool , Capacity .CAPACITY_TYPE_LOCAL_STORAGE , disk );
337+ }
338+ }
339+ });
326340 return null ;
327341 }));
328342 }
0 commit comments