mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Merge branch '4.18' into 4.19
This commit is contained in:
commit
7f8f113709
@ -29,6 +29,7 @@ import com.cloud.utils.db.QueryBuilder;
|
||||
import com.cloud.utils.db.SearchCriteria;
|
||||
import com.cloud.utils.db.Transaction;
|
||||
import com.cloud.utils.db.TransactionCallback;
|
||||
import com.cloud.utils.db.TransactionCallbackNoReturn;
|
||||
import com.cloud.utils.db.TransactionLegacy;
|
||||
import com.cloud.utils.db.TransactionStatus;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
@ -540,12 +541,14 @@ public class UsageDaoImpl extends GenericDaoBase<UsageVO, Long> implements Usage
|
||||
|
||||
@Override
|
||||
public void removeOldUsageRecords(int days) {
|
||||
String sql = DELETE_ALL_BY_INTERVAL;
|
||||
TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.USAGE_DB);
|
||||
Transaction.execute(TransactionLegacy.USAGE_DB, new TransactionCallbackNoReturn() {
|
||||
@Override
|
||||
public void doInTransactionWithoutResult(TransactionStatus status) {
|
||||
TransactionLegacy txn = TransactionLegacy.currentTxn();
|
||||
PreparedStatement pstmt = null;
|
||||
try {
|
||||
txn.start();
|
||||
pstmt = txn.prepareAutoCloseStatement(sql);
|
||||
pstmt = txn.prepareAutoCloseStatement(DELETE_ALL_BY_INTERVAL);
|
||||
pstmt.setLong(1, days);
|
||||
pstmt.executeUpdate();
|
||||
txn.commit();
|
||||
@ -556,6 +559,8 @@ public class UsageDaoImpl extends GenericDaoBase<UsageVO, Long> implements Usage
|
||||
txn.close();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public UsageVO persistUsage(final UsageVO usage) {
|
||||
return Transaction.execute(TransactionLegacy.USAGE_DB, new TransactionCallback<UsageVO>() {
|
||||
|
||||
@ -26,6 +26,7 @@ import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Assume;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Spy;
|
||||
@ -49,8 +50,7 @@ public class LibvirtOvsFetchInterfaceCommandWrapperTest {
|
||||
while(interfaces.hasMoreElements()) {
|
||||
NetworkInterface networkInterface = interfaces.nextElement();
|
||||
if (networkInterface.getInetAddresses().hasMoreElements() &&
|
||||
(networkInterface.getName().startsWith("eth") ||
|
||||
networkInterface.getName().startsWith("wl"))) {
|
||||
networkInterface.getName().matches("^(eth|wl|en).*")) {
|
||||
interfaceName = networkInterface.getName();
|
||||
Enumeration<InetAddress> addresses = networkInterface.getInetAddresses();
|
||||
while(addresses.hasMoreElements()) {
|
||||
@ -60,9 +60,13 @@ public class LibvirtOvsFetchInterfaceCommandWrapperTest {
|
||||
break;
|
||||
};
|
||||
}
|
||||
if (StringUtils.isNotBlank(interfaceName) && StringUtils.isNotBlank(ipAddress)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (SocketException ignored) {}
|
||||
Assume.assumeTrue(StringUtils.isNotBlank(interfaceName));
|
||||
Ternary<String, String, String> result = null;
|
||||
try {
|
||||
result = wrapper.getInterfaceDetails(interfaceName);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user