@Override public boolean apply(Class arg0) { EntityTransaction db = Entities.get(StorageControllerConfiguration.class); try { // Get local IP addresses or host names Set<String> localAddresses = Internets.getAllLocalHostNamesIps(); List<StorageControllerConfiguration> entities = Entities.query(new StorageControllerConfiguration()); for (StorageControllerConfiguration entry : entities) { // This SC is running on the local machine, upgrade its block storage manager config if (localAddresses.contains(entry.getHostName())) { LOG.debug("Upgrading SC config " + entry.getPartition()); entry.setBlockStorageManager(loadLocalBlockStorageManagerConfig()); LOG.debug( "Set storage manager " + entry.getBlockStorageManager() + " for SC " + entry.getPartition()); break; } } db.commit(); return true; } catch (Exception ex) { db.rollback(); throw Exceptions.toUndeclared(ex); } }