Skip to content

Commit bf32776

Browse files
committed
be able to upload template into swift
1 parent 2849f81 commit bf32776

30 files changed

Lines changed: 1367 additions & 3305 deletions

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
import com.cloud.storage.DataStoreRole;
2020

21-
public final class NfsTO implements DataStoreTO {
21+
public class NfsTO implements DataStoreTO {
2222

2323
private String _url;
2424
private DataStoreRole _role;

engine/storage/src/org/apache/cloudstack/storage/LocalHostEndpoint.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,14 @@
1616
// under the License.
1717
package org.apache.cloudstack.storage;
1818

19+
import java.io.File;
1920
import java.util.concurrent.Executors;
2021
import java.util.concurrent.ScheduledExecutorService;
2122
import java.util.concurrent.TimeUnit;
2223

24+
import com.cloud.configuration.Config;
25+
import com.cloud.configuration.dao.ConfigurationDao;
26+
import com.cloud.configuration.dao.ConfigurationDaoImpl;
2327
import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
2428
import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
2529
import org.apache.cloudstack.storage.command.CopyCommand;
@@ -31,12 +35,24 @@
3135
import com.cloud.resource.ServerResource;
3236
import com.cloud.utils.net.NetUtils;
3337

38+
import javax.inject.Inject;
39+
3440
public class LocalHostEndpoint implements EndPoint {
3541
private ScheduledExecutorService executor;
3642
protected ServerResource resource;
43+
@Inject
44+
ConfigurationDao configDao;
3745

3846
public LocalHostEndpoint() {
39-
resource = new LocalNfsSecondaryStorageResource();
47+
// get mount parent folder configured in global setting, if set, this will overwrite _parent in NfsSecondaryStorageResource to work
48+
// around permission issue for default /mnt folder
49+
String mountParent = configDao.getValue(Config.MountParent.key());
50+
51+
String path = mountParent + File.separator + "secStorage";
52+
53+
LocalNfsSecondaryStorageResource localResource = new LocalNfsSecondaryStorageResource();
54+
localResource.setParentPath(path);
55+
resource = localResource;
4056
executor = Executors.newScheduledThreadPool(10);
4157
}
4258

plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,13 +1072,13 @@ private boolean checkOvsNetwork(String networkName) {
10721072

10731073
private void passCmdLine(String vmName, String cmdLine)
10741074
throws InternalErrorException {
1075-
final Script command = new Script(_patchViaSocketPath, _timeout, s_logger);
1075+
final Script command = new Script(_patchViaSocketPath, 5*1000, s_logger);
10761076
String result;
10771077
command.add("-n",vmName);
10781078
command.add("-p", cmdLine.replaceAll(" ", "%"));
10791079
result = command.execute();
10801080
if (result != null) {
1081-
throw new InternalErrorException(result);
1081+
s_logger.debug("passcmd failed:" + result);
10821082
}
10831083
}
10841084

scripts/storage/qcow2/managesnapshot.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,10 @@ create_snapshot() {
6767
local disk=$1
6868
local snapshotname="$2"
6969
local failed=0
70+
is_lv ${disk}
71+
islv_ret=$?
7072

71-
if [ ${dmsnapshot} = "yes" ] && is_lv ${disk}; then
73+
if [ ${dmsnapshot} = "yes" ] && [ "$islv_ret" == "1" ]; then
7274
local lv=`get_lv ${disk}`
7375
local vg=`get_vg ${disk}`
7476
local lv_dm=`double_hyphens ${lv}`
@@ -120,8 +122,10 @@ destroy_snapshot() {
120122
local disk=$1
121123
local snapshotname="$2"
122124
local failed=0
125+
is_lv ${disk}
126+
islv_ret=$?
123127

124-
if is_lv ${disk}; then
128+
if [ "$islv_ret" == "1" ]; then
125129
local lv=`get_lv ${disk}`
126130
local vg=`get_vg ${disk}`
127131
local lv_dm=`double_hyphens ${lv}`
@@ -187,7 +191,10 @@ backup_snapshot() {
187191
fi
188192
fi
189193

190-
if [ ${dmsnapshot} = "yes" ] && is_lv ${disk}; then
194+
is_lv ${disk}
195+
islv_ret=$?
196+
197+
if [ ${dmsnapshot} = "yes" ] && [ "$islv_ret" == "1" ] ; then
191198
local vg=`get_vg ${disk}`
192199
local vg_dm=`double_hyphens ${vg}`
193200
local scriptdir=`dirname ${0}`

0 commit comments

Comments
 (0)