Skip to content

Commit a3846c2

Browse files
committed
Merge remote-tracking branch 'apache/main' into proxmox-console
2 parents 5f95f77 + 0526ec0 commit a3846c2

File tree

176 files changed

+4045
-1315
lines changed

Some content is hidden

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

176 files changed

+4045
-1315
lines changed

.github/linters/codespell.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,15 +183,12 @@ encryted
183183
enebled
184184
enmpty
185185
entires
186-
enviornment
187186
environmnet
188187
equivalant
189188
erro
190189
erronous
191190
everthing
192191
everytime
193-
excetion
194-
excption
195192
excute
196193
execept
197194
execption
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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+
name: CodeQL Analysis
19+
on:
20+
push:
21+
branches: [main]
22+
pull_request:
23+
branches: [main]
24+
permissions:
25+
actions: read
26+
contents: read
27+
security-events: write
28+
jobs:
29+
codeql:
30+
name: CodeQL
31+
runs-on: ubuntu-latest
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
language: ["actions"]
36+
steps:
37+
- name: Checkout repository
38+
uses: actions/checkout@v4
39+
- name: Initialize CodeQL
40+
uses: github/codeql-action/init@v3
41+
with:
42+
languages: ${{ matrix.language }}
43+
- name: Autobuild
44+
uses: github/codeql-action/autobuild@v3
45+
- name: Perform CodeQL Analysis
46+
uses: github/codeql-action/analyze@v3
47+
with:
48+
category: "Security"

.github/workflows/linter.yml

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

18-
name: Lint
18+
name: pre-commit
1919

2020
on: [pull_request]
2121

.pre-commit-config.yaml

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ repos:
3838
- id: check-case-conflict
3939
#- id: check-executables-have-shebangs
4040
- id: check-merge-conflict
41+
- id: check-shebang-scripts-are-executable
42+
files: \.sh$
4143
- id: check-symlinks
4244
- id: check-vcs-permalinks
4345
#- id: check-yaml
@@ -48,6 +50,7 @@ repos:
4850
exclude: >
4951
(?x)
5052
^scripts/vm/systemvm/id_rsa\.cloud$|
53+
^server/src/test/java/org/apache/cloudstack/network/ssl/CertServiceTest.java$|
5154
^server/src/test/java/com/cloud/keystore/KeystoreTest\.java$|
5255
^server/src/test/resources/certs/dsa_self_signed\.key$|
5356
^server/src/test/resources/certs/non_root\.key$|
@@ -57,15 +60,16 @@ repos:
5760
^server/src/test/resources/certs/rsa_self_signed\.key$|
5861
^services/console-proxy/rdpconsole/src/test/doc/rdp-key\.pem$|
5962
^systemvm/agent/certs/localhost\.key$|
60-
^systemvm/agent/certs/realhostip\.key$
63+
^systemvm/agent/certs/realhostip\.key$|
64+
^test/integration/smoke/test_ssl_offloading.py$
6165
- id: end-of-file-fixer
6266
exclude: \.vhd$
6367
- id: fix-byte-order-marker
6468
- id: forbid-submodules
6569
- id: mixed-line-ending
6670
exclude: \.cs$
6771
- id: trailing-whitespace
68-
files: \.(bat|cfg|cs|css|gitignore|header|in|install|java|md|properties|py|rb|sh|sql|txt|vue|xml|xsl|yaml|yml)$
72+
files: \.(bat|cfg|cs|css|gitignore|header|in|install|java|md|properties|py|rb|rc|sh|sql|te|template|txt|ucls|vue|xml|xsl|yaml|yml)$|^cloud-cli/bindir/cloud-tool$|^debian/changelog$
6973
args: [--markdown-linebreak-ext=md]
7074
exclude: ^services/console-proxy/rdpconsole/src/test/doc/freerdp-debug-log\.txt$
7175
- repo: https://github.com/codespell-project/codespell
@@ -75,23 +79,12 @@ repos:
7579
name: run codespell
7680
description: Check spelling with codespell
7781
args: [--ignore-words=.github/linters/codespell.txt]
78-
exclude: ^systemvm/agent/noVNC/|^ui/package\.json$|^ui/package-lock\.json$|^ui/public/js/less\.min\.js$|^ui/public/locales/.*[^n].*\.json$
82+
exclude: ^systemvm/agent/noVNC/|^ui/package\.json$|^ui/package-lock\.json$|^ui/public/js/less\.min\.js$|^ui/public/locales/.*[^n].*\.json$|^server/src/test/java/org/apache/cloudstack/network/ssl/CertServiceTest.java$|^test/integration/smoke/test_ssl_offloading.py$
7983
- repo: https://github.com/pycqa/flake8
8084
rev: 7.0.0
8185
hooks:
8286
- id: flake8
8387
args: [--config, .github/linters/.flake8]
84-
exclude: >
85-
(?x)
86-
^agent/bindir/cloud-setup-agent\.in$|
87-
^client/bindir/cloud-update-xenserver-licenses\.in$|
88-
^cloud-cli/bindir/cloud-tool$|
89-
^python/bindir/cloud-grab-dependent-library-versions$|
90-
^python/bindir/cloud-setup-baremetal$|
91-
^scripts/vm/hypervisor/xenserver/storagePlugin$|
92-
^scripts/vm/hypervisor/xenserver/vmopspremium$|
93-
^setup/bindir/cloud-setup-encryption\.in$|
94-
^venv/.*$
9588
- repo: https://github.com/igorshubovych/markdownlint-cli
9689
rev: v0.45.0
9790
hooks:

PULL_REQUEST_TEMPLATE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ This PR...
2222
- [ ] Bug fix (non-breaking change which fixes an issue)
2323
- [ ] Enhancement (improves an existing feature and functionality)
2424
- [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
25-
- [ ] build/CI
26-
- [ ] test (unit or integration test code)
25+
- [ ] Build/CI
26+
- [ ] Test (unit or integration test code)
2727

2828
### Feature/Enhancement Scale or Bug Severity
2929

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
1-
# Apache CloudStack [![Build Status](https://github.com/apache/cloudstack/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/apache/cloudstack/actions/workflows/build.yml) [![UI Build](https://github.com/apache/cloudstack/actions/workflows/ui.yml/badge.svg)](https://github.com/apache/cloudstack/actions/workflows/ui.yml) [![License Check](https://github.com/apache/cloudstack/actions/workflows/rat.yml/badge.svg?branch=main)](https://github.com/apache/cloudstack/actions/workflows/rat.yml) [![Simulator CI](https://github.com/apache/cloudstack/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/apache/cloudstack/actions/workflows/ci.yml) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=apache_cloudstack&metric=alert_status)](https://sonarcloud.io/dashboard?id=apache_cloudstack) [![codecov](https://codecov.io/gh/apache/cloudstack/branch/main/graph/badge.svg)](https://codecov.io/gh/apache/cloudstack)
1+
# Apache CloudStack
2+
3+
[![Build Status](https://github.com/apache/cloudstack/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/apache/cloudstack/actions/workflows/build.yml)
4+
[![codecov](https://codecov.io/gh/apache/cloudstack/branch/main/graph/badge.svg)](https://codecov.io/gh/apache/cloudstack)
5+
[![Docker CloudStack Simulator Status](https://github.com/apache/cloudstack/actions/workflows/docker-cloudstack-simulator.yml/badge.svg?branch=main)](https://github.com/apache/cloudstack/actions/workflows/docker-cloudstack-simulator.yml)
6+
[![License Check](https://github.com/apache/cloudstack/actions/workflows/rat.yml/badge.svg?branch=main)](https://github.com/apache/cloudstack/actions/workflows/rat.yml)
7+
[![Linter Status](https://github.com/apache/cloudstack/actions/workflows/linter.yml/badge.svg)](https://github.com/apache/cloudstack/actions/workflows/linter.yml)
8+
[![Merge Conflict Checker Status](https://github.com/apache/cloudstack/actions/workflows/merge-conflict-checker.yml/badge.svg?branch=main)](https://github.com/apache/cloudstack/actions/workflows/merge-conflict-checker.yml)
9+
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=apache_cloudstack&metric=alert_status)](https://sonarcloud.io/dashboard?id=apache_cloudstack)
10+
[![Simulator CI](https://github.com/apache/cloudstack/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/apache/cloudstack/actions/workflows/ci.yml)
11+
[![UI Build](https://github.com/apache/cloudstack/actions/workflows/ui.yml/badge.svg?branch=main)](https://github.com/apache/cloudstack/actions/workflows/ui.yml)
212

313
[![Apache CloudStack](tools/logo/apache_cloudstack.png)](https://cloudstack.apache.org/)
414

agent/bindir/cloud-setup-agent.in

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,62 +35,70 @@ for pythonpath in (
3535

3636
from cloudutils.cloudException import CloudRuntimeException, CloudInternalException
3737
from cloudutils.utilities import initLoging, bash
38-
from cloudutils.configFileOps import configFileOps
38+
from cloudutils.configFileOps import configFileOps
3939
from cloudutils.globalEnv import globalEnv
4040
from cloudutils.networkConfig import networkConfig
4141
from cloudutils.syscfg import sysConfigFactory
4242
from cloudutils.serviceConfig import configureLibvirtConfig, configure_libvirt_tls
4343

4444
from optparse import OptionParser
4545

46+
4647
def getUserInputs():
4748
print("Welcome to the CloudStack Agent Setup:")
4849

4950
cfo = configFileOps("@AGENTSYSCONFDIR@/agent.properties")
5051
oldMgt = cfo.getEntry("host")
5152

52-
mgtSvr = input("Please input the Management Server Hostname/IP-Address:[%s]"%oldMgt)
53+
mgtSvr = input(
54+
"Please input the Management Server Hostname/IP-Address:[%s]" % oldMgt
55+
)
5356
if mgtSvr == "":
5457
mgtSvr = oldMgt
5558
try:
5659
socket.getaddrinfo(mgtSvr, 443)
5760
except:
58-
print("Failed to resolve %s. Please input a valid hostname or IP-Address."%mgtSvr)
61+
print(
62+
"Failed to resolve %s. Please input a valid hostname or IP-Address."
63+
% mgtSvr
64+
)
5965
exit(1)
6066

6167
oldToken = cfo.getEntry("zone")
62-
zoneToken = input("Please input the Zone Id:[%s]"%oldToken)
68+
zoneToken = input("Please input the Zone Id:[%s]" % oldToken)
6369

6470
if zoneToken == "":
6571
zoneToken = oldToken
6672

6773
oldPod = cfo.getEntry("pod")
68-
podId = input("Please input the Pod Id:[%s]"%oldPod)
74+
podId = input("Please input the Pod Id:[%s]" % oldPod)
6975

7076
if podId == "":
71-
podId = oldToken
77+
podId = oldToken
7278

7379
oldCluster = cfo.getEntry("cluster")
74-
clusterId = input("Please input the Cluster Id:[%s]"%oldCluster)
80+
clusterId = input("Please input the Cluster Id:[%s]" % oldCluster)
7581
if clusterId == "":
7682
clusterId = oldCluster
7783

7884
oldHypervisor = cfo.getEntry("hypervisor")
7985
if oldHypervisor == "":
8086
oldHypervisor = "kvm"
8187

82-
hypervisor = input("Please input the Hypervisor type kvm/lxc:[%s]"%oldHypervisor)
88+
hypervisor = input("Please input the Hypervisor type kvm/lxc:[%s]" % oldHypervisor)
8389
if hypervisor == "":
8490
hypervisor = oldHypervisor
8591

8692
try:
8793
defaultNic = networkConfig.getDefaultNetwork()
8894
except:
89-
print("Failed to get default route. Please configure your network to have a default route")
95+
print(
96+
"Failed to get default route. Please configure your network to have a default route"
97+
)
9098
exit(1)
9199

92100
defNic = defaultNic.name
93-
network = input("Please choose which network used to create VM:[%s]"%defNic)
101+
network = input("Please choose which network used to create VM:[%s]" % defNic)
94102
if network == "":
95103
if defNic == "":
96104
print("You need to specify one of Nic or bridge on your system")
@@ -100,21 +108,32 @@ def getUserInputs():
100108

101109
return [mgtSvr, zoneToken, network, podId, clusterId, hypervisor]
102110

103-
if __name__ == '__main__':
111+
112+
if __name__ == "__main__":
104113
initLoging("@AGENTLOGDIR@/setup.log")
105114
glbEnv = globalEnv()
106115

107116
glbEnv.mode = "Agent"
108117
glbEnv.agentMode = "Agent"
109118
parser = OptionParser()
110119
parser.add_option("-a", action="store_true", dest="auto", help="auto mode")
111-
parser.add_option("-m", "--host", dest="mgt", help="Management server hostname or IP-Address")
120+
parser.add_option(
121+
"-m", "--host", dest="mgt", help="Management server hostname or IP-Address"
122+
)
112123
parser.add_option("-z", "--zone", dest="zone", help="zone id")
113124
parser.add_option("-p", "--pod", dest="pod", help="pod id")
114125
parser.add_option("-c", "--cluster", dest="cluster", help="cluster id")
115-
parser.add_option("-t", "--hypervisor", default="kvm", dest="hypervisor", help="hypervisor type")
126+
parser.add_option(
127+
"-t", "--hypervisor", default="kvm", dest="hypervisor", help="hypervisor type"
128+
)
116129
parser.add_option("-g", "--guid", dest="guid", help="guid")
117-
parser.add_option("-s", action="store_true", default=False, dest="secure", help="Secure and enable TLS for libvirtd")
130+
parser.add_option(
131+
"-s",
132+
action="store_true",
133+
default=False,
134+
dest="secure",
135+
help="Secure and enable TLS for libvirtd",
136+
)
118137
parser.add_option("--pubNic", dest="pubNic", help="Public traffic interface")
119138
parser.add_option("--prvNic", dest="prvNic", help="Private traffic interface")
120139
parser.add_option("--guestNic", dest="guestNic", help="Guest traffic interface")
@@ -140,15 +159,15 @@ if __name__ == '__main__':
140159
glbEnv.pod = userInputs[3]
141160
glbEnv.cluster = userInputs[4]
142161
glbEnv.hypervisor = userInputs[5]
143-
#generate UUID
162+
# generate UUID
144163
glbEnv.uuid = old_config.getEntry("guid")
145164
if glbEnv.uuid == "":
146165
glbEnv.uuid = bash("uuidgen").getStdout()
147166
else:
148167
for para, value in list(options.__dict__.items()):
149168
if value is None:
150-
print("Missing operand:%s"%para)
151-
print("Try %s --help for more information"%sys.argv[0])
169+
print("Missing operand:%s" % para)
170+
print("Try %s --help for more information" % sys.argv[0])
152171
sys.exit(1)
153172

154173
glbEnv.uuid = options.guid
@@ -168,7 +187,7 @@ if __name__ == '__main__':
168187
try:
169188
syscfg.config()
170189
print("CloudStack Agent setup is done!")
171-
except (CloudRuntimeException,CloudInternalException) as e:
190+
except (CloudRuntimeException, CloudInternalException) as e:
172191
print(e)
173192
print("Try to restore your system:")
174193
try:

agent/conf/developer.properties.template

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
# to you under the Apache License, Version 2.0 (the
66
# "License"); you may not use this file except in compliance
77
# with the License. You may obtain a copy of the License at
8-
#
8+
#
99
# http://www.apache.org/licenses/LICENSE-2.0
10-
#
10+
#
1111
# Unless required by applicable law or agreed to in writing,
1212
# software distributed under the License is distributed on an
1313
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY

api/src/main/java/com/cloud/agent/api/to/LoadBalancerTO.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public LoadBalancerTO(String uuid, String srcIp, int srcPort, String protocol, S
7171
this.destinations = new DestinationTO[destinations.size()];
7272
this.stickinessPolicies = null;
7373
this.sslCert = null;
74-
this.lbProtocol = null;
74+
this.lbProtocol = protocol;
7575
int i = 0;
7676
for (LbDestination destination : destinations) {
7777
this.destinations[i++] = new DestinationTO(destination.getIpAddress(), destination.getDestinationPortStart(), destination.isRevoked(), false);
@@ -205,6 +205,10 @@ public LbSslCert getSslCert() {
205205
return this.sslCert;
206206
}
207207

208+
public void setLbSslCert(LbSslCert sslCert) {
209+
this.sslCert = sslCert;
210+
}
211+
208212
public String getSrcIpVlan() {
209213
return srcIpVlan;
210214
}

api/src/main/java/com/cloud/hypervisor/Hypervisor.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,22 @@
3131
import static com.cloud.hypervisor.Hypervisor.HypervisorType.Functionality.DirectDownloadTemplate;
3232
import static com.cloud.hypervisor.Hypervisor.HypervisorType.Functionality.RootDiskSizeOverride;
3333
import static com.cloud.hypervisor.Hypervisor.HypervisorType.Functionality.VmStorageMigration;
34+
import static com.cloud.hypervisor.Hypervisor.HypervisorType.Functionality.VmStorageMigrationWithSnapshots;
3435

3536
public class Hypervisor {
3637
public static class HypervisorType {
3738
public enum Functionality {
3839
DirectDownloadTemplate,
3940
RootDiskSizeOverride,
40-
VmStorageMigration
41+
VmStorageMigration,
42+
VmStorageMigrationWithSnapshots
4143
}
4244

4345
private static final Map<String, HypervisorType> hypervisorTypeMap = new LinkedHashMap<>();
4446
public static final HypervisorType None = new HypervisorType("None"); //for storage hosts
4547
public static final HypervisorType XenServer = new HypervisorType("XenServer", ImageFormat.VHD, EnumSet.of(RootDiskSizeOverride, VmStorageMigration));
4648
public static final HypervisorType KVM = new HypervisorType("KVM", ImageFormat.QCOW2, EnumSet.of(DirectDownloadTemplate, RootDiskSizeOverride, VmStorageMigration));
47-
public static final HypervisorType VMware = new HypervisorType("VMware", ImageFormat.OVA, EnumSet.of(RootDiskSizeOverride, VmStorageMigration));
49+
public static final HypervisorType VMware = new HypervisorType("VMware", ImageFormat.OVA, EnumSet.of(RootDiskSizeOverride, VmStorageMigration, VmStorageMigrationWithSnapshots));
4850
public static final HypervisorType Hyperv = new HypervisorType("Hyperv");
4951
public static final HypervisorType VirtualBox = new HypervisorType("VirtualBox");
5052
public static final HypervisorType Parralels = new HypervisorType("Parralels");

0 commit comments

Comments
 (0)