Skip to content

Commit 01c8ad8

Browse files
author
Karl Harris
committed
Merge remote-tracking branch 'origin/master' into FEATURE-CENIK123-v1.1
2 parents eb74a6c + 10cc7f8 commit 01c8ad8

File tree

51 files changed

+894
-479
lines changed

Some content is hidden

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

51 files changed

+894
-479
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public class DiskTO {
3434
public static final String VOLUME_SIZE = "volumeSize";
3535
public static final String MOUNT_POINT = "mountpoint";
3636
public static final String PROTOCOL_TYPE = "protocoltype";
37+
public static final String PATH = "path";
3738

3839
private DataTO data;
3940
private Long diskSeq;

api/src/com/cloud/host/Status.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public static String[] toStrings(Status... states) {
123123
s_fsm.addTransition(Status.Connecting, Event.Ready, Status.Up);
124124
s_fsm.addTransition(Status.Connecting, Event.PingTimeout, Status.Alert);
125125
s_fsm.addTransition(Status.Connecting, Event.ShutdownRequested, Status.Disconnected);
126-
s_fsm.addTransition(Status.Connecting, Event.HostDown, Status.Alert);
126+
s_fsm.addTransition(Status.Connecting, Event.HostDown, Status.Down);
127127
s_fsm.addTransition(Status.Connecting, Event.Ping, Status.Connecting);
128128
s_fsm.addTransition(Status.Connecting, Event.ManagementServerDown, Status.Disconnected);
129129
s_fsm.addTransition(Status.Connecting, Event.AgentDisconnected, Status.Alert);

api/src/com/cloud/storage/Volume.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ enum State {
3838
Ready("The volume is ready to be used."),
3939
Migrating("The volume is migrating to other storage pool"),
4040
Snapshotting("There is a snapshot created on this volume, not backed up to secondary storage yet"),
41-
Reverting("Replace the existing volume on a storage system with a snapshot of it"),
4241
Resizing("The volume is being resized"),
4342
Expunging("The volume is being expunging"),
4443
Expunged("The volume is being expunging"),
@@ -86,11 +85,8 @@ public String getDescription() {
8685
s_fsm.addTransition(Expunging, Event.OperationSucceeded, Expunged);
8786
s_fsm.addTransition(Expunging, Event.OperationFailed, Destroy);
8887
s_fsm.addTransition(Ready, Event.SnapshotRequested, Snapshotting);
89-
s_fsm.addTransition(Ready, Event.RevertRequested, Reverting);
9088
s_fsm.addTransition(Snapshotting, Event.OperationSucceeded, Ready);
9189
s_fsm.addTransition(Snapshotting, Event.OperationFailed, Ready);
92-
s_fsm.addTransition(Reverting, Event.OperationSucceeded, Ready);
93-
s_fsm.addTransition(Reverting, Event.OperationFailed, Ready);
9490
s_fsm.addTransition(Ready, Event.MigrationRequested, Migrating);
9591
s_fsm.addTransition(Migrating, Event.OperationSucceeded, Ready);
9692
s_fsm.addTransition(Migrating, Event.OperationFailed, Ready);
@@ -115,7 +111,6 @@ enum Event {
115111
UploadRequested,
116112
MigrationRequested,
117113
SnapshotRequested,
118-
RevertRequested,
119114
DestroyRequested,
120115
ExpungingRequested,
121116
ResizeRequested;

core/src/com/cloud/storage/resource/StorageProcessor.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import org.apache.cloudstack.storage.command.DettachCommand;
2727
import org.apache.cloudstack.storage.command.ForgetObjectCmd;
2828
import org.apache.cloudstack.storage.command.IntroduceObjectCmd;
29+
import org.apache.cloudstack.storage.command.SnapshotAndCopyCommand;
2930

3031
import com.cloud.agent.api.Answer;
3132

@@ -62,7 +63,9 @@ public interface StorageProcessor {
6263

6364
public Answer deleteSnapshot(DeleteCommand cmd);
6465

65-
Answer introduceObject(IntroduceObjectCmd cmd);
66+
public Answer introduceObject(IntroduceObjectCmd cmd);
6667

67-
Answer forgetObject(ForgetObjectCmd cmd);
68+
public Answer forgetObject(ForgetObjectCmd cmd);
69+
70+
public Answer snapshotAndCopy(SnapshotAndCopyCommand cmd);
6871
}

core/src/com/cloud/storage/resource/StorageSubsystemCommandHandlerBase.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import org.apache.cloudstack.storage.command.DeleteCommand;
2929
import org.apache.cloudstack.storage.command.DettachCommand;
3030
import org.apache.cloudstack.storage.command.IntroduceObjectCmd;
31+
import org.apache.cloudstack.storage.command.SnapshotAndCopyCommand;
3132
import org.apache.cloudstack.storage.command.StorageSubSystemCommand;
3233

3334
import com.cloud.agent.api.Answer;
@@ -61,7 +62,10 @@ public Answer handleStorageCommands(StorageSubSystemCommand command) {
6162
return execute((DettachCommand)command);
6263
} else if (command instanceof IntroduceObjectCmd) {
6364
return processor.introduceObject((IntroduceObjectCmd)command);
65+
} else if (command instanceof SnapshotAndCopyCommand) {
66+
return processor.snapshotAndCopy((SnapshotAndCopyCommand)command);
6467
}
68+
6569
return new Answer((Command)command, false, "not implemented yet");
6670
}
6771

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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+
20+
package org.apache.cloudstack.storage.command;
21+
22+
import com.cloud.agent.api.Answer;
23+
24+
public class SnapshotAndCopyAnswer extends Answer {
25+
private String _path;
26+
27+
public SnapshotAndCopyAnswer() {
28+
}
29+
30+
public SnapshotAndCopyAnswer(String errMsg) {
31+
super(null, false, errMsg);
32+
}
33+
34+
public void setPath(String path) {
35+
_path = path;
36+
}
37+
38+
public String getPath() {
39+
return _path;
40+
}
41+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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+
20+
package org.apache.cloudstack.storage.command;
21+
22+
import com.cloud.agent.api.Command;
23+
24+
import java.util.Map;
25+
26+
public final class SnapshotAndCopyCommand extends Command implements StorageSubSystemCommand {
27+
private String _uuidOfSourceVdi;
28+
private Map<String, String> _sourceDetails;
29+
private Map<String, String> _destDetails;
30+
31+
private boolean _executeInSequence = true;
32+
33+
public SnapshotAndCopyCommand(String uuidOfSourceVdi, Map<String, String> sourceDetails, Map<String, String> destDetails) {
34+
_uuidOfSourceVdi = uuidOfSourceVdi;
35+
_sourceDetails = sourceDetails;
36+
_destDetails = destDetails;
37+
}
38+
39+
public String getUuidOfSourceVdi() {
40+
return _uuidOfSourceVdi;
41+
}
42+
43+
public Map<String, String> getSourceDetails() {
44+
return _sourceDetails;
45+
}
46+
47+
public Map<String, String> getDestDetails() {
48+
return _destDetails;
49+
}
50+
51+
@Override
52+
public void setExecuteInSequence(boolean executeInSequence) {
53+
_executeInSequence = executeInSequence;
54+
}
55+
56+
@Override
57+
public boolean executeInSequence() {
58+
return _executeInSequence;
59+
}
60+
}

engine/api/src/org/apache/cloudstack/engine/orchestration/service/VolumeOrchestrationService.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import java.util.Map;
2222
import java.util.Set;
2323

24+
import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
2425
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
2526
import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
2627

@@ -95,9 +96,9 @@ VolumeInfo moveVolume(VolumeInfo volume, long destPoolDcId, Long destPoolPodId,
9596

9697
void cleanupVolumes(long vmId) throws ConcurrentOperationException;
9798

98-
void disconnectVolumeFromHost(VolumeInfo volumeInfo, Host host, DataStore dataStore);
99+
void revokeAccess(DataObject dataObject, Host host, DataStore dataStore);
99100

100-
void disconnectVolumesFromHost(long vmId, long hostId);
101+
void revokeAccess(long vmId, long hostId);
101102

102103
void migrateVolumes(VirtualMachine vm, VirtualMachineTO vmTo, Host srcHost, Host destHost, Map<Volume, StoragePool> volumeToPool);
103104

engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreDriver.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
public interface PrimaryDataStoreDriver extends DataStoreDriver {
2929
public ChapInfo getChapInfo(VolumeInfo volumeInfo);
3030

31-
public boolean connectVolumeToHost(VolumeInfo volumeInfo, Host host, DataStore dataStore);
31+
public boolean grantAccess(DataObject dataObject, Host host, DataStore dataStore);
3232

33-
public void disconnectVolumeFromHost(VolumeInfo volumeInfo, Host host, DataStore dataStore);
33+
public void revokeAccess(DataObject dataObject, Host host, DataStore dataStore);
3434

3535
// intended for managed storage (cloud.storage_pool.managed = true)
3636
// if not managed, return volume.getSize()

engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/VolumeService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ public VolumeInfo getVolume() {
4444

4545
ChapInfo getChapInfo(VolumeInfo volumeInfo, DataStore dataStore);
4646

47-
boolean connectVolumeToHost(VolumeInfo volumeInfo, Host host, DataStore dataStore);
47+
boolean grantAccess(DataObject dataObject, Host host, DataStore dataStore);
4848

49-
void disconnectVolumeFromHost(VolumeInfo volumeInfo, Host host, DataStore dataStore);
49+
void revokeAccess(DataObject dataObject, Host host, DataStore dataStore);
5050

5151
/**
5252
* Creates the volume based on the given criteria

0 commit comments

Comments
 (0)