Skip to content

Commit 0e0c6d8

Browse files
committed
Merge remote-tracking branch 'origin/main' into kvm-disk-only-vm-snapshot
2 parents 3d2be3f + 6fdaf51 commit 0e0c6d8

File tree

118 files changed

+4286
-646
lines changed

Some content is hidden

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

118 files changed

+4286
-646
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ jobs:
236236
237237
- name: Install Python dependencies
238238
run: |
239-
python3 -m pip install --user --upgrade urllib3 lxml paramiko nose texttable ipmisim pyopenssl pycrypto mock flask netaddr pylint pycodestyle six astroid pynose
239+
python3 -m pip install --user --upgrade urllib3 lxml paramiko nose texttable ipmisim pyopenssl pycryptodome mock flask netaddr pylint pycodestyle six astroid pynose
240240
241241
- name: Install jacoco dependencies
242242
run: |

agent/conf/agent.properties

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,3 +441,9 @@ iscsi.session.cleanup.enabled=false
441441

442442
# Wait(in seconds) during agent reconnections. When no value is set then default value of 5s will be used
443443
#backoff.seconds=
444+
445+
# Timeout (in seconds) to wait for the snapshot reversion to complete.
446+
# revert.snapshot.timeout=10800
447+
448+
# Timeout (in seconds) to wait for the incremental snapshot to complete.
449+
# incremental.snapshot.timeout=10800

agent/src/main/java/com/cloud/agent/properties/AgentProperties.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -826,6 +826,16 @@ public Property<Integer> getWorkers() {
826826
*/
827827
public static final Property<Integer> SSL_HANDSHAKE_TIMEOUT = new Property<>("ssl.handshake.timeout", 30, Integer.class);
828828

829+
/**
830+
* Timeout (in seconds) to wait for the incremental snapshot to complete.
831+
* */
832+
public static final Property<Integer> INCREMENTAL_SNAPSHOT_TIMEOUT = new Property<>("incremental.snapshot.timeout", 10800);
833+
834+
/**
835+
* Timeout (in seconds) to wait for the snapshot reversion to complete.
836+
* */
837+
public static final Property<Integer> REVERT_SNAPSHOT_TIMEOUT = new Property<>("revert.snapshot.timeout", 10800);
838+
829839
public static class Property <T>{
830840
private String name;
831841
private T defaultValue;

api/src/main/java/com/cloud/storage/Snapshot.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public boolean equals(String snapshotType) {
4848
}
4949

5050
public enum State {
51-
Allocated, Creating, CreatedOnPrimary, BackingUp, BackedUp, Copying, Destroying, Destroyed,
51+
Allocated, Creating, CreatedOnPrimary, BackingUp, BackedUp, Copying, Destroying, Destroyed, Hidden,
5252
//it's a state, user can't see the snapshot from ui, while the snapshot may still exist on the storage
5353
Error;
5454

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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 com.cloud.agent.api;
21+
22+
import org.apache.cloudstack.storage.to.SnapshotObjectTO;
23+
24+
public class ConvertSnapshotAnswer extends Answer {
25+
26+
private SnapshotObjectTO snapshotObjectTO;
27+
28+
public ConvertSnapshotAnswer(SnapshotObjectTO snapshotObjectTO) {
29+
super(null);
30+
this.snapshotObjectTO = snapshotObjectTO;
31+
}
32+
33+
public SnapshotObjectTO getSnapshotObjectTO() {
34+
return snapshotObjectTO;
35+
}
36+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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 com.cloud.agent.api;
21+
22+
import org.apache.cloudstack.storage.to.SnapshotObjectTO;
23+
24+
public class ConvertSnapshotCommand extends Command {
25+
26+
public static final String TEMP_SNAPSHOT_NAME = "_temp";
27+
28+
SnapshotObjectTO snapshotObjectTO;
29+
30+
public SnapshotObjectTO getSnapshotObjectTO() {
31+
return snapshotObjectTO;
32+
}
33+
34+
public ConvertSnapshotCommand(SnapshotObjectTO snapshotObjectTO) {
35+
this.snapshotObjectTO = snapshotObjectTO;
36+
}
37+
38+
@Override
39+
public boolean executeInSequence() {
40+
return true;
41+
}
42+
}

core/src/main/java/com/cloud/agent/api/GetVmIpAddressCommand.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@ public class GetVmIpAddressCommand extends Command {
2424
String vmName;
2525
String vmNetworkCidr;
2626
boolean windows = false;
27+
String macAddress;
2728

28-
public GetVmIpAddressCommand(String vmName, String vmNetworkCidr, boolean windows) {
29+
public GetVmIpAddressCommand(String vmName, String vmNetworkCidr, boolean windows, String macAddress) {
2930
this.vmName = vmName;
3031
this.windows = windows;
3132
this.vmNetworkCidr = vmNetworkCidr;
33+
this.macAddress = macAddress;
3234
}
3335

3436
@Override
@@ -47,4 +49,8 @@ public boolean isWindows(){
4749
public String getVmNetworkCidr() {
4850
return vmNetworkCidr;
4951
}
52+
53+
public String getMacAddress() {
54+
return macAddress;
55+
}
5056
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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 com.cloud.agent.api;
21+
22+
import org.apache.cloudstack.storage.to.VolumeObjectTO;
23+
24+
import java.util.List;
25+
26+
public class RecreateCheckpointsCommand extends Command {
27+
28+
private List<VolumeObjectTO> volumes;
29+
30+
private String vmName;
31+
32+
public RecreateCheckpointsCommand(List<VolumeObjectTO> volumes, String vmName) {
33+
this.volumes = volumes;
34+
this.vmName = vmName;
35+
}
36+
37+
public List<VolumeObjectTO> getDisks() {
38+
return volumes;
39+
}
40+
41+
public String getVmName() {
42+
return vmName;
43+
}
44+
45+
@Override
46+
public boolean executeInSequence() {
47+
return true;
48+
}
49+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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.api;
20+
21+
import org.apache.cloudstack.storage.to.SnapshotObjectTO;
22+
23+
public class RemoveBitmapCommand extends Command {
24+
25+
private SnapshotObjectTO snapshotObjectTO;
26+
27+
private boolean isVmRunning;
28+
29+
public RemoveBitmapCommand(SnapshotObjectTO snapshotObjectTO, boolean isVmRunning) {
30+
this.snapshotObjectTO = snapshotObjectTO;
31+
this.isVmRunning = isVmRunning;
32+
}
33+
34+
@Override
35+
public boolean executeInSequence() {
36+
return true;
37+
}
38+
39+
public SnapshotObjectTO getSnapshotObjectTO() {
40+
return snapshotObjectTO;
41+
}
42+
43+
public boolean isVmRunning() {
44+
return isVmRunning;
45+
}
46+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ protected Answer execute(CreateObjectCommand cmd) {
142142
}
143143
return new CreateObjectAnswer("not supported type");
144144
} catch (Exception e) {
145-
logger.debug("Failed to create object: " + data.getObjectType() + ": " + e.toString());
145+
logger.error("Failed to create object [{}] due to [{}].", data.getObjectType(), e.getMessage(), e);
146146
return new CreateObjectAnswer(e.toString());
147147
}
148148
}

0 commit comments

Comments
 (0)