Skip to content

Commit 2b4c8c4

Browse files
authored
Merge branch 'apache:main' into main
2 parents 7c7b840 + c3a1c78 commit 2b4c8c4

File tree

527 files changed

+19657
-6560
lines changed

Some content is hidden

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

527 files changed

+19657
-6560
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ env:
6464
smoke/test_dynamicroles
6565
smoke/test_global_settings
6666
smoke/test_guest_vlan_range
67-
smoke/test_host_annotations
67+
smoke/test_annotations
6868
smoke/test_host_maintenance
6969
smoke/test_hostha_simulator"
7070

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,5 +143,5 @@ The following provides more details on the included cryptographic software:
143143
* CloudStack makes use of JaSypt cryptographic libraries.
144144
* CloudStack has a system requirement of MySQL, and uses native database encryption functionality.
145145
* CloudStack makes use of the Bouncy Castle general-purpose encryption library.
146-
* CloudStack can optionally interacts with and controls OpenSwan-based VPNs.
146+
* CloudStack can optionally interact with and control OpenSwan-based VPNs.
147147
* CloudStack has a dependency on and makes use of JSch - a java SSH2 implementation.

agent/conf/agent.properties

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,12 @@ domr.scripts.dir=scripts/network/domr/kvm
9797
# migration will finish quickly. Less than 1 means disabled.
9898
#vm.migrate.pauseafter=0
9999

100+
# Time (in seconds) to wait for VM migrate finish. Less than 1 means disabled.
101+
# If vm migration is not finished in the time, the vm job will be cancelled by libvirt.
102+
# It will be configured by cloudstack management server when cloudstack agent connects.
103+
# please change the global setting 'migratewait' if needed (default value: 3600)
104+
#vm.migrate.wait=0
105+
100106
# Agent hooks is the way to override default agent behavior to extend the functionality without excessive coding
101107
# for a custom deployment. The first hook promoted is libvirt-vm-xml-transformer which allows provider to modify
102108
# VM XML specification before send to libvirt. Hooks are implemented in Groovy and must be implemented in the way

api/src/main/java/com/cloud/agent/api/storage/OVFHelper.java

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,20 @@ private String getChildNodeValue(Node node, String childNodeName) {
115115
return null;
116116
}
117117

118+
/**
119+
* Check if there are elements matching the tag name, otherwise check prepending the prefix
120+
*/
121+
public NodeList getElementsByTagNameAndPrefix(Document doc, String name, String prefix) {
122+
if (doc == null) {
123+
return null;
124+
}
125+
NodeList elementsByTagName = doc.getElementsByTagName(name);
126+
if (elementsByTagName.getLength() > 0) {
127+
return elementsByTagName;
128+
}
129+
return doc.getElementsByTagName(String.format("%s:%s", prefix, name));
130+
}
131+
118132
/**
119133
* Check if the attribute is present on the element, otherwise check preprending ':'
120134
*/
@@ -179,7 +193,7 @@ public List<OVFPropertyTO> getConfigurableOVFPropertiesFromDocument(Document doc
179193
return props;
180194
}
181195
int propertyIndex = 0;
182-
NodeList productSections = doc.getElementsByTagName("ProductSection");
196+
NodeList productSections = getElementsByTagNameAndPrefix(doc, "ProductSection", "ovf");
183197
if (productSections != null) {
184198
String lastCategoryFound = null;
185199
for (int i = 0; i < productSections.getLength(); i++) {
@@ -193,10 +207,12 @@ public List<OVFPropertyTO> getConfigurableOVFPropertiesFromDocument(Document doc
193207
if (child == null) {
194208
continue;
195209
}
196-
if (child.getNodeName().equalsIgnoreCase("Category")) {
210+
if (child.getNodeName().equalsIgnoreCase("Category") ||
211+
child.getNodeName().equalsIgnoreCase("ovf:Category")) {
197212
lastCategoryFound = child.getTextContent();
198213
s_logger.info("Category found " + lastCategoryFound);
199-
} else if (child.getNodeName().equalsIgnoreCase("Property")) {
214+
} else if (child.getNodeName().equalsIgnoreCase("Property") ||
215+
child.getNodeName().equalsIgnoreCase("ovf:Property")) {
200216
OVFPropertyTO prop = createOVFPropertyFromNode(child, propertyIndex, lastCategoryFound);
201217
if (prop != null && prop.isUserConfigurable()) {
202218
props.add(prop);
@@ -398,7 +414,7 @@ protected List<OVFDisk> extractDisksFromOvfDocumentTree(Document doc) {
398414
}
399415

400416
protected List<OVFFile> extractFilesFromOvfDocumentTree(File ovfFile, Document doc) {
401-
NodeList files = doc.getElementsByTagName("File");
417+
NodeList files = getElementsByTagNameAndPrefix(doc, "File", "ovf");
402418
ArrayList<OVFFile> vf = new ArrayList<>();
403419
boolean toggle = true;
404420
for (int j = 0; j < files.getLength(); j++) {
@@ -514,9 +530,9 @@ private OVFDiskController getController(Element controllerItem) {
514530
public void rewriteOVFFileForSingleDisk(final String origOvfFilePath, final String newOvfFilePath, final String diskName) {
515531
final Document doc = getDocumentFromFile(origOvfFilePath);
516532

517-
NodeList disks = doc.getElementsByTagName("Disk");
518-
NodeList files = doc.getElementsByTagName("File");
519-
NodeList items = doc.getElementsByTagName("Item");
533+
NodeList disks = getElementsByTagNameAndPrefix(doc, "Disk", "ovf");
534+
NodeList files = getElementsByTagNameAndPrefix(doc, "File", "ovf");
535+
NodeList items = getElementsByTagNameAndPrefix(doc, "Item", "ovf");
520536
String keepfile = null;
521537
List<Element> toremove = new ArrayList<>();
522538
for (int j = 0; j < files.getLength(); j++) {
@@ -677,7 +693,7 @@ private void fillNicPrerequisites(OVFNetworkTO nic, Node parentNode) {
677693

678694
private void checkForOnlyOneSystemNode(Document doc) throws InternalErrorException {
679695
// get hardware VirtualSystem, for now we support only one of those
680-
NodeList systemElements = doc.getElementsByTagName("VirtualSystem");
696+
NodeList systemElements = getElementsByTagNameAndPrefix(doc, "VirtualSystem", "ovf");
681697
if (systemElements.getLength() != 1) {
682698
String msg = "found " + systemElements.getLength() + " system definitions in OVA, can only handle exactly one.";
683699
s_logger.warn(msg);
@@ -686,7 +702,7 @@ private void checkForOnlyOneSystemNode(Document doc) throws InternalErrorExcepti
686702
}
687703

688704
private Map<String, OVFNetworkTO> getNetworksFromDocumentTree(Document doc) {
689-
NodeList networkElements = doc.getElementsByTagName("Network");
705+
NodeList networkElements = getElementsByTagNameAndPrefix(doc,"Network", "ovf");
690706
Map<String, OVFNetworkTO> nets = new HashMap<>();
691707
for (int i = 0; i < networkElements.getLength(); i++) {
692708

@@ -746,7 +762,7 @@ && hardwareItemContainsConfiguration(x, configuration.getId()))
746762
private String getMinimumHardwareVersionFromDocumentTree(Document doc) {
747763
String version = null;
748764
if (doc != null) {
749-
NodeList systemNodeList = doc.getElementsByTagName("System");
765+
NodeList systemNodeList = getElementsByTagNameAndPrefix(doc, "System", "ovf");
750766
if (systemNodeList.getLength() != 0) {
751767
Node systemItem = systemNodeList.item(0);
752768
String hardwareVersions = getChildNodeValue(systemItem, "VirtualSystemType");
@@ -766,7 +782,7 @@ private List<OVFConfigurationTO> getDeploymentOptionsFromDocumentTree(Document d
766782
if (doc == null) {
767783
return options;
768784
}
769-
NodeList deploymentOptionSection = doc.getElementsByTagName("DeploymentOptionSection");
785+
NodeList deploymentOptionSection = getElementsByTagNameAndPrefix(doc,"DeploymentOptionSection", "ovf");
770786
if (deploymentOptionSection.getLength() == 0) {
771787
return options;
772788
}
@@ -775,7 +791,7 @@ private List<OVFConfigurationTO> getDeploymentOptionsFromDocumentTree(Document d
775791
int index = 0;
776792
for (int i = 0; i < childNodes.getLength(); i++) {
777793
Node node = childNodes.item(i);
778-
if (node != null && node.getNodeName().equals("Configuration")) {
794+
if (node != null && (node.getNodeName().equals("Configuration") || node.getNodeName().equals("ovf:Configuration"))) {
779795
Element configuration = (Element) node;
780796
String configurationId = getNodeAttribute(configuration,"ovf","id");
781797
String description = getChildNodeValue(configuration, "Description");
@@ -793,15 +809,15 @@ private List<OVFVirtualHardwareItemTO> getVirtualHardwareItemsFromDocumentTree(D
793809
if (doc == null) {
794810
return items;
795811
}
796-
NodeList hardwareSection = doc.getElementsByTagName("VirtualHardwareSection");
812+
NodeList hardwareSection = getElementsByTagNameAndPrefix(doc, "VirtualHardwareSection","ovf");
797813
if (hardwareSection.getLength() == 0) {
798814
return items;
799815
}
800816
Node hardwareSectionNode = hardwareSection.item(0);
801817
NodeList childNodes = hardwareSectionNode.getChildNodes();
802818
for (int i = 0; i < childNodes.getLength(); i++) {
803819
Node node = childNodes.item(i);
804-
if (node != null && node.getNodeName().equals("Item")) {
820+
if (node != null && (node.getNodeName().equals("Item") || node.getNodeName().equals("ovf:Item"))) {
805821
Element configuration = (Element) node;
806822
String configurationIds = getNodeAttribute(configuration, "ovf", "configuration");
807823
String allocationUnits = getChildNodeValue(configuration, "AllocationUnits");
@@ -869,7 +885,7 @@ public List<OVFEulaSectionTO> getEulaSectionsFromDocument(Document doc) {
869885
if (doc == null) {
870886
return eulas;
871887
}
872-
NodeList eulaSections = doc.getElementsByTagName("EulaSection");
888+
NodeList eulaSections = getElementsByTagNameAndPrefix(doc, "EulaSection", "ovf");
873889
int eulaIndex = 0;
874890
if (eulaSections.getLength() > 0) {
875891
for (int index = 0; index < eulaSections.getLength(); index++) {
@@ -905,7 +921,7 @@ public Pair<String, String> getOperatingSystemInfoFromDocument(Document doc) {
905921
if (doc == null) {
906922
return null;
907923
}
908-
NodeList guesOsList = doc.getElementsByTagName("OperatingSystemSection");
924+
NodeList guesOsList = getElementsByTagNameAndPrefix(doc, "OperatingSystemSection", "ovf");
909925
if (guesOsList.getLength() == 0) {
910926
return null;
911927
}

api/src/main/java/com/cloud/configuration/ConfigurationService.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.apache.cloudstack.api.command.admin.network.DeleteManagementNetworkIpRangeCmd;
2525
import org.apache.cloudstack.api.command.admin.network.DeleteNetworkOfferingCmd;
2626
import org.apache.cloudstack.api.command.admin.network.UpdateNetworkOfferingCmd;
27+
import org.apache.cloudstack.api.command.admin.network.UpdatePodManagementNetworkIpRangeCmd;
2728
import org.apache.cloudstack.api.command.admin.offering.CreateDiskOfferingCmd;
2829
import org.apache.cloudstack.api.command.admin.offering.CreateServiceOfferingCmd;
2930
import org.apache.cloudstack.api.command.admin.offering.DeleteDiskOfferingCmd;
@@ -39,6 +40,7 @@
3940
import org.apache.cloudstack.api.command.admin.vlan.DedicatePublicIpRangeCmd;
4041
import org.apache.cloudstack.api.command.admin.vlan.DeleteVlanIpRangeCmd;
4142
import org.apache.cloudstack.api.command.admin.vlan.ReleasePublicIpRangeCmd;
43+
import org.apache.cloudstack.api.command.admin.vlan.UpdateVlanIpRangeCmd;
4244
import org.apache.cloudstack.api.command.admin.zone.CreateZoneCmd;
4345
import org.apache.cloudstack.api.command.admin.zone.DeleteZoneCmd;
4446
import org.apache.cloudstack.api.command.admin.zone.UpdateZoneCmd;
@@ -203,6 +205,14 @@ public interface ConfigurationService {
203205
*/
204206
void deletePodIpRange(DeleteManagementNetworkIpRangeCmd cmd) throws ResourceUnavailableException, ConcurrentOperationException;
205207

208+
/**
209+
* Updates a mutually exclusive IP range in the pod.
210+
* @param cmd - The command specifying pod ID, current Start IP, current End IP, new Start IP, new End IP.
211+
* @throws com.cloud.exception.ConcurrentOperationException
212+
* @return Success
213+
*/
214+
void updatePodIpRange(UpdatePodManagementNetworkIpRangeCmd cmd) throws ConcurrentOperationException;
215+
206216
/**
207217
* Edits a pod in the database. Will not allow you to edit pods that are being used anywhere in the system.
208218
*
@@ -272,6 +282,12 @@ public interface ConfigurationService {
272282
Vlan createVlanAndPublicIpRange(CreateVlanIpRangeCmd cmd) throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException,
273283
ResourceAllocationException;
274284

285+
/**
286+
* Updates the IP address Range for the VLAN on the database
287+
* @return The Updated Vlan Object
288+
*/
289+
Vlan updateVlanAndPublicIpRange(UpdateVlanIpRangeCmd cmd) throws ConcurrentOperationException,
290+
ResourceUnavailableException, ResourceAllocationException;
275291
/**
276292
* Marks the the account with the default zone-id.
277293
*

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,9 +324,11 @@ public class EventTypes {
324324
public static final String EVENT_VLAN_IP_RANGE_DELETE = "VLAN.IP.RANGE.DELETE";
325325
public static final String EVENT_VLAN_IP_RANGE_DEDICATE = "VLAN.IP.RANGE.DEDICATE";
326326
public static final String EVENT_VLAN_IP_RANGE_RELEASE = "VLAN.IP.RANGE.RELEASE";
327+
public static final String EVENT_VLAN_IP_RANGE_UPDATE = "VLAN.IP.RANGE.UPDATE";
327328

328329
public static final String EVENT_MANAGEMENT_IP_RANGE_CREATE = "MANAGEMENT.IP.RANGE.CREATE";
329330
public static final String EVENT_MANAGEMENT_IP_RANGE_DELETE = "MANAGEMENT.IP.RANGE.DELETE";
331+
public static final String EVENT_MANAGEMENT_IP_RANGE_UPDATE = "MANAGEMENT.IP.RANGE.UPDATE";
330332

331333
public static final String EVENT_STORAGE_IP_RANGE_CREATE = "STORAGE.IP.RANGE.CREATE";
332334
public static final String EVENT_STORAGE_IP_RANGE_DELETE = "STORAGE.IP.RANGE.DELETE";
@@ -493,6 +495,10 @@ public class EventTypes {
493495
public static final String EVENT_TAGS_CREATE = "CREATE_TAGS";
494496
public static final String EVENT_TAGS_DELETE = "DELETE_TAGS";
495497

498+
// resource icon related events
499+
public static final String EVENT_RESOURCE_ICON_UPLOAD = "UPLOAD.RESOURCE.ICON";
500+
public static final String EVENT_RESOURCE_ICON_DELETE = "DELETE.RESOURCE.ICON";
501+
496502
// meta data related events
497503
public static final String EVENT_RESOURCE_DETAILS_CREATE = "CREATE_RESOURCE_DETAILS";
498504
public static final String EVENT_RESOURCE_DETAILS_DELETE = "DELETE_RESOURCE_DETAILS";
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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.kubernetes.cluster;
18+
19+
import com.cloud.utils.component.Adapter;
20+
import org.apache.cloudstack.acl.ControlledEntity;
21+
22+
public interface KubernetesClusterHelper extends Adapter {
23+
24+
ControlledEntity findByUuid(String uuid);
25+
}

api/src/main/java/com/cloud/network/vpc/StaticRouteProfile.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,9 @@ public String getNetmask() {
106106
public Class<?> getEntityType() {
107107
return StaticRoute.class;
108108
}
109+
110+
@Override
111+
public String getName() {
112+
return null;
113+
}
109114
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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.server;
18+
19+
import org.apache.cloudstack.api.Identity;
20+
import org.apache.cloudstack.api.InternalIdentity;
21+
22+
public interface ResourceIcon extends Identity, InternalIdentity {
23+
long getResourceId();
24+
25+
void setResourceId(long resourceId);
26+
27+
ResourceTag.ResourceObjectType getResourceType();
28+
29+
String getResourceUuid();
30+
31+
String getIcon();
32+
}
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.server;
18+
19+
import java.util.List;
20+
21+
public interface ResourceIconManager {
22+
23+
boolean uploadResourceIcon(List<String> resourceIds, ResourceTag.ResourceObjectType resourceType, String base64Image);
24+
25+
boolean deleteResourceIcon(List<String> resourceIds, ResourceTag.ResourceObjectType resourceType);
26+
27+
ResourceIcon getByResourceTypeAndUuid(ResourceTag.ResourceObjectType type, String resourceId);
28+
}

0 commit comments

Comments
 (0)