Skip to content

Commit d2aa1c4

Browse files
committed
Fix concurrency issues CID-1230585 and CID-1230586
1 parent 9d7b851 commit d2aa1c4

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

core/src/com/cloud/resource/ServerResourceBase.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import java.util.ArrayList;
2727
import java.util.Date;
2828
import java.util.Enumeration;
29+
import java.util.LinkedList;
2930
import java.util.List;
3031
import java.util.Map;
3132

@@ -100,9 +101,9 @@ public boolean configure(final String name, Map<String, Object> params) throws C
100101
final String nicName = nic.getName();
101102
// try {
102103
if (//!nic.isLoopback() &&
103-
//nic.isUp() &&
104-
!nic.isVirtual() && !nicName.startsWith("vnif") && !nicName.startsWith("vnbr") && !nicName.startsWith("peth") && !nicName.startsWith("vif") &&
105-
!nicName.startsWith("virbr") && !nicName.contains(":")) {
104+
//nic.isUp() &&
105+
!nic.isVirtual() && !nicName.startsWith("vnif") && !nicName.startsWith("vnbr") && !nicName.startsWith("peth") && !nicName.startsWith("vif") &&
106+
!nicName.startsWith("virbr") && !nicName.contains(":")) {
106107
final String[] info = NetUtils.getNicParams(nicName);
107108
if (info != null && info[0] != null) {
108109
_privateNic = nic;
@@ -237,16 +238,16 @@ protected void recordWarning(final String msg) {
237238

238239
protected List<String> getWarnings() {
239240
synchronized (_warnings) {
240-
final ArrayList<String> results = _warnings;
241-
_warnings = new ArrayList<String>();
241+
final List<String> results = new LinkedList<String>(_warnings);
242+
_warnings.clear();
242243
return results;
243244
}
244245
}
245246

246247
protected List<String> getErrors() {
247248
synchronized (_errors) {
248-
final ArrayList<String> result = _errors;
249-
_errors = new ArrayList<String>();
249+
final List<String> result = new LinkedList<String>(_errors);
250+
_errors.clear();
250251
return result;
251252
}
252253
}

0 commit comments

Comments
 (0)