Skip to content

Commit 9a12756

Browse files
author
Mice Xia
committed
CLOUDSTACK-684 support vm snapshot
1 parent 3a0c99b commit 9a12756

55 files changed

Lines changed: 4595 additions & 80 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.
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
package com.cloud.agent.api;
19+
20+
import java.util.List;
21+
22+
import com.cloud.agent.api.to.VolumeTO;
23+
24+
public class CreateVMSnapshotAnswer extends Answer {
25+
26+
private List<VolumeTO> volumeTOs;
27+
private VMSnapshotTO vmSnapshotTo;
28+
29+
30+
public List<VolumeTO> getVolumeTOs() {
31+
return volumeTOs;
32+
}
33+
34+
public void setVolumeTOs(List<VolumeTO> volumeTOs) {
35+
this.volumeTOs = volumeTOs;
36+
}
37+
38+
public VMSnapshotTO getVmSnapshotTo() {
39+
return vmSnapshotTo;
40+
}
41+
42+
public void setVmSnapshotTo(VMSnapshotTO vmSnapshotTo) {
43+
this.vmSnapshotTo = vmSnapshotTo;
44+
}
45+
46+
public CreateVMSnapshotAnswer() {
47+
48+
}
49+
50+
public CreateVMSnapshotAnswer(CreateVMSnapshotCommand cmd, boolean success,
51+
String result) {
52+
super(cmd, success, result);
53+
}
54+
55+
public CreateVMSnapshotAnswer(CreateVMSnapshotCommand cmd,
56+
VMSnapshotTO vmSnapshotTo, List<VolumeTO> volumeTOs) {
57+
super(cmd, true, "");
58+
this.vmSnapshotTo = vmSnapshotTo;
59+
this.volumeTOs = volumeTOs;
60+
}
61+
62+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
package com.cloud.agent.api;
18+
19+
import java.util.List;
20+
21+
import com.cloud.agent.api.to.VolumeTO;
22+
import com.cloud.vm.VirtualMachine;
23+
24+
public class CreateVMSnapshotCommand extends VMSnapshotBaseCommand {
25+
26+
public CreateVMSnapshotCommand(String vmName, VMSnapshotTO snapshot, List<VolumeTO> volumeTOs, String guestOSType, VirtualMachine.State vmState) {
27+
super(vmName, snapshot, volumeTOs, guestOSType);
28+
this.vmState = vmState;
29+
}
30+
31+
private VirtualMachine.State vmState;
32+
33+
34+
public VirtualMachine.State getVmState() {
35+
return vmState;
36+
}
37+
38+
public void setVmState(VirtualMachine.State vmState) {
39+
this.vmState = vmState;
40+
}
41+
42+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
package com.cloud.agent.api;
19+
20+
import com.cloud.agent.api.to.VolumeTO;
21+
22+
public class CreateVolumeFromVMSnapshotAnswer extends Answer {
23+
private String path;
24+
private VolumeTO volumeTo;
25+
26+
public VolumeTO getVolumeTo() {
27+
return volumeTo;
28+
}
29+
30+
public CreateVolumeFromVMSnapshotAnswer(
31+
CreateVolumeFromVMSnapshotCommand cmd, VolumeTO volumeTo) {
32+
super(cmd, true, "");
33+
this.volumeTo = volumeTo;
34+
}
35+
36+
public String getPath() {
37+
return path;
38+
}
39+
40+
protected CreateVolumeFromVMSnapshotAnswer() {
41+
42+
}
43+
44+
public CreateVolumeFromVMSnapshotAnswer(
45+
CreateVolumeFromVMSnapshotCommand cmd, String path) {
46+
super(cmd, true, "");
47+
this.path = path;
48+
}
49+
50+
public CreateVolumeFromVMSnapshotAnswer(
51+
CreateVolumeFromVMSnapshotCommand cmd, boolean result, String string) {
52+
super(cmd, result, string);
53+
}
54+
}
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
package com.cloud.agent.api;
18+
19+
import com.cloud.agent.api.to.StorageFilerTO;
20+
import com.cloud.vm.DiskProfile;
21+
22+
public class CreateVolumeFromVMSnapshotCommand extends Command {
23+
24+
protected String path;
25+
protected String name;
26+
protected Boolean fullClone;
27+
protected String storagePoolUuid;
28+
private StorageFilerTO pool;
29+
private DiskProfile diskProfile;
30+
private Long volumeId;
31+
32+
public DiskProfile getDskch() {
33+
return diskProfile;
34+
}
35+
36+
public String getPath() {
37+
return path;
38+
}
39+
40+
public Long getVolumeId() {
41+
return volumeId;
42+
}
43+
44+
protected CreateVolumeFromVMSnapshotCommand() {
45+
46+
}
47+
48+
public CreateVolumeFromVMSnapshotCommand(String path, String name,
49+
Boolean fullClone, String storagePoolUuid) {
50+
this.path = path;
51+
this.name = name;
52+
this.fullClone = fullClone;
53+
this.storagePoolUuid = storagePoolUuid;
54+
}
55+
56+
public CreateVolumeFromVMSnapshotCommand(String path, String name,
57+
Boolean fullClone, String storagePoolUuid, StorageFilerTO pool,
58+
DiskProfile diskProfile, Long volumeId) {
59+
this.path = path;
60+
this.name = name;
61+
this.fullClone = fullClone;
62+
this.storagePoolUuid = storagePoolUuid;
63+
this.pool = pool;
64+
this.diskProfile = diskProfile;
65+
this.volumeId = volumeId;
66+
}
67+
68+
@Override
69+
public boolean executeInSequence() {
70+
return false;
71+
}
72+
73+
public String getName() {
74+
return name;
75+
}
76+
77+
public Boolean getFullClone() {
78+
return fullClone;
79+
}
80+
81+
public String getStoragePoolUuid() {
82+
return storagePoolUuid;
83+
}
84+
85+
public StorageFilerTO getPool() {
86+
return pool;
87+
}
88+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
package com.cloud.agent.api;
18+
19+
import java.util.List;
20+
21+
import com.cloud.agent.api.to.VolumeTO;
22+
23+
public class DeleteVMSnapshotAnswer extends Answer {
24+
private List<VolumeTO> volumeTOs;
25+
26+
public DeleteVMSnapshotAnswer() {
27+
}
28+
29+
public DeleteVMSnapshotAnswer(DeleteVMSnapshotCommand cmd, boolean result,
30+
String message) {
31+
super(cmd, result, message);
32+
}
33+
34+
public DeleteVMSnapshotAnswer(DeleteVMSnapshotCommand cmd,
35+
List<VolumeTO> volumeTOs) {
36+
super(cmd, true, "");
37+
this.volumeTOs = volumeTOs;
38+
}
39+
40+
public List<VolumeTO> getVolumeTOs() {
41+
return volumeTOs;
42+
}
43+
44+
public void setVolumeTOs(List<VolumeTO> volumeTOs) {
45+
this.volumeTOs = volumeTOs;
46+
}
47+
48+
49+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License
17+
package com.cloud.agent.api;
18+
19+
import java.util.List;
20+
21+
import com.cloud.agent.api.to.VolumeTO;
22+
23+
24+
public class DeleteVMSnapshotCommand extends VMSnapshotBaseCommand {
25+
public DeleteVMSnapshotCommand(String vmName, VMSnapshotTO snapshot, List<VolumeTO> volumeTOs, String guestOSType) {
26+
super( vmName, snapshot, volumeTOs, guestOSType);
27+
}
28+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
package com.cloud.agent.api;
19+
20+
import java.util.List;
21+
22+
import com.cloud.agent.api.to.VolumeTO;
23+
import com.cloud.vm.VirtualMachine;
24+
25+
public class RevertToVMSnapshotAnswer extends Answer {
26+
27+
private List<VolumeTO> volumeTOs;
28+
private VirtualMachine.State vmState;
29+
30+
public RevertToVMSnapshotAnswer(RevertToVMSnapshotCommand cmd, boolean result,
31+
String message) {
32+
super(cmd, result, message);
33+
}
34+
35+
public RevertToVMSnapshotAnswer() {
36+
super();
37+
}
38+
39+
public RevertToVMSnapshotAnswer(RevertToVMSnapshotCommand cmd,
40+
List<VolumeTO> volumeTOs,
41+
VirtualMachine.State vmState) {
42+
super(cmd, true, "");
43+
this.volumeTOs = volumeTOs;
44+
this.vmState = vmState;
45+
}
46+
47+
public VirtualMachine.State getVmState() {
48+
return vmState;
49+
}
50+
51+
public List<VolumeTO> getVolumeTOs() {
52+
return volumeTOs;
53+
}
54+
55+
public void setVolumeTOs(List<VolumeTO> volumeTOs) {
56+
this.volumeTOs = volumeTOs;
57+
}
58+
59+
public void setVmState(VirtualMachine.State vmState) {
60+
this.vmState = vmState;
61+
}
62+
63+
}

0 commit comments

Comments
 (0)