Skip to content

Commit b7259a4

Browse files
committed
Merge branch 'asf-master' into ui-restyle
Conflicts: client/WEB-INF/classes/resources/messages.properties ui/dictionary.jsp
2 parents e13c32f + ed6c2d2 commit b7259a4

548 files changed

Lines changed: 76976 additions & 9285 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎agent/src/com/cloud/agent/dao/impl/PropertiesStorage.java‎

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
package com.cloud.agent.dao.impl;
1818

1919
import java.io.File;
20-
import java.io.FileInputStream;
2120
import java.io.FileNotFoundException;
2221
import java.io.FileOutputStream;
2322
import java.io.IOException;
@@ -26,6 +25,7 @@
2625

2726
import javax.ejb.Local;
2827

28+
import org.apache.commons.io.IOUtils;
2929
import org.apache.log4j.Logger;
3030

3131
import com.cloud.agent.dao.StorageComponent;
@@ -59,18 +59,10 @@ public synchronized void persist(String key, String value) {
5959
_properties.store(output, _name);
6060
output.flush();
6161
output.close();
62-
} catch (FileNotFoundException e) {
63-
s_logger.error("Who deleted the file? ", e);
6462
} catch (IOException e) {
6563
s_logger.error("Uh-oh: ", e);
6664
} finally {
67-
if (output != null) {
68-
try {
69-
output.close();
70-
} catch (IOException e) {
71-
// ignore.
72-
}
73-
}
65+
IOUtils.closeQuietly(output);
7466
}
7567
}
7668

@@ -99,7 +91,7 @@ public boolean configure(String name, Map<String, Object> params) {
9991
}
10092

10193
try {
102-
_properties.load(new FileInputStream(file));
94+
PropertiesUtil.loadFromFile(_properties, file);
10395
_file = file;
10496
} catch (FileNotFoundException e) {
10597
s_logger.error("How did we get here? ", e);
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
package com.cloud.agent.dao.impl;
20+
21+
import java.io.File;
22+
import java.io.IOException;
23+
import java.util.HashMap;
24+
25+
import junit.framework.Assert;
26+
27+
import org.apache.commons.io.FileUtils;
28+
import org.junit.Test;
29+
30+
public class PropertiesStorageTest {
31+
@Test
32+
public void configureWithNotExistingFile() {
33+
String fileName = "target/notyetexistingfile"
34+
+ System.currentTimeMillis();
35+
File file = new File(fileName);
36+
37+
PropertiesStorage storage = new PropertiesStorage();
38+
HashMap<String, Object> params = new HashMap<String, Object>();
39+
params.put("path", fileName);
40+
Assert.assertTrue(storage.configure("test", params));
41+
Assert.assertTrue(file.exists());
42+
storage.persist("foo", "bar");
43+
Assert.assertEquals("bar", storage.get("foo"));
44+
45+
storage.stop();
46+
file.delete();
47+
}
48+
49+
@Test
50+
public void configureWithExistingFile() throws IOException {
51+
String fileName = "target/existingfile"
52+
+ System.currentTimeMillis();
53+
File file = new File(fileName);
54+
55+
FileUtils.writeStringToFile(file, "a=b\n\n");
56+
57+
PropertiesStorage storage = new PropertiesStorage();
58+
HashMap<String, Object> params = new HashMap<String, Object>();
59+
params.put("path", fileName);
60+
Assert.assertTrue(storage.configure("test", params));
61+
Assert.assertEquals("b", storage.get("a"));
62+
Assert.assertTrue(file.exists());
63+
storage.persist("foo", "bar");
64+
Assert.assertEquals("bar", storage.get("foo"));
65+
66+
storage.stop();
67+
file.delete();
68+
}
69+
}

‎api/src/com/cloud/agent/api/to/DataStoreTO.java‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import com.cloud.storage.DataStoreRole;
2222

2323
public interface DataStoreTO {
24-
public DataStoreRole getRole();
25-
public String getUuid();
24+
DataStoreRole getRole();
25+
String getUuid();
26+
String getUrl();
2627
}

‎api/src/com/cloud/agent/api/to/DiskTO.java‎

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,35 @@
1818
*/
1919
package com.cloud.agent.api.to;
2020

21+
import java.util.Map;
22+
2123
import com.cloud.storage.Volume;
2224

2325
public class DiskTO {
26+
public static final String CHAP_INITIATOR_USERNAME = "chapInitiatorUsername";
27+
public static final String CHAP_INITIATOR_SECRET = "chapInitiatorSecret";
28+
public static final String CHAP_TARGET_USERNAME = "chapTargetUsername";
29+
public static final String CHAP_TARGET_SECRET = "chapTargetSecret";
30+
public static final String MANAGED = "managed";
31+
public static final String IQN = "iqn";
32+
public static final String STORAGE_HOST = "storageHost";
33+
public static final String STORAGE_PORT = "storagePort";
34+
public static final String VOLUME_SIZE = "volumeSize";
35+
2436
private DataTO data;
2537
private Long diskSeq;
26-
private String vdiUuid;
38+
private String path;
2739
private Volume.Type type;
40+
private Map<String, String> _details;
41+
2842
public DiskTO() {
2943

3044
}
3145

32-
public DiskTO(DataTO data, Long diskSeq, String vdiUuid, Volume.Type type) {
46+
public DiskTO(DataTO data, Long diskSeq, String path, Volume.Type type) {
3347
this.data = data;
3448
this.diskSeq = diskSeq;
35-
this.vdiUuid = vdiUuid;
49+
this.path = path;
3650
this.type = type;
3751
}
3852

@@ -52,12 +66,12 @@ public void setDiskSeq(Long diskSeq) {
5266
this.diskSeq = diskSeq;
5367
}
5468

55-
public String getVdiUuid() {
56-
return vdiUuid;
69+
public String getPath() {
70+
return path;
5771
}
5872

59-
public void setVdiUuid(String vdiUuid) {
60-
this.vdiUuid = vdiUuid;
73+
public void setPath(String path) {
74+
this.path = path;
6175
}
6276

6377
public Volume.Type getType() {
@@ -67,4 +81,12 @@ public Volume.Type getType() {
6781
public void setType(Volume.Type type) {
6882
this.type = type;
6983
}
84+
85+
public void setDetails(Map<String, String> details) {
86+
_details = details;
87+
}
88+
89+
public Map<String, String> getDetails() {
90+
return _details;
91+
}
7092
}

‎api/src/com/cloud/agent/api/to/NfsTO.java‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public NfsTO(String url, DataStoreRole role) {
3939

4040
}
4141

42+
@Override
4243
public String getUrl() {
4344
return _url;
4445
}

‎api/src/com/cloud/agent/api/to/S3TO.java‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ public final class S3TO implements S3Utils.ClientOptions, DataStoreTO {
3939
private Integer socketTimeout;
4040
private Date created;
4141
private boolean enableRRS;
42-
private boolean multipartEnabled;
4342
private long maxSingleUploadSizeInBytes;
4443

4544
public S3TO() {
@@ -182,6 +181,11 @@ public String getUuid() {
182181
return this.uuid;
183182
}
184183

184+
@Override
185+
public String getUrl() {
186+
return null;
187+
}
188+
185189
public void setUuid(final String uuid) {
186190
this.uuid = uuid;
187191
}

‎api/src/com/cloud/event/EventTypes.java‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,9 @@ public class EventTypes {
449449

450450
public static final String EVENT_UCS_ASSOCIATED_PROFILE = "UCS.ASSOCIATEPROFILE";
451451

452+
// Object store migration
453+
public static final String EVENT_MIGRATE_PREPARE_SECONDARY_STORAGE = "MIGRATE.PREPARE.SS";
454+
452455
static {
453456

454457
// TODO: need a way to force author adding event types to declare the entity details as well, with out braking

‎api/src/com/cloud/network/Network.java‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ public static class Provider {
114114
private static List<Provider> supportedProviders = new ArrayList<Provider>();
115115

116116
public static final Provider VirtualRouter = new Provider("VirtualRouter", false);
117+
public static final Provider JuniperContrail = new Provider("JuniperContrail", false);
117118
public static final Provider JuniperSRX = new Provider("JuniperSRX", true);
118119
public static final Provider F5BigIp = new Provider("F5BigIp", true);
119120
public static final Provider Netscaler = new Provider("Netscaler", true);

‎api/src/com/cloud/network/RemoteAccessVpn.java‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ enum State {
3131
String getIpRange();
3232
String getIpsecPresharedKey();
3333
String getLocalIp();
34-
long getNetworkId();
34+
Long getNetworkId();
35+
Long getVpcId();
3536
State getState();
3637
}

‎api/src/com/cloud/network/Site2SiteVpnConnection.java‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,5 @@ enum State {
3535
public State getState();
3636
public Date getCreated();
3737
public Date getRemoved();
38+
public boolean isPassive();
3839
}

0 commit comments

Comments
 (0)