Skip to content

Commit dc25278

Browse files
committed
Merge branch 'main' of https://github.com/apache/cloudstack into nsx-integration
2 parents 5ec4552 + 543c54c commit dc25278

File tree

211 files changed

+10336
-3740
lines changed

Some content is hidden

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

211 files changed

+10336
-3740
lines changed

.github/linters/.flake8

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,12 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18+
# E112 Expected an indented block
19+
# E113 Unexpected indentation
20+
# E133 Closing bracket is missing indentation
1821
# E223 Tab before operator
1922
# E224 Tab after operator
23+
# E227 Missing whitespace around bitwise or shift operator
2024
# E242 Tab after ','
2125
# E273 Tab after keyword
2226
# E274 Tab before keyword
@@ -30,4 +34,7 @@
3034
# W391 Blank line at end of file
3135

3236
[flake8]
33-
select = E223,E224,E242,E273,E274,E742,E743,E901,E902,W291,W292,W293,W391
37+
exclude =
38+
.git,
39+
venv
40+
select = E112,E113,E133,E223,E224,E227,E242,E273,E274,E742,E743,E901,E902,W291,W292,W293,W391

.github/workflows/sonar-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ concurrency:
2929

3030
jobs:
3131
build:
32-
if: github.repository == 'apache/cloudstack'
32+
if: github.repository == 'apache/cloudstack' && github.event.pull_request.head.repo.full_name == github.repository
3333
name: Sonar JaCoCo Coverage
3434
runs-on: ubuntu-22.04
3535
steps:

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ repos:
3131
#- id: check-added-large-files
3232
- id: check-case-conflict
3333
#- id: check-executables-have-shebangs
34-
#- id: check-merge-conflict
34+
- id: check-merge-conflict
3535
- id: check-vcs-permalinks
3636
#- id: check-yaml
3737
- id: detect-private-key
@@ -52,7 +52,7 @@ repos:
5252
exclude: \.vhd$
5353
#- id: fix-byte-order-marker
5454
- id: mixed-line-ending
55-
files: \.(java|md|py|txt|yaml|yml)$
55+
exclude: \.(cs|xml)$
5656
# - id: trailing-whitespace
5757
- repo: https://github.com/pycqa/flake8
5858
rev: 6.1.0

agent/src/main/java/com/cloud/agent/dhcp/FakeDhcpSnooper.java

Lines changed: 0 additions & 161 deletions
This file was deleted.

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import org.apache.cloudstack.config.Configuration;
3131
import org.apache.cloudstack.ha.HAConfig;
3232
import org.apache.cloudstack.usage.Usage;
33+
import org.apache.cloudstack.vm.schedule.VMSchedule;
3334

3435
import com.cloud.dc.DataCenter;
3536
import com.cloud.dc.DataCenterGuestIpv6Prefix;
@@ -84,7 +85,6 @@
8485
import com.cloud.vm.Nic;
8586
import com.cloud.vm.NicSecondaryIp;
8687
import com.cloud.vm.VirtualMachine;
87-
import org.apache.cloudstack.vm.schedule.VMSchedule;
8888

8989
public class EventTypes {
9090

@@ -320,6 +320,7 @@ public class EventTypes {
320320
public static final String EVENT_DOMAIN_UPDATE = "DOMAIN.UPDATE";
321321

322322
// Snapshots
323+
public static final String EVENT_SNAPSHOT_COPY = "SNAPSHOT.COPY";
323324
public static final String EVENT_SNAPSHOT_CREATE = "SNAPSHOT.CREATE";
324325
public static final String EVENT_SNAPSHOT_ON_PRIMARY = "SNAPSHOT.ON_PRIMARY";
325326
public static final String EVENT_SNAPSHOT_OFF_PRIMARY = "SNAPSHOT.OFF_PRIMARY";

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
package com.cloud.storage;
2020

2121
import java.net.MalformedURLException;
22+
import java.util.List;
2223
import java.util.Map;
2324

24-
import com.cloud.utils.fsm.NoTransitionException;
2525
import org.apache.cloudstack.api.command.user.volume.AssignVolumeCmd;
2626
import org.apache.cloudstack.api.command.user.volume.AttachVolumeCmd;
2727
import org.apache.cloudstack.api.command.user.volume.ChangeOfferingForVolumeCmd;
@@ -37,6 +37,7 @@
3737

3838
import com.cloud.exception.ResourceAllocationException;
3939
import com.cloud.user.Account;
40+
import com.cloud.utils.fsm.NoTransitionException;
4041

4142
public interface VolumeApiService {
4243

@@ -105,10 +106,10 @@ public interface VolumeApiService {
105106

106107
Volume detachVolumeFromVM(DetachVolumeCmd cmd);
107108

108-
Snapshot takeSnapshot(Long volumeId, Long policyId, Long snapshotId, Account account, boolean quiescevm, Snapshot.LocationType locationType, boolean asyncBackup, Map<String, String> tags)
109+
Snapshot takeSnapshot(Long volumeId, Long policyId, Long snapshotId, Account account, boolean quiescevm, Snapshot.LocationType locationType, boolean asyncBackup, Map<String, String> tags, List<Long> zoneIds)
109110
throws ResourceAllocationException;
110111

111-
Snapshot allocSnapshot(Long volumeId, Long policyId, String snapshotName, Snapshot.LocationType locationType) throws ResourceAllocationException;
112+
Snapshot allocSnapshot(Long volumeId, Long policyId, String snapshotName, Snapshot.LocationType locationType, List<Long> zoneIds) throws ResourceAllocationException;
112113

113114
Volume updateVolume(long volumeId, String path, String state, Long storageId, Boolean displayVolume, String customId, long owner, String chainInfo, String name);
114115

api/src/main/java/com/cloud/storage/snapshot/SnapshotApiService.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,20 @@
1818

1919
import java.util.List;
2020

21+
import org.apache.cloudstack.api.command.user.snapshot.CopySnapshotCmd;
2122
import org.apache.cloudstack.api.command.user.snapshot.CreateSnapshotPolicyCmd;
2223
import org.apache.cloudstack.api.command.user.snapshot.DeleteSnapshotPoliciesCmd;
2324
import org.apache.cloudstack.api.command.user.snapshot.ListSnapshotPoliciesCmd;
2425
import org.apache.cloudstack.api.command.user.snapshot.ListSnapshotsCmd;
26+
import org.apache.cloudstack.api.command.user.snapshot.UpdateSnapshotPolicyCmd;
2527

2628
import com.cloud.api.commands.ListRecurringSnapshotScheduleCmd;
2729
import com.cloud.exception.ResourceAllocationException;
30+
import com.cloud.exception.StorageUnavailableException;
2831
import com.cloud.storage.Snapshot;
2932
import com.cloud.storage.Volume;
3033
import com.cloud.user.Account;
3134
import com.cloud.utils.Pair;
32-
import org.apache.cloudstack.api.command.user.snapshot.UpdateSnapshotPolicyCmd;
3335

3436
public interface SnapshotApiService {
3537

@@ -50,7 +52,7 @@ public interface SnapshotApiService {
5052
* @param snapshotId
5153
* TODO
5254
*/
53-
boolean deleteSnapshot(long snapshotId);
55+
boolean deleteSnapshot(long snapshotId, Long zoneId);
5456

5557
/**
5658
* Creates a policy with specified schedule. maxSnaps specifies the number of most recent snapshots that are to be
@@ -88,7 +90,7 @@ public interface SnapshotApiService {
8890

8991
Snapshot allocSnapshot(Long volumeId, Long policyId, String snapshotName, Snapshot.LocationType locationType) throws ResourceAllocationException;
9092

91-
Snapshot allocSnapshot(Long volumeId, Long policyId, String snapshotName, Snapshot.LocationType locationType, Boolean isFromVmSnapshot)
93+
Snapshot allocSnapshot(Long volumeId, Long policyId, String snapshotName, Snapshot.LocationType locationType, Boolean isFromVmSnapshot, List<Long> zoneIds)
9294
throws ResourceAllocationException;
9395

9496

@@ -124,4 +126,6 @@ Snapshot allocSnapshot(Long volumeId, Long policyId, String snapshotName, Snapsh
124126
SnapshotPolicy updateSnapshotPolicy(UpdateSnapshotPolicyCmd updateSnapshotPolicyCmd);
125127

126128
void markVolumeSnapshotsAsDestroyed(Volume volume);
129+
130+
Snapshot copySnapshot(CopySnapshotCmd cmd) throws StorageUnavailableException, ResourceAllocationException;
127131
}

api/src/main/java/org/apache/cloudstack/api/ApiConstants.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,10 @@ public class ApiConstants {
7676
public static final String CSR = "csr";
7777
public static final String PRIVATE_KEY = "privatekey";
7878
public static final String DATASTORE_HOST = "datastorehost";
79+
public static final String DATASTORE_ID = "datastoreid";
7980
public static final String DATASTORE_NAME = "datastorename";
8081
public static final String DATASTORE_PATH = "datastorepath";
82+
public static final String DATASTORE_STATE = "datastorestate";
8183
public static final String DATASTORE_TYPE = "datastoretype";
8284
public static final String DOMAIN_SUFFIX = "domainsuffix";
8385
public static final String DNS_SEARCH_ORDER = "dnssearchorder";
@@ -492,6 +494,7 @@ public class ApiConstants {
492494
public static final String ZONE = "zone";
493495
public static final String ZONE_ID = "zoneid";
494496
public static final String ZONE_NAME = "zonename";
497+
public static final String ZONE_WISE = "zonewise";
495498
public static final String NETWORK_TYPE = "networktype";
496499
public static final String PAGE = "page";
497500
public static final String PAGE_SIZE = "pagesize";

api/src/main/java/org/apache/cloudstack/api/ResponseGenerator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ List<TemplateResponse> createTemplateResponses(ResponseView view, VirtualMachine
438438
* @param result
439439
* @return
440440
*/
441-
PrivateGatewayResponse createPrivateGatewayResponse(PrivateGateway result);
441+
PrivateGatewayResponse createPrivateGatewayResponse(ResponseView view, PrivateGateway result);
442442

443443
/**
444444
* @param result
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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 org.apache.cloudstack.api.command.admin.vpc;
18+
19+
import org.apache.log4j.Logger;
20+
21+
import org.apache.cloudstack.api.APICommand;
22+
import org.apache.cloudstack.api.ResponseObject;
23+
import org.apache.cloudstack.api.command.admin.AdminCmd;
24+
import org.apache.cloudstack.api.command.user.vpc.ListPrivateGatewaysCmd;
25+
import org.apache.cloudstack.api.response.PrivateGatewayResponse;
26+
27+
import com.cloud.network.vpc.VpcGateway;
28+
29+
@APICommand(name = "listPrivateGateways", description = "List private gateways", responseObject = PrivateGatewayResponse.class, entityType = {VpcGateway.class},
30+
responseView = ResponseObject.ResponseView.Full,
31+
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
32+
public class ListPrivateGatewaysCmdByAdminCmd extends ListPrivateGatewaysCmd implements AdminCmd {
33+
public static final Logger s_logger = Logger.getLogger(ListPrivateGatewaysCmdByAdminCmd.class.getName());
34+
35+
}

0 commit comments

Comments
 (0)