You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2018/09/12 21:05:34 UTC
[GitHub] nathanejohnson closed pull request #2841: Bug/fix cpu and memory
counts
nathanejohnson closed pull request #2841: Bug/fix cpu and memory counts
URL: https://github.com/apache/cloudstack/pull/2841
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/add_burst_disk_offering_fields.sql b/add_burst_disk_offering_fields.sql
new file mode 100644
index 00000000000..ee14c72a794
--- /dev/null
+++ b/add_burst_disk_offering_fields.sql
@@ -0,0 +1,53 @@
+alter table disk_offering add bytes_read_rate_max bigint(20) default null after bytes_read_rate;
+alter table disk_offering add bytes_read_rate_max_length bigint(20) default null after bytes_read_rate_max;
+alter table disk_offering add bytes_write_rate_max bigint(20) default null after bytes_write_rate;
+alter table disk_offering add bytes_write_rate_max_length bigint(20) default null after bytes_write_rate_max;
+alter table disk_offering add iops_read_rate_max bigint(20) default null after iops_read_rate;
+alter table disk_offering add iops_read_rate_max_length bigint(20) default null after iops_read_rate_max;
+alter table disk_offering add iops_write_rate_max bigint(20) default null after iops_write_rate;
+alter table disk_offering add iops_write_rate_max_length bigint(20) default null after iops_write_rate_max;
+
+
+ALTER VIEW `disk_offering_view` AS
+ SELECT
+ `disk_offering`.`id` AS `id`,
+ `disk_offering`.`uuid` AS `uuid`,
+ `disk_offering`.`name` AS `name`,
+ `disk_offering`.`display_text` AS `display_text`,
+ `disk_offering`.`provisioning_type` AS `provisioning_type`,
+ `disk_offering`.`disk_size` AS `disk_size`,
+ `disk_offering`.`min_iops` AS `min_iops`,
+ `disk_offering`.`max_iops` AS `max_iops`,
+ `disk_offering`.`created` AS `created`,
+ `disk_offering`.`tags` AS `tags`,
+ `disk_offering`.`customized` AS `customized`,
+ `disk_offering`.`customized_iops` AS `customized_iops`,
+ `disk_offering`.`removed` AS `removed`,
+ `disk_offering`.`use_local_storage` AS `use_local_storage`,
+ `disk_offering`.`system_use` AS `system_use`,
+ `disk_offering`.`hv_ss_reserve` AS `hv_ss_reserve`,
+ `disk_offering`.`bytes_read_rate` AS `bytes_read_rate`,
+ `disk_offering`.`bytes_read_rate_max` AS `bytes_read_rate_max`,
+ `disk_offering`.`bytes_read_rate_max_length` AS `bytes_read_rate_max_length`,
+ `disk_offering`.`bytes_write_rate` AS `bytes_write_rate`,
+ `disk_offering`.`bytes_write_rate_max` AS `bytes_write_rate_max`,
+ `disk_offering`.`bytes_write_rate_max_length` AS `bytes_write_rate_max_length`,
+ `disk_offering`.`iops_read_rate` AS `iops_read_rate`,
+ `disk_offering`.`iops_read_rate_max` AS `iops_read_rate_max`,
+ `disk_offering`.`iops_read_rate_max_length` AS `iops_read_rate_max_length`,
+ `disk_offering`.`iops_write_rate` AS `iops_write_rate`,
+ `disk_offering`.`iops_write_rate_max` AS `iops_write_rate_max`,
+ `disk_offering`.`iops_write_rate_max_length` AS `iops_write_rate_max_length`,
+ `disk_offering`.`cache_mode` AS `cache_mode`,
+ `disk_offering`.`sort_key` AS `sort_key`,
+ `disk_offering`.`type` AS `type`,
+ `disk_offering`.`display_offering` AS `display_offering`,
+ `domain`.`id` AS `domain_id`,
+ `domain`.`uuid` AS `domain_uuid`,
+ `domain`.`name` AS `domain_name`,
+ `domain`.`path` AS `domain_path`
+ FROM
+ (`disk_offering`
+ LEFT JOIN `domain` ON ((`disk_offering`.`domain_id` = `domain`.`id`)))
+ WHERE
+ (`disk_offering`.`state` = 'ACTIVE');
diff --git a/agent/pom.xml b/agent/pom.xml
index 96bfd4d9a5c..1b9f2776a7b 100644
--- a/agent/pom.xml
+++ b/agent/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
</parent>
<dependencies>
<dependency>
diff --git a/api/pom.xml b/api/pom.xml
index 160629c2193..54926870ffd 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
</parent>
<dependencies>
<dependency>
diff --git a/api/src/com/cloud/network/Network.java b/api/src/com/cloud/network/Network.java
index 7cc5441603a..2e14f63cb3d 100644
--- a/api/src/com/cloud/network/Network.java
+++ b/api/src/com/cloud/network/Network.java
@@ -41,6 +41,8 @@
Shared, Isolated
}
+ public String updatingInSequence ="updatingInSequence";
+
public static class Service {
private static List<Service> supportedServices = new ArrayList<Service>();
@@ -272,12 +274,26 @@ private State(String description) {
public class IpAddresses {
private String ip4Address;
private String ip6Address;
+ private String macAddress;
+
+ public String getMacAddress() {
+ return macAddress;
+ }
+
+ public void setMacAddress(String macAddress) {
+ this.macAddress = macAddress;
+ }
public IpAddresses(String ip4Address, String ip6Address) {
setIp4Address(ip4Address);
setIp6Address(ip6Address);
}
+ public IpAddresses(String ipAddress, String ip6Address, String macAddress) {
+ this(ipAddress, ip6Address);
+ setMacAddress(macAddress);
+ }
+
public String getIp4Address() {
return ip4Address;
}
diff --git a/api/src/com/cloud/network/NetworkModel.java b/api/src/com/cloud/network/NetworkModel.java
index 780f97d22f4..cada36eaaa3 100644
--- a/api/src/com/cloud/network/NetworkModel.java
+++ b/api/src/com/cloud/network/NetworkModel.java
@@ -27,6 +27,7 @@
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.network.Network.Capability;
+import com.cloud.network.Network.IpAddresses;
import com.cloud.network.Network.Provider;
import com.cloud.network.Network.Service;
import com.cloud.network.Networks.TrafficType;
@@ -254,7 +255,7 @@
void checkIp6Parameters(String startIPv6, String endIPv6, String ip6Gateway, String ip6Cidr) throws InvalidParameterValueException;
- void checkRequestedIpAddresses(long networkId, String ip4, String ip6) throws InvalidParameterValueException;
+ void checkRequestedIpAddresses(long networkId, IpAddresses ips) throws InvalidParameterValueException;
String getStartIpv6Address(long id);
diff --git a/api/src/com/cloud/network/NetworkService.java b/api/src/com/cloud/network/NetworkService.java
index c1b68eb3a46..7a8a9498780 100644
--- a/api/src/com/cloud/network/NetworkService.java
+++ b/api/src/com/cloud/network/NetworkService.java
@@ -77,7 +77,7 @@ IpAddress allocatePortableIP(Account ipOwner, int regionId, Long zoneId, Long ne
IpAddress getIp(long id);
Network updateGuestNetwork(long networkId, String name, String displayText, Account callerAccount, User callerUser, String domainSuffix, Long networkOfferingId,
- Boolean changeCidr, String guestVmCidr, Boolean displayNetwork, String newUUID);
+ Boolean changeCidr, String guestVmCidr, Boolean displayNetwork, String newUUID, boolean updateInSequence, boolean forced);
PhysicalNetwork createPhysicalNetwork(Long zoneId, String vnetRange, String networkSpeed, List<String> isolationMethods, String broadcastDomainRange, Long domainId,
List<String> tags, String name);
diff --git a/api/src/com/cloud/network/element/RedundantResource.java b/api/src/com/cloud/network/element/RedundantResource.java
new file mode 100644
index 00000000000..39b6b97d73a
--- /dev/null
+++ b/api/src/com/cloud/network/element/RedundantResource.java
@@ -0,0 +1,27 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.network.element;
+
+import com.cloud.network.Network;
+
+/**
+ * Created by bharat on 11/08/15.
+ */
+public interface RedundantResource {
+ public void configureResource(Network network);
+ public int getResourceCount(Network network);
+}
diff --git a/api/src/com/cloud/network/router/VirtualRouter.java b/api/src/com/cloud/network/router/VirtualRouter.java
index 0114a962146..060ef0fa141 100644
--- a/api/src/com/cloud/network/router/VirtualRouter.java
+++ b/api/src/com/cloud/network/router/VirtualRouter.java
@@ -26,6 +26,10 @@
VIRTUAL_ROUTER, LB, INTERNAL_LB_VM
}
+ public enum UpdateState {
+ UPDATE_NEEDED, UPDATE_IN_PROGRESS, UPDATE_COMPLETE, UPDATE_FAILED
+ }
+
Role getRole();
boolean getIsRedundantRouter();
diff --git a/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java b/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java
index decf8c43733..d089b852449 100644
--- a/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java
+++ b/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java
@@ -33,7 +33,7 @@
RemoteAccessVpn createRemoteAccessVpn(long vpnServerAddressId, String ipRange, boolean openFirewall, Boolean forDisplay) throws NetworkRuleConflictException;
- boolean destroyRemoteAccessVpnForIp(long ipId, Account caller) throws ResourceUnavailableException;
+ boolean destroyRemoteAccessVpnForIp(long ipId, Account caller, boolean forceCleanup) throws ResourceUnavailableException;
RemoteAccessVpn startRemoteAccessVpn(long vpnServerAddressId, boolean openFirewall) throws ResourceUnavailableException;
diff --git a/api/src/com/cloud/offering/DiskOffering.java b/api/src/com/cloud/offering/DiskOffering.java
index c2069c25359..cffbdafdefb 100644
--- a/api/src/com/cloud/offering/DiskOffering.java
+++ b/api/src/com/cloud/offering/DiskOffering.java
@@ -99,18 +99,53 @@ public String toString() {
Long getBytesReadRate();
+ void setBytesReadRateMax(Long bytesReadRateMax);
+
+ Long getBytesReadRateMax();
+
+ void setBytesReadRateMaxLength(Long bytesReadRateMaxLength);
+
+ Long getBytesReadRateMaxLength();
+
+
void setBytesWriteRate(Long bytesWriteRate);
Long getBytesWriteRate();
+ void setBytesWriteRateMax(Long bytesWriteMax);
+
+ Long getBytesWriteRateMax();
+
+ void setBytesWriteRateMaxLength(Long bytesWriteMaxLength);
+
+ Long getBytesWriteRateMaxLength();
+
+
void setIopsReadRate(Long iopsReadRate);
Long getIopsReadRate();
+ void setIopsReadRateMax(Long iopsReadRateMax);
+
+ Long getIopsReadRateMax();
+
+ void setIopsReadRateMaxLength(Long iopsReadRateMaxLength);
+
+ Long getIopsReadRateMaxLength();
+
void setIopsWriteRate(Long iopsWriteRate);
Long getIopsWriteRate();
+ void setIopsWriteRateMax(Long iopsWriteRateMax);
+
+ Long getIopsWriteRateMax();
+
+
+ void setIopsWriteRateMaxLength(Long iopsWriteRateMaxLength);
+
+ Long getIopsWriteRateMaxLength();
+
void setHypervisorSnapshotReserve(Integer hypervisorSnapshotReserve);
Integer getHypervisorSnapshotReserve();
diff --git a/api/src/com/cloud/vm/NicProfile.java b/api/src/com/cloud/vm/NicProfile.java
index 58e05124c89..6ef9cfe5db1 100644
--- a/api/src/com/cloud/vm/NicProfile.java
+++ b/api/src/com/cloud/vm/NicProfile.java
@@ -114,6 +114,11 @@ public NicProfile(String requestedIPv4, String requestedIPv6) {
this.requestedIPv6 = requestedIPv6;
}
+ public NicProfile(String requestedIPv4, String requestedIPv6, String requestedMacAddress) {
+ this(requestedIPv4, requestedIPv6);
+ this.macAddress = requestedMacAddress;
+ }
+
public NicProfile(ReservationStrategy strategy, String iPv4Address, String macAddress, String iPv4gateway, String iPv4netmask) {
format = AddressFormat.Ip4;
this.iPv4Address = iPv4Address;
diff --git a/api/src/com/cloud/vm/VmDetailConstants.java b/api/src/com/cloud/vm/VmDetailConstants.java
index d34afc13a16..db9d37d1338 100644
--- a/api/src/com/cloud/vm/VmDetailConstants.java
+++ b/api/src/com/cloud/vm/VmDetailConstants.java
@@ -23,4 +23,5 @@
public static final String NESTED_VIRTUALIZATION_FLAG = "nestedVirtualizationFlag";
public static final String HYPERVISOR_TOOLS_VERSION = "hypervisortoolsversion";
public static final String DATA_DISK_CONTROLLER = "dataDiskController";
+ public static final String VIRTIO_SCSI_DRIVER_QUEUES = "virtioScsiDriverQueues";
}
diff --git a/api/src/org/apache/cloudstack/api/ApiConstants.java b/api/src/org/apache/cloudstack/api/ApiConstants.java
index ef4ff9a0fe9..75ed5811761 100644
--- a/api/src/org/apache/cloudstack/api/ApiConstants.java
+++ b/api/src/org/apache/cloudstack/api/ApiConstants.java
@@ -33,7 +33,11 @@
public static final String BIND_DN = "binddn";
public static final String BIND_PASSWORD = "bindpass";
public static final String BYTES_READ_RATE = "bytesreadrate";
+ public static final String BYTES_READ_RATE_MAX = "bytesreadratemax";
+ public static final String BYTES_READ_RATE_MAX_LENGTH = "bytesreadratemaxlength";
public static final String BYTES_WRITE_RATE = "byteswriterate";
+ public static final String BYTES_WRITE_RATE_MAX = "byteswriteratemax";
+ public static final String BYTES_WRITE_RATE_MAX_LENGTH = "byteswriteratemaxlength";
public static final String CATEGORY = "category";
public static final String CAN_REVERT = "canrevert";
public static final String CERTIFICATE = "certificate";
@@ -130,7 +134,11 @@
public static final String INTERNAL_DNS2 = "internaldns2";
public static final String INTERVAL_TYPE = "intervaltype";
public static final String IOPS_READ_RATE = "iopsreadrate";
+ public static final String IOPS_READ_RATE_MAX = "iopsreadratemax";
+ public static final String IOPS_READ_RATE_MAX_LENGTH = "iopsreadratemaxlength";
public static final String IOPS_WRITE_RATE = "iopswriterate";
+ public static final String IOPS_WRITE_RATE_MAX = "iopswriteratemax";
+ public static final String IOPS_WRITE_RATE_MAX_LENGTH = "iopswriteratemaxlength";
public static final String IP_ADDRESS = "ipaddress";
public static final String IP6_ADDRESS = "ip6address";
public static final String IP_ADDRESS_ID = "ipaddressid";
@@ -159,6 +167,7 @@
public static final String LUN = "lun";
public static final String LBID = "lbruleid";
public static final String MAX = "max";
+ public static final String MAC_ADDRESS = "macaddress";
public static final String MAX_SNAPS = "maxsnaps";
public static final String MEMORY = "memory";
public static final String MODE = "mode";
@@ -267,6 +276,7 @@
public static final String USERNAME = "username";
public static final String USER_SECURITY_GROUP_LIST = "usersecuritygrouplist";
public static final String USE_VIRTUAL_NETWORK = "usevirtualnetwork";
+ public static final String Update_IN_SEQUENCE ="updateinsequence";
public static final String VALUE = "value";
public static final String VIRTUAL_MACHINE_ID = "virtualmachineid";
public static final String VIRTUAL_MACHINE_IDS = "virtualmachineids";
@@ -636,6 +646,8 @@
public static final String ADMIN = "admin";
+ public static final String SHOWHIDDEN = "showhidden";
+
public enum HostDetails {
all, capacity, events, stats, min;
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java b/api/src/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java
index a34bc3eb622..bc5a0809f65 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java
@@ -76,6 +76,12 @@
description = "the ID of the Account to update the parameter value for corresponding account")
private Long accountId;
+ @Parameter(name = ApiConstants.SHOWHIDDEN,
+ type = CommandType.BOOLEAN,
+ description = "Whether to show hidden parameters")
+ private Boolean showHidden;
+
+
// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
@@ -104,6 +110,13 @@ public Long getAccountId() {
return accountId;
}
+ public Boolean getShowHidden() {
+ if(showHidden == null) {
+ showHidden = Boolean.FALSE;
+ }
+ return showHidden;
+ }
+
@Override
public Long getPageSizeVal() {
Long defaultPageSize = 500L;
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkCmdByAdmin.java b/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkCmdByAdmin.java
index 269f43ec959..388348c592c 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkCmdByAdmin.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkCmdByAdmin.java
@@ -49,7 +49,7 @@ public void execute() throws InsufficientCapacityException, ConcurrentOperationE
}
Network result = _networkService.updateGuestNetwork(getId(), getNetworkName(), getDisplayText(), callerAccount,
- callerUser, getNetworkDomain(), getNetworkOfferingId(), getChangeCidr(), getGuestVmCidr(), getDisplayNetwork(), getCustomId());
+ callerUser, getNetworkDomain(), getNetworkOfferingId(), getChangeCidr(), getGuestVmCidr(), getDisplayNetwork(), getCustomId(), getUpdateInSequence(),getForced());
if (result != null) {
diff --git a/api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java
index 747da053be6..469f714d028 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java
@@ -80,15 +80,41 @@
@Parameter(name = ApiConstants.BYTES_READ_RATE, type = CommandType.LONG, required = false, description = "bytes read rate of the disk offering")
private Long bytesReadRate;
+
+ @Parameter(name = ApiConstants.BYTES_READ_RATE_MAX, type = CommandType.LONG, required = false, description = "burst bytes read rate of the disk offering")
+ private Long bytesReadRateMax;
+
+ @Parameter(name = ApiConstants.BYTES_READ_RATE_MAX_LENGTH, type = CommandType.LONG, required = false, description = "length (in seconds) of the burst")
+ private Long bytesReadRateMaxLength;
+
@Parameter(name = ApiConstants.BYTES_WRITE_RATE, type = CommandType.LONG, required = false, description = "bytes write rate of the disk offering")
private Long bytesWriteRate;
+ @Parameter(name = ApiConstants.BYTES_WRITE_RATE_MAX, type = CommandType.LONG, required = false, description = "burst bytes write rate of the disk offering")
+ private Long bytesWriteRateMax;
+
+
+ @Parameter(name = ApiConstants.BYTES_WRITE_RATE_MAX_LENGTH, type = CommandType.LONG, required = false, description = "length (in seconds) of the burst")
+ private Long bytesWriteRateMaxLength;
+
@Parameter(name = ApiConstants.IOPS_READ_RATE, type = CommandType.LONG, required = false, description = "io requests read rate of the disk offering")
private Long iopsReadRate;
+ @Parameter(name = ApiConstants.IOPS_READ_RATE_MAX, type = CommandType.LONG, required = false, description = "burst requests read rate of the disk offering")
+ private Long iopsReadRateMax;
+
+ @Parameter(name = ApiConstants.IOPS_READ_RATE_MAX_LENGTH, type = CommandType.LONG, required = false, description = "length (in seconds) of the burst")
+ private Long iopsReadRateMaxLength;
+
@Parameter(name = ApiConstants.IOPS_WRITE_RATE, type = CommandType.LONG, required = false, description = "io requests write rate of the disk offering")
private Long iopsWriteRate;
+ @Parameter(name = ApiConstants.IOPS_WRITE_RATE_MAX, type = CommandType.LONG, required = false, description = "burst io requests write rate of the disk offering")
+ private Long iopsWriteRateMax;
+
+ @Parameter(name = ApiConstants.IOPS_WRITE_RATE_MAX_LENGTH, type = CommandType.LONG, required = false, description = "length (in seconds) of the burst")
+ private Long iopsWriteRateMaxLength;
+
@Parameter(name = ApiConstants.CUSTOMIZED_IOPS, type = CommandType.BOOLEAN, required = false, description = "whether disk offering iops is custom or not")
private Boolean customizedIops;
@@ -148,18 +174,50 @@ public Long getBytesReadRate() {
return bytesReadRate;
}
+ public Long getBytesReadRateMax() {
+ return bytesReadRateMax;
+ }
+
+ public Long getBytesReadRateMaxLength() {
+ return bytesReadRateMaxLength;
+ }
+
public Long getBytesWriteRate() {
return bytesWriteRate;
}
+ public Long getBytesWriteRateMax() {
+ return bytesWriteRateMax;
+ }
+
+ public Long getBytesWriteRateMaxLength() {
+ return bytesWriteRateMaxLength;
+ }
+
public Long getIopsReadRate() {
return iopsReadRate;
}
+ public Long getIopsReadRateMax() {
+ return iopsReadRateMax;
+ }
+
+ public Long getIopsReadRateMaxLength() {
+ return iopsReadRateMaxLength;
+ }
+
public Long getIopsWriteRate() {
return iopsWriteRate;
}
+ public Long getIopsWriteRateMax() {
+ return iopsWriteRateMax;
+ }
+
+ public Long getIopsWriteRateMaxLength() {
+ return iopsWriteRateMaxLength;
+ }
+
public String getStorageType() {
return storageType;
}
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmd.java
index 921e74b67b2..c313f369b0e 100644
--- a/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmd.java
@@ -75,11 +75,17 @@
@Parameter(name = ApiConstants.GUEST_VM_CIDR, type = CommandType.STRING, description = "CIDR for guest VMs, CloudStack allocates IPs to guest VMs only from this CIDR")
private String guestVmCidr;
+ @Parameter(name =ApiConstants.Update_IN_SEQUENCE, type=CommandType.BOOLEAN, description = "if true, we will update the routers one after the other. applicable only for redundant router based networks using virtual router as provider")
+ private Boolean updateInSequence;
+
@Parameter(name = ApiConstants.DISPLAY_NETWORK,
type = CommandType.BOOLEAN,
description = "an optional field, whether to the display the network to the end user or not.", authorized = {RoleType.Admin})
private Boolean displayNetwork;
+ @Parameter(name= ApiConstants.FORCED, type = CommandType.BOOLEAN, description = "Setting this to true will cause a forced network update,", authorized = {RoleType.Admin})
+ private Boolean forced;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -119,6 +125,19 @@ public Boolean getDisplayNetwork() {
return displayNetwork;
}
+ public Boolean getUpdateInSequence(){
+ if(updateInSequence ==null)
+ return false;
+ else
+ return updateInSequence;
+ }
+
+ public boolean getForced(){
+ if(forced==null){
+ return false;
+ }
+ return forced;
+ }
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@@ -149,7 +168,7 @@ public void execute() throws InsufficientCapacityException, ConcurrentOperationE
Network result =
_networkService.updateGuestNetwork(getId(), getNetworkName(), getDisplayText(), callerAccount, callerUser, getNetworkDomain(), getNetworkOfferingId(),
- getChangeCidr(), getGuestVmCidr(), getDisplayNetwork(), getCustomId());
+ getChangeCidr(), getGuestVmCidr(), getDisplayNetwork(), getCustomId(), getUpdateInSequence(), getForced());
if (result != null) {
NetworkResponse response = _responseGenerator.createNetworkResponse(ResponseView.Restricted, result);
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/AddNicToVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/AddNicToVMCmd.java
index f265ecf236a..ef03e78bea5 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vm/AddNicToVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/AddNicToVMCmd.java
@@ -36,8 +36,10 @@
import org.apache.cloudstack.context.CallContext;
import com.cloud.event.EventTypes;
+import com.cloud.exception.InvalidParameterValueException;
import com.cloud.user.Account;
import com.cloud.uservm.UserVm;
+import com.cloud.utils.net.NetUtils;
import com.cloud.vm.VirtualMachine;
@APICommand(name = "addNicToVirtualMachine", description = "Adds VM to specified network by creating a NIC", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = {VirtualMachine.class},
@@ -60,6 +62,9 @@
@Parameter(name = ApiConstants.IP_ADDRESS, type = CommandType.STRING, description = "IP Address for the new network")
private String ipaddr;
+ @Parameter(name = ApiConstants.MAC_ADDRESS, type = CommandType.STRING, description = "Mac Address for the new network")
+ private String macaddr;
+
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@@ -76,6 +81,18 @@ public String getIpAddress() {
return ipaddr;
}
+ public String getMacAddress() {
+ if (macaddr == null) {
+ return null;
+ }
+ if(!NetUtils.isValidMac(macaddr)) {
+ throw new InvalidParameterValueException("Mac address is not valid: " + macaddr);
+ } else if(!NetUtils.isUnicastMac(macaddr)) {
+ throw new InvalidParameterValueException("Mac address is not unicast: " + macaddr);
+ }
+ return NetUtils.standardizeMacAddress(macaddr);
+ }
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
index 7769ff8573b..67c33511be1 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
@@ -152,7 +152,7 @@
private List<String> securityGroupNameList;
@Parameter(name = ApiConstants.IP_NETWORK_LIST, type = CommandType.MAP, description = "ip to network mapping. Can't be specified with networkIds parameter."
- + " Example: iptonetworklist[0].ip=10.10.10.11&iptonetworklist[0].ipv6=fc00:1234:5678::abcd&iptonetworklist[0].networkid=uuid - requests to use ip 10.10.10.11 in network id=uuid")
+ + " Example: iptonetworklist[0].ip=10.10.10.11&iptonetworklist[0].ipv6=fc00:1234:5678::abcd&iptonetworklist[0].networkid=uuid&iptonetworklist[0].mac=aa:bb:cc:dd:ee::ff - requests to use ip 10.10.10.11 in network id=uuid")
private Map ipToNetworkList;
@Parameter(name = ApiConstants.IP_ADDRESS, type = CommandType.STRING, description = "the ip address for default vm's network")
@@ -161,6 +161,9 @@
@Parameter(name = ApiConstants.IP6_ADDRESS, type = CommandType.STRING, description = "the ipv6 address for default vm's network")
private String ip6Address;
+ @Parameter(name = ApiConstants.MAC_ADDRESS, type = CommandType.STRING, description = "the mac address for default vm's network")
+ private String macAddress;
+
@Parameter(name = ApiConstants.KEYBOARD, type = CommandType.STRING, description = "an optional keyboard device type for the virtual machine. valid value can be one of de,de-ch,es,fi,fr,fr-be,fr-ch,is,it,jp,nl-be,no,pt,uk,us")
private String keyboard;
@@ -352,10 +355,19 @@ public boolean getStartVm() {
}
String requestedIp = ips.get("ip");
String requestedIpv6 = ips.get("ipv6");
+ String requestedMac = ips.get("mac");
if (requestedIpv6 != null) {
requestedIpv6 = NetUtils.standardizeIp6Address(requestedIpv6);
}
- IpAddresses addrs = new IpAddresses(requestedIp, requestedIpv6);
+ if (requestedMac != null) {
+ if(!NetUtils.isValidMac(requestedMac)) {
+ throw new InvalidParameterValueException("Mac address is not valid: " + requestedMac);
+ } else if(!NetUtils.isUnicastMac(requestedMac)) {
+ throw new InvalidParameterValueException("Mac address is not unicast: " + requestedMac);
+ }
+ requestedMac = NetUtils.standardizeMacAddress(requestedMac);
+ }
+ IpAddresses addrs = new IpAddresses(requestedIp, requestedIpv6, requestedMac);
ipToNetworkMap.put(networkId, addrs);
}
}
@@ -370,6 +382,19 @@ public String getIp6Address() {
return NetUtils.standardizeIp6Address(ip6Address);
}
+
+ public String getMacAddress() {
+ if (macAddress == null) {
+ return null;
+ }
+ if(!NetUtils.isValidMac(macAddress)) {
+ throw new InvalidParameterValueException("Mac address is not valid: " + macAddress);
+ } else if(!NetUtils.isUnicastMac(macAddress)) {
+ throw new InvalidParameterValueException("Mac address is not unicast: " + macAddress);
+ }
+ return NetUtils.standardizeMacAddress(macAddress);
+ }
+
public List<Long> getAffinityGroupIdList() {
if (affinityGroupNameList != null && affinityGroupIdList != null) {
throw new InvalidParameterValueException("affinitygroupids parameter is mutually exclusive with affinitygroupnames parameter");
@@ -577,7 +602,7 @@ public void create() throws ResourceAllocationException {
}
UserVm vm = null;
- IpAddresses addrs = new IpAddresses(ipAddress, getIp6Address());
+ IpAddresses addrs = new IpAddresses(ipAddress, getIp6Address(), getMacAddress());
if (zone.getNetworkType() == NetworkType.Basic) {
if (getNetworkIds() != null) {
throw new InvalidParameterValueException("Can't specify network Ids in Basic zone");
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java
index e4c2f7d6338..661100b533e 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/ScaleVMCmd.java
@@ -16,6 +16,9 @@
// under the License.
package org.apache.cloudstack.api.command.user.vm;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -78,8 +81,22 @@ public Long getServiceOfferingId() {
return serviceOfferingId;
}
+ //instead of reading a map directly we are using collections.
+ //it is because details.values() cannot be cast to a map.
+ //it gives a exception
public Map<String, String> getDetails() {
- return details;
+ Map<String, String> customparameterMap = new HashMap<String, String>();
+ if (details != null && details.size() != 0) {
+ Collection parameterCollection = details.values();
+ Iterator iter = parameterCollection.iterator();
+ while (iter.hasNext()) {
+ HashMap<String, String> value = (HashMap<String, String>)iter.next();
+ for (String key : value.keySet()) {
+ customparameterMap.put(key, value.get(key));
+ }
+ }
+ }
+ return customparameterMap;
}
/////////////////////////////////////////////////////
@@ -142,4 +159,4 @@ public void execute() {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to scale vm");
}
}
-}
+}
\ No newline at end of file
diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/UpgradeVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/UpgradeVMCmd.java
index bc9c1c85962..b10555556bd 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vm/UpgradeVMCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vm/UpgradeVMCmd.java
@@ -16,6 +16,9 @@
// under the License.
package org.apache.cloudstack.api.command.user.vm;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
import java.util.Map;
import org.apache.log4j.Logger;
@@ -77,7 +80,18 @@ public Long getServiceOfferingId() {
}
public Map<String, String> getDetails() {
- return details;
+ Map<String, String> customparameterMap = new HashMap<String, String>();
+ if (details != null && details.size() != 0) {
+ Collection parameterCollection = details.values();
+ Iterator iter = parameterCollection.iterator();
+ while (iter.hasNext()) {
+ HashMap<String, String> value = (HashMap<String, String>)iter.next();
+ for (String key : value.keySet()) {
+ customparameterMap.put(key, value.get(key));
+ }
+ }
+ }
+ return customparameterMap;
}
/////////////////////////////////////////////////////
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteRemoteAccessVpnCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteRemoteAccessVpnCmd.java
index 37b7b5aaa3e..12ab531375f 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteRemoteAccessVpnCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteRemoteAccessVpnCmd.java
@@ -93,7 +93,7 @@ public String getEventType() {
@Override
public void execute() throws ResourceUnavailableException {
- if (! _ravService.destroyRemoteAccessVpnForIp(publicIpId, CallContext.current().getCallingAccount())) {
+ if (! _ravService.destroyRemoteAccessVpnForIp(publicIpId, CallContext.current().getCallingAccount(), false)) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete remote access vpn");
}
}
diff --git a/api/src/org/apache/cloudstack/api/response/DiskOfferingResponse.java b/api/src/org/apache/cloudstack/api/response/DiskOfferingResponse.java
index f579119483b..dfccd7ac93b 100644
--- a/api/src/org/apache/cloudstack/api/response/DiskOfferingResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/DiskOfferingResponse.java
@@ -92,18 +92,50 @@
@Param(description = "bytes read rate of the disk offering")
private Long bytesReadRate;
+ @SerializedName("diskBytesReadRateMax")
+ @Param(description = "burst bytes read rate of the disk offering")
+ private Long bytesReadRateMax;
+
+ @SerializedName("diskBytesReadRateMaxLength")
+ @Param(description = "length (in seconds) of the burst")
+ private Long bytesReadRateMaxLength;
+
@SerializedName("diskBytesWriteRate")
@Param(description = "bytes write rate of the disk offering")
private Long bytesWriteRate;
+ @SerializedName("diskBytesWriteRateMax")
+ @Param(description = "burst bytes write rate of the disk offering")
+ private Long bytesWriteRateMax;
+
+ @SerializedName("diskBytesWriteRateMaxLength")
+ @Param(description = "length (in seconds) of the burst")
+ private Long bytesWriteRateMaxLength;
+
@SerializedName("diskIopsReadRate")
@Param(description = "io requests read rate of the disk offering")
private Long iopsReadRate;
+ @SerializedName("diskIopsReadRateMax")
+ @Param(description = "burst io requests read rate of the disk offering")
+ private Long iopsReadRateMax;
+
+ @SerializedName("diskIopsReadRateMaxLength")
+ @Param(description = "length (in second) of the burst")
+ private Long iopsReadRateMaxLength;
+
@SerializedName("diskIopsWriteRate")
@Param(description = "io requests write rate of the disk offering")
private Long iopsWriteRate;
+ @SerializedName("diskIopsWriteRateMax")
+ @Param(description = "burst io requests write rate of the disk offering")
+ private Long iopsWriteRateMax;
+
+ @SerializedName("diskIopsWriteRateMaxLength")
+ @Param(description = "length (in seconds) of the burst")
+ private Long iopsWriteRateMaxLength;
+
@SerializedName("cacheMode")
@Param(description = "the cache mode to use for this disk offering. none, writeback or writethrough", since = "4.4")
private String cacheMode;
@@ -253,15 +285,31 @@ public void setBytesReadRate(Long bytesReadRate) {
this.bytesReadRate = bytesReadRate;
}
+ public void setBytesReadRateMax(Long bytesReadRateMax) { this.bytesReadRateMax = bytesReadRateMax; }
+
+ public void setBytesReadRateMaxLength(Long bytesReadRateMaxLength) { this.bytesReadRateMaxLength = bytesReadRateMaxLength; }
+
public void setBytesWriteRate(Long bytesWriteRate) {
this.bytesWriteRate = bytesWriteRate;
}
+ public void setBytesWriteRateMax(Long bytesWriteRateMax) { this.bytesWriteRateMax = bytesWriteRateMax; }
+
+ public void setBytesWriteRateMaxLength(Long bytesWriteRateMaxLength) { this.bytesWriteRateMaxLength = bytesWriteRateMaxLength; }
+
public void setIopsReadRate(Long iopsReadRate) {
this.iopsReadRate = iopsReadRate;
}
+ public void setIopsReadRateMax(Long iopsReadRateMax) { this.iopsReadRateMax = iopsReadRateMax; }
+
+ public void setIopsReadRateMaxLength(Long iopsReadRateMaxLength) { this.iopsReadRateMaxLength = iopsReadRateMaxLength; }
+
public void setIopsWriteRate(Long iopsWriteRate) {
this.iopsWriteRate = iopsWriteRate;
}
+
+ public void setIopsWriteRateMax(Long iopsWriteRateMax) { this.iopsWriteRateMax = iopsWriteRateMax; }
+
+ public void setIopsWriteRateMaxLength(Long iopsWriteRateMaxLength) { this.iopsWriteRateMaxLength = iopsWriteRateMaxLength; }
}
diff --git a/api/src/org/apache/cloudstack/api/response/TemplateResponse.java b/api/src/org/apache/cloudstack/api/response/TemplateResponse.java
index 3e21043e339..248b3f3c0cd 100644
--- a/api/src/org/apache/cloudstack/api/response/TemplateResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/TemplateResponse.java
@@ -179,6 +179,10 @@
@Param(description = "the list of resource tags associated with tempate", responseObject = ResourceTagResponse.class)
private Set<ResourceTagResponse> tags;
+ @SerializedName(ApiConstants.BITS)
+ @Param(description="the processor bit size", since = "4.10")
+ private int bits;
+
@SerializedName(ApiConstants.SSHKEY_ENABLED)
@Param(description = "true if template is sshkey enabled, false otherwise")
private Boolean sshKeyEnabled;
@@ -361,4 +365,9 @@ public void setDynamicallyScalable(boolean isDynamicallyScalable) {
public String getZoneId() {
return zoneId;
}
+ public void setBits(int bits) {
+ this.bits = bits;
+ }
+
+
}
diff --git a/client/pom.xml b/client/pom.xml
index d329c7f08a3..e74f7463d6f 100644
--- a/client/pom.xml
+++ b/client/pom.xml
@@ -17,7 +17,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
</parent>
<dependencies>
<dependency>
diff --git a/client/tomcatconf/catalina.properties.in b/client/tomcatconf/catalina.properties.in
index 282892bb763..e0baf61261d 100644
--- a/client/tomcatconf/catalina.properties.in
+++ b/client/tomcatconf/catalina.properties.in
@@ -44,7 +44,7 @@ package.definition=sun.,java.,org.apache.catalina.,org.apache.coyote.,org.apache
# "foo/*.jar": Add all the JARs of the specified folder as class
# repositories
# "foo/bar.jar": Add bar.jar as a class repository
-common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar,/usr/share/java/mysql-connector-java.jar,/usr/share/cloudstack-mysql-ha/lib/*jar
+common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar,/usr/share/java/mysql-connector-java.jar,/usr/share/cloudstack-mysql-ha/lib/*.jar
#
# List of comma-separated paths defining the contents of the "server"
diff --git a/core/pom.xml b/core/pom.xml
index 9c74333144e..2f58642671f 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -25,7 +25,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
</parent>
<dependencies>
<dependency>
diff --git a/core/src/com/cloud/agent/resource/virtualnetwork/VRScripts.java b/core/src/com/cloud/agent/resource/virtualnetwork/VRScripts.java
index a2515056be1..838f0877918 100644
--- a/core/src/com/cloud/agent/resource/virtualnetwork/VRScripts.java
+++ b/core/src/com/cloud/agent/resource/virtualnetwork/VRScripts.java
@@ -19,6 +19,8 @@
package com.cloud.agent.resource.virtualnetwork;
+import org.joda.time.Duration;
+
public class VRScripts {
public final static String CONFIG_PERSIST_LOCATION = "/var/cache/cloud/";
public final static String IP_ASSOCIATION_CONFIG = "ip_associations.json";
@@ -40,7 +42,8 @@
public static final String LOAD_BALANCER_CONFIG = "load_balancer.json";
public final static String CONFIG_CACHE_LOCATION = "/var/cache/cloud/";
- public final static int DEFAULT_EXECUTEINVR_TIMEOUT = 120; //Seconds
+ public final static Duration VR_SCRIPT_EXEC_TIMEOUT = Duration.standardMinutes(10);
+ public final static Duration CONNECTION_TIMEOUT = Duration.standardMinutes(1);
// New scripts for use with chef
public static final String UPDATE_CONFIG = "update_config.py";
diff --git a/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRouterDeployer.java b/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRouterDeployer.java
index f6a1694c558..6501292b82b 100644
--- a/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRouterDeployer.java
+++ b/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRouterDeployer.java
@@ -19,13 +19,14 @@
package com.cloud.agent.resource.virtualnetwork;
+import org.joda.time.Duration;
+
import com.cloud.agent.api.routing.NetworkElementCommand;
import com.cloud.utils.ExecutionResult;
public interface VirtualRouterDeployer {
ExecutionResult executeInVR(String routerIp, String script, String args);
- /* timeout in seconds */
- ExecutionResult executeInVR(String routerIp, String script, String args, int timeout);
+ ExecutionResult executeInVR(String routerIp, String script, String args, Duration timeout);
ExecutionResult createFileInVR(String routerIp, String path, String filename, String content);
ExecutionResult prepareCommand(NetworkElementCommand cmd);
ExecutionResult cleanupCommand(NetworkElementCommand cmd);
diff --git a/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java b/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java
index f3edc696759..87a38d3e39f 100644
--- a/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java
+++ b/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java
@@ -22,6 +22,7 @@
import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.channels.SocketChannel;
+import org.joda.time.Duration;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -73,7 +74,7 @@
private int _sleep;
private int _retry;
private int _port;
- private int _eachTimeout;
+ private Duration _eachTimeout;
private String _cfgVersion = "1.0";
@@ -153,10 +154,10 @@ private Answer executeQueryCommand(NetworkElementCommand cmd) {
}
private ExecutionResult applyConfigToVR(String routerAccessIp, ConfigItem c) {
- return applyConfigToVR(routerAccessIp, c, VRScripts.DEFAULT_EXECUTEINVR_TIMEOUT);
+ return applyConfigToVR(routerAccessIp, c, VRScripts.VR_SCRIPT_EXEC_TIMEOUT);
}
- private ExecutionResult applyConfigToVR(String routerAccessIp, ConfigItem c, int timeout) {
+ private ExecutionResult applyConfigToVR(String routerAccessIp, ConfigItem c, Duration timeout) {
if (c instanceof FileConfigItem) {
FileConfigItem configItem = (FileConfigItem)c;
return _vrDeployer.createFileInVR(routerAccessIp, configItem.getFilePath(), configItem.getFileName(), configItem.getFileContents());
@@ -271,7 +272,7 @@ public boolean configure(final String name, final Map<String, Object> params) th
_port = NumbersUtil.parseInt(value, 3922);
value = (String)params.get("router.aggregation.command.each.timeout");
- _eachTimeout = NumbersUtil.parseInt(value, 3);
+ _eachTimeout = Duration.standardSeconds(NumbersUtil.parseInt(value, 10));
if (_vrDeployer == null) {
throw new ConfigurationException("Unable to find the resource for VirtualRouterDeployer!");
@@ -374,9 +375,9 @@ private Answer execute(AggregationControlCommand cmd) {
FileConfigItem fileConfigItem = new FileConfigItem(VRScripts.CONFIG_CACHE_LOCATION, cfgFileName, sb.toString());
ScriptConfigItem scriptConfigItem = new ScriptConfigItem(VRScripts.VR_CFG, "-c " + VRScripts.CONFIG_CACHE_LOCATION + cfgFileName);
// 120s is the minimal timeout
- int timeout = answerCounts * _eachTimeout;
- if (timeout < 120) {
- timeout = 120;
+ Duration timeout = _eachTimeout.withDurationAdded(_eachTimeout.getStandardSeconds(), answerCounts);
+ if (timeout.isShorterThan(VRScripts.VR_SCRIPT_EXEC_TIMEOUT)) {
+ timeout = VRScripts.VR_SCRIPT_EXEC_TIMEOUT;
}
ExecutionResult result = applyConfigToVR(cmd.getRouterAccessIp(), fileConfigItem);
diff --git a/core/src/org/apache/cloudstack/storage/to/VolumeObjectTO.java b/core/src/org/apache/cloudstack/storage/to/VolumeObjectTO.java
index 509cc3a1be9..2d240c4ad40 100644
--- a/core/src/org/apache/cloudstack/storage/to/VolumeObjectTO.java
+++ b/core/src/org/apache/cloudstack/storage/to/VolumeObjectTO.java
@@ -46,9 +46,17 @@
private Long deviceId;
private Long bytesReadRate;
+ private Long bytesReadRateMax;
+ private Long bytesReadRateMaxLength;
private Long bytesWriteRate;
+ private Long bytesWriteRateMax;
+ private Long bytesWriteRateMaxLength;
private Long iopsReadRate;
+ private Long iopsReadRateMax;
+ private Long iopsReadRateMaxLength;
private Long iopsWriteRate;
+ private Long iopsWriteRateMax;
+ private Long iopsWriteRateMaxLength;
private DiskCacheMode cacheMode;
private Hypervisor.HypervisorType hypervisorType;
@@ -75,9 +83,17 @@ public VolumeObjectTO(VolumeInfo volume) {
format = volume.getFormat();
provisioningType = volume.getProvisioningType();
bytesReadRate = volume.getBytesReadRate();
+ bytesReadRateMax = volume.getBytesReadRateMax();
+ bytesReadRateMaxLength = volume.getBytesReadRateMaxLength();
bytesWriteRate = volume.getBytesWriteRate();
+ bytesWriteRateMax = volume.getBytesWriteRateMax();
+ bytesWriteRateMaxLength = volume.getBytesWriteRateMaxLength();
iopsReadRate = volume.getIopsReadRate();
+ iopsReadRateMax = volume.getIopsReadRateMax();
+ iopsReadRateMaxLength = volume.getIopsReadRateMaxLength();
iopsWriteRate = volume.getIopsWriteRate();
+ iopsWriteRateMax = volume.getIopsWriteRateMax();
+ iopsWriteRateMaxLength = volume.getIopsWriteRateMaxLength();
cacheMode = volume.getCacheMode();
hypervisorType = volume.getHypervisorType();
setDeviceId(volume.getDeviceId());
@@ -213,6 +229,14 @@ public Long getBytesReadRate() {
return bytesReadRate;
}
+ public Long getBytesReadRateMax() { return bytesReadRateMax; }
+
+ public void setBytesReadRateMax(Long bytesReadRateMax) { this.bytesReadRateMax = bytesReadRateMax; }
+
+ public Long getBytesReadRateMaxLength() { return bytesReadRateMaxLength; }
+
+ public void setBytesReadRateMaxLength(Long bytesReadRateMaxLength) { this.bytesReadRateMaxLength = bytesReadRateMaxLength; }
+
public void setBytesWriteRate(Long bytesWriteRate) {
this.bytesWriteRate = bytesWriteRate;
}
@@ -221,6 +245,14 @@ public Long getBytesWriteRate() {
return bytesWriteRate;
}
+ public Long getBytesWriteRateMax() { return bytesWriteRateMax; }
+
+ public void setBytesWriteRateMax(Long bytesWriteRateMax) { this.bytesWriteRateMax = bytesWriteRateMax; }
+
+ public Long getBytesWriteRateMaxLength() { return bytesWriteRateMaxLength; }
+
+ public void setBytesWriteRateMaxLength(Long bytesWriteRateMaxLength) { this.bytesWriteRateMaxLength = bytesWriteRateMaxLength; }
+
public void setIopsReadRate(Long iopsReadRate) {
this.iopsReadRate = iopsReadRate;
}
@@ -229,6 +261,14 @@ public Long getIopsReadRate() {
return iopsReadRate;
}
+ public Long getIopsReadRateMax() { return iopsReadRateMax; }
+
+ public void setIopsReadRateMax(Long iopsReadRateMax) { this.iopsReadRateMax = iopsReadRateMax; }
+
+ public Long getIopsReadRateMaxLength() { return iopsReadRateMaxLength; }
+
+ public void setIopsReadRateMaxLength(Long iopsReadRateMaxLength) { this.iopsReadRateMaxLength = iopsReadRateMaxLength; }
+
public void setIopsWriteRate(Long iopsWriteRate) {
this.iopsWriteRate = iopsWriteRate;
}
@@ -237,6 +277,14 @@ public Long getIopsWriteRate() {
return iopsWriteRate;
}
+ public Long getIopsWriteRateMax() { return iopsWriteRateMax; }
+
+ public void setIopsWriteRateMax(Long iopsWriteRateMax) { this.iopsWriteRateMax = iopsWriteRateMax; }
+
+ public Long getIopsWriteRateMaxLength() { return iopsWriteRateMaxLength; }
+
+ public void setIopsWriteRateMaxLength(Long iopsWriteRateMaxLength) { this.iopsWriteRateMaxLength = iopsWriteRateMaxLength; }
+
public Long getDeviceId() {
return deviceId;
}
diff --git a/core/test/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResourceTest.java b/core/test/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResourceTest.java
index 6b5f1d1baf5..6405037dd0f 100644
--- a/core/test/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResourceTest.java
+++ b/core/test/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResourceTest.java
@@ -31,6 +31,7 @@
import javax.naming.ConfigurationException;
+import org.joda.time.Duration;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
@@ -97,11 +98,11 @@
@Override
public ExecutionResult executeInVR(final String routerIp, final String script, final String args) {
- return executeInVR(routerIp, script, args, 60);
+ return executeInVR(routerIp, script, args, Duration.standardSeconds(60L));
}
@Override
- public ExecutionResult executeInVR(final String routerIp, final String script, final String args, final int timeout) {
+ public ExecutionResult executeInVR(final String routerIp, final String script, final String args, final Duration timeout) {
assertEquals(routerIp, ROUTERIP);
verifyCommand(_currentCmd, script, args);
return new ExecutionResult(true, null);
diff --git a/developer/pom.xml b/developer/pom.xml
index bdd330a26bb..6dd6320958f 100644
--- a/developer/pom.xml
+++ b/developer/pom.xml
@@ -18,7 +18,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
</parent>
<dependencies>
<dependency>
diff --git a/engine/api/pom.xml b/engine/api/pom.xml
index 71003da0ebe..e9e69a8dfc4 100644
--- a/engine/api/pom.xml
+++ b/engine/api/pom.xml
@@ -16,7 +16,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-engine</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/engine/api/src/com/cloud/vm/VirtualMachineManager.java b/engine/api/src/com/cloud/vm/VirtualMachineManager.java
index 8b226564229..8503e888834 100644
--- a/engine/api/src/com/cloud/vm/VirtualMachineManager.java
+++ b/engine/api/src/com/cloud/vm/VirtualMachineManager.java
@@ -90,6 +90,8 @@ void allocate(String vmInstanceName, VirtualMachineTemplate template, ServiceOff
void stop(String vmUuid) throws ResourceUnavailableException;
+ void stop(String vmUuid, boolean forced) throws ResourceUnavailableException;
+
void expunge(String vmUuid) throws ResourceUnavailableException;
void registerGuru(VirtualMachine.Type type, VirtualMachineGuru guru);
diff --git a/engine/api/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntity.java b/engine/api/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntity.java
index 37501f014d0..5561a00720c 100644
--- a/engine/api/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntity.java
+++ b/engine/api/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntity.java
@@ -114,6 +114,12 @@ String reserve(DeploymentPlanner plannerToUse, @BeanParam DeploymentPlan plan, E
*/
boolean stop(String caller) throws ResourceUnavailableException, CloudException;
+ /**
+ * Stop the virtual machine, optionally force
+ *
+ */
+ boolean stop(String caller, boolean forced) throws ResourceUnavailableException, CloudException;
+
/**
* Cleans up after any botched starts. CloudStack Orchestration Platform
* will attempt a best effort to actually shutdown any resource but
diff --git a/engine/api/src/org/apache/cloudstack/engine/orchestration/service/NetworkOrchestrationService.java b/engine/api/src/org/apache/cloudstack/engine/orchestration/service/NetworkOrchestrationService.java
index b71aa96d5cc..89bec1783f6 100644
--- a/engine/api/src/org/apache/cloudstack/engine/orchestration/service/NetworkOrchestrationService.java
+++ b/engine/api/src/org/apache/cloudstack/engine/orchestration/service/NetworkOrchestrationService.java
@@ -224,4 +224,14 @@ void implementNetworkElementsAndResources(DeployDestination dest, ReservationCon
boolean resourceCountNeedsUpdate(NetworkOffering ntwkOff, ACLType aclType);
void prepareAllNicsForMigration(VirtualMachineProfile vm, DeployDestination dest);
+
+ boolean canUpdateInSequence(Network network);
+
+ List<String> getServicesNotSupportedInNewOffering(Network network, long newNetworkOfferingId);
+
+ void cleanupConfigForServicesInNetwork(List<String> services, Network network);
+
+ void configureUpdateInSequence(Network network);
+
+ int getResourceCount(Network network);
}
diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/VolumeInfo.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/VolumeInfo.java
index f93f4efac83..fecade59af9 100644
--- a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/VolumeInfo.java
+++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/VolumeInfo.java
@@ -46,11 +46,27 @@
Long getBytesReadRate();
+ Long getBytesReadRateMax();
+
+ Long getBytesReadRateMaxLength();
+
Long getBytesWriteRate();
+ Long getBytesWriteRateMax();
+
+ Long getBytesWriteRateMaxLength();
+
Long getIopsReadRate();
+ Long getIopsReadRateMax();
+
+ Long getIopsReadRateMaxLength();
+
Long getIopsWriteRate();
+ Long getIopsWriteRateMax();
+
+ Long getIopsWriteRateMaxLength();
+
DiskCacheMode getCacheMode();
}
diff --git a/engine/components-api/pom.xml b/engine/components-api/pom.xml
index 6947aefc278..809c282b21e 100644
--- a/engine/components-api/pom.xml
+++ b/engine/components-api/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-engine</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/engine/network/pom.xml b/engine/network/pom.xml
index fca11c6350b..045195c41dc 100644
--- a/engine/network/pom.xml
+++ b/engine/network/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-engine</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/engine/orchestration/pom.xml b/engine/orchestration/pom.xml
index 099fdc4f357..5bf4296ffee 100755
--- a/engine/orchestration/pom.xml
+++ b/engine/orchestration/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-engine</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
index 2136f8eeb5a..15197672918 100644
--- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -744,14 +744,17 @@ protected boolean checkWorkItems(final VMInstanceVO vm, final State state) throw
protected <T extends VMInstanceVO> boolean changeState(final T vm, final Event event, final Long hostId, final ItWorkVO work, final Step step) throws NoTransitionException {
// FIXME: We should do this better.
- final Step previousStep = work.getStep();
- _workDao.updateStep(work, step);
+ Step previousStep = null;
+ if (work != null) {
+ previousStep = work.getStep();
+ _workDao.updateStep(work, step);
+ }
boolean result = false;
try {
result = stateTransitTo(vm, event, hostId);
return result;
} finally {
- if (!result) {
+ if (!result && previousStep != null) {
_workDao.updateStep(work, previousStep);
}
}
@@ -1232,8 +1235,13 @@ private void syncDiskChainChange(final StartAnswer answer) {
@Override
public void stop(final String vmUuid) throws ResourceUnavailableException {
+ stop(vmUuid, false);
+ }
+
+ @Override
+ public void stop(String vmUuid, boolean forced) throws ResourceUnavailableException {
try {
- advanceStop(vmUuid, false);
+ advanceStop(vmUuid, forced);
} catch (final OperationTimedoutException e) {
throw new AgentUnavailableException("Unable to stop vm because the operation to stop timed out", e.getAgentId(), e);
} catch (final ConcurrentOperationException e) {
@@ -1494,12 +1502,13 @@ private void advanceStop(final VMInstanceVO vm, final boolean cleanUpEvenIfUnabl
if (doCleanup) {
if (cleanup(vmGuru, new VirtualMachineProfileImpl(vm), work, Event.StopRequested, cleanUpEvenIfUnableToStop)) {
try {
- if (s_logger.isDebugEnabled()) {
+ if (s_logger.isDebugEnabled() && work != null) {
s_logger.debug("Updating work item to Done, id:" + work.getId());
}
if (!changeState(vm, Event.AgentReportStopped, null, work, Step.Done)) {
throw new CloudRuntimeException("Unable to stop " + vm);
}
+
} catch (final NoTransitionException e) {
s_logger.warn("Unable to cleanup " + vm);
throw new CloudRuntimeException("Unable to stop " + vm, e);
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManager.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManager.java
index 314531459d6..6ed9328d2d6 100644
--- a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManager.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManager.java
@@ -44,5 +44,7 @@ void deployVirtualMachine(String reservationId, VMEntityVO vmEntityVO, String ca
boolean stopvirtualmachine(VMEntityVO vmEntityVO, String caller) throws ResourceUnavailableException;
+ boolean stopvirtualmachine(VMEntityVO vmEntityVO, String caller, boolean forced) throws ResourceUnavailableException;
+
boolean destroyVirtualMachine(VMEntityVO vmEntityVO, String caller) throws AgentUnavailableException, OperationTimedoutException, ConcurrentOperationException;
}
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java
index 829ed107022..9c194e44549 100644
--- a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java
@@ -254,6 +254,12 @@ public boolean stopvirtualmachine(VMEntityVO vmEntityVO, String caller) throws R
return true;
}
+ @Override
+ public boolean stopvirtualmachine(VMEntityVO vmEntityVO, String caller, boolean forced) throws ResourceUnavailableException {
+ _itMgr.stop(vmEntityVO.getUuid(), forced);
+ return true;
+ }
+
@Override
public boolean destroyVirtualMachine(VMEntityVO vmEntityVO, String caller) throws AgentUnavailableException, OperationTimedoutException, ConcurrentOperationException {
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntityImpl.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntityImpl.java
index 706748f4f75..316c5fb15b3 100644
--- a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntityImpl.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntityImpl.java
@@ -217,6 +217,11 @@ public boolean stop(String caller) throws ResourceUnavailableException {
return manager.stopvirtualmachine(this.vmEntityVO, caller);
}
+ @Override
+ public boolean stop(String caller, boolean forced) throws ResourceUnavailableException {
+ return manager.stopvirtualmachine(this.vmEntityVO, caller, forced);
+ }
+
@Override
public void cleanup() {
// TODO Auto-generated method stub
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
index 2cf1635efb4..dfb519aec05 100644
--- a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
@@ -36,6 +36,15 @@
import javax.inject.Inject;
import javax.naming.ConfigurationException;
+import com.cloud.network.Networks;
+
+import com.cloud.network.dao.NetworkDetailsDao;
+import com.cloud.network.dao.RemoteAccessVpnDao;
+import com.cloud.network.dao.RemoteAccessVpnVO;
+import com.cloud.network.dao.VpnUserDao;
+import com.cloud.network.element.RedundantResource;
+import com.cloud.vm.dao.DomainRouterDao;
+import org.apache.log4j.Logger;
import org.apache.cloudstack.acl.ControlledEntity.ACLType;
import org.apache.cloudstack.context.CallContext;
import org.apache.cloudstack.engine.cloud.entity.api.db.VMNetworkMapVO;
@@ -50,7 +59,6 @@
import org.apache.cloudstack.framework.messagebus.PublishScope;
import org.apache.cloudstack.managed.context.ManagedContextRunnable;
import org.apache.cloudstack.region.PortableIpDao;
-import org.apache.log4j.Logger;
import com.cloud.agent.AgentManager;
import com.cloud.agent.Listener;
@@ -107,7 +115,6 @@
import com.cloud.network.NetworkModel;
import com.cloud.network.NetworkProfile;
import com.cloud.network.NetworkStateListener;
-import com.cloud.network.Networks;
import com.cloud.network.Networks.BroadcastDomainType;
import com.cloud.network.Networks.TrafficType;
import com.cloud.network.PhysicalNetwork;
@@ -265,9 +272,16 @@
MessageBus _messageBus;
@Inject
VMNetworkMapDao _vmNetworkMapDao;
+ @Inject
+ DomainRouterDao _rotuerDao;
+ @Inject
+ RemoteAccessVpnDao _remoteAccessVpnDao;
+ @Inject
+ VpnUserDao _vpnUserDao;
List<NetworkGuru> networkGurus;
+
public List<NetworkGuru> getNetworkGurus() {
return networkGurus;
}
@@ -350,6 +364,8 @@ public void setDhcpProviders(final List<DhcpServiceProvider> dhcpProviders) {
PortableIpDao _portableIpDao;
@Inject
ConfigDepot _configDepot;
+ @Inject
+ NetworkDetailsDao _networkDetailsDao;
protected StateMachine2<Network.State, Network.Event, Network> _stateMachine;
ScheduledExecutorService _executor;
@@ -1032,9 +1048,6 @@ boolean isNetworkImplemented(final NetworkVO network) {
} catch (final NoTransitionException e) {
s_logger.error(e.getMessage());
return null;
- } catch (final CloudRuntimeException e) {
- s_logger.error("Caught exception: " + e.getMessage());
- return null;
} finally {
if (implemented.first() == null) {
s_logger.debug("Cleaning up because we're unable to implement the network " + network);
@@ -1271,6 +1284,152 @@ protected boolean prepareElement(final NetworkElement element, final Network net
return true;
}
+ @Override
+ public boolean canUpdateInSequence(Network network){
+ List<Provider> providers = getNetworkProviders(network.getId());
+
+ //check if the there are no service provider other than virtualrouter.
+ for(Provider provider :providers){
+ if(provider!=Provider.VirtualRouter)
+ throw new UnsupportedOperationException("Cannot update the network resources in sequence when providers other than virtualrouter are used");
+ }
+ return true;
+ }
+
+ @Override
+ public List<String> getServicesNotSupportedInNewOffering(Network network,long newNetworkOfferingId){
+ NetworkOffering offering =_networkOfferingDao.findById(newNetworkOfferingId);
+ List<String> services=_ntwkOfferingSrvcDao.listServicesForNetworkOffering(offering.getId());
+ List<NetworkServiceMapVO> serviceMap= _ntwkSrvcDao.getServicesInNetwork(network.getId());
+ List<String> servicesNotInNewOffering=new ArrayList<>();
+ for(NetworkServiceMapVO serviceVO :serviceMap){
+ boolean inlist=false;
+ for(String service: services){
+ if(serviceVO.getService().equalsIgnoreCase(service)){
+ inlist=true;
+ break;
+ }
+ }
+ if(!inlist){
+ //ignore Gateway service as this has no effect on the
+ //behaviour of network.
+ if(!serviceVO.getService().equalsIgnoreCase(Service.Gateway.getName()))
+ servicesNotInNewOffering.add(serviceVO.getService());
+ }
+ }
+ return servicesNotInNewOffering;
+ }
+
+ @Override
+ public void cleanupConfigForServicesInNetwork(List<String> services, final Network network){
+ long networkId=network.getId();
+ Account caller=_accountDao.findById(Account.ACCOUNT_ID_SYSTEM);
+ long userId=User.UID_SYSTEM;
+ //remove all PF/Static Nat rules for the network
+ s_logger.info("Services:"+services+" are no longer supported in network:"+network.getUuid()+
+ " after applying new network offering:"+network.getNetworkOfferingId()+" removing the related configuration");
+ if(services.contains(Service.StaticNat.getName())|| services.contains(Service.PortForwarding.getName())) {
+ try {
+ if (_rulesMgr.revokeAllPFStaticNatRulesForNetwork(networkId, userId, caller)) {
+ s_logger.debug("Successfully cleaned up portForwarding/staticNat rules for network id=" + networkId);
+ } else {
+ s_logger.warn("Failed to release portForwarding/StaticNat rules as a part of network id=" + networkId + " cleanup");
+ }
+ if(services.contains(Service.StaticNat.getName())){
+ //removing static nat configured on ips.
+ //optimizing the db operations using transaction.
+ Transaction.execute(new TransactionCallbackNoReturn() {
+ @Override
+ public void doInTransactionWithoutResult(TransactionStatus status) {
+ List<IPAddressVO> ips = _ipAddressDao.listStaticNatPublicIps(network.getId());
+ for (IPAddressVO ip : ips) {
+ ip.setOneToOneNat(false);
+ ip.setAssociatedWithVmId(null);
+ ip.setVmIp(null);
+ _ipAddressDao.update(ip.getId(),ip);
+ }
+ }
+ });
+ }
+ } catch (ResourceUnavailableException ex) {
+ s_logger.warn("Failed to release portForwarding/StaticNat rules as a part of network id=" + networkId + " cleanup due to resourceUnavailable ", ex);
+ }
+ }
+ if(services.contains(Service.SourceNat.getName())){
+ Transaction.execute(new TransactionCallbackNoReturn() {
+ @Override
+ public void doInTransactionWithoutResult(TransactionStatus status) {
+ List<IPAddressVO> ips = _ipAddressDao.listByAssociatedNetwork(network.getId(),true);
+ //removing static nat configured on ips.
+ for (IPAddressVO ip : ips) {
+ ip.setSourceNat(false);
+ _ipAddressDao.update(ip.getId(),ip);
+ }
+ }
+ });
+ }
+ if(services.contains(Service.Lb.getName())){
+ //remove all LB rules for the network
+ if (_lbMgr.removeAllLoadBalanacersForNetwork(networkId, caller, userId)) {
+ s_logger.debug("Successfully cleaned up load balancing rules for network id=" + networkId);
+ } else {
+ s_logger.warn("Failed to cleanup LB rules as a part of network id=" + networkId + " cleanup");
+ }
+ }
+
+ if(services.contains(Service.Firewall.getName())){
+ //revoke all firewall rules for the network
+ try {
+ if (_firewallMgr.revokeAllFirewallRulesForNetwork(networkId, userId, caller)) {
+ s_logger.debug("Successfully cleaned up firewallRules rules for network id=" + networkId);
+ } else {
+ s_logger.warn("Failed to cleanup Firewall rules as a part of network id=" + networkId + " cleanup");
+ }
+ } catch (ResourceUnavailableException ex) {
+ s_logger.warn("Failed to cleanup Firewall rules as a part of network id=" + networkId + " cleanup due to resourceUnavailable ", ex);
+ }
+ }
+
+ //do not remove vpn service for vpc networks.
+ if(services.contains(Service.Vpn.getName()) && network.getVpcId()==null){
+ RemoteAccessVpnVO vpn = _remoteAccessVpnDao.findByAccountAndNetwork(network.getAccountId(),networkId);
+ try {
+ _vpnMgr.destroyRemoteAccessVpnForIp(vpn.getServerAddressId(), caller, true);
+ } catch (ResourceUnavailableException ex) {
+ s_logger.warn("Failed to cleanup remote access vpn resources of network:"+network.getUuid() + " due to Exception: ", ex);
+ }
+ }
+ }
+
+ @Override
+ public void configureUpdateInSequence(Network network) {
+ List<Provider> providers = getNetworkProviders(network.getId());
+ for (NetworkElement element : networkElements) {
+ if (providers.contains(element.getProvider())) {
+ if (element instanceof RedundantResource) {
+ ((RedundantResource) element).configureResource(network);
+ }
+ }
+ }
+ }
+
+ @Override
+ public int getResourceCount(Network network){
+ List<Provider> providers = getNetworkProviders(network.getId());
+ int resourceCount=0;
+ for (NetworkElement element : networkElements) {
+ if (providers.contains(element.getProvider())) {
+ //currently only one element implements the redundant resource interface
+ if (element instanceof RedundantResource) {
+ resourceCount= ((RedundantResource) element).getResourceCount(network);
+ break;
+ }
+ }
+ }
+ return resourceCount;
+ }
+
+
@DB
protected void updateNic(final NicVO nic, final long networkId, final int count) {
Transaction.execute(new TransactionCallbackNoReturn() {
@@ -2025,7 +2184,7 @@ public Network createGuestNetwork(final long networkOfferingId, final String nam
// Check if cidr is RFC1918 compliant if the network is Guest Isolated for IPv4
if (cidr != null && ntwkOff.getGuestType() == Network.GuestType.Isolated && ntwkOff.getTrafficType() == TrafficType.Guest) {
if (!NetUtils.validateGuestCidr(cidr)) {
- throw new InvalidParameterValueException("Virtual Guest Cidr " + cidr + " is not RFC1918 compliant");
+ throw new InvalidParameterValueException("Virtual Guest Cidr " + cidr + " is not RFC 1918 or 6598 compliant");
}
}
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
index 8de6bd24e7e..96c26af2c8f 100644
--- a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
@@ -44,7 +44,10 @@
import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotDataFactory;
import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo;
import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotService;
+import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotStrategy;
+import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotStrategy.SnapshotOperation;
import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
+import org.apache.cloudstack.engine.subsystem.api.storage.StorageStrategyFactory;
import org.apache.cloudstack.engine.subsystem.api.storage.TemplateDataFactory;
import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo;
import org.apache.cloudstack.engine.subsystem.api.storage.VolumeDataFactory;
@@ -178,6 +181,8 @@
ClusterManager clusterManager;
@Inject
StorageManager storageMgr;
+ @Inject
+ StorageStrategyFactory _storageStrategyFactory;
private final StateMachine2<Volume.State, Volume.Event, Volume> _volStateMachine;
protected List<StoragePoolAllocator> _storagePoolAllocators;
@@ -383,6 +388,24 @@ public VolumeInfo createVolumeFromSnapshot(Volume volume, Snapshot snapshot, Use
DataStoreRole dataStoreRole = getDataStoreRole(snapshot);
SnapshotInfo snapInfo = snapshotFactory.getSnapshot(snapshot.getId(), dataStoreRole);
+
+ if(snapInfo == null && dataStoreRole == DataStoreRole.Image) {
+ // snapshot is not backed up to secondary, let's do that now.
+ snapInfo = snapshotFactory.getSnapshot(snapshot.getId(), DataStoreRole.Primary);
+
+ if (snapInfo == null) {
+ throw new CloudRuntimeException("Cannot find snapshot " + snapshot.getId());
+ }
+ // We need to copy the snapshot onto secondary.
+ SnapshotStrategy snapshotStrategy = _storageStrategyFactory.getSnapshotStrategy(snapshot, SnapshotOperation.BACKUP);
+ snapshotStrategy.backupSnapshot(snapInfo);
+
+ // Attempt to grab it again.
+ snapInfo = snapshotFactory.getSnapshot(snapshot.getId(), dataStoreRole);
+ if (snapInfo == null) {
+ throw new CloudRuntimeException("Cannot find snapshot " + snapshot.getId() + " on secondary and could not create backup");
+ }
+ }
// don't try to perform a sync if the DataStoreRole of the snapshot is equal to DataStoreRole.Primary
if (!DataStoreRole.Primary.equals(dataStoreRole)) {
try {
diff --git a/engine/pom.xml b/engine/pom.xml
index 6895f25f665..9c39427478f 100644
--- a/engine/pom.xml
+++ b/engine/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../pom.xml</relativePath>
</parent>
<build>
diff --git a/engine/schema/pom.xml b/engine/schema/pom.xml
index f7b1fb40756..a02d315b1fb 100644
--- a/engine/schema/pom.xml
+++ b/engine/schema/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-engine</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/engine/schema/src/com/cloud/storage/DiskOfferingVO.java b/engine/schema/src/com/cloud/storage/DiskOfferingVO.java
index 5de7f987e12..4b2cdd0adf3 100644
--- a/engine/schema/src/com/cloud/storage/DiskOfferingVO.java
+++ b/engine/schema/src/com/cloud/storage/DiskOfferingVO.java
@@ -108,15 +108,40 @@
@Column(name = "bytes_read_rate")
Long bytesReadRate;
+ @Column(name = "bytes_read_rate_max")
+ Long bytesReadRateMax;
+
+ @Column(name = "bytes_read_rate_max_length")
+ Long bytesReadRateMaxLength;
+
@Column(name = "bytes_write_rate")
Long bytesWriteRate;
+ @Column(name = "bytes_write_rate_max")
+ Long bytesWriteRateMax;
+
+ @Column(name = "bytes_write_rate_max_length")
+ Long bytesWriteRateMaxLength;
+
@Column(name = "iops_read_rate")
Long iopsReadRate;
+ @Column(name = "iops_read_rate_max")
+ Long iopsReadRateMax;
+
+ @Column(name = "iops_read_rate_max_length")
+ Long iopsReadRateMaxLength;
+
@Column(name = "iops_write_rate")
Long iopsWriteRate;
+ @Column(name = "iops_write_rate_max")
+ Long iopsWriteRateMax;
+
+ @Column(name = "iops_write_rate_max_length")
+ Long iopsWriteRateMaxLength;
+
+
@Column(name = "cache_mode", updatable = true, nullable = false)
@Enumerated(value = EnumType.STRING)
private DiskCacheMode cacheMode;
@@ -471,9 +496,9 @@ public void setBytesReadRate(Long bytesReadRate) {
}
@Override
- public Long getBytesReadRate() {
- return bytesReadRate;
- }
+ public Long getBytesReadRate() { return bytesReadRate; }
+
+
@Override
public void setBytesWriteRate(Long bytesWriteRate) {
@@ -485,6 +510,28 @@ public Long getBytesWriteRate() {
return bytesWriteRate;
}
+ @Override
+ public Long getBytesWriteRateMax() { return bytesWriteRateMax; }
+
+ public void setBytesWriteRateMax(Long bytesWriteRateMax) { this.bytesWriteRateMax = bytesWriteRateMax; }
+
+ @Override
+ public Long getBytesWriteRateMaxLength() { return bytesWriteRateMaxLength; }
+
+ public void setBytesWriteRateMaxLength(Long bytesWriteRateMaxLength) { this.bytesWriteRateMaxLength = bytesWriteRateMaxLength; }
+
+ @Override
+ public Long getBytesReadRateMax() { return bytesReadRateMax; }
+
+ @Override
+ public void setBytesReadRateMax(Long bytesReadRateMax) { this.bytesReadRateMax = bytesReadRateMax; }
+
+ @Override
+ public Long getBytesReadRateMaxLength() { return bytesReadRateMaxLength; }
+
+ @Override
+ public void setBytesReadRateMaxLength(Long bytesReadRateMaxLength) { this.bytesReadRateMaxLength = bytesReadRateMaxLength; }
+
@Override
public void setIopsReadRate(Long iopsReadRate) {
this.iopsReadRate = iopsReadRate;
@@ -495,6 +542,18 @@ public Long getIopsReadRate() {
return iopsReadRate;
}
+ @Override
+ public Long getIopsReadRateMax() { return iopsReadRateMax; }
+
+ @Override
+ public void setIopsReadRateMax(Long iopsReadRateMax) { this.iopsReadRateMax = iopsReadRateMax; }
+
+ @Override
+ public Long getIopsReadRateMaxLength() { return iopsReadRateMaxLength; }
+
+ @Override
+ public void setIopsReadRateMaxLength(Long iopsReadRateMaxLength) { this.iopsReadRateMaxLength = iopsReadRateMaxLength; }
+
@Override
public void setIopsWriteRate(Long iopsWriteRate) {
this.iopsWriteRate = iopsWriteRate;
@@ -505,6 +564,18 @@ public Long getIopsWriteRate() {
return iopsWriteRate;
}
+ @Override
+ public Long getIopsWriteRateMax() { return iopsWriteRateMax; }
+
+ @Override
+ public void setIopsWriteRateMax(Long iopsWriteRateMax) { this.iopsWriteRateMax = iopsWriteRateMax; }
+
+ @Override
+ public Long getIopsWriteRateMaxLength() { return iopsWriteRateMaxLength; }
+
+ @Override
+ public void setIopsWriteRateMaxLength(Long iopsWriteRateMaxLength) { this.iopsWriteRateMaxLength = iopsWriteRateMaxLength; }
+
@Override
public void setHypervisorSnapshotReserve(Integer hypervisorSnapshotReserve) {
this.hypervisorSnapshotReserve = hypervisorSnapshotReserve;
diff --git a/engine/schema/src/com/cloud/upgrade/DatabaseUpgradeChecker.java b/engine/schema/src/com/cloud/upgrade/DatabaseUpgradeChecker.java
index d2b0066bc61..d836d628457 100644
--- a/engine/schema/src/com/cloud/upgrade/DatabaseUpgradeChecker.java
+++ b/engine/schema/src/com/cloud/upgrade/DatabaseUpgradeChecker.java
@@ -63,6 +63,7 @@
import com.cloud.upgrade.dao.Upgrade470to471;
import com.cloud.upgrade.dao.Upgrade471to480;
import com.cloud.upgrade.dao.Upgrade480to481;
+import com.cloud.upgrade.dao.Upgrade481to482;
import com.cloud.upgrade.dao.UpgradeSnapshot217to224;
import com.cloud.upgrade.dao.UpgradeSnapshot223to224;
import com.cloud.upgrade.dao.VersionDao;
@@ -110,7 +111,7 @@ public DatabaseUpgradeChecker() {
new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(),
new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(),
new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(),
- new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481()});
+ new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to482()});
_upgradeMap.put("2.1.8", new DbUpgrade[] {new Upgrade218to22(), new Upgrade221to222(), new UpgradeSnapshot217to224(),
new Upgrade222to224(), new Upgrade218to224DomainVlans(), new Upgrade224to225(), new Upgrade225to226(),
@@ -118,7 +119,7 @@ public DatabaseUpgradeChecker() {
new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(),
new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(),
new Upgrade410to420(), new Upgrade420to421(),
- new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481()});
+ new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to482()});
_upgradeMap.put("2.1.9", new DbUpgrade[] {new Upgrade218to22(), new Upgrade221to222(), new UpgradeSnapshot217to224(),
new Upgrade222to224(), new Upgrade218to224DomainVlans(), new Upgrade224to225(), new Upgrade225to226(),
@@ -126,165 +127,168 @@ public DatabaseUpgradeChecker() {
new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(),
new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(),
new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(),
- new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481()});
+ new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to482()});
_upgradeMap.put("2.2.1", new DbUpgrade[] {new Upgrade221to222(), new UpgradeSnapshot223to224(), new Upgrade222to224(),
new Upgrade224to225(), new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(),
new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(),
new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(),
new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(),
- new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481()});
+ new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to482()});
_upgradeMap.put("2.2.2", new DbUpgrade[] {new Upgrade222to224(), new UpgradeSnapshot223to224(), new Upgrade224to225(),
new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(),
new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(),
new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(),
- new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481()});
+ new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to482()});
_upgradeMap.put("2.2.3", new DbUpgrade[] {new Upgrade222to224(), new UpgradeSnapshot223to224(), new Upgrade224to225(),
new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(),
new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(),
new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(),
- new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481()});
+ new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to482()});
_upgradeMap.put("2.2.4", new DbUpgrade[] {new Upgrade224to225(), new Upgrade225to226(), new Upgrade227to228(),
new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(),
new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(),
new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(),
- new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481()});
+ new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to482()});
_upgradeMap.put("2.2.5", new DbUpgrade[] {new Upgrade225to226(), new Upgrade227to228(), new Upgrade228to229(),
new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(),
new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(),
new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(),
- new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481()});
+ new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to482()});
_upgradeMap.put("2.2.6", new DbUpgrade[] {new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(),
new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(),
new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(),
new Upgrade410to420(), new Upgrade420to421(),
- new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481()});
+ new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to482()});
_upgradeMap.put("2.2.7", new DbUpgrade[] {new Upgrade227to228(), new Upgrade228to229(), new Upgrade229to2210(),
new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(),
new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(),
new Upgrade410to420(),
new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(),
- new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481()});
+ new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to482()});
_upgradeMap.put("2.2.8", new DbUpgrade[] {new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(),
new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30()
, new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(),
- new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481()});
+ new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to482()});
_upgradeMap.put("2.2.9", new DbUpgrade[] {new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(),
new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(),
new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(),
- new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481()});
+ new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to482()});
_upgradeMap.put("2.2.10", new DbUpgrade[] {new Upgrade2210to2211(), new Upgrade2211to2212(), new Upgrade2212to2213(),
new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(),
new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(),
- new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481()});
+ new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to482()});
_upgradeMap.put("2.2.12", new DbUpgrade[] {new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(),
new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(),
- new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481()});
+ new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to482()});
_upgradeMap.put("2.2.13", new DbUpgrade[] {new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(),
new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(),
- new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481()});
+ new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to482()});
_upgradeMap.put("2.2.14", new DbUpgrade[] {new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(),
new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(),
- new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481()});
+ new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to482()});
_upgradeMap.put("3.0.0", new DbUpgrade[] {new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40(),
new Upgrade40to41(), new Upgrade410to420(),
- new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481()});
+ new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to482()});
_upgradeMap.put("3.0.1", new DbUpgrade[] {new Upgrade301to302(), new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(),
- new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481()});
+ new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to482()});
_upgradeMap.put("3.0.2", new DbUpgrade[] {new Upgrade302to40(), new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(),
- new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481()});
+ new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to482()});
- _upgradeMap.put("4.0.0", new DbUpgrade[] {new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481()});
+ _upgradeMap.put("4.0.0", new DbUpgrade[] {new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to482()});
- _upgradeMap.put("4.0.1", new DbUpgrade[] {new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481()});
+ _upgradeMap.put("4.0.1", new DbUpgrade[] {new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to482()});
- _upgradeMap.put("4.0.2", new DbUpgrade[] {new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481()});
+ _upgradeMap.put("4.0.2", new DbUpgrade[] {new Upgrade40to41(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to482()});
- _upgradeMap.put("4.1.0", new DbUpgrade[] {new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481()});
+ _upgradeMap.put("4.1.0", new DbUpgrade[] {new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to482()});
- _upgradeMap.put("4.1.1", new DbUpgrade[] {new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481()});
+ _upgradeMap.put("4.1.1", new DbUpgrade[] {new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to482()});
- _upgradeMap.put("4.2.0", new DbUpgrade[] {new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481()});
+ _upgradeMap.put("4.2.0", new DbUpgrade[] {new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to482()});
- _upgradeMap.put("4.2.1", new DbUpgrade[] {new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481()});
+ _upgradeMap.put("4.2.1", new DbUpgrade[] {new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to482()});
- _upgradeMap.put("4.3.0", new DbUpgrade[] {new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481()});
+ _upgradeMap.put("4.3.0", new DbUpgrade[] {new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to482()});
- _upgradeMap.put("4.3.1", new DbUpgrade[] {new Upgrade431to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481()});
+ _upgradeMap.put("4.3.1", new DbUpgrade[] {new Upgrade431to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to482()});
- _upgradeMap.put("4.3.2", new DbUpgrade[] {new Upgrade432to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481()});
+ _upgradeMap.put("4.3.2", new DbUpgrade[] {new Upgrade432to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to482()});
- _upgradeMap.put("4.4.0", new DbUpgrade[] {new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481()});
+ _upgradeMap.put("4.4.0", new DbUpgrade[] {new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to482()});
- _upgradeMap.put("4.4.1", new DbUpgrade[] {new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481() });
+ _upgradeMap.put("4.4.1", new DbUpgrade[] {new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to482() });
- _upgradeMap.put("4.4.2", new DbUpgrade[] {new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481()});
+ _upgradeMap.put("4.4.2", new DbUpgrade[] {new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to482()});
- _upgradeMap.put("4.4.3", new DbUpgrade[] {new Upgrade443to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481()});
+ _upgradeMap.put("4.4.3", new DbUpgrade[] {new Upgrade443to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to482()});
- _upgradeMap.put("4.4.4", new DbUpgrade[] {new Upgrade444to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481()});
+ _upgradeMap.put("4.4.4", new DbUpgrade[] {new Upgrade444to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to482()});
- _upgradeMap.put("4.5.0", new DbUpgrade[] {new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481()});
+ _upgradeMap.put("4.5.0", new DbUpgrade[] {new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to482()});
- _upgradeMap.put("4.5.1", new DbUpgrade[] {new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481()});
+ _upgradeMap.put("4.5.1", new DbUpgrade[] {new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to482()});
- _upgradeMap.put("4.5.2", new DbUpgrade[] {new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481()});
+ _upgradeMap.put("4.5.2", new DbUpgrade[] {new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to482()});
- _upgradeMap.put("4.5.3", new DbUpgrade[] {new Upgrade453to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481()});
+ _upgradeMap.put("4.5.3", new DbUpgrade[] {new Upgrade453to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to482()});
- _upgradeMap.put("4.6.0", new DbUpgrade[] {new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481()});
+ _upgradeMap.put("4.6.0", new DbUpgrade[] {new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to482()});
- _upgradeMap.put("4.6.1", new DbUpgrade[] {new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481()});
+ _upgradeMap.put("4.6.1", new DbUpgrade[] {new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to482()});
- _upgradeMap.put("4.6.2", new DbUpgrade[] {new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481()});
+ _upgradeMap.put("4.6.2", new DbUpgrade[] {new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to482()});
- _upgradeMap.put("4.7.0", new DbUpgrade[] {new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481()});
+ _upgradeMap.put("4.7.0", new DbUpgrade[] {new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to482()});
- _upgradeMap.put("4.7.1", new DbUpgrade[] {new Upgrade471to480(),new Upgrade480to481()});
+ _upgradeMap.put("4.7.1", new DbUpgrade[] {new Upgrade471to480(),new Upgrade480to481(), new Upgrade481to482()});
- _upgradeMap.put("4.7.2", new DbUpgrade[] {new Upgrade471to480(),new Upgrade480to481()});
+ _upgradeMap.put("4.7.2", new DbUpgrade[] {new Upgrade471to480(),new Upgrade480to481(), new Upgrade481to482()});
+
+ _upgradeMap.put("4.8.0", new DbUpgrade[] {new Upgrade480to481(), new Upgrade481to482()});
+
+ _upgradeMap.put("4.8.1", new DbUpgrade[] {new Upgrade481to482()});
- _upgradeMap.put("4.8.0", new DbUpgrade[] {new Upgrade480to481()});
//CP Upgrades
_upgradeMap.put("3.0.3", new DbUpgrade[] {new Upgrade303to304(), new Upgrade304to305(), new Upgrade305to306(), new Upgrade306to307(), new Upgrade307to410(),
- new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481()});
+ new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to482()});
_upgradeMap.put("3.0.4", new DbUpgrade[] {new Upgrade304to305(), new Upgrade305to306(), new Upgrade306to307(), new Upgrade307to410(), new Upgrade410to420(),
- new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481()});
+ new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to482()});
_upgradeMap.put("3.0.5", new DbUpgrade[] {new Upgrade305to306(), new Upgrade306to307(), new Upgrade307to410(), new Upgrade410to420(), new Upgrade420to421(),
- new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481()});
+ new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to482()});
_upgradeMap.put("3.0.6", new DbUpgrade[] {new Upgrade306to307(), new Upgrade307to410(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(),
- new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481()});
+ new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to482()});
- _upgradeMap.put("3.0.7", new DbUpgrade[] {new Upgrade307to410(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481()});
+ _upgradeMap.put("3.0.7", new DbUpgrade[] {new Upgrade307to410(), new Upgrade410to420(), new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to482()});
_upgradeMap.put("2.2.15", new DbUpgrade[] {new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(),
new Upgrade302to303(), new Upgrade303to304(), new Upgrade304to305(), new Upgrade305to306(), new Upgrade306to307(), new Upgrade307to410(),
new Upgrade410to420(),
- new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481()});
+ new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to482()});
_upgradeMap.put("2.2.16", new DbUpgrade[] {new Upgrade2214to30(), new Upgrade30to301(), new Upgrade301to302(),
new Upgrade302to303(), new Upgrade303to304(), new Upgrade304to305(), new Upgrade305to306(), new Upgrade306to307(), new Upgrade307to410(),
new Upgrade410to420(),
- new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481()});
+ new Upgrade420to421(), new Upgrade421to430(), new Upgrade430to440(), new Upgrade440to441(), new Upgrade441to442(), new Upgrade442to450(), new Upgrade450to451(), new Upgrade451to452(), new Upgrade452to460(), new Upgrade460to461(), new Upgrade461to470(), new Upgrade470to471(), new Upgrade471to480(), new Upgrade480to481(), new Upgrade481to482()});
}
protected void runScript(Connection conn, File file) {
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade481to482.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade481to482.java
new file mode 100644
index 00000000000..5bd26925576
--- /dev/null
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade481to482.java
@@ -0,0 +1,67 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package com.cloud.upgrade.dao;
+
+import com.cloud.utils.exception.CloudRuntimeException;
+import com.cloud.utils.script.Script;
+import org.apache.log4j.Logger;
+
+import java.io.File;
+import java.sql.Connection;
+
+public class Upgrade481to482 implements DbUpgrade {
+ final static Logger s_logger = Logger.getLogger(Upgrade481to482.class);
+
+ @Override
+ public String[] getUpgradableVersionRange() {
+ return new String[] {"4.8.1", "4.8.2"};
+ }
+
+ @Override
+ public String getUpgradedVersion() {
+ return "4.8.2";
+ }
+
+ @Override
+ public boolean supportsRollingUpgrade() {
+ return false;
+ }
+
+ @Override
+ public File[] getPrepareScripts() {
+ String script = Script.findScript("", "db/schema-481to482.sql");
+ if (script == null) {
+ throw new CloudRuntimeException("Unable to find db/schema-481to482.sql");
+ }
+ return new File[] {new File(script)};
+ }
+
+ @Override
+ public void performDataMigration(Connection conn) {
+ }
+
+ @Override
+ public File[] getCleanupScripts() {
+ String script = Script.findScript("", "db/schema-481to482-cleanup.sql");
+ if (script == null) {
+ throw new CloudRuntimeException("Unable to find db/schema-480to481-cleanup.sql");
+ }
+
+ return new File[] {new File(script)};
+ }
+}
diff --git a/engine/schema/src/com/cloud/vm/DomainRouterVO.java b/engine/schema/src/com/cloud/vm/DomainRouterVO.java
index 2596d24a5fb..2a7aa49b6ed 100644
--- a/engine/schema/src/com/cloud/vm/DomainRouterVO.java
+++ b/engine/schema/src/com/cloud/vm/DomainRouterVO.java
@@ -69,6 +69,11 @@
@Column(name = "vpc_id")
private Long vpcId;
+
+ @Column(name= "update_state")
+ @Enumerated(EnumType.STRING)
+ private UpdateState updateState;
+
public DomainRouterVO(final long id, final long serviceOfferingId, final long elementId, final String name, final long templateId, final HypervisorType hypervisorType, final long guestOSId, final long domainId,
final long accountId, final long userId, final boolean isRedundantRouter, final RedundantState redundantState, final boolean haEnabled, final boolean stopPending,
final Long vpcId) {
@@ -193,4 +198,13 @@ public Long getVpcId() {
return vpcId;
}
+ public UpdateState getUpdateState() {
+ return updateState;
+ }
+
+ public void setUpdateState(UpdateState updateState) {
+ this.updateState = updateState;
+ }
+
+
}
diff --git a/engine/schema/src/com/cloud/vm/dao/NicDao.java b/engine/schema/src/com/cloud/vm/dao/NicDao.java
index 2c7895a5a55..9105a0d5c8d 100644
--- a/engine/schema/src/com/cloud/vm/dao/NicDao.java
+++ b/engine/schema/src/com/cloud/vm/dao/NicDao.java
@@ -44,6 +44,8 @@
NicVO findByIp4AddressAndNetworkId(String ip4Address, long networkId);
+ NicVO findByNetworkIdAndMacAddress(long networkId, String mac);
+
NicVO findDefaultNicForVM(long instanceId);
/**
diff --git a/engine/schema/src/com/cloud/vm/dao/NicDaoImpl.java b/engine/schema/src/com/cloud/vm/dao/NicDaoImpl.java
index f27088a4457..a860a8dfe4c 100644
--- a/engine/schema/src/com/cloud/vm/dao/NicDaoImpl.java
+++ b/engine/schema/src/com/cloud/vm/dao/NicDaoImpl.java
@@ -66,6 +66,7 @@ protected void init() {
AllFieldsSearch.and("secondaryip", AllFieldsSearch.entity().getSecondaryIp(), Op.EQ);
AllFieldsSearch.and("nicid", AllFieldsSearch.entity().getId(), Op.EQ);
AllFieldsSearch.and("strategy", AllFieldsSearch.entity().getReservationStrategy(), Op.EQ);
+ AllFieldsSearch.and("macAddress", AllFieldsSearch.entity().getMacAddress(), Op.EQ);
AllFieldsSearch.done();
IpSearch = createSearchBuilder(String.class);
@@ -190,6 +191,14 @@ public NicVO findByIp4AddressAndNetworkId(String ip4Address, long networkId) {
return findOneBy(sc);
}
+ @Override
+ public NicVO findByNetworkIdAndMacAddress(long networkId, String mac) {
+ SearchCriteria<NicVO> sc = AllFieldsSearch.create();
+ sc.setParameters("network", networkId);
+ sc.setParameters("macAddress", mac);
+ return findOneBy(sc);
+ }
+
@Override
public NicVO findDefaultNicForVM(long instanceId) {
SearchCriteria<NicVO> sc = AllFieldsSearch.create();
diff --git a/engine/service/pom.xml b/engine/service/pom.xml
index bbdded98fdb..762b7c9a87b 100644
--- a/engine/service/pom.xml
+++ b/engine/service/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-engine</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
</parent>
<artifactId>cloud-engine-service</artifactId>
<packaging>war</packaging>
diff --git a/engine/storage/cache/pom.xml b/engine/storage/cache/pom.xml
index 5290ee3a538..a95e3e8c113 100644
--- a/engine/storage/cache/pom.xml
+++ b/engine/storage/cache/pom.xml
@@ -15,7 +15,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-engine</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/engine/storage/datamotion/pom.xml b/engine/storage/datamotion/pom.xml
index a816531af73..7a6bfd429f2 100644
--- a/engine/storage/datamotion/pom.xml
+++ b/engine/storage/datamotion/pom.xml
@@ -16,7 +16,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-engine</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/engine/storage/image/pom.xml b/engine/storage/image/pom.xml
index 6617d426224..ddb2ff1a93a 100644
--- a/engine/storage/image/pom.xml
+++ b/engine/storage/image/pom.xml
@@ -16,7 +16,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-engine</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/engine/storage/integration-test/pom.xml b/engine/storage/integration-test/pom.xml
index 50990aa2e82..adefbdc84b1 100644
--- a/engine/storage/integration-test/pom.xml
+++ b/engine/storage/integration-test/pom.xml
@@ -16,7 +16,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-engine</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/engine/storage/pom.xml b/engine/storage/pom.xml
index 1cfd140a6c2..0b141944e9e 100644
--- a/engine/storage/pom.xml
+++ b/engine/storage/pom.xml
@@ -16,7 +16,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-engine</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/engine/storage/snapshot/pom.xml b/engine/storage/snapshot/pom.xml
index c3c216e6664..d485b173586 100644
--- a/engine/storage/snapshot/pom.xml
+++ b/engine/storage/snapshot/pom.xml
@@ -16,7 +16,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-engine</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<dependencies>
@@ -37,6 +37,11 @@
<type>test-jar</type>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.cloudstack</groupId>
+ <artifactId>cloud-engine-storage-volume</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
<build>
<plugins>
diff --git a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotStateMachineManagerImpl.java b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotStateMachineManagerImpl.java
index cf5944b21df..1cec2dc3c1d 100644
--- a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotStateMachineManagerImpl.java
+++ b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotStateMachineManagerImpl.java
@@ -47,6 +47,7 @@ public SnapshotStateMachineManagerImpl() {
stateMachine.addTransition(Snapshot.State.BackingUp, Event.OperationFailed, Snapshot.State.Error);
stateMachine.addTransition(Snapshot.State.BackedUp, Event.DestroyRequested, Snapshot.State.Destroying);
stateMachine.addTransition(Snapshot.State.BackedUp, Event.CopyingRequested, Snapshot.State.Copying);
+ stateMachine.addTransition(Snapshot.State.BackedUp, Event.BackupToSecondary, Snapshot.State.BackingUp);
stateMachine.addTransition(Snapshot.State.Copying, Event.OperationSucceeded, Snapshot.State.BackedUp);
stateMachine.addTransition(Snapshot.State.Copying, Event.OperationFailed, Snapshot.State.BackedUp);
stateMachine.addTransition(Snapshot.State.Destroying, Event.OperationSucceeded, Snapshot.State.Destroyed);
diff --git a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/XenserverSnapshotStrategy.java b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/XenserverSnapshotStrategy.java
index edd194e605b..77f229c5204 100644
--- a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/XenserverSnapshotStrategy.java
+++ b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/XenserverSnapshotStrategy.java
@@ -36,8 +36,10 @@
import org.apache.cloudstack.storage.command.CreateObjectAnswer;
import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreDao;
import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreVO;
+import org.apache.cloudstack.storage.datastore.PrimaryDataStoreImpl;
import org.apache.cloudstack.storage.to.SnapshotObjectTO;
+import com.cloud.configuration.Config;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.hypervisor.Hypervisor;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
@@ -53,6 +55,7 @@
import com.cloud.storage.dao.VolumeDao;
import com.cloud.storage.snapshot.SnapshotManager;
import com.cloud.storage.Storage.ImageFormat;
+import com.cloud.storage.Storage.StoragePoolType;
import com.cloud.utils.NumbersUtil;
import com.cloud.utils.db.DB;
import com.cloud.utils.exception.CloudRuntimeException;
@@ -263,6 +266,12 @@ public boolean deleteSnapshot(Long snapshotId) {
//snapshot is deleted on backup storage, need to delete it on primary storage
SnapshotDataStoreVO snapshotOnPrimary = snapshotStoreDao.findBySnapshot(snapshotId, DataStoreRole.Primary);
if (snapshotOnPrimary != null) {
+ SnapshotInfo snapshotOnPrimaryInfo = snapshotDataFactory.getSnapshot(snapshotId, DataStoreRole.Primary);
+ long volumeId = snapshotOnPrimary.getVolumeId();
+ VolumeVO volumeVO = volumeDao.findById(volumeId);
+ if (((PrimaryDataStoreImpl)snapshotOnPrimaryInfo.getDataStore()).getPoolType() == StoragePoolType.RBD && volumeVO != null) {
+ snapshotSvr.deleteSnapshot(snapshotOnPrimaryInfo);
+ }
snapshotOnPrimary.setState(State.Destroyed);
snapshotStoreDao.update(snapshotOnPrimary.getId(), snapshotOnPrimary);
}
@@ -366,20 +375,38 @@ public SnapshotInfo takeSnapshot(SnapshotInfo snapshot) {
snapshot = result.getSnashot();
DataStore primaryStore = snapshot.getDataStore();
+ boolean backupFlag = Boolean.parseBoolean(configDao.getValue(Config.BackupSnapshotAfterTakingSnapshot.toString()));
+
+ SnapshotInfo backupedSnapshot;
+ if(backupFlag) {
+ backupedSnapshot = backupSnapshot(snapshot);
+ } else {
+ // Fake it to get the transitions to fire in the proper order
+ s_logger.debug("skipping backup of snapshot due to configuration "+Config.BackupSnapshotAfterTakingSnapshot.toString());
- SnapshotInfo backupedSnapshot = backupSnapshot(snapshot);
+ SnapshotObject snapObj = (SnapshotObject)snapshot;
+ try {
+ snapObj.processEvent(Snapshot.Event.OperationNotPerformed);
+ } catch (NoTransitionException e) {
+ s_logger.debug("Failed to change state: " + snapshot.getId() + ": " + e.toString());
+ throw new CloudRuntimeException(e.toString());
+ }
+ backupedSnapshot = snapshot;
+ }
try {
SnapshotInfo parent = snapshot.getParent();
- if (backupedSnapshot != null && parent != null) {
- Long parentSnapshotId = parent.getId();
- while (parentSnapshotId != null && parentSnapshotId != 0L) {
- SnapshotDataStoreVO snapshotDataStoreVO = snapshotStoreDao.findByStoreSnapshot(primaryStore.getRole(), primaryStore.getId(), parentSnapshotId);
- if (snapshotDataStoreVO != null) {
- parentSnapshotId = snapshotDataStoreVO.getParentSnapshotId();
- snapshotStoreDao.remove(snapshotDataStoreVO.getId());
- } else {
- parentSnapshotId = null;
+ if (backupedSnapshot != null && parent != null && primaryStore instanceof PrimaryDataStoreImpl) {
+ if (((PrimaryDataStoreImpl)primaryStore).getPoolType() != StoragePoolType.RBD) {
+ Long parentSnapshotId = parent.getId();
+ while (parentSnapshotId != null && parentSnapshotId != 0L) {
+ SnapshotDataStoreVO snapshotDataStoreVO = snapshotStoreDao.findByStoreSnapshot(primaryStore.getRole(), primaryStore.getId(), parentSnapshotId);
+ if (snapshotDataStoreVO != null) {
+ parentSnapshotId = snapshotDataStoreVO.getParentSnapshotId();
+ snapshotStoreDao.remove(snapshotDataStoreVO.getId());
+ } else {
+ parentSnapshotId = null;
+ }
}
}
SnapshotDataStoreVO snapshotDataStoreVO = snapshotStoreDao.findByStoreSnapshot(primaryStore.getRole(), primaryStore.getId(), snapshot.getId());
diff --git a/engine/storage/volume/pom.xml b/engine/storage/volume/pom.xml
index 41058374e76..a427719f641 100644
--- a/engine/storage/volume/pom.xml
+++ b/engine/storage/volume/pom.xml
@@ -16,7 +16,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-engine</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java
index 5bf49a9a813..324de40c95b 100644
--- a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java
@@ -207,6 +207,24 @@ public Long getBytesReadRate() {
return null;
}
+ @Override
+ public Long getBytesReadRateMax() {
+ DiskOfferingVO diskOfferingVO = getDiskOfferingVO();
+ if (diskOfferingVO != null) {
+ return diskOfferingVO.getBytesReadRateMax();
+ }
+ return null;
+ }
+
+ @Override
+ public Long getBytesReadRateMaxLength() {
+ DiskOfferingVO diskOfferingVO = getDiskOfferingVO();
+ if (diskOfferingVO != null) {
+ return diskOfferingVO.getBytesReadRateMaxLength();
+ }
+ return null;
+ }
+
@Override
public Long getBytesWriteRate() {
DiskOfferingVO diskOfferingVO = getDiskOfferingVO();
@@ -216,6 +234,24 @@ public Long getBytesWriteRate() {
return null;
}
+ @Override
+ public Long getBytesWriteRateMax() {
+ DiskOfferingVO diskOfferingVO = getDiskOfferingVO();
+ if (diskOfferingVO != null) {
+ return diskOfferingVO.getBytesWriteRateMax();
+ }
+ return null;
+ }
+
+ @Override
+ public Long getBytesWriteRateMaxLength() {
+ DiskOfferingVO diskOfferingVO = getDiskOfferingVO();
+ if (diskOfferingVO != null) {
+ return diskOfferingVO.getBytesWriteRateMaxLength();
+ }
+ return null;
+ }
+
@Override
public Long getIopsReadRate() {
DiskOfferingVO diskOfferingVO = getDiskOfferingVO();
@@ -225,6 +261,24 @@ public Long getIopsReadRate() {
return null;
}
+ @Override
+ public Long getIopsReadRateMax() {
+ DiskOfferingVO diskOfferingVO = getDiskOfferingVO();
+ if (diskOfferingVO != null) {
+ return diskOfferingVO.getIopsReadRateMax();
+ }
+ return null;
+ }
+
+ @Override
+ public Long getIopsReadRateMaxLength() {
+ DiskOfferingVO diskOfferingVO = getDiskOfferingVO();
+ if (diskOfferingVO != null) {
+ return diskOfferingVO.getIopsReadRateMaxLength();
+ }
+ return null;
+ }
+
@Override
public Long getIopsWriteRate() {
DiskOfferingVO diskOfferingVO = getDiskOfferingVO();
@@ -234,6 +288,24 @@ public Long getIopsWriteRate() {
return null;
}
+ @Override
+ public Long getIopsWriteRateMax() {
+ DiskOfferingVO diskOfferingVO = getDiskOfferingVO();
+ if (diskOfferingVO != null) {
+ return diskOfferingVO.getIopsWriteRateMax();
+ }
+ return null;
+ }
+
+ @Override
+ public Long getIopsWriteRateMaxLength() {
+ DiskOfferingVO diskOfferingVO = getDiskOfferingVO();
+ if (diskOfferingVO != null) {
+ return diskOfferingVO.getIopsWriteRateMaxLength();
+ }
+ return null;
+ }
+
@Override
public DiskCacheMode getCacheMode() {
DiskOfferingVO diskOfferingVO = getDiskOfferingVO();
diff --git a/framework/cluster/pom.xml b/framework/cluster/pom.xml
index 68142ac7eec..9f4ec253f74 100644
--- a/framework/cluster/pom.xml
+++ b/framework/cluster/pom.xml
@@ -15,7 +15,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-framework</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/framework/config/pom.xml b/framework/config/pom.xml
index d9d9c6cfc2b..3a5e1c9bb79 100644
--- a/framework/config/pom.xml
+++ b/framework/config/pom.xml
@@ -15,7 +15,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-framework</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/framework/db/pom.xml b/framework/db/pom.xml
index f311ecea573..52a049dbff8 100644
--- a/framework/db/pom.xml
+++ b/framework/db/pom.xml
@@ -15,7 +15,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-framework</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/framework/events/pom.xml b/framework/events/pom.xml
index d8a69cf572d..2f0e19a7eec 100644
--- a/framework/events/pom.xml
+++ b/framework/events/pom.xml
@@ -15,7 +15,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-framework</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/framework/ipc/pom.xml b/framework/ipc/pom.xml
index dee2edf589d..76972a99dda 100644
--- a/framework/ipc/pom.xml
+++ b/framework/ipc/pom.xml
@@ -16,7 +16,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-framework</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/framework/jobs/pom.xml b/framework/jobs/pom.xml
index dd3cce48144..4a70ebce8b0 100644
--- a/framework/jobs/pom.xml
+++ b/framework/jobs/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-framework</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/framework/managed-context/pom.xml b/framework/managed-context/pom.xml
index 72572348fca..202bcbf7b57 100644
--- a/framework/managed-context/pom.xml
+++ b/framework/managed-context/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-maven-standard</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../maven-standard/pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/framework/pom.xml b/framework/pom.xml
index 7b58cdd098e..c3cf3e7fdc4 100644
--- a/framework/pom.xml
+++ b/framework/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
</parent>
<build>
<defaultGoal>install</defaultGoal>
diff --git a/framework/quota/pom.xml b/framework/quota/pom.xml
index 16878925766..f64de43dcb1 100644
--- a/framework/quota/pom.xml
+++ b/framework/quota/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-framework</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/framework/quota/test/org/apache/cloudstack/quota/QuotaAlertManagerImplTest.java b/framework/quota/test/org/apache/cloudstack/quota/QuotaAlertManagerImplTest.java
index 14244fc204d..d898ef2be37 100644
--- a/framework/quota/test/org/apache/cloudstack/quota/QuotaAlertManagerImplTest.java
+++ b/framework/quota/test/org/apache/cloudstack/quota/QuotaAlertManagerImplTest.java
@@ -32,7 +32,6 @@
import org.apache.cloudstack.quota.dao.QuotaUsageDao;
import org.apache.cloudstack.quota.vo.QuotaAccountVO;
import org.apache.cloudstack.quota.vo.QuotaEmailTemplatesVO;
-import org.joda.time.DateTime;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -47,8 +46,10 @@
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.util.ArrayList;
+import java.util.Calendar;
import java.util.Date;
import java.util.List;
+import java.util.TimeZone;
@RunWith(MockitoJUnitRunner.class)
public class QuotaAlertManagerImplTest extends TestCase {
@@ -179,7 +180,11 @@ public void testSendQuotaAlert() throws UnsupportedEncodingException, MessagingE
public void testGetDifferenceDays() {
Date now = new Date();
assertTrue(QuotaAlertManagerImpl.getDifferenceDays(now, now) == 0L);
- assertTrue(QuotaAlertManagerImpl.getDifferenceDays(now, new DateTime(now).plusDays(1).toDate()) == 1L);
+ Calendar c = Calendar.getInstance();
+ c.setTimeZone(TimeZone.getTimeZone("UTC"));
+ Calendar c2 = (Calendar) c.clone();
+ c2.add(Calendar.DATE, 1);
+ assertEquals(1L, QuotaAlertManagerImpl.getDifferenceDays(c.getTime(), c2.getTime()));
}
@Test
diff --git a/framework/rest/pom.xml b/framework/rest/pom.xml
index 545a651e782..fe7618ea3ff 100644
--- a/framework/rest/pom.xml
+++ b/framework/rest/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-framework</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>cloud-framework-rest</artifactId>
diff --git a/framework/security/pom.xml b/framework/security/pom.xml
index 6649e9946f1..3122dab8c74 100644
--- a/framework/security/pom.xml
+++ b/framework/security/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-framework</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/framework/spring/lifecycle/pom.xml b/framework/spring/lifecycle/pom.xml
index 15b3367fd12..ddc97bd10e8 100644
--- a/framework/spring/lifecycle/pom.xml
+++ b/framework/spring/lifecycle/pom.xml
@@ -16,7 +16,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-maven-standard</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../../maven-standard/pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/framework/spring/module/pom.xml b/framework/spring/module/pom.xml
index 17e89f8d608..91a1f03018c 100644
--- a/framework/spring/module/pom.xml
+++ b/framework/spring/module/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-maven-standard</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../../maven-standard/pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/maven-standard/pom.xml b/maven-standard/pom.xml
index dd8d83c25c3..2626e34f200 100644
--- a/maven-standard/pom.xml
+++ b/maven-standard/pom.xml
@@ -25,7 +25,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../pom.xml</relativePath>
</parent>
<build>
diff --git a/packaging/centos7/cloud-management.sysconfig b/packaging/centos7/cloud-management.sysconfig
index c262b115181..6e5fcf9d8d6 100644
--- a/packaging/centos7/cloud-management.sysconfig
+++ b/packaging/centos7/cloud-management.sysconfig
@@ -45,5 +45,5 @@ SHUTDOWN_VERBOSE="false"
# Set the TOMCAT_PID location
CATALINA_PID="/var/run/cloudstack-management.pid"
-CLASSPATH=/etc/cloudstack/management:/usr/share/cloudstack-common:/usr/share/cloudstack-management/setup:/usr/share/java/mysql-connector-java.jar
+CLASSPATH=/etc/cloudstack/management:/usr/share/cloudstack-common:/usr/share/cloudstack-management/setup
diff --git a/packaging/centos7/tomcat7/catalina.properties b/packaging/centos7/tomcat7/catalina.properties
index 282892bb763..e0baf61261d 100644
--- a/packaging/centos7/tomcat7/catalina.properties
+++ b/packaging/centos7/tomcat7/catalina.properties
@@ -44,7 +44,7 @@ package.definition=sun.,java.,org.apache.catalina.,org.apache.coyote.,org.apache
# "foo/*.jar": Add all the JARs of the specified folder as class
# repositories
# "foo/bar.jar": Add bar.jar as a class repository
-common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar,/usr/share/java/mysql-connector-java.jar,/usr/share/cloudstack-mysql-ha/lib/*jar
+common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,${catalina.home}/lib/*.jar,/usr/share/java/mysql-connector-java.jar,/usr/share/cloudstack-mysql-ha/lib/*.jar
#
# List of comma-separated paths defining the contents of the "server"
diff --git a/packaging/systemd/cloudstack-usage.service b/packaging/systemd/cloudstack-usage.service
index 9a1827da613..d80aba6f6fe 100644
--- a/packaging/systemd/cloudstack-usage.service
+++ b/packaging/systemd/cloudstack-usage.service
@@ -27,10 +27,11 @@ Environment=JAVA_HOME=/usr/lib/jvm/jre
Environment=JAVA_HEAP_INITIAL=256m
Environment=JAVA_HEAP_MAX=2048m
Environment=JAVA_CLASS=com.cloud.usage.UsageServer
+Environment=JAVA_PID=$$
ExecStart=/bin/sh -ec '\
export UCP=`ls /usr/share/cloudstack-usage/cloud-usage-*.jar /usr/share/cloudstack-usage/lib/*.jar | tr "\\n" ":"`; \
export CLASSPATH="$UCP:/etc/cloudstack/usage:/usr/share/java/mysql-connector-java.jar"; \
- ${JAVA_HOME}/bin/java -Xms${JAVA_HEAP_INITIAL} -Xmx${JAVA_HEAP_MAX} -cp "$CLASSPATH" $JAVA_CLASS'
+ ${JAVA_HOME}/bin/java -Dpid=${JAVA_PID} -Xms${JAVA_HEAP_INITIAL} -Xmx${JAVA_HEAP_MAX} -cp "$CLASSPATH" $JAVA_CLASS'
Restart=always
RestartSec=10s
diff --git a/plugins/acl/static-role-based/pom.xml b/plugins/acl/static-role-based/pom.xml
index 5171886ccf6..2300e5b5266 100644
--- a/plugins/acl/static-role-based/pom.xml
+++ b/plugins/acl/static-role-based/pom.xml
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
</project>
diff --git a/plugins/affinity-group-processors/explicit-dedication/pom.xml b/plugins/affinity-group-processors/explicit-dedication/pom.xml
index e8b13d06438..aec79106f1c 100644
--- a/plugins/affinity-group-processors/explicit-dedication/pom.xml
+++ b/plugins/affinity-group-processors/explicit-dedication/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<build>
diff --git a/plugins/affinity-group-processors/host-anti-affinity/pom.xml b/plugins/affinity-group-processors/host-anti-affinity/pom.xml
index 7f712a96f8e..197b51457d2 100644
--- a/plugins/affinity-group-processors/host-anti-affinity/pom.xml
+++ b/plugins/affinity-group-processors/host-anti-affinity/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<build>
diff --git a/plugins/alert-handlers/snmp-alerts/pom.xml b/plugins/alert-handlers/snmp-alerts/pom.xml
index 7b2727d78e8..f550564cda9 100644
--- a/plugins/alert-handlers/snmp-alerts/pom.xml
+++ b/plugins/alert-handlers/snmp-alerts/pom.xml
@@ -22,7 +22,7 @@
<parent>
<artifactId>cloudstack-plugins</artifactId>
<groupId>org.apache.cloudstack</groupId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/plugins/alert-handlers/syslog-alerts/pom.xml b/plugins/alert-handlers/syslog-alerts/pom.xml
index 8ad576627ce..ed2ffa97cd6 100644
--- a/plugins/alert-handlers/syslog-alerts/pom.xml
+++ b/plugins/alert-handlers/syslog-alerts/pom.xml
@@ -22,7 +22,7 @@
<parent>
<artifactId>cloudstack-plugins</artifactId>
<groupId>org.apache.cloudstack</groupId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/plugins/api/discovery/pom.xml b/plugins/api/discovery/pom.xml
index 93e8b2d7b51..2e86bebc711 100644
--- a/plugins/api/discovery/pom.xml
+++ b/plugins/api/discovery/pom.xml
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/plugins/api/rate-limit/pom.xml b/plugins/api/rate-limit/pom.xml
index 06904891482..6efde874994 100644
--- a/plugins/api/rate-limit/pom.xml
+++ b/plugins/api/rate-limit/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<build>
diff --git a/plugins/api/solidfire-intg-test/pom.xml b/plugins/api/solidfire-intg-test/pom.xml
index a9911120985..5640c897ad3 100644
--- a/plugins/api/solidfire-intg-test/pom.xml
+++ b/plugins/api/solidfire-intg-test/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/plugins/database/mysql-ha/pom.xml b/plugins/database/mysql-ha/pom.xml
index 9b89047dc1f..37c0d9541ba 100644
--- a/plugins/database/mysql-ha/pom.xml
+++ b/plugins/database/mysql-ha/pom.xml
@@ -15,7 +15,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/plugins/database/quota/pom.xml b/plugins/database/quota/pom.xml
index 450eb678607..d604f1225ec 100644
--- a/plugins/database/quota/pom.xml
+++ b/plugins/database/quota/pom.xml
@@ -16,7 +16,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/plugins/dedicated-resources/pom.xml b/plugins/dedicated-resources/pom.xml
index 24a86913bb2..3161387eaf9 100644
--- a/plugins/dedicated-resources/pom.xml
+++ b/plugins/dedicated-resources/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../pom.xml</relativePath>
</parent>
</project>
diff --git a/plugins/deployment-planners/implicit-dedication/pom.xml b/plugins/deployment-planners/implicit-dedication/pom.xml
index 15b56bfa4f9..08d475313ec 100644
--- a/plugins/deployment-planners/implicit-dedication/pom.xml
+++ b/plugins/deployment-planners/implicit-dedication/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
</project>
diff --git a/plugins/deployment-planners/user-concentrated-pod/pom.xml b/plugins/deployment-planners/user-concentrated-pod/pom.xml
index f22932b5e78..0b531ea5673 100644
--- a/plugins/deployment-planners/user-concentrated-pod/pom.xml
+++ b/plugins/deployment-planners/user-concentrated-pod/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
</project>
diff --git a/plugins/deployment-planners/user-dispersing/pom.xml b/plugins/deployment-planners/user-dispersing/pom.xml
index 20a63d902a3..dc5435c3ac2 100644
--- a/plugins/deployment-planners/user-dispersing/pom.xml
+++ b/plugins/deployment-planners/user-dispersing/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
</project>
diff --git a/plugins/event-bus/inmemory/pom.xml b/plugins/event-bus/inmemory/pom.xml
index 50c842c6dc4..377d432249f 100644
--- a/plugins/event-bus/inmemory/pom.xml
+++ b/plugins/event-bus/inmemory/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/plugins/event-bus/kafka/pom.xml b/plugins/event-bus/kafka/pom.xml
index 4d380b99736..ec012f58a55 100644
--- a/plugins/event-bus/kafka/pom.xml
+++ b/plugins/event-bus/kafka/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/plugins/event-bus/rabbitmq/pom.xml b/plugins/event-bus/rabbitmq/pom.xml
index e68d49a28ae..3bd5c38e5d8 100644
--- a/plugins/event-bus/rabbitmq/pom.xml
+++ b/plugins/event-bus/rabbitmq/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/plugins/file-systems/netapp/pom.xml b/plugins/file-systems/netapp/pom.xml
index 205eddc795a..00b21abc714 100644
--- a/plugins/file-systems/netapp/pom.xml
+++ b/plugins/file-systems/netapp/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/plugins/ha-planners/skip-heurestics/pom.xml b/plugins/ha-planners/skip-heurestics/pom.xml
index 140737ce87d..1fa57126ad7 100644
--- a/plugins/ha-planners/skip-heurestics/pom.xml
+++ b/plugins/ha-planners/skip-heurestics/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
</project>
diff --git a/plugins/host-allocators/random/pom.xml b/plugins/host-allocators/random/pom.xml
index 9d55949952f..a24f389f02e 100644
--- a/plugins/host-allocators/random/pom.xml
+++ b/plugins/host-allocators/random/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
</project>
diff --git a/plugins/hypervisors/baremetal/pom.xml b/plugins/hypervisors/baremetal/pom.xml
index 109e418179b..7b922f0725f 100755
--- a/plugins/hypervisors/baremetal/pom.xml
+++ b/plugins/hypervisors/baremetal/pom.xml
@@ -21,7 +21,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>cloud-plugin-hypervisor-baremetal</artifactId>
diff --git a/plugins/hypervisors/hyperv/pom.xml b/plugins/hypervisors/hyperv/pom.xml
index f13301cc005..a30ecf7d476 100644
--- a/plugins/hypervisors/hyperv/pom.xml
+++ b/plugins/hypervisors/hyperv/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<properties>
diff --git a/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/resource/HypervDirectConnectResource.java b/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/resource/HypervDirectConnectResource.java
index 5b5ec57a889..862cc30a2e5 100644
--- a/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/resource/HypervDirectConnectResource.java
+++ b/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/resource/HypervDirectConnectResource.java
@@ -32,6 +32,7 @@
import java.security.UnrecoverableKeyException;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
+import org.joda.time.Duration;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -622,11 +623,11 @@ private UnPlugNicAnswer execute(final UnPlugNicCommand cmd) {
@Override
public ExecutionResult executeInVR(final String routerIP, final String script, final String args) {
- return executeInVR(routerIP, script, args, 120);
+ return executeInVR(routerIP, script, args, Duration.standardSeconds(120L));
}
@Override
- public ExecutionResult executeInVR(final String routerIP, final String script, final String args, final int timeout) {
+ public ExecutionResult executeInVR(final String routerIP, final String script, final String args, final Duration timeout) {
Pair<Boolean, String> result;
//TODO: Password should be masked, cannot output to log directly
@@ -635,8 +636,8 @@ public ExecutionResult executeInVR(final String routerIP, final String script, f
}
try {
- result = SshHelper.sshExecute(routerIP, DEFAULT_DOMR_SSHPORT, "root", getSystemVMKeyFile(), null, "/opt/cloud/bin/" + script + " " + args,
- 60000, 60000, timeout * 1000);
+ result = SshHelper.sshExecute(routerIP, DEFAULT_DOMR_SSHPORT, "root", getSystemVMKeyFile(), null, "/opt/cloud/bin/" + script + " " + args, VRScripts.CONNECTION_TIMEOUT,
+ VRScripts.CONNECTION_TIMEOUT, timeout);
} catch (final Exception e) {
final String msg = "Command failed due to " + e ;
s_logger.error(msg);
diff --git a/plugins/hypervisors/kvm/pom.xml b/plugins/hypervisors/kvm/pom.xml
index 8275e253c05..d5fb37e6121 100644
--- a/plugins/hypervisors/kvm/pom.xml
+++ b/plugins/hypervisors/kvm/pom.xml
@@ -15,7 +15,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
index 883c8c99429..00d3b673a42 100755
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
@@ -25,6 +25,7 @@
import java.net.InetAddress;
import java.net.URI;
import java.net.URISyntaxException;
+import org.joda.time.Duration;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
@@ -52,6 +53,7 @@
import org.apache.cloudstack.utils.qemu.QemuImg.PhysicalDiskFormat;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.libvirt.Connect;
import org.libvirt.Domain;
@@ -99,6 +101,7 @@
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.DevicesDef;
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.DiskDef;
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.DiskDef.DeviceType;
+import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.DiskDef.DiscardType;
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.DiskDef.DiskProtocol;
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.FeaturesDef;
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.FilesystemDef;
@@ -108,6 +111,7 @@
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.InputDef;
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.InterfaceDef;
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.InterfaceDef.GuestNetType;
+import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.SCSIDef;
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.SerialDef;
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.TermPolicy;
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.VideoDef;
@@ -142,6 +146,7 @@
import com.cloud.utils.ssh.SshHelper;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachine.PowerState;
+import com.cloud.vm.VmDetailConstants;
/**
* LibvirtComputingResource execute requests on the computing/routing host using
@@ -189,7 +194,8 @@
private long _hvVersion;
private long _kernelVersion;
- private int _timeout;
+ private Duration _timeout;
+ private static final int NUMMEMSTATS =2;
private KVMHAMonitor _monitor;
public static final String SSHKEYSPATH = "/root/.ssh";
@@ -276,12 +282,12 @@
@Override
public ExecutionResult executeInVR(final String routerIp, final String script, final String args) {
- return executeInVR(routerIp, script, args, _timeout / 1000);
+ return executeInVR(routerIp, script, args, _timeout);
}
@Override
- public ExecutionResult executeInVR(final String routerIp, final String script, final String args, final int timeout) {
- final Script command = new Script(_routerProxyPath, timeout * 1000, s_logger);
+ public ExecutionResult executeInVR(final String routerIp, final String script, final String args, final Duration timeout) {
+ final Script command = new Script(_routerProxyPath, timeout, s_logger);
final AllLinesParser parser = new AllLinesParser();
command.add(script);
command.add(routerIp);
@@ -383,7 +389,7 @@ public String getUpdateHostPasswdPath() {
return _updateHostPasswdPath;
}
- public int getTimeout() {
+ public Duration getTimeout() {
return _timeout;
}
@@ -774,7 +780,7 @@ public boolean configure(final String name, final Map<String, Object> params) th
}
value = (String)params.get("scripts.timeout");
- _timeout = NumbersUtil.parseInt(value, 30 * 60) * 1000;
+ _timeout = Duration.standardSeconds(NumbersUtil.parseInt(value, 30 * 60));
value = (String)params.get("stop.script.timeout");
_stopTimeout = NumbersUtil.parseInt(value, 120) * 1000;
@@ -1947,14 +1953,17 @@ So if getMinSpeed() returns null we fall back to getSpeed().
features.addFeatures("pae");
features.addFeatures("apic");
features.addFeatures("acpi");
- //for rhel 6.5 and above, hyperv enlightment feature is added
- /*
- * if (vmTO.getOs().contains("Windows Server 2008") && hostOsVersion != null && ((hostOsVersion.first() == 6 && hostOsVersion.second() >= 5) || (hostOsVersion.first() >= 7))) {
- * LibvirtVMDef.HyperVEnlightenmentFeatureDef hyv = new LibvirtVMDef.HyperVEnlightenmentFeatureDef();
- * hyv.setRelaxed(true);
- * features.addHyperVFeature(hyv);
- * }
- */
+ //for rhel 6.5 and above, hyperv enlightenment feature is added
+
+ if (vmTO.getOs().contains("Windows PV")) {
+ LibvirtVMDef.HyperVEnlightenmentFeatureDef hyv = new LibvirtVMDef.HyperVEnlightenmentFeatureDef();
+ hyv.setFeature("relaxed", true);
+ hyv.setFeature("vapic", true);
+ hyv.setFeature("spinlocks", true);
+ hyv.setRetries(8096);
+ features.addHyperVFeature(hyv);
+ }
+
vm.addComp(features);
final TermPolicy term = new TermPolicy();
@@ -1966,7 +1975,7 @@ So if getMinSpeed() returns null we fall back to getSpeed().
final ClockDef clock = new ClockDef();
if (vmTO.getOs().startsWith("Windows")) {
clock.setClockOffset(ClockDef.ClockOffset.LOCALTIME);
- clock.setTimer("rtc", "catchup", null);
+ clock.setTimer("hypervclock", null, null);
} else if (vmTO.getType() != VirtualMachine.Type.User || isGuestPVEnabled(vmTO.getOs())) {
if (_hypervisorLibvirtVersion >= 9 * 1000 + 10) {
clock.setTimer("kvmclock", null, null, _noKvmClock);
@@ -2001,6 +2010,20 @@ So if getMinSpeed() returns null we fall back to getSpeed().
final InputDef input = new InputDef("tablet", "usb");
devices.addDevice(input);
+
+ DiskDef.DiskBus busT = getDiskModelFromVMDetail(vmTO);
+
+ if (busT == null) {
+ busT = getGuestDiskModel(vmTO.getPlatformEmulator());
+ }
+
+ // If we're using virtio scsi, then we need to add a virtual scsi controller
+ if (busT == DiskDef.DiskBus.SCSI) {
+ int queues = getVirtioSCSIDriverQueuesFromVMDetail(vmTO);
+ final SCSIDef sd = new SCSIDef((short)0, 0, 0, 9, 0, queues);
+ devices.addDevice(sd);
+ }
+
vm.addComp(devices);
return vm;
@@ -2084,23 +2107,16 @@ public int compare(final DiskTO arg0, final DiskTO arg1) {
}
// if params contains a rootDiskController key, use its value (this is what other HVs are doing)
- DiskDef.DiskBus diskBusType = null;
- final Map <String, String> params = vmSpec.getDetails();
- if (params != null && params.get("rootDiskController") != null && !params.get("rootDiskController").isEmpty()) {
- final String rootDiskController = params.get("rootDiskController");
- s_logger.debug("Passed custom disk bus " + rootDiskController);
- for (final DiskDef.DiskBus bus : DiskDef.DiskBus.values()) {
- if (bus.toString().equalsIgnoreCase(rootDiskController)) {
- s_logger.debug("Found matching enum for disk bus " + rootDiskController);
- diskBusType = bus;
- break;
- }
- }
- }
+ DiskDef.DiskBus diskBusType = getDiskModelFromVMDetail(vmSpec);
if (diskBusType == null) {
diskBusType = getGuestDiskModel(vmSpec.getPlatformEmulator());
}
+
+ // I'm not sure why previously certain DATADISKs were hard-coded VIRTIO and others not, however this
+ // maintains existing functionality with the exception that SCSI will override VIRTIO.
+ DiskDef.DiskBus diskBusTypeData = (diskBusType == DiskDef.DiskBus.SCSI) ? diskBusType : DiskDef.DiskBus.VIRTIO;
+
final DiskDef disk = new DiskDef();
if (volume.getType() == Volume.Type.ISO) {
if (volPath == null) {
@@ -2112,6 +2128,11 @@ public int compare(final DiskTO arg0, final DiskTO arg1) {
} else {
final int devId = volume.getDiskSeq().intValue();
+ if (diskBusType == DiskDef.DiskBus.SCSI ) {
+ disk.setQemuDriver(true);
+ disk.setDiscard(DiscardType.UNMAP);
+ }
+
if (pool.getType() == StoragePoolType.RBD) {
/*
For RBD pools we use the secret mechanism in libvirt.
@@ -2130,7 +2151,7 @@ public int compare(final DiskTO arg0, final DiskTO arg1) {
disk.defBlockBasedDisk(physicalDisk.getPath(), devId, diskBusType);
} else {
if (volume.getType() == Volume.Type.DATADISK) {
- disk.defFileBasedDisk(physicalDisk.getPath(), devId, DiskDef.DiskBus.VIRTIO, DiskDef.DiskFmtType.QCOW2);
+ disk.defFileBasedDisk(physicalDisk.getPath(), devId, diskBusTypeData, DiskDef.DiskFmtType.QCOW2);
} else {
disk.defFileBasedDisk(physicalDisk.getPath(), devId, diskBusType, DiskDef.DiskFmtType.QCOW2);
}
@@ -2145,19 +2166,45 @@ public int compare(final DiskTO arg0, final DiskTO arg1) {
if (volumeObjectTO.getBytesReadRate() != null && volumeObjectTO.getBytesReadRate() > 0) {
disk.setBytesReadRate(volumeObjectTO.getBytesReadRate());
}
+ if (volumeObjectTO.getBytesReadRateMax() != null && volumeObjectTO.getBytesReadRateMax() > 0) {
+ disk.setBytesReadRateMax(volumeObjectTO.getBytesReadRateMax());
+ }
+ if (volumeObjectTO.getBytesReadRateMaxLength() != null && volumeObjectTO.getBytesReadRateMaxLength() > 0) {
+ disk.setBytesReadRateMaxLength(volumeObjectTO.getBytesReadRateMaxLength());
+ }
if (volumeObjectTO.getBytesWriteRate() != null && volumeObjectTO.getBytesWriteRate() > 0) {
disk.setBytesWriteRate(volumeObjectTO.getBytesWriteRate());
}
+ if (volumeObjectTO.getBytesWriteRateMax() != null && volumeObjectTO.getBytesWriteRateMax() > 0) {
+ disk.setBytesWriteRateMax(volumeObjectTO.getBytesWriteRateMax());
+ }
+ if (volumeObjectTO.getBytesWriteRateMaxLength() != null && volumeObjectTO.getBytesWriteRateMaxLength() > 0) {
+ disk.setBytesWriteRateMaxLength(volumeObjectTO.getBytesWriteRateMaxLength());
+ }
if (volumeObjectTO.getIopsReadRate() != null && volumeObjectTO.getIopsReadRate() > 0) {
disk.setIopsReadRate(volumeObjectTO.getIopsReadRate());
}
+ if (volumeObjectTO.getIopsReadRateMax() != null && volumeObjectTO.getIopsReadRateMax() > 0) {
+ disk.setIopsReadRateMax(volumeObjectTO.getIopsReadRateMax());
+ }
+ if (volumeObjectTO.getIopsReadRateMaxLength() != null && volumeObjectTO.getIopsReadRateMaxLength() > 0) {
+ disk.setIopsReadRateMaxLength(volumeObjectTO.getIopsReadRateMaxLength());
+ }
if (volumeObjectTO.getIopsWriteRate() != null && volumeObjectTO.getIopsWriteRate() > 0) {
disk.setIopsWriteRate(volumeObjectTO.getIopsWriteRate());
}
+ if (volumeObjectTO.getIopsWriteRateMax() != null && volumeObjectTO.getIopsWriteRateMax() > 0) {
+ disk.setIopsWriteRateMax(volumeObjectTO.getIopsWriteRateMax());
+ }
+ if (volumeObjectTO.getIopsWriteRateMaxLength() != null && volumeObjectTO.getIopsWriteRateMaxLength() > 0) {
+ disk.setIopsWriteRateMaxLength(volumeObjectTO.getIopsWriteRateMaxLength());
+ }
+
if (volumeObjectTO.getCacheMode() != null) {
disk.setCacheMode(DiskDef.DiskCacheMode.valueOf(volumeObjectTO.getCacheMode().toString().toUpperCase()));
}
}
+
vm.getDevices().addDevice(disk);
}
@@ -2270,19 +2317,23 @@ public synchronized String attachOrDetachISO(final Connect conn, final String vm
public synchronized String attachOrDetachDisk(final Connect conn,
final boolean attach, final String vmName, final KVMPhysicalDisk attachingDisk,
- final int devId, final Long bytesReadRate, final Long bytesWriteRate, final Long iopsReadRate, final Long iopsWriteRate, final String cacheMode) throws LibvirtException, InternalErrorException {
+ final int devId, final Long bytesReadRate, final Long bytesReadRateMax, final Long bytesReadRateMaxLength,
+ final Long bytesWriteRate, final Long bytesWriteRateMax, final Long bytesWriteRateMaxLength,
+ final Long iopsReadRate, final Long iopsReadRateMax, final Long iopsReadRateMaxLength,
+ final Long iopsWriteRate, final Long iopsWriteRateMax, final Long iopsWriteRateMaxLength,
+ final String cacheMode) throws LibvirtException, InternalErrorException {
List<DiskDef> disks = null;
Domain dm = null;
DiskDef diskdef = null;
final KVMStoragePool attachingPool = attachingDisk.getPool();
try {
- if (!attach) {
- dm = conn.domainLookupByName(vmName);
- final LibvirtDomainXMLParser parser = new LibvirtDomainXMLParser();
- final String xml = dm.getXMLDesc(0);
- parser.parseDomainXML(xml);
- disks = parser.getDisks();
+ dm = conn.domainLookupByName(vmName);
+ final LibvirtDomainXMLParser parser = new LibvirtDomainXMLParser();
+ final String domXml = dm.getXMLDesc(0);
+ parser.parseDomainXML(domXml);
+ disks = parser.getDisks();
+ if (!attach) {
for (final DiskDef disk : disks) {
final String file = disk.getDiskPath();
if (file != null && file.equalsIgnoreCase(attachingDisk.getPath())) {
@@ -2294,30 +2345,65 @@ public synchronized String attachOrDetachDisk(final Connect conn,
throw new InternalErrorException("disk: " + attachingDisk.getPath() + " is not attached before");
}
} else {
+ DiskDef.DiskBus busT = DiskDef.DiskBus.VIRTIO;
+ for (final DiskDef disk : disks) {
+ if (disk.getDeviceType() == DeviceType.DISK) {
+ if (disk.getBusType() == DiskDef.DiskBus.SCSI) {
+ busT = DiskDef.DiskBus.SCSI;
+ }
+ break;
+ }
+ }
+
diskdef = new DiskDef();
+ if (busT == DiskDef.DiskBus.SCSI) {
+ diskdef.setQemuDriver(true);
+ diskdef.setDiscard(DiscardType.UNMAP);
+ }
if (attachingPool.getType() == StoragePoolType.RBD) {
diskdef.defNetworkBasedDisk(attachingDisk.getPath(), attachingPool.getSourceHost(), attachingPool.getSourcePort(), attachingPool.getAuthUserName(),
- attachingPool.getUuid(), devId, DiskDef.DiskBus.VIRTIO, DiskProtocol.RBD, DiskDef.DiskFmtType.RAW);
+ attachingPool.getUuid(), devId, busT, DiskProtocol.RBD, DiskDef.DiskFmtType.RAW);
} else if (attachingPool.getType() == StoragePoolType.Gluster) {
diskdef.defNetworkBasedDisk(attachingDisk.getPath(), attachingPool.getSourceHost(), attachingPool.getSourcePort(), null,
- null, devId, DiskDef.DiskBus.VIRTIO, DiskProtocol.GLUSTER, DiskDef.DiskFmtType.QCOW2);
+ null, devId, busT, DiskProtocol.GLUSTER, DiskDef.DiskFmtType.QCOW2);
} else if (attachingDisk.getFormat() == PhysicalDiskFormat.QCOW2) {
- diskdef.defFileBasedDisk(attachingDisk.getPath(), devId, DiskDef.DiskBus.VIRTIO, DiskDef.DiskFmtType.QCOW2);
+ diskdef.defFileBasedDisk(attachingDisk.getPath(), devId, busT, DiskDef.DiskFmtType.QCOW2);
} else if (attachingDisk.getFormat() == PhysicalDiskFormat.RAW) {
- diskdef.defBlockBasedDisk(attachingDisk.getPath(), devId, DiskDef.DiskBus.VIRTIO);
+ diskdef.defBlockBasedDisk(attachingDisk.getPath(), devId, busT);
}
if (bytesReadRate != null && bytesReadRate > 0) {
diskdef.setBytesReadRate(bytesReadRate);
}
+ if (bytesReadRateMax != null && bytesReadRateMax > 0) {
+ diskdef.setBytesReadRateMax(bytesReadRateMax);
+ }
+ if (bytesReadRateMaxLength != null && bytesReadRateMaxLength > 0) {
+ diskdef.setBytesReadRateMaxLength(bytesReadRateMaxLength);
+ }
if (bytesWriteRate != null && bytesWriteRate > 0) {
diskdef.setBytesWriteRate(bytesWriteRate);
}
+ if (bytesWriteRateMax != null && bytesWriteRateMax > 0) {
+ diskdef.setBytesWriteRateMax(bytesWriteRateMax);
+ }
+ if (bytesWriteRateMaxLength != null && bytesWriteRateMaxLength > 0) {
+ diskdef.setBytesWriteRateMaxLength(bytesWriteRateMaxLength);
+ }
if (iopsReadRate != null && iopsReadRate > 0) {
diskdef.setIopsReadRate(iopsReadRate);
}
+ if (iopsReadRateMax != null && iopsReadRateMax > 0) {
+ diskdef.setIopsReadRateMax(iopsReadRateMax);
+ }
+ if (iopsReadRateMaxLength != null && iopsReadRateMaxLength > 0) {
+ diskdef.setIopsReadRateMaxLength(iopsReadRateMaxLength);
+ }
if (iopsWriteRate != null && iopsWriteRate > 0) {
diskdef.setIopsWriteRate(iopsWriteRate);
}
+ if (iopsWriteRateMax != null && iopsWriteRateMax > 0) {
+ diskdef.setIopsWriteRateMax(iopsWriteRateMax);
+ }
if (cacheMode != null) {
diskdef.setCacheMode(DiskDef.DiskCacheMode.valueOf(cacheMode.toUpperCase()));
@@ -2880,19 +2966,8 @@ private String getHypervisorPath(final Connect conn) {
}
boolean isGuestPVEnabled(final String guestOSName) {
- if (guestOSName == null) {
- return false;
- }
- if (guestOSName.startsWith("Ubuntu") || guestOSName.startsWith("Fedora 13") || guestOSName.startsWith("Fedora 12") || guestOSName.startsWith("Fedora 11") ||
- guestOSName.startsWith("Fedora 10") || guestOSName.startsWith("Fedora 9") || guestOSName.startsWith("CentOS 5.3") || guestOSName.startsWith("CentOS 5.4") ||
- guestOSName.startsWith("CentOS 5.5") || guestOSName.startsWith("CentOS") || guestOSName.startsWith("Fedora") ||
- guestOSName.startsWith("Red Hat Enterprise Linux 5.3") || guestOSName.startsWith("Red Hat Enterprise Linux 5.4") ||
- guestOSName.startsWith("Red Hat Enterprise Linux 5.5") || guestOSName.startsWith("Red Hat Enterprise Linux 6") || guestOSName.startsWith("Debian GNU/Linux") ||
- guestOSName.startsWith("FreeBSD 10") || guestOSName.startsWith("Oracle") || guestOSName.startsWith("Other PV")) {
- return true;
- } else {
- return false;
- }
+ DiskDef.DiskBus db = getGuestDiskModel(guestOSName);
+ return db != DiskDef.DiskBus.IDE;
}
public boolean isCentosHost() {
@@ -2903,14 +2978,54 @@ public boolean isCentosHost() {
}
}
+ public DiskDef.DiskBus getDiskModelFromVMDetail(final VirtualMachineTO vmTO) {
+ Map<String, String> details = vmTO.getDetails();
+ if (details == null) {
+ return null;
+ }
+
+ final String rootDiskController = details.get(VmDetailConstants.ROOT_DISK_CONTROLLER);
+ if (StringUtils.isNotBlank(rootDiskController)) {
+ s_logger.debug("Passed custom disk bus " + rootDiskController);
+ for (final DiskDef.DiskBus bus : DiskDef.DiskBus.values()) {
+ if (bus.toString().equalsIgnoreCase(rootDiskController)) {
+ s_logger.debug("Found matching enum for disk bus " + rootDiskController);
+ return bus;
+ }
+ }
+ }
+ return null;
+ }
+
+ public int getVirtioSCSIDriverQueuesFromVMDetail(final VirtualMachineTO vmTO) {
+ Map<String, String> details = vmTO.getDetails();
+ String queueStr = details.get(VmDetailConstants.VIRTIO_SCSI_DRIVER_QUEUES);
+ int queues = 0;
+ if (queueStr != null) {
+ try {
+ queues = Integer.parseInt(queueStr);
+ } catch(NumberFormatException nfe) {}
+ }
+ return queues;
+ }
+
private DiskDef.DiskBus getGuestDiskModel(final String platformEmulator) {
- if (isGuestPVEnabled(platformEmulator)) {
+ if (platformEmulator == null) {
+ return DiskDef.DiskBus.IDE;
+ } else if (platformEmulator.startsWith("Other PV Virtio-SCSI")) {
+ return DiskDef.DiskBus.SCSI;
+ } else if (platformEmulator.startsWith("Ubuntu") || platformEmulator.startsWith("Fedora 13") || platformEmulator.startsWith("Fedora 12") || platformEmulator.startsWith("Fedora 11") ||
+ platformEmulator.startsWith("Fedora 10") || platformEmulator.startsWith("Fedora 9") || platformEmulator.startsWith("CentOS 5.3") || platformEmulator.startsWith("CentOS 5.4") ||
+ platformEmulator.startsWith("CentOS 5.5") || platformEmulator.startsWith("CentOS") || platformEmulator.startsWith("Fedora") ||
+ platformEmulator.startsWith("Red Hat Enterprise Linux 5.3") || platformEmulator.startsWith("Red Hat Enterprise Linux 5.4") ||
+ platformEmulator.startsWith("Red Hat Enterprise Linux 5.5") || platformEmulator.startsWith("Red Hat Enterprise Linux 6") || platformEmulator.startsWith("Debian GNU/Linux") ||
+ platformEmulator.startsWith("FreeBSD 10") || platformEmulator.startsWith("Oracle") || platformEmulator.startsWith("Other PV")) {
return DiskDef.DiskBus.VIRTIO;
} else {
return DiskDef.DiskBus.IDE;
}
- }
+ }
private void cleanupVMNetworks(final Connect conn, final List<InterfaceDef> nics) {
if (nics != null) {
for (final InterfaceDef nic : nics) {
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java
index 0b6b9d989c8..c03f3cdcd6b 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java
@@ -120,21 +120,61 @@ public boolean parseDomainXML(String domXML) {
Long bytesReadRate = Long.parseLong(bytesReadRateStr);
def.setBytesReadRate(bytesReadRate);
}
+ String bytesReadRateMaxStr = getTagValue("read_bytes_sec_max", (Element)iotune.item(0));
+ if (bytesReadRateMaxStr != null) {
+ Long bytesReadRateMax = Long.parseLong(bytesReadRateMaxStr);
+ def.setBytesReadRateMax(bytesReadRateMax);
+ }
+ String bytesReadRateMaxLengthStr = getTagValue("read_bytes_sec_max_length", (Element)iotune.item(0));
+ if (bytesReadRateMaxLengthStr != null) {
+ Long bytesReadRateMaxLength = Long.parseLong(bytesReadRateMaxLengthStr);
+ def.setBytesReadRateMaxLength(bytesReadRateMaxLength);
+ }
String bytesWriteRateStr = getTagValue("write_bytes_sec", (Element)iotune.item(0));
if (bytesWriteRateStr != null) {
Long bytesWriteRate = Long.parseLong(bytesWriteRateStr);
def.setBytesWriteRate(bytesWriteRate);
}
+ String bytesWriteRateMaxStr = getTagValue("write_bytes_sec_max", (Element)iotune.item(0));
+ if (bytesWriteRateMaxStr != null) {
+ Long bytesWriteRateMax = Long.parseLong(bytesWriteRateMaxStr);
+ def.setBytesWriteRateMax(bytesWriteRateMax);
+ }
+ String bytesWriteRateMaxLengthStr = getTagValue("write_bytes_sec_max_length", (Element)iotune.item(0));
+ if (bytesWriteRateMaxLengthStr != null) {
+ Long bytesWriteRateMaxLength = Long.parseLong(bytesWriteRateMaxLengthStr);
+ def.setBytesWriteRateMaxLength(bytesWriteRateMaxLength);
+ }
String iopsReadRateStr = getTagValue("read_iops_sec", (Element)iotune.item(0));
if (iopsReadRateStr != null) {
Long iopsReadRate = Long.parseLong(iopsReadRateStr);
def.setIopsReadRate(iopsReadRate);
}
+ String iopsReadRateMaxStr = getTagValue("read_iops_sec_max", (Element)iotune.item(0));
+ if (iopsReadRateMaxStr != null) {
+ Long iopsReadRateMax = Long.parseLong(iopsReadRateMaxStr);
+ def.setIopsReadRateMax(iopsReadRateMax);
+ }
+ String iopsReadRateMaxLengthStr = getTagValue("read_iops_sec_max_length", (Element)iotune.item(0));
+ if (iopsReadRateMaxLengthStr != null) {
+ Long iopsReadRateMaxLength = Long.parseLong(iopsReadRateMaxLengthStr);
+ def.setIopsReadRateMaxLength(iopsReadRateMaxLength);
+ }
String iopsWriteRateStr = getTagValue("write_iops_sec", (Element)iotune.item(0));
if (iopsWriteRateStr != null) {
Long iopsWriteRate = Long.parseLong(iopsWriteRateStr);
def.setIopsWriteRate(iopsWriteRate);
}
+ String iopsWriteRateMaxStr = getTagValue("write_iops_sec_max", (Element)iotune.item(0));
+ if (iopsWriteRateMaxStr != null) {
+ Long iopsWriteRateMax = Long.parseLong(iopsWriteRateMaxStr);
+ def.setIopsWriteRateMax(iopsWriteRateMax);
+ }
+ String iopsWriteRateMaxLengthStr = getTagValue("write_iops_sec_max_length", (Element)iotune.item(0));
+ if (iopsWriteRateMaxLengthStr != null) {
+ Long iopsWriteRateMaxLength = Long.parseLong(iopsWriteRateMaxLengthStr);
+ def.setIopsWriteRateMaxLength(iopsWriteRateMaxLength);
+ }
}
diskDefs.add(def);
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
index 6ce7d6c8f5e..94a1f5b5653 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java
@@ -368,6 +368,8 @@ public String toString() {
if (_timerName.equals("kvmclock") && _noKvmClock) {
clockBuilder.append("present='no' />");
+ } else if (_timerName.equals("hypervclock")) {
+ clockBuilder.append("present='yes' />");
} else {
if (_tickPolicy != null) {
clockBuilder.append("tickpolicy='");
@@ -544,6 +546,23 @@ public String toString() {
}
}
+ public enum DiscardType {
+ IGNORE("ignore"), UNMAP("unmap");
+ String _discardType;
+ DiscardType(String discardType) {
+ _discardType = discardType;
+ }
+
+ @Override
+ public String toString() {
+ if (_discardType == null) {
+ return "ignore";
+ }
+ return _discardType;
+ }
+
+ }
+
private DeviceType _deviceType; /* floppy, disk, cdrom */
private DiskType _diskType;
private DiskProtocol _diskProtocol;
@@ -559,12 +578,29 @@ public String toString() {
private boolean _shareable = false;
private boolean _deferAttach = false;
private Long _bytesReadRate;
+ private Long _bytesReadRateMax;
+ private Long _bytesReadRateMaxLength;
private Long _bytesWriteRate;
+ private Long _bytesWriteRateMax;
+ private Long _bytesWriteRateMaxLength;
private Long _iopsReadRate;
+ private Long _iopsReadRateMax;
+ private Long _iopsReadRateMaxLength;
private Long _iopsWriteRate;
+ private Long _iopsWriteRateMax;
+ private Long _iopsWriteRateMaxLength;
private DiskCacheMode _diskCacheMode;
private String _serial;
private boolean qemuDriver = true;
+ private DiscardType _discard = DiscardType.IGNORE;
+
+ public DiscardType getDiscard() {
+ return _discard;
+ }
+
+ public void setDiscard(DiscardType discard) {
+ this._discard = discard;
+ }
public void setDeviceType(DeviceType deviceType) {
_deviceType = deviceType;
@@ -724,18 +760,50 @@ public void setBytesReadRate(Long bytesReadRate) {
_bytesReadRate = bytesReadRate;
}
+ public void setBytesReadRateMax(Long bytesReadRateMax) {
+ _bytesReadRateMax = bytesReadRateMax;
+ }
+
+ public void setBytesReadRateMaxLength(Long bytesReadRateLength) {
+ _bytesReadRate = bytesReadRateLength;
+ }
+
public void setBytesWriteRate(Long bytesWriteRate) {
_bytesWriteRate = bytesWriteRate;
}
+ public void setBytesWriteRateMax(Long bytesWriteRateMax) {
+ _bytesWriteRateMax = bytesWriteRateMax;
+ }
+
+ public void setBytesWriteRateMaxLength(Long bytesWriteRateMaxLength) {
+ _bytesWriteRateMaxLength = bytesWriteRateMaxLength;
+ }
+
public void setIopsReadRate(Long iopsReadRate) {
_iopsReadRate = iopsReadRate;
}
+ public void setIopsReadRateMax(Long iopsReadRateMax) {
+ _iopsReadRateMax = iopsReadRateMax;
+ }
+
+ public void setIopsReadRateMaxLength(Long iopsReadRateMaxLength) {
+ _iopsReadRateMaxLength = iopsReadRateMaxLength;
+ }
+
public void setIopsWriteRate(Long iopsWriteRate) {
_iopsWriteRate = iopsWriteRate;
}
+ public void setIopsWriteRateMax(Long iopsWriteRateMax) {
+ _iopsWriteRateMax = iopsWriteRateMax;
+ }
+
+ public void setIopsWriteRateMaxLength(Long iopsWriteRateMaxLength) {
+ _iopsWriteRateMaxLength = iopsWriteRateMaxLength;
+ }
+
public void setCacheMode(DiskCacheMode cacheMode) {
_diskCacheMode = cacheMode;
}
@@ -763,7 +831,11 @@ public String toString() {
diskBuilder.append(">\n");
if(qemuDriver) {
diskBuilder.append("<driver name='qemu'" + " type='" + _diskFmtType
- + "' cache='" + _diskCacheMode + "' " + "/>\n");
+ + "' cache='" + _diskCacheMode + "' ");
+ if(_discard != null && _discard != DiscardType.IGNORE) {
+ diskBuilder.append("discard='" + _discard.toString() + "' ");
+ }
+ diskBuilder.append("/>\n");
}
if (_diskType == DiskType.FILE) {
@@ -823,6 +895,31 @@ public String toString() {
diskBuilder.append("<read_iops_sec>" + _iopsReadRate + "</read_iops_sec>\n");
if ((_iopsWriteRate != null) && (_iopsWriteRate > 0))
diskBuilder.append("<write_iops_sec>" + _iopsWriteRate + "</write_iops_sec>\n");
+ if (s_qemuVersion >= 2004000) {
+ if (_bytesReadRateMax != null && _bytesReadRateMax > 0 ) {
+ diskBuilder.append("<read_bytes_sec_max>" + _bytesReadRateMax + "</read_bytes_sec_max>\n");
+ }
+ if (_bytesWriteRateMax != null && _bytesWriteRateMax > 0) {
+ diskBuilder.append("<write_bytes_sec_max>" + _bytesWriteRateMax + "</write_bytes_sec_max>\n");
+ }
+ if (_iopsReadRateMax != null && _iopsReadRateMax > 0)
+ diskBuilder.append("<read_iops_sec_max>" + _iopsReadRateMax + "</read_iops_sec_max>\n");
+ if (_iopsWriteRateMax != null && _iopsWriteRateMax > 0)
+ diskBuilder.append("<write_iops_sec_max>" + _iopsWriteRateMax + "</write_iops_sec_max>");
+ }
+ if (s_qemuVersion >= 2006000) {
+ if (_bytesReadRateMaxLength != null && _bytesReadRateMaxLength > 0) {
+ diskBuilder.append("<read_bytes_sec_max_length>" + _bytesReadRateMaxLength + "</read_bytes_sec_max_length>\n");
+ }
+ if (_bytesWriteRateMaxLength != null && _bytesWriteRateMaxLength > 0) {
+ diskBuilder.append("<write_bytes_sec_max_length>" + _bytesWriteRateMaxLength + "</write_bytes_sec_max_length>\n");
+ }
+ if (_iopsReadRateMaxLength != null && _iopsReadRateMaxLength > 0)
+ diskBuilder.append("<read_iops_sec_max_length>" + _iopsReadRateMaxLength + "</read_iops_sec_max_length>");
+ if (_iopsWriteRateMaxLength != null && _iopsWriteRateMaxLength > 0)
+ diskBuilder.append("<write_iops_sec_max_length>" + _iopsWriteRateMaxLength + "</write_iops_sec_max_length>");
+ }
+
diskBuilder.append("</iotune>\n");
}
@@ -1274,6 +1371,46 @@ public String toString() {
}
}
+ public static class SCSIDef {
+ private short index = 0;
+ private int domain = 0;
+ private int bus = 0;
+ private int slot = 9;
+ private int function = 0;
+ private int queues = 0;
+
+ public SCSIDef(short index, int domain, int bus, int slot, int function) {
+ this.index = index;
+ this.domain = domain;
+ this.bus = bus;
+ this.slot = slot;
+ this.function = function;
+ }
+
+ public SCSIDef(short index, int domain, int bus, int slot, int function, int queues) {
+ this(index, domain, bus, slot, function);
+ this.queues = queues;
+ }
+
+ public SCSIDef() {
+
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder scsiBuilder = new StringBuilder();
+
+ scsiBuilder.append(String.format("<controller type='scsi' index='%d' model='virtio-scsi'>\n", this.index ));
+ scsiBuilder.append(String.format("<address type='pci' domain='0x%04X' bus='0x%02X' slot='0x%02X' function='0x%01X'/>\n",
+ this.domain, this.bus, this.slot, this.function ) );
+ if(this.queues > 0) {
+ scsiBuilder.append(String.format("<driver queues='%d'/>\n", this.queues));
+ }
+ scsiBuilder.append("</controller>\n");
+ return scsiBuilder.toString();
+ }
+ }
+
public static class InputDef {
private final String _type; /* tablet, mouse */
private final String _bus; /* ps2, usb, xen */
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtOvsCreateTunnelCommandWrapper.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtOvsCreateTunnelCommandWrapper.java
index b840e8b472c..03d9cf94561 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtOvsCreateTunnelCommandWrapper.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtOvsCreateTunnelCommandWrapper.java
@@ -29,7 +29,7 @@
import com.cloud.resource.ResourceWrapper;
import com.cloud.utils.script.Script;
-@ResourceWrapper(handles = OvsCreateTunnelCommand.class)
+@ResourceWrapper(handles = OvsCreateTunnelCommand.class)
public final class LibvirtOvsCreateTunnelCommandWrapper extends CommandWrapper<OvsCreateTunnelCommand, Answer, LibvirtComputingResource> {
private static final Logger s_logger = Logger.getLogger(LibvirtOvsCreateTunnelCommandWrapper.class);
@@ -40,13 +40,10 @@ public Answer execute(final OvsCreateTunnelCommand command, final LibvirtComputi
try {
if (!libvirtComputingResource.findOrCreateTunnelNetwork(bridge)) {
s_logger.debug("Error during bridge setup");
- return new OvsCreateTunnelAnswer(command, false,
- "Cannot create network", bridge);
+ return new OvsCreateTunnelAnswer(command, false, "Cannot create network", bridge);
}
- libvirtComputingResource.configureTunnelNetwork(command.getNetworkId(), command.getFrom(),
- command.getNetworkName());
-
+ libvirtComputingResource.configureTunnelNetwork(command.getNetworkId(), command.getFrom(), command.getNetworkName());
final Script scriptCommand = new Script(libvirtComputingResource.getOvsTunnelPath(), libvirtComputingResource.getTimeout(), s_logger);
scriptCommand.add("create_tunnel");
scriptCommand.add("--bridge", bridge);
@@ -57,8 +54,7 @@ public Answer execute(final OvsCreateTunnelCommand command, final LibvirtComputi
final String result = scriptCommand.execute();
if (result != null) {
- return new OvsCreateTunnelAnswer(command, true, result, null,
- bridge);
+ return new OvsCreateTunnelAnswer(command, true, result, null, bridge);
} else {
return new OvsCreateTunnelAnswer(command, false, result, bridge);
}
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtPvlanSetupCommandWrapper.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtPvlanSetupCommandWrapper.java
index 435b98a18ab..3e01dc42599 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtPvlanSetupCommandWrapper.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtPvlanSetupCommandWrapper.java
@@ -22,6 +22,7 @@
import java.util.List;
import org.apache.log4j.Logger;
+import org.joda.time.Duration;
import org.libvirt.Connect;
import org.libvirt.LibvirtException;
@@ -45,8 +46,8 @@ public Answer execute(final PvlanSetupCommand command, final LibvirtComputingRes
final String op = command.getOp();
final String dhcpName = command.getDhcpName();
final String dhcpMac = command.getDhcpMac();
- final String dhcpIp = command.getDhcpIp();
final String vmMac = command.getVmMac();
+ final String dhcpIp = command.getDhcpIp();
boolean add = true;
String opr = "-A";
@@ -58,7 +59,7 @@ public Answer execute(final PvlanSetupCommand command, final LibvirtComputingRes
String result = null;
try {
final String guestBridgeName = libvirtComputingResource.getGuestBridgeName();
- final int timeout = libvirtComputingResource.getTimeout();
+ final Duration timeout = libvirtComputingResource.getTimeout();
if (command.getType() == PvlanSetupCommand.Type.DHCP) {
final String ovsPvlanDhcpHostPath = libvirtComputingResource.getOvsPvlanDhcpHostPath();
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java
index 749cbd84851..17e103b2551 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java
@@ -67,7 +67,10 @@
import com.ceph.rados.IoCTX;
import com.ceph.rados.Rados;
+import com.ceph.rados.exceptions.ErrorCode;
+import com.ceph.rados.exceptions.RadosException;
import com.ceph.rbd.Rbd;
+import com.ceph.rbd.RbdException;
import com.ceph.rbd.RbdImage;
import com.cloud.agent.api.Answer;
import com.cloud.agent.api.storage.PrimaryStorageDownloadAnswer;
@@ -83,6 +86,8 @@
import com.cloud.hypervisor.kvm.resource.LibvirtConnection;
import com.cloud.hypervisor.kvm.resource.LibvirtDomainXMLParser;
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.DiskDef;
+import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.DiskDef.DeviceType;
+import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.DiskDef.DiscardType;
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.DiskDef.DiskProtocol;
import com.cloud.storage.JavaStorageLayer;
import com.cloud.storage.Storage.ImageFormat;
@@ -725,10 +730,10 @@ public Answer backupSnapshot(final CopyCommand cmd) {
final QemuImgFile srcFile =
new QemuImgFile(KVMPhysicalDisk.RBDStringBuilder(primaryPool.getSourceHost(), primaryPool.getSourcePort(), primaryPool.getAuthUserName(),
primaryPool.getAuthSecret(), rbdSnapshot));
- srcFile.setFormat(PhysicalDiskFormat.RAW);
+ srcFile.setFormat(snapshotDisk.getFormat());
final QemuImgFile destFile = new QemuImgFile(snapshotFile);
- destFile.setFormat(snapshotDisk.getFormat());
+ destFile.setFormat(PhysicalDiskFormat.QCOW2);
s_logger.debug("Backing up RBD snapshot " + rbdSnapshot + " to " + snapshotFile);
final QemuImg q = new QemuImg(cmd.getWaitInMillSeconds());
@@ -945,19 +950,21 @@ protected synchronized String attachOrDetachDevice(final Connect conn, final boo
}
protected synchronized String attachOrDetachDisk(final Connect conn, final boolean attach, final String vmName, final KVMPhysicalDisk attachingDisk, final int devId, final String serial,
- final Long bytesReadRate, final Long bytesWriteRate, final Long iopsReadRate, final Long iopsWriteRate) throws LibvirtException, InternalErrorException {
+ final Long bytesReadRate, final Long bytesReadRateMax, final Long bytesReadRateMaxLength,
+ final Long bytesWriteRate, final Long bytesWriteRateMax, final Long bytesWriteRateMaxLength,
+ final Long iopsReadRate, final Long iopsReadRateMax, final Long iopsReadRateMaxLength,
+ final Long iopsWriteRate, final Long iopsWriteRateMax, final Long iopsWriteRateMaxLength) throws LibvirtException, InternalErrorException {
List<DiskDef> disks = null;
Domain dm = null;
DiskDef diskdef = null;
final KVMStoragePool attachingPool = attachingDisk.getPool();
try {
+ dm = conn.domainLookupByName(vmName);
+ final LibvirtDomainXMLParser parser = new LibvirtDomainXMLParser();
+ final String domXml = dm.getXMLDesc(0);
+ parser.parseDomainXML(domXml);
+ disks = parser.getDisks();
if (!attach) {
- dm = conn.domainLookupByName(vmName);
- final LibvirtDomainXMLParser parser = new LibvirtDomainXMLParser();
- final String xml = dm.getXMLDesc(0);
- parser.parseDomainXML(xml);
- disks = parser.getDisks();
-
if (attachingPool.getType() == StoragePoolType.RBD) {
if (resource.getHypervisorType() == Hypervisor.HypervisorType.LXC) {
final String device = resource.mapRbdDevice(attachingDisk);
@@ -979,7 +986,20 @@ protected synchronized String attachOrDetachDisk(final Connect conn, final boole
throw new InternalErrorException("disk: " + attachingDisk.getPath() + " is not attached before");
}
} else {
+ DiskDef.DiskBus busT = DiskDef.DiskBus.VIRTIO;
+ for (final DiskDef disk : disks) {
+ if (disk.getDeviceType() == DeviceType.DISK) {
+ if (disk.getBusType() == DiskDef.DiskBus.SCSI) {
+ busT = DiskDef.DiskBus.SCSI;
+ }
+ break;
+ }
+ }
diskdef = new DiskDef();
+ if (busT == DiskDef.DiskBus.SCSI) {
+ diskdef.setQemuDriver(true);
+ diskdef.setDiscard(DiscardType.UNMAP);
+ }
diskdef.setSerial(serial);
if (attachingPool.getType() == StoragePoolType.RBD) {
if(resource.getHypervisorType() == Hypervisor.HypervisorType.LXC){
@@ -987,38 +1007,62 @@ protected synchronized String attachOrDetachDisk(final Connect conn, final boole
final String device = resource.mapRbdDevice(attachingDisk);
if (device != null) {
s_logger.debug("RBD device on host is: "+device);
- diskdef.defBlockBasedDisk(device, devId, DiskDef.DiskBus.VIRTIO);
+ diskdef.defBlockBasedDisk(device, devId, busT);
} else {
throw new InternalErrorException("Error while mapping disk "+attachingDisk.getPath()+" on host");
}
} else {
diskdef.defNetworkBasedDisk(attachingDisk.getPath(), attachingPool.getSourceHost(), attachingPool.getSourcePort(), attachingPool.getAuthUserName(),
- attachingPool.getUuid(), devId, DiskDef.DiskBus.VIRTIO, DiskProtocol.RBD, DiskDef.DiskFmtType.RAW);
+ attachingPool.getUuid(), devId, busT, DiskProtocol.RBD, DiskDef.DiskFmtType.RAW);
}
} else if (attachingPool.getType() == StoragePoolType.Gluster) {
final String mountpoint = attachingPool.getLocalPath();
final String path = attachingDisk.getPath();
final String glusterVolume = attachingPool.getSourceDir().replace("/", "");
diskdef.defNetworkBasedDisk(glusterVolume + path.replace(mountpoint, ""), attachingPool.getSourceHost(), attachingPool.getSourcePort(), null,
- null, devId, DiskDef.DiskBus.VIRTIO, DiskProtocol.GLUSTER, DiskDef.DiskFmtType.QCOW2);
+ null, devId, busT, DiskProtocol.GLUSTER, DiskDef.DiskFmtType.QCOW2);
} else if (attachingDisk.getFormat() == PhysicalDiskFormat.QCOW2) {
- diskdef.defFileBasedDisk(attachingDisk.getPath(), devId, DiskDef.DiskBus.VIRTIO, DiskDef.DiskFmtType.QCOW2);
+ diskdef.defFileBasedDisk(attachingDisk.getPath(), devId, busT, DiskDef.DiskFmtType.QCOW2);
} else if (attachingDisk.getFormat() == PhysicalDiskFormat.RAW) {
- diskdef.defBlockBasedDisk(attachingDisk.getPath(), devId, DiskDef.DiskBus.VIRTIO);
+ diskdef.defBlockBasedDisk(attachingDisk.getPath(), devId, busT);
}
if ((bytesReadRate != null) && (bytesReadRate > 0)) {
diskdef.setBytesReadRate(bytesReadRate);
}
+ if ((bytesReadRateMax != null) && (bytesReadRateMax > 0)) {
+ diskdef.setBytesReadRateMax(bytesReadRateMax);
+ }
+ if ((bytesReadRateMaxLength != null) && (bytesReadRateMaxLength > 0)) {
+ diskdef.setBytesReadRateMaxLength(bytesReadRateMaxLength);
+ }
if ((bytesWriteRate != null) && (bytesWriteRate > 0)) {
diskdef.setBytesWriteRate(bytesWriteRate);
}
+ if ((bytesWriteRateMax != null) && (bytesWriteRateMax > 0)) {
+ diskdef.setBytesWriteRateMax(bytesWriteRateMax);
+ }
+ if ((bytesWriteRateMaxLength != null) && (bytesWriteRateMaxLength > 0)) {
+ diskdef.setBytesWriteRateMaxLength(bytesWriteRateMaxLength);
+ }
if ((iopsReadRate != null) && (iopsReadRate > 0)) {
diskdef.setIopsReadRate(iopsReadRate);
}
+ if ((iopsReadRateMax != null) && (iopsReadRateMax > 0)) {
+ diskdef.setIopsReadRateMax(iopsReadRateMax);
+ }
+ if ((iopsReadRateMaxLength != null) && (iopsReadRateMaxLength > 0)) {
+ diskdef.setIopsReadRateMaxLength(iopsReadRateMaxLength);
+ }
if ((iopsWriteRate != null) && (iopsWriteRate > 0)) {
diskdef.setIopsWriteRate(iopsWriteRate);
}
+ if ((iopsWriteRateMax != null) && (iopsWriteRateMax > 0)) {
+ diskdef.setIopsWriteRateMax(iopsWriteRateMax);
+ }
+ if ((iopsWriteRateMaxLength != null) && (iopsWriteRateMaxLength > 0)) {
+ diskdef.setIopsWriteRateMaxLength(iopsWriteRateMaxLength);
+ }
}
final String xml = diskdef.toString();
@@ -1044,7 +1088,11 @@ public Answer attachVolume(final AttachCommand cmd) {
final KVMPhysicalDisk phyDisk = storagePoolMgr.getPhysicalDisk(primaryStore.getPoolType(), primaryStore.getUuid(), vol.getPath());
- attachOrDetachDisk(conn, true, vmName, phyDisk, disk.getDiskSeq().intValue(), serial, vol.getBytesReadRate(), vol.getBytesWriteRate(), vol.getIopsReadRate(), vol.getIopsWriteRate());
+ attachOrDetachDisk(conn, true, vmName, phyDisk, disk.getDiskSeq().intValue(), serial,
+ vol.getBytesReadRate(), vol.getBytesReadRateMax(), vol.getBytesReadRateMaxLength(),
+ vol.getBytesWriteRate(), vol.getBytesWriteRateMax(), vol.getBytesWriteRateMaxLength(),
+ vol.getIopsReadRate(), vol.getIopsReadRateMax(), vol.getIopsReadRateMaxLength(),
+ vol.getIopsWriteRate(), vol.getIopsWriteRateMax(), vol.getIopsWriteRateMaxLength());
return new AttachAnswer(disk);
} catch (final LibvirtException e) {
@@ -1069,7 +1117,11 @@ public Answer dettachVolume(final DettachCommand cmd) {
final KVMPhysicalDisk phyDisk = storagePoolMgr.getPhysicalDisk(primaryStore.getPoolType(), primaryStore.getUuid(), vol.getPath());
- attachOrDetachDisk(conn, false, vmName, phyDisk, disk.getDiskSeq().intValue(), serial, vol.getBytesReadRate(), vol.getBytesWriteRate(), vol.getIopsReadRate(), vol.getIopsWriteRate());
+ attachOrDetachDisk(conn, false, vmName, phyDisk, disk.getDiskSeq().intValue(), serial,
+ vol.getBytesReadRate(), vol.getBytesReadRateMax(), vol.getBytesReadRateMaxLength(),
+ vol.getBytesWriteRate(), vol.getBytesWriteRateMax(), vol.getBytesWriteRateMaxLength(),
+ vol.getIopsReadRate(), vol.getIopsReadRateMax(), vol.getIopsReadRateMaxLength(),
+ vol.getIopsWriteRate(), vol.getIopsWriteRateMax(), vol.getIopsWriteRateMaxLength());
storagePoolMgr.disconnectPhysicalDisk(primaryStore.getPoolType(), primaryStore.getUuid(), vol.getPath());
@@ -1287,7 +1339,59 @@ public Answer createVolumeFromSnapshot(final CopyCommand cmd) {
@Override
public Answer deleteSnapshot(final DeleteCommand cmd) {
- return new Answer(cmd);
+ String snap_full_name = "";
+ try {
+ SnapshotObjectTO snapshotTO = (SnapshotObjectTO) cmd.getData();
+ PrimaryDataStoreTO primaryStore = (PrimaryDataStoreTO) snapshotTO.getDataStore();
+ VolumeObjectTO volume = snapshotTO.getVolume();
+ KVMStoragePool primaryPool = storagePoolMgr.getStoragePool(primaryStore.getPoolType(), primaryStore.getUuid());
+ KVMPhysicalDisk disk = storagePoolMgr.getPhysicalDisk(primaryStore.getPoolType(), primaryStore.getUuid(), volume.getPath());
+ String snapshotFullPath = snapshotTO.getPath();
+ String snapshotName = snapshotFullPath.substring(snapshotFullPath.lastIndexOf("/") + 1);
+ snap_full_name = disk.getName() + "@" + snapshotName;
+ if (primaryPool.getType() == StoragePoolType.RBD) {
+ Rados r = new Rados(primaryPool.getAuthUserName());
+ r.confSet("mon_host", primaryPool.getSourceHost() + ":" + primaryPool.getSourcePort());
+ r.confSet("key", primaryPool.getAuthSecret());
+ r.confSet("client_mount_timeout", "30");
+ r.connect();
+ s_logger.debug("Succesfully connected to Ceph cluster at " + r.confGet("mon_host"));
+ IoCTX io = r.ioCtxCreate(primaryPool.getSourceDir());
+ Rbd rbd = new Rbd(io);
+ RbdImage image = rbd.open(disk.getName());
+ try {
+ s_logger.info("Attempting to remove RBD snapshot " + snap_full_name);
+ if (image.snapIsProtected(snapshotName)) {
+ s_logger.debug("Unprotecting RBD snapshot " + snap_full_name);
+ image.snapUnprotect(snapshotName);
+ }
+ image.snapRemove(snapshotName);
+ s_logger.info("Snapshot " + snap_full_name + " successfully removed from " +
+ primaryPool.getType().toString() + " pool.");
+ } catch (RbdException e) {
+ s_logger.error("Failed to remove snapshot " + snap_full_name + ", with exception: " + e.toString() +
+ ", RBD error: " + ErrorCode.getErrorMessage(e.getReturnValue()));
+ } finally {
+ rbd.close(image);
+ r.ioCtxDestroy(io);
+ }
+ } else {
+ s_logger.warn("Operation not implemented for storage pool type of " + primaryPool.getType().toString());
+ throw new InternalErrorException("Operation not implemented for storage pool type of " + primaryPool.getType().toString());
+ }
+ return new Answer(cmd, true, "Snapshot " + snap_full_name + " removed successfully.");
+ } catch (RadosException e) {
+ s_logger.error("Failed to remove snapshot " + snap_full_name + ", with exception: " + e.toString() +
+ ", RBD error: " + ErrorCode.getErrorMessage(e.getReturnValue()));
+ return new Answer(cmd, false, "Failed to remove snapshot " + snap_full_name);
+ } catch (RbdException e) {
+ s_logger.error("Failed to remove snapshot " + snap_full_name + ", with exception: " + e.toString() +
+ ", RBD error: " + ErrorCode.getErrorMessage(e.getReturnValue()));
+ return new Answer(cmd, false, "Failed to remove snapshot " + snap_full_name);
+ } catch (Exception e) {
+ s_logger.error("Failed to remove snapshot " + snap_full_name + ", with exception: " + e.toString());
+ return new Answer(cmd, false, "Failed to remove snapshot " + snap_full_name);
+ }
}
@Override
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
index d7bdab2532d..6e8ba30ea4a 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
@@ -35,6 +35,7 @@
import com.ceph.rados.IoCTX;
import com.ceph.rados.Rados;
+import com.ceph.rados.exceptions.ErrorCode;
import com.ceph.rados.exceptions.RadosException;
import com.ceph.rbd.Rbd;
import com.ceph.rbd.RbdException;
@@ -863,26 +864,36 @@ public boolean deletePhysicalDisk(String uuid, KVMStoragePool pool, Storage.Imag
RbdImage image = rbd.open(uuid);
s_logger.debug("Fetching list of snapshots of RBD image " + pool.getSourceDir() + "/" + uuid);
List<RbdSnapInfo> snaps = image.snapList();
- for (RbdSnapInfo snap : snaps) {
- if (image.snapIsProtected(snap.name)) {
- s_logger.debug("Unprotecting snapshot " + pool.getSourceDir() + "/" + uuid + "@" + snap.name);
- image.snapUnprotect(snap.name);
- } else {
- s_logger.debug("Snapshot " + pool.getSourceDir() + "/" + uuid + "@" + snap.name + " is not protected.");
+ try {
+ for (RbdSnapInfo snap : snaps) {
+ if (image.snapIsProtected(snap.name)) {
+ s_logger.debug("Unprotecting snapshot " + pool.getSourceDir() + "/" + uuid + "@" + snap.name);
+ image.snapUnprotect(snap.name);
+ } else {
+ s_logger.debug("Snapshot " + pool.getSourceDir() + "/" + uuid + "@" + snap.name + " is not protected.");
+ }
+ s_logger.debug("Removing snapshot " + pool.getSourceDir() + "/" + uuid + "@" + snap.name);
+ image.snapRemove(snap.name);
}
- s_logger.debug("Removing snapshot " + pool.getSourceDir() + "/" + uuid + "@" + snap.name);
- image.snapRemove(snap.name);
+ s_logger.info("Succesfully unprotected and removed any remaining snapshots (" + snaps.size() + ") of "
+ + pool.getSourceDir() + "/" + uuid + " Continuing to remove the RBD image");
+ } catch (RbdException e) {
+ s_logger.error("Failed to remove snapshot with exception: " + e.toString() +
+ ", RBD error: " + ErrorCode.getErrorMessage(e.getReturnValue()));
+ throw new CloudRuntimeException(e.toString() + " - " + ErrorCode.getErrorMessage(e.getReturnValue()));
+ } finally {
+ s_logger.debug("Closing image and destroying context");
+ rbd.close(image);
+ r.ioCtxDestroy(io);
}
-
- rbd.close(image);
- r.ioCtxDestroy(io);
-
- s_logger.info("Succesfully unprotected and removed any remaining snapshots (" + snaps.size() + ") of "
- + pool.getSourceDir() + "/" + uuid + " Continuing to remove the RBD image");
} catch (RadosException e) {
- throw new CloudRuntimeException(e.toString());
+ s_logger.error("Failed to remove snapshot with exception: " + e.toString() +
+ ", RBD error: " + ErrorCode.getErrorMessage(e.getReturnValue()));
+ throw new CloudRuntimeException(e.toString() + " - " + ErrorCode.getErrorMessage(e.getReturnValue()));
} catch (RbdException e) {
- throw new CloudRuntimeException(e.toString());
+ s_logger.error("Failed to remove snapshot with exception: " + e.toString() +
+ ", RBD error: " + ErrorCode.getErrorMessage(e.getReturnValue()));
+ throw new CloudRuntimeException(e.toString() + " - " + ErrorCode.getErrorMessage(e.getReturnValue()));
}
}
diff --git a/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtComputingResourceTest.java b/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtComputingResourceTest.java
index a10b477e411..3acea5ea2d6 100644
--- a/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtComputingResourceTest.java
+++ b/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtComputingResourceTest.java
@@ -53,6 +53,7 @@
import org.apache.cloudstack.utils.linux.MemStat;
import org.apache.cloudstack.utils.qemu.QemuImg.PhysicalDiskFormat;
import org.apache.commons.lang.SystemUtils;
+import org.joda.time.Duration;
import org.junit.Assert;
import org.junit.Assume;
import org.junit.Test;
@@ -1623,7 +1624,7 @@ public void testModifySshKeysCommand() {
when(libvirtUtilitiesHelper.retrieveSshPubKeyPath()).thenReturn("/path/pub/keys");
when(libvirtUtilitiesHelper.retrieveSshPrvKeyPath()).thenReturn("/path/pvt/keys");
- when(libvirtComputingResource.getTimeout()).thenReturn(0);
+ when(libvirtComputingResource.getTimeout()).thenReturn(Duration.ZERO);
final LibvirtRequestWrapper wrapper = LibvirtRequestWrapper.getInstance();
assertNotNull(wrapper);
@@ -2179,7 +2180,7 @@ public void testOvsVpcPhysicalTopologyConfigCommand() {
final OvsVpcPhysicalTopologyConfigCommand command = new OvsVpcPhysicalTopologyConfigCommand(hosts, tiers, vms, cidr);
when(libvirtComputingResource.getOvsTunnelPath()).thenReturn("/path");
- when(libvirtComputingResource.getTimeout()).thenReturn(0);
+ when(libvirtComputingResource.getTimeout()).thenReturn(Duration.ZERO);
final LibvirtRequestWrapper wrapper = LibvirtRequestWrapper.getInstance();
@@ -2223,7 +2224,7 @@ public void testOvsVpcRoutingPolicyConfigCommand() {
final OvsVpcRoutingPolicyConfigCommand command = new OvsVpcRoutingPolicyConfigCommand(id, cidr, acls, tiers);
when(libvirtComputingResource.getOvsTunnelPath()).thenReturn("/path");
- when(libvirtComputingResource.getTimeout()).thenReturn(0);
+ when(libvirtComputingResource.getTimeout()).thenReturn(Duration.ZERO);
final LibvirtRequestWrapper wrapper = LibvirtRequestWrapper.getInstance();
@@ -2699,6 +2700,7 @@ public void testOvsCreateTunnelCommand() {
when(libvirtComputingResource.findOrCreateTunnelNetwork(bridge)).thenReturn(true);
when(libvirtComputingResource.configureTunnelNetwork(command.getNetworkId(), command.getFrom(),
command.getNetworkName())).thenReturn(true);
+ when(libvirtComputingResource.getTimeout()).thenReturn(Duration.ZERO);
final LibvirtRequestWrapper wrapper = LibvirtRequestWrapper.getInstance();
assertNotNull(wrapper);
@@ -4273,8 +4275,7 @@ public void testPvlanSetupCommandDhcpAdd() {
final String guestBridgeName = "br0";
when(libvirtComputingResource.getGuestBridgeName()).thenReturn(guestBridgeName);
- final int timeout = 0;
- when(libvirtComputingResource.getTimeout()).thenReturn(timeout);
+ when(libvirtComputingResource.getTimeout()).thenReturn(Duration.ZERO);
final String ovsPvlanDhcpHostPath = "/pvlan";
when(libvirtComputingResource.getOvsPvlanDhcpHostPath()).thenReturn(ovsPvlanDhcpHostPath);
when(libvirtComputingResource.getLibvirtUtilitiesHelper()).thenReturn(libvirtUtilitiesHelper);
@@ -4315,8 +4316,7 @@ public void testPvlanSetupCommandVm() {
final String guestBridgeName = "br0";
when(libvirtComputingResource.getGuestBridgeName()).thenReturn(guestBridgeName);
- final int timeout = 0;
- when(libvirtComputingResource.getTimeout()).thenReturn(timeout);
+ when(libvirtComputingResource.getTimeout()).thenReturn(Duration.ZERO);
final String ovsPvlanVmPath = "/pvlan";
when(libvirtComputingResource.getOvsPvlanVmPath()).thenReturn(ovsPvlanVmPath);
@@ -4345,8 +4345,7 @@ public void testPvlanSetupCommandDhcpException() {
final String guestBridgeName = "br0";
when(libvirtComputingResource.getGuestBridgeName()).thenReturn(guestBridgeName);
- final int timeout = 0;
- when(libvirtComputingResource.getTimeout()).thenReturn(timeout);
+ when(libvirtComputingResource.getTimeout()).thenReturn(Duration.ZERO);
final String ovsPvlanDhcpHostPath = "/pvlan";
when(libvirtComputingResource.getOvsPvlanDhcpHostPath()).thenReturn(ovsPvlanDhcpHostPath);
when(libvirtComputingResource.getLibvirtUtilitiesHelper()).thenReturn(libvirtUtilitiesHelper);
@@ -4387,8 +4386,7 @@ public void testPvlanSetupCommandDhcpDelete() {
final String guestBridgeName = "br0";
when(libvirtComputingResource.getGuestBridgeName()).thenReturn(guestBridgeName);
- final int timeout = 0;
- when(libvirtComputingResource.getTimeout()).thenReturn(timeout);
+ when(libvirtComputingResource.getTimeout()).thenReturn(Duration.ZERO);
final String ovsPvlanDhcpHostPath = "/pvlan";
when(libvirtComputingResource.getOvsPvlanDhcpHostPath()).thenReturn(ovsPvlanDhcpHostPath);
when(libvirtComputingResource.getLibvirtUtilitiesHelper()).thenReturn(libvirtUtilitiesHelper);
diff --git a/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtVMDefTest.java b/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtVMDefTest.java
index a9261291a02..683bdd71724 100644
--- a/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtVMDefTest.java
+++ b/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtVMDefTest.java
@@ -21,6 +21,7 @@
import junit.framework.TestCase;
import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.DiskDef;
+import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.SCSIDef;
import com.cloud.utils.Pair;
public class LibvirtVMDefTest extends TestCase {
@@ -118,4 +119,13 @@ public void testHypervEnlightDef() {
assertTrue((hostOsVersion.first() == 6 && hostOsVersion.second() >= 5) || (hostOsVersion.first() >= 7));
}
+ public void testSCSIDef() {
+ SCSIDef def = new SCSIDef();
+ String str = def.toString();
+ String expected = "<controller type='scsi' index='0' model='virtio-scsi'>\n" +
+ "<address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>\n" +
+ "</controller>\n";
+ assertEquals(str, expected);
+ }
+
}
diff --git a/plugins/hypervisors/ovm/pom.xml b/plugins/hypervisors/ovm/pom.xml
index 2ad537cc3d2..bad97b92875 100644
--- a/plugins/hypervisors/ovm/pom.xml
+++ b/plugins/hypervisors/ovm/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/plugins/hypervisors/ovm3/pom.xml b/plugins/hypervisors/ovm3/pom.xml
index 1bc4ae3e4e1..bfe5ff7cde7 100644
--- a/plugins/hypervisors/ovm3/pom.xml
+++ b/plugins/hypervisors/ovm3/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/plugins/hypervisors/ovm3/src/main/java/com/cloud/hypervisor/ovm3/resources/Ovm3VirtualRoutingResource.java b/plugins/hypervisors/ovm3/src/main/java/com/cloud/hypervisor/ovm3/resources/Ovm3VirtualRoutingResource.java
index 46c60763d27..f99169d8565 100644
--- a/plugins/hypervisors/ovm3/src/main/java/com/cloud/hypervisor/ovm3/resources/Ovm3VirtualRoutingResource.java
+++ b/plugins/hypervisors/ovm3/src/main/java/com/cloud/hypervisor/ovm3/resources/Ovm3VirtualRoutingResource.java
@@ -17,6 +17,8 @@
package com.cloud.hypervisor.ovm3.resources;
+import org.joda.time.Duration;
+
import javax.ejb.Local;
import org.apache.log4j.Logger;
@@ -27,6 +29,7 @@
import com.cloud.agent.api.routing.NetworkElementCommand;
import com.cloud.agent.api.routing.SetSourceNatCommand;
import com.cloud.agent.api.to.IpAddressTO;
+import com.cloud.agent.resource.virtualnetwork.VRScripts;
import com.cloud.agent.resource.virtualnetwork.VirtualRouterDeployer;
import com.cloud.hypervisor.ovm3.objects.CloudstackPlugin;
import com.cloud.hypervisor.ovm3.objects.Connection;
@@ -38,7 +41,6 @@
private final Logger logger = Logger
.getLogger(Ovm3VirtualRoutingResource.class);
private String domRCloudPath = "/opt/cloud/bin/";
- private int vrTimeout = 600;
private Connection c;
private String agentName;
public Ovm3VirtualRoutingResource() {
@@ -53,12 +55,12 @@ public void setConnection(Connection conn) {
@Override
public ExecutionResult executeInVR(String routerIp, String script,
String args) {
- return executeInVR(routerIp, script, args, vrTimeout);
+ return executeInVR(routerIp, script, args, VRScripts.VR_SCRIPT_EXEC_TIMEOUT);
}
@Override
public ExecutionResult executeInVR(String routerIp, String script,
- String args, int timeout) {
+ String args, Duration timeout) {
if (!script.contains(domRCloudPath)) {
script = domRCloudPath + "/" + script;
}
diff --git a/plugins/hypervisors/simulator/pom.xml b/plugins/hypervisors/simulator/pom.xml
index ebe8870591a..ac83d9a3691 100644
--- a/plugins/hypervisors/simulator/pom.xml
+++ b/plugins/hypervisors/simulator/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>cloud-plugin-hypervisor-simulator</artifactId>
diff --git a/plugins/hypervisors/ucs/pom.xml b/plugins/hypervisors/ucs/pom.xml
index ea1536747ad..4418a7cba4f 100755
--- a/plugins/hypervisors/ucs/pom.xml
+++ b/plugins/hypervisors/ucs/pom.xml
@@ -15,7 +15,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>cloud-plugin-hypervisor-ucs</artifactId>
diff --git a/plugins/hypervisors/vmware/pom.xml b/plugins/hypervisors/vmware/pom.xml
index fd0f1709cf7..598ba70fc95 100644
--- a/plugins/hypervisors/vmware/pom.xml
+++ b/plugins/hypervisors/vmware/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
index dd419f2574f..8979e524514 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
@@ -24,6 +24,7 @@
import java.net.URI;
import java.nio.channels.SocketChannel;
import java.rmi.RemoteException;
+import org.joda.time.Duration;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -210,6 +211,7 @@
import com.cloud.agent.api.to.StorageFilerTO;
import com.cloud.agent.api.to.VirtualMachineTO;
import com.cloud.agent.api.to.VolumeTO;
+import com.cloud.agent.resource.virtualnetwork.VRScripts;
import com.cloud.agent.resource.virtualnetwork.VirtualRouterDeployer;
import com.cloud.agent.resource.virtualnetwork.VirtualRoutingResource;
import com.cloud.dc.DataCenter.NetworkType;
@@ -1197,11 +1199,11 @@ private ExecutionResult prepareNetworkElementCommand(IpAssocCommand cmd) {
@Override
public ExecutionResult executeInVR(String routerIP, String script, String args) {
- return executeInVR(routerIP, script, args, 120);
+ return executeInVR(routerIP, script, args, VRScripts.VR_SCRIPT_EXEC_TIMEOUT);
}
@Override
- public ExecutionResult executeInVR(String routerIP, String script, String args, int timeout) {
+ public ExecutionResult executeInVR(String routerIP, String script, String args, Duration timeout) {
Pair<Boolean, String> result;
//TODO: Password should be masked, cannot output to log directly
@@ -1212,7 +1214,7 @@ public ExecutionResult executeInVR(String routerIP, String script, String args,
try {
VmwareManager mgr = getServiceContext().getStockObject(VmwareManager.CONTEXT_STOCK_NAME);
result = SshHelper.sshExecute(routerIP, DefaultDomRSshPort, "root", mgr.getSystemVMKeyFile(), null, "/opt/cloud/bin/" + script + " " + args,
- 60000, 60000, timeout * 1000);
+ VRScripts.CONNECTION_TIMEOUT, VRScripts.CONNECTION_TIMEOUT, timeout);
} catch (Exception e) {
String msg = "Command failed due to " + VmwareHelper.getExceptionMessage(e);
s_logger.error(msg);
diff --git a/plugins/hypervisors/xenserver/pom.xml b/plugins/hypervisors/xenserver/pom.xml
index 6f86a5c0bc7..8607baf30c7 100644
--- a/plugins/hypervisors/xenserver/pom.xml
+++ b/plugins/hypervisors/xenserver/pom.xml
@@ -16,7 +16,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
index 7c8bca7f1bd..ed86f75e496 100644
--- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
+++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
@@ -29,6 +29,7 @@
import java.net.URL;
import java.net.URLConnection;
import java.nio.charset.Charset;
+import org.joda.time.Duration;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
@@ -97,6 +98,7 @@
import com.cloud.agent.api.to.NfsTO;
import com.cloud.agent.api.to.NicTO;
import com.cloud.agent.api.to.VirtualMachineTO;
+import com.cloud.agent.resource.virtualnetwork.VRScripts;
import com.cloud.agent.resource.virtualnetwork.VirtualRouterDeployer;
import com.cloud.agent.resource.virtualnetwork.VirtualRoutingResource;
import com.cloud.exception.InternalErrorException;
@@ -1652,18 +1654,18 @@ public StopAnswer execute(final StopCommand cmd) {
@Override
public ExecutionResult executeInVR(final String routerIP, final String script, final String args) {
// Timeout is 120 seconds by default
- return executeInVR(routerIP, script, args, 120);
+ return executeInVR(routerIP, script, args, VRScripts.VR_SCRIPT_EXEC_TIMEOUT);
}
@Override
- public ExecutionResult executeInVR(final String routerIP, final String script, final String args, final int timeout) {
+ public ExecutionResult executeInVR(final String routerIP, final String script, final String args, final Duration timeout) {
Pair<Boolean, String> result;
String cmdline = "/opt/cloud/bin/router_proxy.sh " + script + " " + routerIP + " " + args;
// semicolon need to be escape for bash
cmdline = cmdline.replaceAll(";", "\\\\;");
try {
s_logger.debug("Executing command in VR: " + cmdline);
- result = SshHelper.sshExecute(_host.getIp(), 22, _username, null, _password.peek(), cmdline, 60000, 60000, timeout * 1000);
+ result = SshHelper.sshExecute(_host.getIp(), 22, _username, null, _password.peek(), cmdline, VRScripts.CONNECTION_TIMEOUT, VRScripts.CONNECTION_TIMEOUT, timeout);
} catch (final Exception e) {
return new ExecutionResult(false, e.getMessage());
}
diff --git a/plugins/network-elements/bigswitch/pom.xml b/plugins/network-elements/bigswitch/pom.xml
index 699c85f4db5..c4147d862ec 100644
--- a/plugins/network-elements/bigswitch/pom.xml
+++ b/plugins/network-elements/bigswitch/pom.xml
@@ -25,7 +25,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<build>
diff --git a/plugins/network-elements/brocade-vcs/pom.xml b/plugins/network-elements/brocade-vcs/pom.xml
index c4d28d8394d..a056a73af9f 100644
--- a/plugins/network-elements/brocade-vcs/pom.xml
+++ b/plugins/network-elements/brocade-vcs/pom.xml
@@ -16,7 +16,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
diff --git a/plugins/network-elements/cisco-vnmc/pom.xml b/plugins/network-elements/cisco-vnmc/pom.xml
index 12a994e8ac0..8ec41f39aa9 100644
--- a/plugins/network-elements/cisco-vnmc/pom.xml
+++ b/plugins/network-elements/cisco-vnmc/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/plugins/network-elements/dns-notifier/pom.xml b/plugins/network-elements/dns-notifier/pom.xml
index 0f58b883edc..5ea6cd1ea1e 100644
--- a/plugins/network-elements/dns-notifier/pom.xml
+++ b/plugins/network-elements/dns-notifier/pom.xml
@@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>cloud-plugin-example-dns-notifier</artifactId>
diff --git a/plugins/network-elements/elastic-loadbalancer/pom.xml b/plugins/network-elements/elastic-loadbalancer/pom.xml
index ddb00d31ac1..8af08fffda6 100644
--- a/plugins/network-elements/elastic-loadbalancer/pom.xml
+++ b/plugins/network-elements/elastic-loadbalancer/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
</project>
diff --git a/plugins/network-elements/f5/pom.xml b/plugins/network-elements/f5/pom.xml
index 571f5296852..e563e4cb3d6 100644
--- a/plugins/network-elements/f5/pom.xml
+++ b/plugins/network-elements/f5/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/plugins/network-elements/globodns/pom.xml b/plugins/network-elements/globodns/pom.xml
index 73d40d1ac35..133b31cc754 100644
--- a/plugins/network-elements/globodns/pom.xml
+++ b/plugins/network-elements/globodns/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/plugins/network-elements/internal-loadbalancer/pom.xml b/plugins/network-elements/internal-loadbalancer/pom.xml
index c9d7e7e06a4..d848349ab64 100644
--- a/plugins/network-elements/internal-loadbalancer/pom.xml
+++ b/plugins/network-elements/internal-loadbalancer/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<build>
diff --git a/plugins/network-elements/juniper-contrail/pom.xml b/plugins/network-elements/juniper-contrail/pom.xml
index f493b423b8f..20ea0492b3b 100644
--- a/plugins/network-elements/juniper-contrail/pom.xml
+++ b/plugins/network-elements/juniper-contrail/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<repositories>
diff --git a/plugins/network-elements/juniper-srx/pom.xml b/plugins/network-elements/juniper-srx/pom.xml
index 9e2833b7299..c5af6ba0aee 100644
--- a/plugins/network-elements/juniper-srx/pom.xml
+++ b/plugins/network-elements/juniper-srx/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/plugins/network-elements/midonet/pom.xml b/plugins/network-elements/midonet/pom.xml
index b57a4826555..f48c0c08f1f 100644
--- a/plugins/network-elements/midonet/pom.xml
+++ b/plugins/network-elements/midonet/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<repositories>
diff --git a/plugins/network-elements/netscaler/pom.xml b/plugins/network-elements/netscaler/pom.xml
index 4bc747dfde0..dbe871b8d06 100644
--- a/plugins/network-elements/netscaler/pom.xml
+++ b/plugins/network-elements/netscaler/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/plugins/network-elements/nicira-nvp/pom.xml b/plugins/network-elements/nicira-nvp/pom.xml
index e86fdf10ef6..98f6300fdd4 100644
--- a/plugins/network-elements/nicira-nvp/pom.xml
+++ b/plugins/network-elements/nicira-nvp/pom.xml
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
@@ -34,7 +34,7 @@
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-utils</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
diff --git a/plugins/network-elements/nuage-vsp/pom.xml b/plugins/network-elements/nuage-vsp/pom.xml
index b254cbccd33..513af1df2f3 100644
--- a/plugins/network-elements/nuage-vsp/pom.xml
+++ b/plugins/network-elements/nuage-vsp/pom.xml
@@ -25,7 +25,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/plugins/network-elements/opendaylight/pom.xml b/plugins/network-elements/opendaylight/pom.xml
index 167375a2caa..8ab609bc0e2 100644
--- a/plugins/network-elements/opendaylight/pom.xml
+++ b/plugins/network-elements/opendaylight/pom.xml
@@ -25,7 +25,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
diff --git a/plugins/network-elements/ovs/pom.xml b/plugins/network-elements/ovs/pom.xml
index 26f98732687..82cc5c8c82c 100644
--- a/plugins/network-elements/ovs/pom.xml
+++ b/plugins/network-elements/ovs/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
</project>
diff --git a/plugins/network-elements/palo-alto/pom.xml b/plugins/network-elements/palo-alto/pom.xml
index 5719acfbe3b..db31c0fe7bf 100644
--- a/plugins/network-elements/palo-alto/pom.xml
+++ b/plugins/network-elements/palo-alto/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
</project>
diff --git a/plugins/network-elements/stratosphere-ssp/pom.xml b/plugins/network-elements/stratosphere-ssp/pom.xml
index 6d57670d551..6f16cb2f890 100644
--- a/plugins/network-elements/stratosphere-ssp/pom.xml
+++ b/plugins/network-elements/stratosphere-ssp/pom.xml
@@ -25,7 +25,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
</project>
diff --git a/plugins/network-elements/vxlan/pom.xml b/plugins/network-elements/vxlan/pom.xml
index c31b72f7921..c41834e786c 100644
--- a/plugins/network-elements/vxlan/pom.xml
+++ b/plugins/network-elements/vxlan/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
</project>
diff --git a/plugins/pom.xml b/plugins/pom.xml
index 530245c5460..00cc5767612 100755
--- a/plugins/pom.xml
+++ b/plugins/pom.xml
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
</parent>
<build>
diff --git a/plugins/storage-allocators/random/pom.xml b/plugins/storage-allocators/random/pom.xml
index 960aa1f0cd1..aafbf81fdfb 100644
--- a/plugins/storage-allocators/random/pom.xml
+++ b/plugins/storage-allocators/random/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/plugins/storage/image/default/pom.xml b/plugins/storage/image/default/pom.xml
index 48a544ae38d..055bd25a355 100644
--- a/plugins/storage/image/default/pom.xml
+++ b/plugins/storage/image/default/pom.xml
@@ -16,7 +16,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/plugins/storage/image/s3/pom.xml b/plugins/storage/image/s3/pom.xml
index d7f8d4f4484..ae11f25e180 100644
--- a/plugins/storage/image/s3/pom.xml
+++ b/plugins/storage/image/s3/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/plugins/storage/image/sample/pom.xml b/plugins/storage/image/sample/pom.xml
index 961a36750df..6e03512c4b7 100644
--- a/plugins/storage/image/sample/pom.xml
+++ b/plugins/storage/image/sample/pom.xml
@@ -16,7 +16,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/plugins/storage/image/swift/pom.xml b/plugins/storage/image/swift/pom.xml
index 3365e7775dc..4c4a35806db 100644
--- a/plugins/storage/image/swift/pom.xml
+++ b/plugins/storage/image/swift/pom.xml
@@ -16,7 +16,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/plugins/storage/volume/cloudbyte/pom.xml b/plugins/storage/volume/cloudbyte/pom.xml
index a762cec1090..7f70adf6a1a 100755
--- a/plugins/storage/volume/cloudbyte/pom.xml
+++ b/plugins/storage/volume/cloudbyte/pom.xml
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/plugins/storage/volume/default/pom.xml b/plugins/storage/volume/default/pom.xml
index 17500d7cb6c..2b661529730 100644
--- a/plugins/storage/volume/default/pom.xml
+++ b/plugins/storage/volume/default/pom.xml
@@ -16,7 +16,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/plugins/storage/volume/nexenta/pom.xml b/plugins/storage/volume/nexenta/pom.xml
index 04556c1b8a8..087a257dfb0 100644
--- a/plugins/storage/volume/nexenta/pom.xml
+++ b/plugins/storage/volume/nexenta/pom.xml
@@ -16,7 +16,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/plugins/storage/volume/sample/pom.xml b/plugins/storage/volume/sample/pom.xml
index c26d574142a..7e10322848f 100644
--- a/plugins/storage/volume/sample/pom.xml
+++ b/plugins/storage/volume/sample/pom.xml
@@ -16,7 +16,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/plugins/storage/volume/solidfire/pom.xml b/plugins/storage/volume/solidfire/pom.xml
index fb7ecdf74db..d2039689c5b 100644
--- a/plugins/storage/volume/solidfire/pom.xml
+++ b/plugins/storage/volume/solidfire/pom.xml
@@ -16,7 +16,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/plugins/user-authenticators/ldap/pom.xml b/plugins/user-authenticators/ldap/pom.xml
index 95e7824accf..b63653c1982 100644
--- a/plugins/user-authenticators/ldap/pom.xml
+++ b/plugins/user-authenticators/ldap/pom.xml
@@ -15,7 +15,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
diff --git a/plugins/user-authenticators/md5/pom.xml b/plugins/user-authenticators/md5/pom.xml
index 29199a7de58..e72f63874bc 100644
--- a/plugins/user-authenticators/md5/pom.xml
+++ b/plugins/user-authenticators/md5/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
</project>
diff --git a/plugins/user-authenticators/pbkdf2/pom.xml b/plugins/user-authenticators/pbkdf2/pom.xml
index 1f622934766..7e54a93882a 100644
--- a/plugins/user-authenticators/pbkdf2/pom.xml
+++ b/plugins/user-authenticators/pbkdf2/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
</project>
diff --git a/plugins/user-authenticators/plain-text/pom.xml b/plugins/user-authenticators/plain-text/pom.xml
index c64f6fce9d3..4048b228657 100644
--- a/plugins/user-authenticators/plain-text/pom.xml
+++ b/plugins/user-authenticators/plain-text/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
</project>
diff --git a/plugins/user-authenticators/saml2/pom.xml b/plugins/user-authenticators/saml2/pom.xml
index f7b6140c635..c13fc64a4b8 100644
--- a/plugins/user-authenticators/saml2/pom.xml
+++ b/plugins/user-authenticators/saml2/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/plugins/user-authenticators/sha256salted/pom.xml b/plugins/user-authenticators/sha256salted/pom.xml
index 3713ab2ba5f..273db2716bb 100644
--- a/plugins/user-authenticators/sha256salted/pom.xml
+++ b/plugins/user-authenticators/sha256salted/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-plugins</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
</project>
diff --git a/pom.xml b/pom.xml
index 5c81b3fd1b8..f7d87904b2a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -30,7 +30,7 @@
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<packaging>pom</packaging>
<name>Apache CloudStack</name>
<description>Apache CloudStack is an IaaS (“Infrastructure as a Service”) cloud orchestration platform.</description>
diff --git a/quickcloud/pom.xml b/quickcloud/pom.xml
index a1ec781c949..7f2bb3d55f1 100644
--- a/quickcloud/pom.xml
+++ b/quickcloud/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-maven-standard</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../maven-standard/pom.xml</relativePath>
</parent>
</project>
diff --git a/server/pom.xml b/server/pom.xml
index 0656541f080..cb07047a586 100644
--- a/server/pom.xml
+++ b/server/pom.xml
@@ -15,7 +15,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
</parent>
<dependencies>
<dependency>
diff --git a/server/src/com/cloud/api/ApiServer.java b/server/src/com/cloud/api/ApiServer.java
index 689ae9c6752..5c2c7ba5b1e 100644
--- a/server/src/com/cloud/api/ApiServer.java
+++ b/server/src/com/cloud/api/ApiServer.java
@@ -147,6 +147,7 @@
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InterruptedIOException;
+import java.lang.reflect.Type;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
@@ -174,6 +175,7 @@
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import com.google.gson.reflect.TypeToken;
@Component
public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiServerService {
@@ -264,10 +266,11 @@ private void handleAsyncJobPublishEvent(String subject, String senderAddress, Ob
String info = job.getCmdInfo();
String cmdEventType = "unknown";
if (info != null) {
- String marker = "\"cmdEventType\"";
- int begin = info.indexOf(marker);
- if (begin >= 0) {
- cmdEventType = info.substring(begin + marker.length() + 2, info.indexOf(",", begin) - 1);
+ Type type = new TypeToken<Map<String, String>>(){}.getType();
+ Map<String, String> cmdInfo = ApiGsonHelper.getBuilder().create().fromJson(info, type);
+ String eventTypeObj = cmdInfo.get("cmdEventType");
+ if (eventTypeObj != null) {
+ cmdEventType = eventTypeObj;
if (s_logger.isDebugEnabled())
s_logger.debug("Retrieved cmdEventType from job info: " + cmdEventType);
diff --git a/server/src/com/cloud/api/query/dao/DiskOfferingJoinDaoImpl.java b/server/src/com/cloud/api/query/dao/DiskOfferingJoinDaoImpl.java
index 9ca44872fec..b46fbd0deb6 100644
--- a/server/src/com/cloud/api/query/dao/DiskOfferingJoinDaoImpl.java
+++ b/server/src/com/cloud/api/query/dao/DiskOfferingJoinDaoImpl.java
@@ -73,9 +73,17 @@ public DiskOfferingResponse newDiskOfferingResponse(DiskOfferingJoinVO offering)
diskOfferingResponse.setHypervisorSnapshotReserve(offering.getHypervisorSnapshotReserve());
diskOfferingResponse.setStorageType(offering.isUseLocalStorage() ? ServiceOffering.StorageType.local.toString() : ServiceOffering.StorageType.shared.toString());
diskOfferingResponse.setBytesReadRate(offering.getBytesReadRate());
+ diskOfferingResponse.setBytesReadRateMax(offering.getBytesReadRateMax());
+ diskOfferingResponse.setBytesReadRateMaxLength(offering.getBytesReadRateMaxLength());
diskOfferingResponse.setBytesWriteRate(offering.getBytesWriteRate());
+ diskOfferingResponse.setBytesWriteRateMax(offering.getBytesWriteRateMax());
+ diskOfferingResponse.setBytesWriteRateMaxLength(offering.getBytesWriteRateMaxLength());
diskOfferingResponse.setIopsReadRate(offering.getIopsReadRate());
+ diskOfferingResponse.setIopsReadRateMax(offering.getIopsReadRateMax());
+ diskOfferingResponse.setIopsReadRateMaxLength(offering.getIopsReadRateMaxLength());
diskOfferingResponse.setIopsWriteRate(offering.getIopsWriteRate());
+ diskOfferingResponse.setIopsWriteRateMax(offering.getIopsWriteRateMax());
+ diskOfferingResponse.setIopsWriteRateMaxLength(offering.getIopsWriteRateMaxLength());
diskOfferingResponse.setCacheMode(offering.getCacheMode());
diskOfferingResponse.setObjectName("diskoffering");
diff --git a/server/src/com/cloud/api/query/dao/DomainJoinDaoImpl.java b/server/src/com/cloud/api/query/dao/DomainJoinDaoImpl.java
index be3f5b4126d..6aecb8159dd 100644
--- a/server/src/com/cloud/api/query/dao/DomainJoinDaoImpl.java
+++ b/server/src/com/cloud/api/query/dao/DomainJoinDaoImpl.java
@@ -110,7 +110,7 @@ public void setResourceLimits(DomainJoinVO domain, boolean fullView, ResourceLim
long volumeLimit = ApiDBUtils.findCorrectResourceLimitForDomain(domain.getVolumeLimit(), fullView, ResourceType.volume, domain.getId());
String volumeLimitDisplay = (fullView || volumeLimit == -1) ? "Unlimited" : String.valueOf(volumeLimit);
- long volumeTotal = (domain.getVolumeTotal() == 0) ? 0 : domain.getVolumeTotal();
+ long volumeTotal = (domain.getVolumeTotal() == null) ? 0 : domain.getVolumeTotal();
String volumeAvail = (fullView || volumeLimit == -1) ? "Unlimited" : String.valueOf(volumeLimit - volumeTotal);
response.setVolumeLimit(volumeLimitDisplay);
response.setVolumeTotal(volumeTotal);
diff --git a/server/src/com/cloud/api/query/dao/TemplateJoinDaoImpl.java b/server/src/com/cloud/api/query/dao/TemplateJoinDaoImpl.java
index 5444eca6ba5..dc6419e58b0 100644
--- a/server/src/com/cloud/api/query/dao/TemplateJoinDaoImpl.java
+++ b/server/src/com/cloud/api/query/dao/TemplateJoinDaoImpl.java
@@ -291,6 +291,7 @@ public TemplateResponse newIsoResponse(TemplateJoinVO iso) {
isoResponse.setOsTypeId(iso.getGuestOSUuid());
isoResponse.setOsTypeName(iso.getGuestOSName());
+ isoResponse.setBits(iso.getBits());
// populate owner.
ApiResponseHelper.populateOwner(isoResponse, iso);
diff --git a/server/src/com/cloud/api/query/vo/DiskOfferingJoinVO.java b/server/src/com/cloud/api/query/vo/DiskOfferingJoinVO.java
index e846b0b646f..7651b1989cd 100644
--- a/server/src/com/cloud/api/query/vo/DiskOfferingJoinVO.java
+++ b/server/src/com/cloud/api/query/vo/DiskOfferingJoinVO.java
@@ -83,15 +83,39 @@
@Column(name = "bytes_read_rate")
Long bytesReadRate;
+ @Column(name = "bytes_read_rate_max")
+ Long bytesReadRateMax;
+
+ @Column(name = "bytes_read_rate_max_length")
+ Long bytesReadRateMaxLength;
+
@Column(name = "bytes_write_rate")
Long bytesWriteRate;
+ @Column(name = "bytes_write_rate_max")
+ Long bytesWriteRateMax;
+
+ @Column(name = "bytes_write_rate_max_length")
+ Long bytesWriteRateMaxLength;
+
@Column(name = "iops_read_rate")
Long iopsReadRate;
+ @Column(name = "iops_read_rate_max")
+ Long iopsReadRateMax;
+
+ @Column(name = "iops_read_rate_max_length")
+ Long iopsReadRateMaxLength;
+
@Column(name = "iops_write_rate")
Long iopsWriteRate;
+ @Column(name = "iops_write_rate_max")
+ Long iopsWriteRateMax;
+
+ @Column(name = "iops_write_rate_max_length")
+ Long iopsWriteRateMaxLength;
+
@Column(name = "cache_mode")
String cacheMode;
@@ -228,15 +252,31 @@ public Long getBytesReadRate() {
return bytesReadRate;
}
+ public Long getBytesReadRateMax() { return bytesReadRateMax; }
+
+ public Long getBytesReadRateMaxLength() { return bytesReadRateMaxLength; }
+
public Long getBytesWriteRate() {
return bytesWriteRate;
}
+ public Long getBytesWriteRateMax() { return bytesWriteRateMax; }
+
+ public Long getBytesWriteRateMaxLength() { return bytesWriteRateMaxLength; }
+
public Long getIopsReadRate() {
return iopsReadRate;
}
+ public Long getIopsReadRateMax() { return iopsReadRateMax; }
+
+ public Long getIopsReadRateMaxLength() { return iopsReadRateMaxLength; }
+
public Long getIopsWriteRate() {
return iopsWriteRate;
}
+
+ public Long getIopsWriteRateMax() { return iopsWriteRateMax; }
+
+ public Long getIopsWriteRateMaxLength() { return iopsWriteRateMaxLength; }
}
diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java
index 600ecc4ac53..df41085acdf 100644
--- a/server/src/com/cloud/configuration/Config.java
+++ b/server/src/com/cloud/configuration/Config.java
@@ -512,7 +512,7 @@
null),
SnapshotDeltaMax("Snapshots", SnapshotManager.class, Integer.class, "snapshot.delta.max", "16", "max delta snapshots between two full snapshots.", null),
BackupSnapshotAfterTakingSnapshot(
- "Hidden",
+ "Snapshots",
SnapshotManager.class,
Boolean.class,
"snapshot.backup.rightafter",
@@ -1954,6 +1954,15 @@
"the interval cloudstack sync with UCS manager for available blades in case user remove blades from chassis without notifying CloudStack",
null),
+ AllowShowHiddenConfigViaApi(
+ "Advanced",
+ ManagementServer.class,
+ Boolean.class,
+ "com.cloud.configuration.allowshowhidden",
+ "false",
+ "Whether or not to allow showing hidden values via api",
+ null),
+
RedundantRouterVrrpInterval(
"Advanced",
NetworkOrchestrationService.class,
diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
index f8a1fac90fd..cb6744dfeed 100644
--- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
@@ -2231,7 +2231,10 @@ public ServiceOffering updateServiceOffering(final UpdateServiceOfferingCmd cmd)
protected DiskOfferingVO createDiskOffering(final Long userId, final Long domainId, final String name, final String description, final String provisioningType,
final Long numGibibytes, String tags, boolean isCustomized, final boolean localStorageRequired,
final boolean isDisplayOfferingEnabled, final Boolean isCustomizedIops, Long minIops, Long maxIops,
- Long bytesReadRate, Long bytesWriteRate, Long iopsReadRate, Long iopsWriteRate,
+ Long bytesReadRate, Long bytesReadRateMax, Long bytesReadRateMaxLength,
+ Long bytesWriteRate, Long bytesWriteRateMax, Long bytesWriteRateMaxLength,
+ Long iopsReadRate, Long iopsReadRateMax, Long iopsReadRateMaxLength,
+ Long iopsWriteRate, Long iopsWriteRateMax, Long iopsWriteRateMaxLength,
final Integer hypervisorSnapshotReserve) {
long diskSize = 0;// special case for custom disk offerings
if (numGibibytes != null && numGibibytes <= 0) {
@@ -2251,9 +2254,17 @@ protected DiskOfferingVO createDiskOffering(final Long userId, final Long domain
if (isCustomizedIops != null) {
bytesReadRate = null;
+ bytesReadRateMax = null;
+ bytesReadRateMaxLength = null;
bytesWriteRate = null;
+ bytesWriteRateMax = null;
+ bytesWriteRateMaxLength = null;
iopsReadRate = null;
+ iopsReadRateMax = null;
+ iopsReadRateMaxLength = null;
iopsWriteRate = null;
+ iopsWriteRateMax = null;
+ iopsWriteRateMaxLength = null;
if (isCustomizedIops) {
minIops = null;
@@ -2310,15 +2321,39 @@ protected DiskOfferingVO createDiskOffering(final Long userId, final Long domain
if (bytesReadRate != null && bytesReadRate > 0) {
newDiskOffering.setBytesReadRate(bytesReadRate);
}
+ if (bytesReadRateMax != null && bytesReadRateMax > 0) {
+ newDiskOffering.setBytesReadRateMax(bytesReadRateMax);
+ }
+ if (bytesReadRateMaxLength != null && bytesReadRateMaxLength > 0) {
+ newDiskOffering.setBytesReadRateMaxLength(bytesReadRateMaxLength);
+ }
if (bytesWriteRate != null && bytesWriteRate > 0) {
newDiskOffering.setBytesWriteRate(bytesWriteRate);
}
+ if (bytesWriteRateMax != null && bytesWriteRateMax > 0) {
+ newDiskOffering.setBytesWriteRateMax(bytesWriteRateMax);
+ }
+ if (bytesWriteRateMaxLength != null && bytesWriteRateMaxLength > 0) {
+ newDiskOffering.setBytesWriteRateMaxLength(bytesWriteRateMaxLength);
+ }
if (iopsReadRate != null && iopsReadRate > 0) {
newDiskOffering.setIopsReadRate(iopsReadRate);
}
+ if (iopsReadRateMax != null && iopsReadRateMax > 0) {
+ newDiskOffering.setIopsReadRateMax(iopsReadRateMax);
+ }
+ if (iopsReadRateMaxLength != null && iopsReadRateMaxLength > 0) {
+ newDiskOffering.setIopsReadRateMaxLength(iopsReadRateMaxLength);
+ }
if (iopsWriteRate != null && iopsWriteRate > 0) {
newDiskOffering.setIopsWriteRate(iopsWriteRate);
}
+ if (iopsWriteRateMax != null && iopsWriteRateMax > 0) {
+ newDiskOffering.setIopsWriteRateMax(iopsWriteRateMax);
+ }
+ if (iopsWriteRateMaxLength != null && iopsWriteRateMaxLength > 0) {
+ newDiskOffering.setIopsWriteRateMaxLength(iopsWriteRateMaxLength);
+ }
if (hypervisorSnapshotReserve != null && hypervisorSnapshotReserve < 0) {
throw new InvalidParameterValueException("If provided, Hypervisor Snapshot Reserve must be greater than or equal to 0.");
@@ -2376,15 +2411,25 @@ public DiskOffering createDiskOffering(final CreateDiskOfferingCmd cmd) {
final Long minIops = cmd.getMinIops();
final Long maxIops = cmd.getMaxIops();
final Long bytesReadRate = cmd.getBytesReadRate();
+ final Long bytesReadRateMax = cmd.getBytesReadRateMax();
+ final Long bytesReadRateMaxLength = cmd.getBytesReadRateMaxLength();
final Long bytesWriteRate = cmd.getBytesWriteRate();
+ final Long bytesWriteRateMax = cmd.getBytesWriteRateMax();
+ final Long bytesWriteRateMaxLength = cmd.getBytesWriteRateMaxLength();
final Long iopsReadRate = cmd.getIopsReadRate();
+ final Long iopsReadRateMax = cmd.getIopsReadRateMax();
+ final Long iopsReadRateMaxLength = cmd.getIopsReadRateMaxLength();
final Long iopsWriteRate = cmd.getIopsWriteRate();
+ final Long iopsWriteRateMax = cmd.getIopsWriteRateMax();
+ final Long iopsWriteRateMaxLength = cmd.getIopsWriteRateMaxLength();
final Integer hypervisorSnapshotReserve = cmd.getHypervisorSnapshotReserve();
final Long userId = CallContext.current().getCallingUserId();
return createDiskOffering(userId, domainId, name, description, provisioningType, numGibibytes, tags, isCustomized,
localStorageRequired, isDisplayOfferingEnabled, isCustomizedIops, minIops,
- maxIops, bytesReadRate, bytesWriteRate, iopsReadRate, iopsWriteRate, hypervisorSnapshotReserve);
+ maxIops, bytesReadRate, bytesReadRateMax, bytesReadRateMaxLength, bytesWriteRate, bytesWriteRateMax, bytesWriteRateMaxLength,
+ iopsReadRate, iopsReadRateMax, iopsReadRateMaxLength, iopsWriteRate, iopsWriteRateMax, iopsWriteRateMaxLength,
+ hypervisorSnapshotReserve);
}
@Override
diff --git a/server/src/com/cloud/network/IpAddressManagerImpl.java b/server/src/com/cloud/network/IpAddressManagerImpl.java
index d4da5fae24c..2dc04d5e823 100644
--- a/server/src/com/cloud/network/IpAddressManagerImpl.java
+++ b/server/src/com/cloud/network/IpAddressManagerImpl.java
@@ -562,7 +562,7 @@ protected boolean cleanupIpResources(long ipId, long userId, Account caller) {
// the code would be triggered
s_logger.debug("Cleaning up remote access vpns as a part of public IP id=" + ipId + " release...");
try {
- _vpnMgr.destroyRemoteAccessVpnForIp(ipId, caller);
+ _vpnMgr.destroyRemoteAccessVpnForIp(ipId, caller,false);
} catch (ResourceUnavailableException e) {
s_logger.warn("Unable to destroy remote access vpn for ip id=" + ipId + " as a part of ip release", e);
success = false;
@@ -1698,6 +1698,22 @@ public String acquireGuestIpAddress(Network network, String requestedIp) {
Random _rand = new Random(System.currentTimeMillis());
+ /**
+ * Get the list of public IPs that need to be applied for a static NAT enable/disable operation.
+ * Manipulating only these ips prevents concurrency issues when disabling static nat at the same time.
+ * @param staticNats
+ * @return The list of IPs that need to be applied for the static NAT to work.
+ */
+ public List<IPAddressVO> getStaticNatSourceIps(List<? extends StaticNat> staticNats) {
+ List<IPAddressVO> userIps = new ArrayList<>();
+
+ for (StaticNat snat : staticNats) {
+ userIps.add(_ipAddressDao.findById(snat.getSourceIpAddressId()));
+ }
+
+ return userIps;
+ }
+
@Override
public boolean applyStaticNats(List<? extends StaticNat> staticNats, boolean continueOnError, boolean forRevoke) throws ResourceUnavailableException {
if (staticNats == null || staticNats.size() == 0) {
@@ -1714,8 +1730,8 @@ public boolean applyStaticNats(List<? extends StaticNat> staticNats, boolean con
return true;
}
- // get the list of public ip's owned by the network
- List<IPAddressVO> userIps = _ipAddressDao.listByAssociatedNetwork(network.getId(), null);
+ List<IPAddressVO> userIps = getStaticNatSourceIps(staticNats);
+
List<PublicIp> publicIps = new ArrayList<PublicIp>();
if (userIps != null && !userIps.isEmpty()) {
for (IPAddressVO userIp : userIps) {
@@ -1881,7 +1897,9 @@ public void doInTransactionWithoutResult(TransactionStatus status) throws Insuff
nic.setBroadcastUri(BroadcastDomainType.Vlan.toUri(ip.getVlanTag()));
nic.setFormat(AddressFormat.Ip4);
nic.setReservationId(String.valueOf(ip.getVlanTag()));
- nic.setMacAddress(ip.getMacAddress());
+ if (nic.getMacAddress() == null) {
+ nic.setMacAddress(ip.getMacAddress());
+ }
}
nic.setIPv4Dns1(dc.getDns1());
nic.setIPv4Dns2(dc.getDns2());
@@ -1953,8 +1971,9 @@ public void doInTransactionWithoutResult(TransactionStatus status) throws Insuff
nic.setBroadcastUri(network.getBroadcastUri());
nic.setFormat(AddressFormat.Ip4);
-
- nic.setMacAddress(_networkModel.getNextAvailableMacAddressInNetwork(network.getId()));
+ if(nic.getMacAddress() == null) {
+ nic.setMacAddress(_networkModel.getNextAvailableMacAddressInNetwork(network.getId()));
+ }
}
nic.setIPv4Dns1(dc.getDns1());
nic.setIPv4Dns2(dc.getDns2());
diff --git a/server/src/com/cloud/network/NetworkModelImpl.java b/server/src/com/cloud/network/NetworkModelImpl.java
index f3e25e8695b..5dfc02fbd45 100644
--- a/server/src/com/cloud/network/NetworkModelImpl.java
+++ b/server/src/com/cloud/network/NetworkModelImpl.java
@@ -60,6 +60,7 @@
import com.cloud.network.IpAddress.State;
import com.cloud.network.Network.Capability;
import com.cloud.network.Network.GuestType;
+import com.cloud.network.Network.IpAddresses;
import com.cloud.network.Network.Provider;
import com.cloud.network.Network.Service;
import com.cloud.network.Networks.TrafficType;
@@ -2140,7 +2141,10 @@ public void checkIp6Parameters(String startIPv6, String endIPv6, String ip6Gatew
}
@Override
- public void checkRequestedIpAddresses(long networkId, String ip4, String ip6) throws InvalidParameterValueException {
+ public void checkRequestedIpAddresses(long networkId, IpAddresses ips) throws InvalidParameterValueException {
+ String ip4 = ips.getIp4Address();
+ String ip6 = ips.getIp6Address();
+ String mac = ips.getMacAddress();
if (ip4 != null) {
if (!NetUtils.isValidIp(ip4)) {
throw new InvalidParameterValueException("Invalid specified IPv4 address " + ip4);
@@ -2169,6 +2173,15 @@ public void checkRequestedIpAddresses(long networkId, String ip4, String ip6) th
throw new InvalidParameterValueException("Requested IPv6 is not in the predefined range!");
}
}
+ if (mac != null) {
+ if(!NetUtils.isValidMac(mac)) {
+ throw new InvalidParameterValueException("Invalid specified MAC address " + mac);
+ }
+ if (_nicDao.findByNetworkIdAndMacAddress(networkId, mac) != null) {
+ throw new InvalidParameterValueException("The requested Mac address is already taken! " + mac);
+ }
+
+ }
}
@Override
diff --git a/server/src/com/cloud/network/NetworkServiceImpl.java b/server/src/com/cloud/network/NetworkServiceImpl.java
index b6dac872f30..cade54f088c 100644
--- a/server/src/com/cloud/network/NetworkServiceImpl.java
+++ b/server/src/com/cloud/network/NetworkServiceImpl.java
@@ -39,6 +39,7 @@
import javax.inject.Inject;
import javax.naming.ConfigurationException;
+import com.cloud.network.router.VirtualRouter;
import org.apache.cloudstack.acl.ControlledEntity.ACLType;
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
import org.apache.cloudstack.api.ApiConstants;
@@ -108,6 +109,8 @@
import com.cloud.network.dao.IPAddressVO;
import com.cloud.network.dao.LoadBalancerVMMapDao;
import com.cloud.network.dao.NetworkDao;
+import com.cloud.network.dao.NetworkDetailVO;
+import com.cloud.network.dao.NetworkDetailsDao;
import com.cloud.network.dao.NetworkDomainDao;
import com.cloud.network.dao.NetworkDomainVO;
import com.cloud.network.dao.NetworkServiceMapDao;
@@ -178,6 +181,7 @@
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.utils.exception.ExceptionUtil;
import com.cloud.utils.net.NetUtils;
+import com.cloud.vm.DomainRouterVO;
import com.cloud.vm.Nic;
import com.cloud.vm.NicSecondaryIp;
import com.cloud.vm.NicVO;
@@ -187,6 +191,7 @@
import com.cloud.vm.UserVmVO;
import com.cloud.vm.VMInstanceVO;
import com.cloud.vm.VirtualMachine;
+import com.cloud.vm.dao.DomainRouterDao;
import com.cloud.vm.dao.NicDao;
import com.cloud.vm.dao.NicSecondaryIpDao;
import com.cloud.vm.dao.NicSecondaryIpVO;
@@ -324,6 +329,12 @@
@Inject
MessageBus _messageBus;
+ @Inject
+ DomainRouterDao _routerDao;
+
+ @Inject
+ NetworkDetailsDao _networkDetailsDao;
+
int _cidrLimit;
boolean _allowSubdomainNetworkAccess;
@@ -1992,8 +2003,7 @@ private boolean checkForNonStoppedVmInNetwork(long networkId) {
@DB
@ActionEvent(eventType = EventTypes.EVENT_NETWORK_UPDATE, eventDescription = "updating network", async = true)
public Network updateGuestNetwork(final long networkId, String name, String displayText, Account callerAccount, User callerUser, String domainSuffix,
- final Long networkOfferingId, Boolean changeCidr, String guestVmCidr, Boolean displayNetwork, String customId) {
-
+ final Long networkOfferingId, Boolean changeCidr, String guestVmCidr, Boolean displayNetwork, String customId, boolean updateInSequence, boolean forced) {
boolean restartNetwork = false;
// verify input parameters
@@ -2239,130 +2249,178 @@ public Network updateGuestNetwork(final long networkId, String name, String disp
ReservationContext context = new ReservationContextImpl(null, null, callerUser, callerAccount);
// 1) Shutdown all the elements and cleanup all the rules. Don't allow to shutdown network in intermediate
// states - Shutdown and Implementing
- boolean validStateToShutdown = (network.getState() == Network.State.Implemented || network.getState() == Network.State.Setup || network.getState() == Network.State.Allocated);
- if (restartNetwork) {
- if (validStateToShutdown) {
- if (!changeCidr) {
- s_logger.debug("Shutting down elements and resources for network id=" + networkId + " as a part of network update");
-
- if (!_networkMgr.shutdownNetworkElementsAndResources(context, true, network)) {
- s_logger.warn("Failed to shutdown the network elements and resources as a part of network restart: " + network);
- CloudRuntimeException ex = new CloudRuntimeException("Failed to shutdown the network elements and resources as a part of update to network of specified id");
- ex.addProxyObject(network.getUuid(), "networkId");
- throw ex;
- }
- } else {
- // We need to shutdown the network, since we want to re-implement the network.
- s_logger.debug("Shutting down network id=" + networkId + " as a part of network update");
-
- //check if network has reservation
- if (NetUtils.isNetworkAWithinNetworkB(network.getCidr(), network.getNetworkCidr())) {
- s_logger.warn("Existing IP reservation will become ineffective for the network with id = " + networkId
- + " You need to reapply reservation after network reimplementation.");
- //set cidr to the newtork cidr
- network.setCidr(network.getNetworkCidr());
- //set networkCidr to null to bring network back to no IP reservation state
- network.setNetworkCidr(null);
+ int resourceCount=1;
+ if(updateInSequence && restartNetwork && _networkOfferingDao.findById(network.getNetworkOfferingId()).getRedundantRouter()
+ && (networkOfferingId==null || _networkOfferingDao.findById(networkOfferingId).getRedundantRouter()) && network.getVpcId()==null) {
+ _networkMgr.canUpdateInSequence(network);
+ NetworkDetailVO networkDetail =new NetworkDetailVO(network.getId(),Network.updatingInSequence,"true",true);
+ _networkDetailsDao.persist(networkDetail);
+ _networkMgr.configureUpdateInSequence(network);
+ resourceCount=_networkMgr.getResourceCount(network);
+ //check if routers are in correct state before proceeding with the update
+ List<DomainRouterVO> routers=_routerDao.listByNetworkAndRole(networkId, VirtualRouter.Role.VIRTUAL_ROUTER);
+ for(DomainRouterVO router :routers){
+ if(router.getRedundantState()== VirtualRouter.RedundantState.UNKNOWN){
+ if(!forced){
+ throw new CloudRuntimeException("Domain router: "+router.getInstanceName()+" is in unknown state, Cannot update network. set parameter forced to true for forcing an update");
}
+ }
+ }
+ }
+ List<String > servicesNotInNewOffering = null;
+ if(networkOfferingId != null)
+ servicesNotInNewOffering = _networkMgr.getServicesNotSupportedInNewOffering(network,networkOfferingId);
+ if(!forced && servicesNotInNewOffering != null && !servicesNotInNewOffering.isEmpty()){
+ NetworkOfferingVO newOffering = _networkOfferingDao.findById(networkOfferingId);
+ throw new CloudRuntimeException("The new offering:"+newOffering.getUniqueName()
+ +" will remove the following services "+servicesNotInNewOffering +"along with all the related configuration currently in use. will not proceed with the network update." +
+ "set forced parameter to true for forcing an update.");
+ }
+ try{
+ if(servicesNotInNewOffering!=null && !servicesNotInNewOffering.isEmpty()){
+ _networkMgr.cleanupConfigForServicesInNetwork(servicesNotInNewOffering,network);
+ }
+ }catch (Throwable e){
+ s_logger.debug("failed to cleanup config related to unused services error:"+e.getMessage());
+ }
+
+ boolean validStateToShutdown = (network.getState() == Network.State.Implemented || network.getState() == Network.State.Setup || network.getState() == Network.State.Allocated);
+ try {
+
+ do {
+ if (restartNetwork) {
+ if (validStateToShutdown) {
+ if (!changeCidr) {
+ s_logger.debug("Shutting down elements and resources for network id=" + networkId + " as a part of network update");
+
+ if (!_networkMgr.shutdownNetworkElementsAndResources(context, true, network)) {
+ s_logger.warn("Failed to shutdown the network elements and resources as a part of network restart: " + network);
+ CloudRuntimeException ex = new CloudRuntimeException("Failed to shutdown the network elements and resources as a part of update to network of specified id");
+ ex.addProxyObject(network.getUuid(), "networkId");
+ throw ex;
+ }
+ } else {
+ // We need to shutdown the network, since we want to re-implement the network.
+ s_logger.debug("Shutting down network id=" + networkId + " as a part of network update");
+
+ //check if network has reservation
+ if (NetUtils.isNetworkAWithinNetworkB(network.getCidr(), network.getNetworkCidr())) {
+ s_logger.warn("Existing IP reservation will become ineffective for the network with id = " + networkId
+ + " You need to reapply reservation after network reimplementation.");
+ //set cidr to the newtork cidr
+ network.setCidr(network.getNetworkCidr());
+ //set networkCidr to null to bring network back to no IP reservation state
+ network.setNetworkCidr(null);
+ }
- if (!_networkMgr.shutdownNetwork(network.getId(), context, true)) {
- s_logger.warn("Failed to shutdown the network as a part of update to network with specified id");
- CloudRuntimeException ex = new CloudRuntimeException("Failed to shutdown the network as a part of update of specified network id");
+ if (!_networkMgr.shutdownNetwork(network.getId(), context, true)) {
+ s_logger.warn("Failed to shutdown the network as a part of update to network with specified id");
+ CloudRuntimeException ex = new CloudRuntimeException("Failed to shutdown the network as a part of update of specified network id");
+ ex.addProxyObject(network.getUuid(), "networkId");
+ throw ex;
+ }
+ }
+ } else {
+ CloudRuntimeException ex = new CloudRuntimeException(
+ "Failed to shutdown the network elements and resources as a part of update to network with specified id; network is in wrong state: " + network.getState());
ex.addProxyObject(network.getUuid(), "networkId");
throw ex;
}
}
- } else {
- CloudRuntimeException ex = new CloudRuntimeException(
- "Failed to shutdown the network elements and resources as a part of update to network with specified id; network is in wrong state: " + network.getState());
- ex.addProxyObject(network.getUuid(), "networkId");
- throw ex;
- }
- }
- // 2) Only after all the elements and rules are shutdown properly, update the network VO
- // get updated network
- Network.State networkState = _networksDao.findById(networkId).getState();
- boolean validStateToImplement = (networkState == Network.State.Implemented || networkState == Network.State.Setup || networkState == Network.State.Allocated);
- if (restartNetwork && !validStateToImplement) {
- CloudRuntimeException ex = new CloudRuntimeException(
- "Failed to implement the network elements and resources as a part of update to network with specified id; network is in wrong state: " + networkState);
- ex.addProxyObject(network.getUuid(), "networkId");
- throw ex;
- }
+ // 2) Only after all the elements and rules are shutdown properly, update the network VO
+ // get updated network
+ Network.State networkState = _networksDao.findById(networkId).getState();
+ boolean validStateToImplement = (networkState == Network.State.Implemented || networkState == Network.State.Setup || networkState == Network.State.Allocated);
+ if (restartNetwork && !validStateToImplement) {
+ CloudRuntimeException ex = new CloudRuntimeException(
+ "Failed to implement the network elements and resources as a part of update to network with specified id; network is in wrong state: " + networkState);
+ ex.addProxyObject(network.getUuid(), "networkId");
+ throw ex;
+ }
- if (networkOfferingId != null) {
- if (networkOfferingChanged) {
- Transaction.execute(new TransactionCallbackNoReturn() {
- @Override
- public void doInTransactionWithoutResult(TransactionStatus status) {
- network.setNetworkOfferingId(networkOfferingId);
- _networksDao.update(networkId, network, newSvcProviders);
- // get all nics using this network
- // log remove usage events for old offering
- // log assign usage events for new offering
- List<NicVO> nics = _nicDao.listByNetworkId(networkId);
- for (NicVO nic : nics) {
- long vmId = nic.getInstanceId();
- VMInstanceVO vm = _vmDao.findById(vmId);
- if (vm == null) {
- s_logger.error("Vm for nic " + nic.getId() + " not found with Vm Id:" + vmId);
- continue;
+ if (networkOfferingId != null) {
+ if (networkOfferingChanged) {
+ Transaction.execute(new TransactionCallbackNoReturn() {
+ @Override
+ public void doInTransactionWithoutResult(TransactionStatus status) {
+ network.setNetworkOfferingId(networkOfferingId);
+ _networksDao.update(networkId, network, newSvcProviders);
+ // get all nics using this network
+ // log remove usage events for old offering
+ // log assign usage events for new offering
+ List<NicVO> nics = _nicDao.listByNetworkId(networkId);
+ for (NicVO nic : nics) {
+ long vmId = nic.getInstanceId();
+ VMInstanceVO vm = _vmDao.findById(vmId);
+ if (vm == null) {
+ s_logger.error("Vm for nic " + nic.getId() + " not found with Vm Id:" + vmId);
+ continue;
+ }
+ long isDefault = (nic.isDefaultNic()) ? 1 : 0;
+ String nicIdString = Long.toString(nic.getId());
+ UsageEventUtils.publishUsageEvent(EventTypes.EVENT_NETWORK_OFFERING_REMOVE, vm.getAccountId(), vm.getDataCenterId(), vm.getId(), nicIdString,
+ oldNetworkOfferingId, null, isDefault, VirtualMachine.class.getName(), vm.getUuid(), vm.isDisplay());
+ UsageEventUtils.publishUsageEvent(EventTypes.EVENT_NETWORK_OFFERING_ASSIGN, vm.getAccountId(), vm.getDataCenterId(), vm.getId(), nicIdString,
+ networkOfferingId, null, isDefault, VirtualMachine.class.getName(), vm.getUuid(), vm.isDisplay());
+ }
+ }
+ });
+ } else {
+ network.setNetworkOfferingId(networkOfferingId);
+ _networksDao.update(networkId, network,
+ _networkMgr.finalizeServicesAndProvidersForNetwork(_entityMgr.findById(NetworkOffering.class, networkOfferingId), network.getPhysicalNetworkId()));
}
- long isDefault = (nic.isDefaultNic()) ? 1 : 0;
- String nicIdString = Long.toString(nic.getId());
- UsageEventUtils.publishUsageEvent(EventTypes.EVENT_NETWORK_OFFERING_REMOVE, vm.getAccountId(), vm.getDataCenterId(), vm.getId(), nicIdString,
- oldNetworkOfferingId, null, isDefault, VirtualMachine.class.getName(), vm.getUuid(), vm.isDisplay());
- UsageEventUtils.publishUsageEvent(EventTypes.EVENT_NETWORK_OFFERING_ASSIGN, vm.getAccountId(), vm.getDataCenterId(), vm.getId(), nicIdString,
- networkOfferingId, null, isDefault, VirtualMachine.class.getName(), vm.getUuid(), vm.isDisplay());
+ } else {
+ _networksDao.update(networkId, network);
}
+
+ // 3) Implement the elements and rules again
+ if (restartNetwork) {
+ if (network.getState() != Network.State.Allocated) {
+ DeployDestination dest = new DeployDestination(_dcDao.findById(network.getDataCenterId()), null, null, null);
+ s_logger.debug("Implementing the network " + network + " elements and resources as a part of network update");
+ try {
+ if (!changeCidr) {
+ _networkMgr.implementNetworkElementsAndResources(dest, context, network, _networkOfferingDao.findById(network.getNetworkOfferingId()));
+ } else {
+ _networkMgr.implementNetwork(network.getId(), dest, context);
+ }
+ } catch (Exception ex) {
+ s_logger.warn("Failed to implement network " + network + " elements and resources as a part of network update due to ", ex);
+ CloudRuntimeException e = new CloudRuntimeException("Failed to implement network (with specified id) elements and resources as a part of network update");
+ e.addProxyObject(network.getUuid(), "networkId");
+ throw e;
+ }
}
- });
- } else {
- network.setNetworkOfferingId(networkOfferingId);
- _networksDao.update(networkId, network,
- _networkMgr.finalizeServicesAndProvidersForNetwork(_entityMgr.findById(NetworkOffering.class, networkOfferingId), network.getPhysicalNetworkId()));
- }
- } else {
- _networksDao.update(networkId, network);
- }
-
- // 3) Implement the elements and rules again
- if (restartNetwork) {
- if (network.getState() != Network.State.Allocated) {
- DeployDestination dest = new DeployDestination(_dcDao.findById(network.getDataCenterId()), null, null, null);
- s_logger.debug("Implementing the network " + network + " elements and resources as a part of network update");
- try {
- if (!changeCidr) {
- _networkMgr.implementNetworkElementsAndResources(dest, context, network, _networkOfferingDao.findById(network.getNetworkOfferingId()));
- } else {
- _networkMgr.implementNetwork(network.getId(), dest, context);
- }
- } catch (Exception ex) {
- s_logger.warn("Failed to implement network " + network + " elements and resources as a part of network update due to ", ex);
- CloudRuntimeException e = new CloudRuntimeException("Failed to implement network (with specified id) elements and resources as a part of network update");
- e.addProxyObject(network.getUuid(), "networkId");
- throw e;
}
- }
- }
- // 4) if network has been upgraded from a non persistent ntwk offering to a persistent ntwk offering,
- // implement the network if its not already
- if (networkOfferingChanged && !oldNtwkOff.getIsPersistent() && networkOffering.getIsPersistent()) {
- if (network.getState() == Network.State.Allocated) {
- try {
- DeployDestination dest = new DeployDestination(_dcDao.findById(network.getDataCenterId()), null, null, null);
- _networkMgr.implementNetwork(network.getId(), dest, context);
- } catch (Exception ex) {
- s_logger.warn("Failed to implement network " + network + " elements and resources as a part o" + "f network update due to ", ex);
- CloudRuntimeException e = new CloudRuntimeException("Failed to implement network (with specified" + " id) elements and resources as a part of network update");
- e.addProxyObject(network.getUuid(), "networkId");
- throw e;
+ // 4) if network has been upgraded from a non persistent ntwk offering to a persistent ntwk offering,
+ // implement the network if its not already
+ if (networkOfferingChanged && !oldNtwkOff.getIsPersistent() && networkOffering.getIsPersistent()) {
+ if (network.getState() == Network.State.Allocated) {
+ try {
+ DeployDestination dest = new DeployDestination(_dcDao.findById(network.getDataCenterId()), null, null, null);
+ _networkMgr.implementNetwork(network.getId(), dest, context);
+ } catch (Exception ex) {
+ s_logger.warn("Failed to implement network " + network + " elements and resources as a part o" + "f network update due to ", ex);
+ CloudRuntimeException e = new CloudRuntimeException("Failed to implement network (with specified" + " id) elements and resources as a part of network update");
+ e.addProxyObject(network.getUuid(), "networkId");
+ throw e;
+ }
+ }
+ }
+ resourceCount--;
+ } while(updateInSequence && resourceCount>0);
+ }catch (Exception exception){
+ throw new CloudRuntimeException("failed to update network "+network.getUuid()+"due to "+exception.getMessage());
+ }finally {
+ if(updateInSequence){
+ if( _networkDetailsDao.findDetail(networkId,Network.updatingInSequence)!=null){
+ _networkDetailsDao.removeDetail(networkId,Network.updatingInSequence);
}
}
}
-
return getNetwork(network.getId());
}
diff --git a/server/src/com/cloud/network/element/VirtualRouterElement.java b/server/src/com/cloud/network/element/VirtualRouterElement.java
index d802188e4c4..03d19588af3 100644
--- a/server/src/com/cloud/network/element/VirtualRouterElement.java
+++ b/server/src/com/cloud/network/element/VirtualRouterElement.java
@@ -24,6 +24,9 @@
import javax.inject.Inject;
+import com.cloud.network.dao.NetworkDetailVO;
+import com.cloud.network.dao.NetworkDetailsDao;
+import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.agent.api.to.LoadBalancerTO;
import com.cloud.configuration.ConfigurationManager;
import com.cloud.dc.DataCenter;
@@ -109,7 +112,7 @@
public class VirtualRouterElement extends AdapterBase implements VirtualRouterElementService, DhcpServiceProvider, UserDataServiceProvider, SourceNatServiceProvider,
StaticNatServiceProvider, FirewallServiceProvider, LoadBalancingServiceProvider, PortForwardingServiceProvider, RemoteAccessVPNServiceProvider, IpDeployer,
-NetworkMigrationResponder, AggregatedCommandExecutor {
+NetworkMigrationResponder, AggregatedCommandExecutor, RedundantResource {
private static final Logger s_logger = Logger.getLogger(VirtualRouterElement.class);
public static final AutoScaleCounterType AutoScaleCounterCpu = new AutoScaleCounterType("cpu");
public static final AutoScaleCounterType AutoScaleCounterMemory = new AutoScaleCounterType("memory");
@@ -159,6 +162,9 @@
@Inject
NetworkTopologyContext networkTopologyContext;
+ @Inject
+ NetworkDetailsDao _networkDetailsDao;
+
@Inject
protected RouterDeploymentDefinitionBuilder routerDeploymentDefinitionBuilder;
@@ -262,7 +268,7 @@ public boolean prepare(final Network network, final NicProfile nic, final Virtua
public boolean applyFWRules(final Network network, final List<? extends FirewallRule> rules) throws ResourceUnavailableException {
boolean result = true;
if (canHandle(network, Service.Firewall)) {
- final List<DomainRouterVO> routers = _routerDao.listByNetworkAndRole(network.getId(), Role.VIRTUAL_ROUTER);
+ final List<DomainRouterVO> routers = getRouters(network);
if (routers == null || routers.isEmpty()) {
s_logger.debug("Virtual router elemnt doesn't need to apply firewall rules on the backend; virtual " + "router doesn't exist in the network " + network.getId());
return true;
@@ -407,7 +413,7 @@ public boolean applyLBRules(final Network network, final List<LoadBalancingRule>
return false;
}
- final List<DomainRouterVO> routers = _routerDao.listByNetworkAndRole(network.getId(), Role.VIRTUAL_ROUTER);
+ final List<DomainRouterVO> routers = getRouters(network);
if (routers == null || routers.isEmpty()) {
s_logger.debug("Virtual router elemnt doesn't need to apply lb rules on the backend; virtual " + "router doesn't exist in the network " + network.getId());
return true;
@@ -498,7 +504,7 @@ public boolean applyIps(final Network network, final List<? extends PublicIpAddr
}
boolean result = true;
if (canHandle) {
- final List<DomainRouterVO> routers = _routerDao.listByNetworkAndRole(network.getId(), Role.VIRTUAL_ROUTER);
+ final List<DomainRouterVO> routers = getRouters(network);
if (routers == null || routers.isEmpty()) {
s_logger.debug("Virtual router elemnt doesn't need to associate ip addresses on the backend; virtual " + "router doesn't exist in the network " + network.getId());
return true;
@@ -657,7 +663,7 @@ public static String getHAProxyStickinessCapability() {
public boolean applyStaticNats(final Network network, final List<? extends StaticNat> rules) throws ResourceUnavailableException {
boolean result = true;
if (canHandle(network, Service.StaticNat)) {
- final List<DomainRouterVO> routers = _routerDao.listByNetworkAndRole(network.getId(), Role.VIRTUAL_ROUTER);
+ final List<DomainRouterVO> routers = getRouters(network);
if (routers == null || routers.isEmpty()) {
s_logger.debug("Virtual router elemnt doesn't need to apply static nat on the backend; virtual " + "router doesn't exist in the network " + network.getId());
return true;
@@ -673,6 +679,46 @@ public boolean applyStaticNats(final Network network, final List<? extends Stati
return result;
}
+ public List<DomainRouterVO> getRouters(Network network){
+ List<DomainRouterVO> routers = _routerDao.listByNetworkAndRole(network.getId(), Role.VIRTUAL_ROUTER);
+ if (routers !=null && routers.isEmpty()) {
+ return null;
+ }
+ NetworkDetailVO updateInSequence=_networkDetailsDao.findDetail(network.getId(), Network.updatingInSequence);
+ if(network.isRedundant() && updateInSequence!=null && "true".equalsIgnoreCase(updateInSequence.getValue())){
+ List<DomainRouterVO> masterRouters=new ArrayList<DomainRouterVO>();
+ int noOfrouters=routers.size();
+ while (noOfrouters>0){
+ DomainRouterVO router = routers.get(0);
+ if(router.getUpdateState()== VirtualRouter.UpdateState.UPDATE_IN_PROGRESS){
+ ArrayList<DomainRouterVO> routerList = new ArrayList<DomainRouterVO>();
+ routerList.add(router);
+ return routerList;
+ }
+ if(router.getUpdateState()== VirtualRouter.UpdateState.UPDATE_COMPLETE) {
+ routers.remove(router);
+ noOfrouters--;
+ continue;
+ }
+ if(router.getRedundantState()!=VirtualRouter.RedundantState.BACKUP) {
+ masterRouters.add(router);
+ routers.remove(router);
+ }
+ noOfrouters--;
+ }
+ if(routers.size()==0 && masterRouters.size()==0){
+ return null;
+ }
+ if(routers.size()==0 && masterRouters.size()!=0){
+ routers=masterRouters;
+ }
+ routers=routers.subList(0,1);
+ routers.get(0).setUpdateState(VirtualRouter.UpdateState.UPDATE_IN_PROGRESS);
+ _routerDao.persist(routers.get(0));
+ }
+ return routers;
+ }
+
@Override
public boolean shutdown(final Network network, final ReservationContext context, final boolean cleanup) throws ConcurrentOperationException, ResourceUnavailableException {
final List<DomainRouterVO> routers = _routerDao.listByNetworkAndRole(network.getId(), Role.VIRTUAL_ROUTER);
@@ -1031,7 +1077,7 @@ public boolean addPasswordAndUserdata(final Network network, final NicProfile ni
List<DomainRouterVO> routers;
if (publicNetwork) {
- routers = _routerDao.listByNetworkAndRole(network.getId(), Role.VIRTUAL_ROUTER);
+ routers = getRouters(network);
} else {
if (isPodBased && dest.getPod() != null) {
final Long podId = dest.getPod().getId();
@@ -1228,7 +1274,27 @@ public boolean completeAggregatedExecution(final Network network, final DeployDe
throw new ResourceUnavailableException("Can't find at least one router!", DataCenter.class, network.getDataCenterId());
}
- return _routerMgr.completeAggregatedExecution(network, routers);
+ NetworkDetailVO networkDetail=_networkDetailsDao.findDetail(network.getId(), Network.updatingInSequence);
+ boolean updateInSequence= "true".equalsIgnoreCase((networkDetail!=null ? networkDetail.getValue() : null));
+ if(updateInSequence){
+ DomainRouterVO router=routers.get(0);
+ router.setUpdateState(VirtualRouter.UpdateState.UPDATE_COMPLETE);
+ _routerDao.persist(router);
+ }
+ boolean result=false;
+ try{
+ result=_routerMgr.completeAggregatedExecution(network, routers);
+ } finally {
+ if(!result && updateInSequence) {
+ //fail the network update. even if one router fails we fail the network update.
+ List<DomainRouterVO> routerList = _routerDao.listByNetworkAndRole(network.getId(), VirtualRouter.Role.VIRTUAL_ROUTER);
+ for (DomainRouterVO router : routerList) {
+ router.setUpdateState(VirtualRouter.UpdateState.UPDATE_FAILED);
+ _routerDao.persist(router);
+ }
+ }
+ }
+ return result;
}
@Override
@@ -1237,4 +1303,22 @@ public boolean cleanupAggregatedExecution(final Network network, final DeployDes
// lets not waste another command
return true;
}
+
+ @Override
+ public void configureResource(Network network) {
+ NetworkDetailVO networkDetail=_networkDetailsDao.findDetail(network.getId(), Network.updatingInSequence);
+ if(networkDetail==null || !"true".equalsIgnoreCase(networkDetail.getValue()))
+ throw new CloudRuntimeException("failed to configure the resource, network update is not in progress.");
+ List<DomainRouterVO>routers = _routerDao.listByNetworkAndRole(network.getId(), VirtualRouter.Role.VIRTUAL_ROUTER);
+ for(DomainRouterVO router : routers){
+ router.setUpdateState(VirtualRouter.UpdateState.UPDATE_NEEDED);
+ _routerDao.persist(router);
+ }
+ }
+
+ @Override
+ public int getResourceCount(Network network) {
+ return _routerDao.listByNetworkAndRole(network.getId(), VirtualRouter.Role.VIRTUAL_ROUTER).size();
+ }
+
}
diff --git a/server/src/com/cloud/network/router/CommandSetupHelper.java b/server/src/com/cloud/network/router/CommandSetupHelper.java
index 7208b256813..500fc49a0c0 100644
--- a/server/src/com/cloud/network/router/CommandSetupHelper.java
+++ b/server/src/com/cloud/network/router/CommandSetupHelper.java
@@ -780,10 +780,11 @@ public int compare(final PublicIpAddress o1, final PublicIpAddress o2) {
final boolean add = ipAddr.getState() == IpAddress.State.Releasing ? false : true;
boolean sourceNat = ipAddr.isSourceNat();
- /* enable sourceNAT for the first ip of the public interface */
- if (firstIP) {
- sourceNat = true;
+ /* enable sourceNAT for the first ip of the public interface as long as it's source nat. */
+ if (firstIP && !sourceNat) {
+ firstIP = false;
}
+
final String vlanId = ipAddr.getVlanTag();
final String vlanGateway = ipAddr.getGateway();
final String vlanNetmask = ipAddr.getNetmask();
diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
index f7947d5c54b..68899e947d4 100644
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -2282,6 +2282,11 @@ public VirtualRouter startRouter(final long routerId, final boolean reprogramNet
// verify parameters
DomainRouterVO router = _routerDao.findById(routerId);
+ //clean up the update_state feild
+ if(router.getUpdateState()== VirtualRouter.UpdateState.UPDATE_FAILED){
+ router.setUpdateState(null);
+ _routerDao.update(router.getId(),router);
+ }
if (router == null) {
throw new InvalidParameterValueException("Unable to find router by id " + routerId + ".");
}
diff --git a/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
index c2d923cb951..7b82125dccf 100644
--- a/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java
@@ -696,6 +696,16 @@ public void finalizeStop(final VirtualMachineProfile profile, final Answer answe
return _routerDao.listByVpcId(vpcId);
}
+ @Override
+ public boolean start() {
+ return true;
+ }
+
+ @Override
+ public boolean stop() {
+ return true;
+ }
+
@Override
public boolean startRemoteAccessVpn(final RemoteAccessVpn vpn, final VirtualRouter router) throws ResourceUnavailableException {
if (router.getState() != State.Running) {
diff --git a/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java b/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
index b473f050e04..065c097f0f8 100644
--- a/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
+++ b/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
@@ -281,7 +281,7 @@ private void validateRemoteAccessVpnConfiguration() throws ConfigurationExceptio
@Override
@DB
@ActionEvent(eventType = EventTypes.EVENT_REMOTE_ACCESS_VPN_DESTROY, eventDescription = "removing remote access vpn", async = true)
- public boolean destroyRemoteAccessVpnForIp(long ipId, Account caller) throws ResourceUnavailableException {
+ public boolean destroyRemoteAccessVpnForIp(long ipId, Account caller, final boolean forceCleanup) throws ResourceUnavailableException {
final RemoteAccessVpnVO vpn = _remoteAccessVpnDao.findByPublicIpAddress(ipId);
if (vpn == null) {
s_logger.debug("there are no Remote access vpns for public ip address id=" + ipId);
@@ -309,7 +309,7 @@ public boolean destroyRemoteAccessVpnForIp(long ipId, Account caller) throws Res
RemoteAccessVpn.State.Running);
success = false;
} finally {
- if (success) {
+ if (success|| forceCleanup) {
//Cleanup corresponding ports
final List<? extends FirewallRule> vpnFwRules = _rulesDao.listByIpAndPurpose(ipId, Purpose.Vpn);
@@ -339,7 +339,7 @@ public void doInTransactionWithoutResult(TransactionStatus status) {
success = _firewallMgr.applyIngressFirewallRules(ipId, caller);
}
- if (success) {
+ if (success|| forceCleanup) {
try {
Transaction.execute(new TransactionCallbackNoReturn() {
@Override
diff --git a/server/src/com/cloud/resourcelimit/ResourceLimitManagerImpl.java b/server/src/com/cloud/resourcelimit/ResourceLimitManagerImpl.java
index 25afd0115ea..95e81235299 100644
--- a/server/src/com/cloud/resourcelimit/ResourceLimitManagerImpl.java
+++ b/server/src/com/cloud/resourcelimit/ResourceLimitManagerImpl.java
@@ -29,6 +29,8 @@
import javax.inject.Inject;
import javax.naming.ConfigurationException;
+import com.cloud.vm.UserVmDetailVO;
+import com.cloud.vm.dao.UserVmDetailsDao;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
@@ -123,6 +125,8 @@
@Inject
private UserVmDao _userVmDao;
@Inject
+ private UserVmDetailsDao _userVmDetailsDao;
+ @Inject
private AccountDao _accountDao;
@Inject
protected SnapshotDao _snapshotDao;
@@ -938,11 +942,31 @@ public long countCpusForAccount(long accountId) {
sc.setJoinParameters("offerings", "state", new Object[] {State.Destroyed, State.Error, State.Expunging});
sc.setJoinParameters("offerings", "displayVm", 1);
List<SumCount> cpus = _serviceOfferingDao.customSearch(sc, null);
+ long total = 0;
if (cpus != null) {
- return cpus.get(0).sum;
+ total = cpus.get(0).sum;
} else {
return 0;
}
+
+
+ GenericSearchBuilder<UserVmDetailVO, SumCount> detailCpuSearch = _userVmDetailsDao.createSearchBuilder(SumCount.class);
+ detailCpuSearch.select("sum", Func.SUM, detailCpuSearch.entity().getValue());
+ detailCpuSearch.and("name", detailCpuSearch.entity().getName(), Op.EQ);
+ detailCpuSearch.join("vms", join1, detailCpuSearch.entity().getResourceId(), join1.entity().getId(), JoinBuilder.JoinType.INNER);
+
+ sc = detailCpuSearch.create();
+ sc.setParameters("name", "cpu");
+ sc.setJoinParameters("offerings", "accountId", accountId);
+ sc.setJoinParameters("offerings", "type", VirtualMachine.Type.User);
+ sc.setJoinParameters("offerings", "state", new Object[] {State.Destroyed, State.Error, State.Expunging});
+ sc.setJoinParameters("offerings", "displayVm", 1);
+
+ cpus = _userVmDetailsDao.customSearch(sc, null);
+ if (cpus != null) {
+ total += cpus.get(0).sum;
+ }
+ return total;
}
public long calculateMemoryForAccount(long accountId) {
@@ -962,11 +986,27 @@ public long calculateMemoryForAccount(long accountId) {
sc.setJoinParameters("offerings", "state", new Object[] {State.Destroyed, State.Error, State.Expunging});
sc.setJoinParameters("offerings", "displayVm", 1);
List<SumCount> memory = _serviceOfferingDao.customSearch(sc, null);
+ long total = 0;
if (memory != null) {
- return memory.get(0).sum;
- } else {
- return 0;
+ total = memory.get(0).sum;
+ }
+
+ GenericSearchBuilder<UserVmDetailVO, SumCount> detailMemorySearch = _userVmDetailsDao.createSearchBuilder(SumCount.class);
+ detailMemorySearch.select("sum", Func.SUM, detailMemorySearch.entity().getValue());
+ detailMemorySearch.and("name", detailMemorySearch.entity().getName(), Op.EQ);
+ detailMemorySearch.join("vms", join1, detailMemorySearch.entity().getResourceId(), join1.entity().getId(), JoinBuilder.JoinType.INNER);
+ sc = detailMemorySearch.create();
+ sc.setParameters("name", "memory");
+ sc.setJoinParameters("offerings", "accountId", accountId);
+ sc.setJoinParameters("offerings", "type", VirtualMachine.Type.User);
+ sc.setJoinParameters("offerings", "state", new Object[] {State.Destroyed, State.Error, State.Expunging});
+ sc.setJoinParameters("offerings", "displayVm", 1);
+
+ memory = _userVmDetailsDao.customSearch(sc, null);
+ if (memory != null) {
+ total += memory.get(0).sum;
}
+ return total;
}
public long calculateSecondaryStorageForAccount(long accountId) {
diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java
index e4ae8e16699..9b423902678 100644
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@ -1652,6 +1652,8 @@ private boolean hasSuitablePoolsForVolume(final VolumeVO volume, final Host host
final Long clusterId = cmd.getClusterId();
final Long storagepoolId = cmd.getStoragepoolId();
final Long accountId = cmd.getAccountId();
+ final Boolean showHidden = cmd.getShowHidden();
+
String scope = null;
Long id = null;
int paramCountCheck = 0;
@@ -1701,8 +1703,12 @@ private boolean hasSuitablePoolsForVolume(final VolumeVO volume, final Host host
sc.addAnd("category", SearchCriteria.Op.EQ, category);
}
- // hidden configurations are not displayed using the search API
- sc.addAnd("category", SearchCriteria.Op.NEQ, "Hidden");
+ if (!showHidden) {
+ // hidden configurations are not displayed using the search API unless showHidden == true
+ sc.addAnd("category", SearchCriteria.Op.NEQ, "Hidden");
+ } else if (!Boolean.valueOf(_configs.get(Config.AllowShowHiddenConfigViaApi.key()))) {
+ throw new InvalidParameterValueException("showhidden not allowed");
+ }
if (scope != null && !scope.isEmpty()) {
// getting the list of parameters at requested scope
diff --git a/server/src/com/cloud/storage/VolumeApiServiceImpl.java b/server/src/com/cloud/storage/VolumeApiServiceImpl.java
index 92435030ca1..71cc2337704 100644
--- a/server/src/com/cloud/storage/VolumeApiServiceImpl.java
+++ b/server/src/com/cloud/storage/VolumeApiServiceImpl.java
@@ -219,7 +219,7 @@
@Inject
AccountDao _accountDao;
@Inject
- final DataCenterDao _dcDao = null;
+ DataCenterDao _dcDao = null;
@Inject
VMTemplateDao _templateDao;
@Inject
@@ -1479,11 +1479,13 @@ public Volume attachVolumeToVM(Long vmId, Long volumeId, Long deviceId) {
Account owner = _accountDao.findById(volumeToAttach.getAccountId());
- try {
- _resourceLimitMgr.checkResourceLimit(owner, ResourceType.primary_storage, volumeToAttach.getSize());
- } catch (ResourceAllocationException e) {
- s_logger.error("primary storage resource limit check failed", e);
- throw new InvalidParameterValueException(e.getMessage());
+ if(!(volumeToAttach.getState() == Volume.State.Allocated || volumeToAttach.getState() == Volume.State.Ready)){
+ try {
+ _resourceLimitMgr.checkResourceLimit(owner, ResourceType.primary_storage, volumeToAttach.getSize());
+ } catch (ResourceAllocationException e) {
+ s_logger.error("primary storage resource limit check failed", e);
+ throw new InvalidParameterValueException(e.getMessage());
+ }
}
HypervisorType rootDiskHyperType = vm.getHypervisorType();
diff --git a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
index 65f51404182..13452523831 100644
--- a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
+++ b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
@@ -1009,6 +1009,13 @@ public SnapshotInfo takeSnapshot(VolumeInfo volume) throws ResourceAllocationExc
try {
postCreateSnapshot(volume.getId(), snapshotId, payload.getSnapshotPolicyId());
SnapshotDataStoreVO snapshotStoreRef = _snapshotStoreDao.findBySnapshot(snapshotId, DataStoreRole.Image);
+ if(snapshotStoreRef == null) {
+ // The snapshot was not backed up to secondary. Find the snap on primary
+ snapshotStoreRef = _snapshotStoreDao.findBySnapshot(snapshotId, DataStoreRole.Primary);
+ if(snapshotStoreRef == null) {
+ throw new CloudRuntimeException("Could not find snapshot");
+ }
+ }
UsageEventUtils.publishUsageEvent(EventTypes.EVENT_SNAPSHOT_CREATE, snapshot.getAccountId(), snapshot.getDataCenterId(), snapshotId, snapshot.getName(),
null, null, snapshotStoreRef.getPhysicalSize(), volume.getSize(), snapshot.getClass().getName(), snapshot.getUuid());
// Correct the resource count of snapshot in case of delta snapshots.
diff --git a/server/src/com/cloud/template/TemplateManagerImpl.java b/server/src/com/cloud/template/TemplateManagerImpl.java
index e6141425dfe..88846c77516 100644
--- a/server/src/com/cloud/template/TemplateManagerImpl.java
+++ b/server/src/com/cloud/template/TemplateManagerImpl.java
@@ -71,7 +71,9 @@
import org.apache.cloudstack.engine.subsystem.api.storage.Scope;
import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotDataFactory;
import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo;
+import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotStrategy;
import org.apache.cloudstack.engine.subsystem.api.storage.StorageCacheManager;
+import org.apache.cloudstack.engine.subsystem.api.storage.StorageStrategyFactory;
import org.apache.cloudstack.engine.subsystem.api.storage.TemplateDataFactory;
import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo;
import org.apache.cloudstack.engine.subsystem.api.storage.TemplateService;
@@ -79,6 +81,7 @@
import org.apache.cloudstack.engine.subsystem.api.storage.VolumeDataFactory;
import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
import org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope;
+import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotStrategy.SnapshotOperation;
import org.apache.cloudstack.framework.async.AsyncCallFuture;
import org.apache.cloudstack.framework.config.ConfigKey;
import org.apache.cloudstack.framework.config.Configurable;
@@ -251,6 +254,8 @@
@Inject
private SnapshotDataFactory _snapshotFactory;
@Inject
+ StorageStrategyFactory _storageStrategyFactory;
+ @Inject
private TemplateService _tmpltSvr;
@Inject
private DataStoreManager _dataStoreMgr;
@@ -1472,6 +1477,21 @@ public VirtualMachineTemplate createPrivateTemplate(CreateTemplateCmd command) t
SnapshotInfo snapInfo = _snapshotFactory.getSnapshot(snapshotId, dataStoreRole);
if (dataStoreRole == DataStoreRole.Image) {
+ if (snapInfo == null) {
+ snapInfo = _snapshotFactory.getSnapshot(snapshotId, DataStoreRole.Primary);
+ if(snapInfo == null) {
+ throw new CloudRuntimeException("Cannot find snapshot "+snapshotId);
+ }
+ // We need to copy the snapshot onto secondary.
+ SnapshotStrategy snapshotStrategy = _storageStrategyFactory.getSnapshotStrategy(snapshot, SnapshotOperation.BACKUP);
+ snapshotStrategy.backupSnapshot(snapInfo);
+
+ // Attempt to grab it again.
+ snapInfo = _snapshotFactory.getSnapshot(snapshotId, dataStoreRole);
+ if(snapInfo == null) {
+ throw new CloudRuntimeException("Cannot find snapshot " + snapshotId + " on secondary and could not create backup");
+ }
+ }
DataStore snapStore = snapInfo.getDataStore();
if (snapStore != null) {
diff --git a/server/src/com/cloud/user/AccountManagerImpl.java b/server/src/com/cloud/user/AccountManagerImpl.java
index d3eb40c7db6..b0d7d4b0ad8 100644
--- a/server/src/com/cloud/user/AccountManagerImpl.java
+++ b/server/src/com/cloud/user/AccountManagerImpl.java
@@ -786,7 +786,7 @@ protected boolean cleanupAccount(AccountVO account, long callerUserId, Account c
try {
for (RemoteAccessVpnVO vpn : remoteAccessVpns) {
- _remoteAccessVpnMgr.destroyRemoteAccessVpnForIp(vpn.getServerAddressId(), caller);
+ _remoteAccessVpnMgr.destroyRemoteAccessVpnForIp(vpn.getServerAddressId(), caller, false);
}
} catch (ResourceUnavailableException ex) {
s_logger.warn("Failed to cleanup remote access vpn resources as a part of account id=" + accountId + " cleanup due to Exception: ", ex);
diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java
index cc007d90210..cadbe127359 100644
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -1122,6 +1122,7 @@ public UserVm addNicToVirtualMachine(AddNicToVMCmd cmd) throws InvalidParameterV
Long vmId = cmd.getVmId();
Long networkId = cmd.getNetworkId();
String ipAddress = cmd.getIpAddress();
+ String macAddress = cmd.getMacAddress();
Account caller = CallContext.current().getCallingAccount();
UserVmVO vmInstance = _vmDao.findById(vmId);
@@ -1152,12 +1153,17 @@ public UserVm addNicToVirtualMachine(AddNicToVMCmd cmd) throws InvalidParameterV
throw new CloudRuntimeException("A NIC already exists for VM:" + vmInstance.getInstanceName() + " in network: " + network.getUuid());
}
- NicProfile profile = new NicProfile(null, null);
+ NicProfile profile = new NicProfile(ipAddress, null, macAddress);
if (ipAddress != null) {
if (!(NetUtils.isValidIp(ipAddress) || NetUtils.isValidIpv6(ipAddress))) {
throw new InvalidParameterValueException("Invalid format for IP address parameter: " + ipAddress);
}
- profile = new NicProfile(ipAddress, null);
+ }
+
+ if(macAddress != null) {
+ if(!NetUtils.isValidMac(macAddress)) {
+ throw new InvalidParameterValueException("Invalid format for MAC address parameter: " + macAddress);
+ }
}
// Perform permission check on VM
@@ -3249,17 +3255,19 @@ protected UserVm createVirtualMachine(DataCenter zone, ServiceOffering serviceOf
if (requestedIpPair == null) {
requestedIpPair = new IpAddresses(null, null);
} else {
- _networkModel.checkRequestedIpAddresses(network.getId(), requestedIpPair.getIp4Address(), requestedIpPair.getIp6Address());
+ _networkModel.checkRequestedIpAddresses(network.getId(), requestedIpPair);
}
- NicProfile profile = new NicProfile(requestedIpPair.getIp4Address(), requestedIpPair.getIp6Address());
+ NicProfile profile = new NicProfile(requestedIpPair.getIp4Address(), requestedIpPair.getIp6Address(), requestedIpPair.getMacAddress());
if (defaultNetworkNumber == 0) {
defaultNetworkNumber++;
// if user requested specific ip for default network, add it
if (defaultIps.getIp4Address() != null || defaultIps.getIp6Address() != null) {
- _networkModel.checkRequestedIpAddresses(network.getId(), defaultIps.getIp4Address(), defaultIps.getIp6Address());
+ _networkModel.checkRequestedIpAddresses(network.getId(), defaultIps);
profile = new NicProfile(defaultIps.getIp4Address(), defaultIps.getIp6Address());
+ } else if (defaultIps.getMacAddress() != null) {
+ profile = new NicProfile(null, null, defaultIps.getMacAddress());
}
profile.setDefaultNic(true);
@@ -3866,7 +3874,7 @@ public UserVm stopVirtualMachine(long vmId, boolean forced) throws ConcurrentOpe
boolean status = false;
try {
VirtualMachineEntity vmEntity = _orchSrvc.getVirtualMachine(vm.getUuid());
- status = vmEntity.stop(Long.toString(userId));
+ status = vmEntity.stop(Long.toString(userId), forced);
if (status) {
return _vmDao.findById(vmId);
} else {
diff --git a/server/src/org/cloud/network/router/deployment/RouterDeploymentDefinition.java b/server/src/org/cloud/network/router/deployment/RouterDeploymentDefinition.java
index 2d04a7e633f..16c947231aa 100644
--- a/server/src/org/cloud/network/router/deployment/RouterDeploymentDefinition.java
+++ b/server/src/org/cloud/network/router/deployment/RouterDeploymentDefinition.java
@@ -20,6 +20,9 @@
import java.util.List;
import java.util.Map;
+import com.cloud.network.dao.NetworkDetailVO;
+import com.cloud.network.dao.NetworkDetailsDao;
+import com.cloud.network.router.VirtualRouter;
import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
import org.apache.log4j.Logger;
@@ -106,6 +109,7 @@
protected Long tableLockId;
protected boolean isPublicNetwork;
protected PublicIp sourceNatIp;
+ protected NetworkDetailsDao networkDetailsDao;
protected RouterDeploymentDefinition(final Network guestNetwork, final DeployDestination dest,
final Account owner, final Map<Param, Object> params) {
@@ -393,7 +397,13 @@ protected void deployAllVirtualRouters() throws ConcurrentOperationException, In
// Don't start the router as we are holding the network lock that
// needs to be released at the end of router allocation
final DomainRouterVO router = nwHelper.deployRouter(this, false);
-
+ //check if the network update is in progress.
+ //if update is in progress add the update_pending flag to DomainRouterVO.
+ NetworkDetailVO detail =networkDetailsDao.findDetail(guestNetwork.getId(),Network.updatingInSequence);
+ if("true".equalsIgnoreCase(detail!=null ? detail.getValue() : null)) {
+ router.setUpdateState(VirtualRouter.UpdateState.UPDATE_IN_PROGRESS);
+ routerDao.persist(router);
+ }
if (router != null) {
routerDao.addRouterToGuestNetwork(router, guestNetwork);
//Fix according to changes by Sheng Yang in commit ID cb4513379996b262ae378daf00c6388c6b7313cf
diff --git a/server/src/org/cloud/network/router/deployment/RouterDeploymentDefinitionBuilder.java b/server/src/org/cloud/network/router/deployment/RouterDeploymentDefinitionBuilder.java
index 3ba4fad77de..3765537a148 100644
--- a/server/src/org/cloud/network/router/deployment/RouterDeploymentDefinitionBuilder.java
+++ b/server/src/org/cloud/network/router/deployment/RouterDeploymentDefinitionBuilder.java
@@ -22,6 +22,7 @@
import javax.inject.Inject;
+import com.cloud.network.dao.NetworkDetailsDao;
import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
@@ -96,6 +97,8 @@
private VpcManager vpcMgr;
@Inject
private VlanDao vlanDao;
+ @Inject
+ private NetworkDetailsDao networkDetailsDao;
@Autowired
@Qualifier("networkHelper")
@@ -133,6 +136,7 @@ protected RouterDeploymentDefinition injectDependencies(
routerDeploymentDefinition.ipv6Dao = ipv6Dao;
routerDeploymentDefinition.ipAddressDao = ipAddressDao;
routerDeploymentDefinition.serviceOfferingId = offeringId;
+ routerDeploymentDefinition.networkDetailsDao = networkDetailsDao;
routerDeploymentDefinition.nwHelper = nwHelper;
diff --git a/server/test/com/cloud/network/IpAddressManagerTest.java b/server/test/com/cloud/network/IpAddressManagerTest.java
new file mode 100644
index 00000000000..0bf92ee2f69
--- /dev/null
+++ b/server/test/com/cloud/network/IpAddressManagerTest.java
@@ -0,0 +1,71 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package com.cloud.network;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+
+import com.cloud.network.dao.IPAddressDao;
+import com.cloud.network.dao.IPAddressVO;
+import com.cloud.network.rules.StaticNat;
+import com.cloud.network.rules.StaticNatImpl;
+import com.cloud.utils.net.Ip;
+
+import static org.mockito.Mockito.when;
+
+import java.util.Collections;
+import java.util.List;
+
+import static org.mockito.Mockito.anyLong;
+import static org.mockito.Mockito.mock;
+
+public class IpAddressManagerTest {
+
+ @Mock
+ IPAddressDao _ipAddrDao;
+
+ @InjectMocks
+ IpAddressManagerImpl _ipManager;
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @Test
+ public void testGetStaticNatSourceIps() {
+ String publicIpAddress = "192.168.1.3";
+ IPAddressVO vo = mock(IPAddressVO.class);
+ when(vo.getAddress()).thenReturn(new Ip(publicIpAddress));
+ when(vo.getId()).thenReturn(1l);
+
+ when(_ipAddrDao.findById(anyLong())).thenReturn(vo);
+ StaticNat snat = new StaticNatImpl(1, 1, 1, 1, publicIpAddress, false);
+
+ List<IPAddressVO> ips = _ipManager.getStaticNatSourceIps(Collections.singletonList(snat));
+ Assert.assertNotNull(ips);
+ Assert.assertEquals(1, ips.size());
+
+ IPAddressVO returnedVO = ips.get(0);
+ Assert.assertEquals(vo, returnedVO);
+ }
+}
diff --git a/server/test/com/cloud/network/MockNetworkModelImpl.java b/server/test/com/cloud/network/MockNetworkModelImpl.java
index c00d83f7265..04861d311d8 100644
--- a/server/test/com/cloud/network/MockNetworkModelImpl.java
+++ b/server/test/com/cloud/network/MockNetworkModelImpl.java
@@ -30,6 +30,7 @@
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.network.Network.Capability;
import com.cloud.network.Network.GuestType;
+import com.cloud.network.Network.IpAddresses;
import com.cloud.network.Network.Provider;
import com.cloud.network.Network.Service;
import com.cloud.network.Networks.IsolationType;
@@ -825,7 +826,7 @@ public void checkIp6Parameters(String startIPv6, String endIPv6, String ip6Gatew
}
@Override
- public void checkRequestedIpAddresses(long networkId, String ip4, String ip6) throws InvalidParameterValueException {
+ public void checkRequestedIpAddresses(long networkId, IpAddresses ips) throws InvalidParameterValueException {
// TODO Auto-generated method stub
}
diff --git a/server/test/com/cloud/network/element/VirtualRouterElementTest.java b/server/test/com/cloud/network/element/VirtualRouterElementTest.java
index 659277824ea..4fbc28ee4cb 100644
--- a/server/test/com/cloud/network/element/VirtualRouterElementTest.java
+++ b/server/test/com/cloud/network/element/VirtualRouterElementTest.java
@@ -19,6 +19,7 @@
import static org.junit.Assert.assertTrue;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyBoolean;
+import static org.mockito.Matchers.anyList;
import static org.mockito.Matchers.anyLong;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.when;
@@ -26,6 +27,11 @@
import java.util.ArrayList;
import java.util.List;
+import com.cloud.exception.AgentUnavailableException;
+import com.cloud.network.dao.NetworkDetailVO;
+import com.cloud.network.dao.NetworkDetailsDao;
+import com.cloud.network.router.VirtualRouter;
+import com.cloud.utils.exception.CloudRuntimeException;
import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
import org.cloud.network.router.deployment.RouterDeploymentDefinitionBuilder;
@@ -35,6 +41,8 @@
import org.mockito.InjectMocks;
import org.mockito.Matchers;
import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.invocation.InvocationOnMock;
import org.mockito.runners.MockitoJUnitRunner;
import com.cloud.cluster.dao.ManagementServerHostDao;
@@ -111,6 +119,7 @@
import com.cloud.vm.dao.UserVmDao;
import com.cloud.vm.dao.UserVmDetailsDao;
import com.cloud.vm.dao.VMInstanceDao;
+import org.mockito.stubbing.Answer;
@RunWith(MockitoJUnitRunner.class)
public class VirtualRouterElementTest {
@@ -127,6 +136,7 @@
@Mock private ManagementServerHostDao _msHostDao;
@Mock private NetworkDao _networkDao;
@Mock private NetworkOfferingDao _networkOfferingDao;
+ @Mock private NetworkDetailsDao _networkDetailsDao;
@Mock private NicDao _nicDao;
@Mock private NicIpAliasDao _nicIpAliasDao;
@Mock private OpRouterMonitorServiceDao _opRouterMonitorServiceDao;
@@ -225,6 +235,62 @@ public void testPrepare() {
}
+ @Test
+ public void testGetRouters1(){
+ Network networkUpdateInprogress=new NetworkVO(1l,null,null,null,1l,1l,1l,1l,"d","d","d",null,1l,1l,null,true,null,true);
+ mockDAOs((NetworkVO)networkUpdateInprogress,testOffering);
+ //getRoutes should always return the router that is updating.
+ List<DomainRouterVO> routers=virtualRouterElement.getRouters(networkUpdateInprogress);
+ assertTrue(routers.size()==1);
+ assertTrue(routers.get(0).getUpdateState()== VirtualRouter.UpdateState.UPDATE_IN_PROGRESS);
+ }
+
+ @Test
+ public void testGetRouters2(){
+ Network networkUpdateInprogress=new NetworkVO(2l,null,null,null,1l,1l,1l,1l,"d","d","d",null,1l,1l,null,true,null,true);
+ mockDAOs((NetworkVO)networkUpdateInprogress,testOffering);
+ //alwyas return backup routers first when both master and backup need update.
+ List<DomainRouterVO> routers=virtualRouterElement.getRouters(networkUpdateInprogress);
+ assertTrue(routers.size()==1);
+ assertTrue(routers.get(0).getRedundantState()==RedundantState.BACKUP && routers.get(0).getUpdateState()==VirtualRouter.UpdateState.UPDATE_IN_PROGRESS);
+ }
+
+ @Test
+ public void testGetRouters3(){
+ Network network=new NetworkVO(3l,null,null,null,1l,1l,1l,1l,"d","d","d",null,1l,1l,null,true,null,true);
+ mockDAOs((NetworkVO)network,testOffering);
+ //alwyas return backup routers first when both master and backup need update.
+ List<DomainRouterVO> routers=virtualRouterElement.getRouters(network);
+ assertTrue(routers.size()==4);
+ }
+
+ @Test
+ public void getResourceCountTest(){
+ Network network=new NetworkVO(3l,null,null,null,1l,1l,1l,1l,"d","d","d",null,1l,1l,null,true,null,true);
+ mockDAOs((NetworkVO)network,testOffering);
+ int routers=virtualRouterElement.getResourceCount(network);
+ assertTrue(routers==4);
+ }
+
+ @Test
+ public void completeAggregationCommandTest1() throws AgentUnavailableException,ResourceUnavailableException {
+ virtualRouterElement._routerMgr = Mockito.mock(VpcVirtualNetworkApplianceManagerImpl.class);
+ virtualRouterElement.routerDeploymentDefinitionBuilder = routerDeploymentDefinitionBuilder;
+ Network network = new NetworkVO(6l, null, null, null, 1l, 1l, 1l, 1l, "d", "d", "d", null, 1l, 1l, null, true, null, true);
+ when(virtualRouterElement._routerMgr.completeAggregatedExecution(any(Network.class), anyList())).thenReturn(true);
+ mockDAOs((NetworkVO) network, testOffering);
+ when(virtualRouterElement._routerDao.persist(any(DomainRouterVO.class))).thenAnswer(new Answer<Object>() {
+ @Override
+ public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
+ Object args[] = invocationOnMock.getArguments();
+ DomainRouterVO router = (DomainRouterVO) args[0];
+ if (router.getUpdateState() != VirtualRouter.UpdateState.UPDATE_COMPLETE) {
+ throw new CloudRuntimeException("TestFailed: completeAggregationCommandTest1 failed");
+ } else return null;
+ }
+ });
+ virtualRouterElement.completeAggregatedExecution(network, testDestination);
+ }
/**
* @param networks
* @param offerings
@@ -293,11 +359,94 @@ private void mockDAOs(final NetworkVO network, final NetworkOfferingVO offering)
/* haEnabled */ false,
/* stopPending */ false,
/* vpcId */ null);
-
+ final DomainRouterVO routerNeedUpdateBackup = new DomainRouterVO(/* id */ 2L,
+ /* serviceOfferingId */ 1L,
+ /* elementId */ 0L,
+ "name",
+ /* templateId */0L,
+ HypervisorType.XenServer,
+ /* guestOSId */ 0L,
+ /* domainId */ 0L,
+ /* accountId */ 1L,
+ /* userId */ 1L,
+ /* isRedundantRouter */ false,
+ RedundantState.BACKUP,
+ /* haEnabled */ false,
+ /* stopPending */ false,
+ /* vpcId */ null);
+ routerNeedUpdateBackup.setUpdateState(VirtualRouter.UpdateState.UPDATE_NEEDED);
+ final DomainRouterVO routerNeedUpdateMaster = new DomainRouterVO(/* id */ 3L,
+ /* serviceOfferingId */ 1L,
+ /* elementId */ 0L,
+ "name",
+ /* templateId */0L,
+ HypervisorType.XenServer,
+ /* guestOSId */ 0L,
+ /* domainId */ 0L,
+ /* accountId */ 1L,
+ /* userId */ 1L,
+ /* isRedundantRouter */ false,
+ RedundantState.MASTER,
+ /* haEnabled */ false,
+ /* stopPending */ false,
+ /* vpcId */ null);
+ routerNeedUpdateMaster.setUpdateState(VirtualRouter.UpdateState.UPDATE_NEEDED);
+ final DomainRouterVO routerUpdateComplete = new DomainRouterVO(/* id */ 4L,
+ /* serviceOfferingId */ 1L,
+ /* elementId */ 0L,
+ "name",
+ /* templateId */0L,
+ HypervisorType.XenServer,
+ /* guestOSId */ 0L,
+ /* domainId */ 0L,
+ /* accountId */ 1L,
+ /* userId */ 1L,
+ /* isRedundantRouter */ false,
+ RedundantState.UNKNOWN,
+ /* haEnabled */ false,
+ /* stopPending */ false,
+ /* vpcId */ null);
+ routerUpdateComplete.setUpdateState(VirtualRouter.UpdateState.UPDATE_COMPLETE);
+ final DomainRouterVO routerUpdateInProgress = new DomainRouterVO(/* id */ 5L,
+ /* serviceOfferingId */ 1L,
+ /* elementId */ 0L,
+ "name",
+ /* templateId */0L,
+ HypervisorType.XenServer,
+ /* guestOSId */ 0L,
+ /* domainId */ 0L,
+ /* accountId */ 1L,
+ /* userId */ 1L,
+ /* isRedundantRouter */ false,
+ RedundantState.UNKNOWN,
+ /* haEnabled */ false,
+ /* stopPending */ false,
+ /* vpcId */ null);
+ routerUpdateInProgress.setUpdateState(VirtualRouter.UpdateState.UPDATE_IN_PROGRESS);
+ List<DomainRouterVO> routerList1=new ArrayList<>();
+ routerList1.add(routerUpdateComplete);
+ routerList1.add(routerNeedUpdateBackup);
+ routerList1.add(routerNeedUpdateMaster);
+ routerList1.add(routerUpdateInProgress);
+ List<DomainRouterVO> routerList2=new ArrayList<>();
+ routerList2.add(routerUpdateComplete);
+ routerList2.add(routerNeedUpdateBackup);
+ routerList2.add(routerNeedUpdateMaster);
+ List<DomainRouterVO> routerList3=new ArrayList<>();
+ routerList3.add(routerUpdateComplete);
+ routerList3.add(routerUpdateInProgress);
when(_routerDao.getNextInSequence(Long.class, "id")).thenReturn(1L);
when(_templateDao.findRoutingTemplate(HypervisorType.XenServer, "SystemVM Template (XenServer)")).thenReturn(new VMTemplateVO());
when(_routerDao.persist(any(DomainRouterVO.class))).thenReturn(router);
when(_routerDao.findById(router.getId())).thenReturn(router);
+ when(_routerDao.listByNetworkAndRole(1l, VirtualRouter.Role.VIRTUAL_ROUTER)).thenReturn(routerList1);
+ when(_routerDao.listByNetworkAndRole(2l, VirtualRouter.Role.VIRTUAL_ROUTER)).thenReturn(routerList2);
+ when(_routerDao.listByNetworkAndRole(3l, VirtualRouter.Role.VIRTUAL_ROUTER)).thenReturn(routerList1);
+ when(_routerDao.listByNetworkAndRole(6l, VirtualRouter.Role.VIRTUAL_ROUTER)).thenReturn(routerList3);
+ when(_networkDetailsDao.findDetail(1l, Network.updatingInSequence)).thenReturn(new NetworkDetailVO(1l,Network.updatingInSequence,"true",true));
+ when(_networkDetailsDao.findDetail(2l, Network.updatingInSequence)).thenReturn(new NetworkDetailVO(2l,Network.updatingInSequence,"true",true));
+ when(_networkDetailsDao.findDetail(6l, Network.updatingInSequence)).thenReturn(new NetworkDetailVO(2l,Network.updatingInSequence,"true",true));
+ when(_routerDao.persist(any(DomainRouterVO.class))).thenReturn(router);
}
}
diff --git a/server/test/com/cloud/storage/VolumeApiServiceImplTest.java b/server/test/com/cloud/storage/VolumeApiServiceImplTest.java
index 71f6deddf60..cf7a666075d 100644
--- a/server/test/com/cloud/storage/VolumeApiServiceImplTest.java
+++ b/server/test/com/cloud/storage/VolumeApiServiceImplTest.java
@@ -16,39 +16,35 @@
// under the License.
package com.cloud.storage;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyLong;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.doNothing;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
-
-import javax.inject.Inject;
-
+import com.cloud.configuration.Resource;
+import com.cloud.dc.DataCenterVO;
+import com.cloud.dc.dao.DataCenterDao;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.host.dao.HostDao;
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.org.Grouping;
import com.cloud.serializer.GsonHelper;
+import com.cloud.storage.dao.VolumeDao;
+import com.cloud.user.Account;
+import com.cloud.user.AccountManager;
+import com.cloud.user.AccountVO;
+import com.cloud.user.ResourceLimitService;
import com.cloud.user.User;
+import com.cloud.user.UserVO;
+import com.cloud.user.dao.AccountDao;
+import com.cloud.utils.db.TransactionLegacy;
import com.cloud.vm.UserVmManager;
+import com.cloud.vm.UserVmVO;
import com.cloud.vm.VirtualMachine;
-import junit.framework.Assert;
-import org.apache.cloudstack.api.command.user.volume.CreateVolumeCmd;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-
+import com.cloud.vm.VirtualMachine.State;
+import com.cloud.vm.dao.UserVmDao;
+import com.cloud.vm.dao.VMInstanceDao;
+import com.cloud.vm.snapshot.VMSnapshotVO;
+import com.cloud.vm.snapshot.dao.VMSnapshotDao;
import org.apache.cloudstack.acl.ControlledEntity;
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
+import org.apache.cloudstack.api.command.user.volume.CreateVolumeCmd;
import org.apache.cloudstack.api.command.user.volume.DetachVolumeCmd;
import org.apache.cloudstack.context.CallContext;
import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo;
@@ -61,22 +57,31 @@
import org.apache.cloudstack.framework.jobs.impl.AsyncJobVO;
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.exception.ResourceAllocationException;
-import com.cloud.hypervisor.Hypervisor.HypervisorType;
-import com.cloud.storage.dao.VolumeDao;
-import com.cloud.user.Account;
-import com.cloud.user.AccountManager;
-import com.cloud.user.AccountVO;
-import com.cloud.user.UserVO;
-import com.cloud.utils.db.TransactionLegacy;
-import com.cloud.vm.UserVmVO;
-import com.cloud.vm.VirtualMachine.State;
-import com.cloud.vm.dao.UserVmDao;
-import com.cloud.vm.dao.VMInstanceDao;
-import com.cloud.vm.snapshot.VMSnapshotVO;
-import com.cloud.vm.snapshot.dao.VMSnapshotDao;
+import javax.inject.Inject;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyLong;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
public class VolumeApiServiceImplTest {
@Inject
@@ -110,6 +115,14 @@
CreateVolumeCmd createVol;
@Mock
UserVmManager _userVmMgr;
+ @Mock
+ DataCenterDao _dcDao;
+ @Mock
+ ResourceLimitService _resourceLimitMgr;
+ @Mock
+ AccountDao _accountDao;
+ @Mock
+ HostDao _hostDao;
DetachVolumeCmd detachCmd = new DetachVolumeCmd();
Class<?> _detachCmdClass = detachCmd.getClass();
@@ -128,10 +141,15 @@ public void setup() throws Exception {
_svc.volFactory = _volFactory;
_svc.volService = volService;
_svc._userVmMgr = _userVmMgr;
+ _svc._dcDao = _dcDao;
+ _svc._resourceLimitMgr = _resourceLimitMgr;
+ _svc._accountDao = _accountDao;
+ _svc._hostDao = _hostDao;
_svc._gson = GsonHelper.getGsonLogger();
// mock caller context
AccountVO account = new AccountVO("admin", 1L, "networkDomain", Account.ACCOUNT_TYPE_NORMAL, "uuid");
+ AccountVO account2 = new AccountVO("Account2", 2L, "networkDomain", Account.ACCOUNT_TYPE_NORMAL, "uuid");
UserVO user = new UserVO(1, "testuser", "password", "firstname", "lastName", "email", "timezone", UUID.randomUUID().toString(), User.Source.UNKNOWN);
CallContext.register(user, account);
// mock async context
@@ -180,6 +198,7 @@ public void setup() throws Exception {
when(_svc._volsDao.findById(3L)).thenReturn(volumeOfStoppeHyperVVm);
StoragePoolVO unmanagedPool = new StoragePoolVO();
+
when(_svc._storagePoolDao.findById(1L)).thenReturn(unmanagedPool);
// volume of managed pool id=4
@@ -203,6 +222,9 @@ public void setup() throws Exception {
when(correctRootVolume.getDataCenterId()).thenReturn(1L);
when(correctRootVolume.getVolumeType()).thenReturn(Volume.Type.ROOT);
when(correctRootVolume.getInstanceId()).thenReturn(null);
+ when(correctRootVolume.getState()).thenReturn(Volume.State.Ready);
+ when(correctRootVolume.getTemplateId()).thenReturn(null);
+ when(correctRootVolume.getPoolId()).thenReturn(1L);
when(_svc.volFactory.getVolume(6L)).thenReturn(correctRootVolume);
VolumeVO correctRootVolumeVO = new VolumeVO("root", 1L, 1L, 1L, 1L, 2L, "root", "root", Storage.ProvisioningType.THIN, 1, null,
@@ -255,6 +277,11 @@ public void setup() throws Exception {
when(_svc._vmSnapshotDao.findByVm(any(Long.class))).thenReturn(new ArrayList<VMSnapshotVO>());
when(_svc._vmInstanceDao.findById(any(Long.class))).thenReturn(stoppedVm);
+ DataCenterVO enabledZone = Mockito.mock(DataCenterVO.class);
+ when(enabledZone.getAllocationState()).thenReturn(Grouping.AllocationState.Enabled);
+
+ when(_svc._dcDao.findById(anyLong())).thenReturn(enabledZone);
+
} finally {
txn.close("runVolumeDaoImplTest");
}
@@ -358,6 +385,7 @@ public void attachRootVolumePositive() throws NoSuchFieldException, IllegalAcces
public void testTakeSnapshotF1() throws ResourceAllocationException {
when(_volFactory.getVolume(anyLong())).thenReturn(volumeInfoMock);
when(volumeInfoMock.getState()).thenReturn(Volume.State.Allocated);
+ when(volumeInfoMock.getPoolId()).thenReturn(1L);
_svc.takeSnapshot(5L, Snapshot.MANUAL_POLICY_ID, 3L, null, false);
}
@@ -366,6 +394,7 @@ public void testTakeSnapshotF2() throws ResourceAllocationException {
when(_volFactory.getVolume(anyLong())).thenReturn(volumeInfoMock);
when(volumeInfoMock.getState()).thenReturn(Volume.State.Ready);
when(volumeInfoMock.getInstanceId()).thenReturn(null);
+ when(volumeInfoMock.getPoolId()).thenReturn(1L);
when (volService.takeSnapshot(Mockito.any(VolumeInfo.class))).thenReturn(snapshotInfoMock);
_svc.takeSnapshot(5L, Snapshot.MANUAL_POLICY_ID, 3L, null, false);
}
@@ -408,6 +437,38 @@ public void testUpdateMissingRootDiskControllerWithValidChainInfo() {
verify(_svc._userVmMgr, times(1)).persistDeviceBusInfo(any(UserVmVO.class), eq("scsi"));
}
+ /**
+ * The resource limit check for primary storage should not be skipped for Volume in 'Uploaded' state.
+ * @throws NoSuchFieldException
+ * @throws IllegalAccessException
+ * @throws ResourceAllocationException
+ */
+ @Test
+ public void testResourceLimitCheckForUploadedVolume() throws NoSuchFieldException, IllegalAccessException, ResourceAllocationException {
+ doThrow(new ResourceAllocationException("primary storage resource limit check failed", Resource.ResourceType.primary_storage)).when(_svc._resourceLimitMgr).checkResourceLimit(any(AccountVO.class), any(Resource.ResourceType.class), any(Long.class));
+ UserVmVO vm = Mockito.mock(UserVmVO.class);
+ VolumeInfo volumeToAttach = Mockito.mock(VolumeInfo.class);
+ when(volumeToAttach.getId()).thenReturn(9L);
+ when(volumeToAttach.getDataCenterId()).thenReturn(34L);
+ when(volumeToAttach.getVolumeType()).thenReturn(Volume.Type.DATADISK);
+ when(volumeToAttach.getInstanceId()).thenReturn(null);
+ when(_userVmDao.findById(anyLong())).thenReturn(vm);
+ when(vm.getType()).thenReturn(VirtualMachine.Type.User);
+ when(vm.getState()).thenReturn(State.Running);
+ when(vm.getDataCenterId()).thenReturn(34L);
+ when(_svc._volsDao.findByInstanceAndType(anyLong(), any(Volume.Type.class))).thenReturn(new ArrayList(10));
+ when(_svc.volFactory.getVolume(9L)).thenReturn(volumeToAttach);
+ when(volumeToAttach.getState()).thenReturn(Volume.State.Uploaded);
+ DataCenterVO zoneWithDisabledLocalStorage = Mockito.mock(DataCenterVO.class);
+ when(_svc._dcDao.findById(anyLong())).thenReturn(zoneWithDisabledLocalStorage);
+ when(zoneWithDisabledLocalStorage.isLocalStorageEnabled()).thenReturn(true);
+ try {
+ _svc.attachVolumeToVM(2L, 9L, null);
+ } catch (InvalidParameterValueException e) {
+ Assert.assertEquals(e.getMessage(), ("primary storage resource limit check failed"));
+ }
+ }
+
@After
public void tearDown() {
CallContext.unregister();
diff --git a/server/test/com/cloud/template/TemplateManagerImplTest.java b/server/test/com/cloud/template/TemplateManagerImplTest.java
index ed4ec520a98..4cc150e4177 100644
--- a/server/test/com/cloud/template/TemplateManagerImplTest.java
+++ b/server/test/com/cloud/template/TemplateManagerImplTest.java
@@ -61,6 +61,7 @@
import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStore;
import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotDataFactory;
import org.apache.cloudstack.engine.subsystem.api.storage.StorageCacheManager;
+import org.apache.cloudstack.engine.subsystem.api.storage.StorageStrategyFactory;
import org.apache.cloudstack.engine.subsystem.api.storage.TemplateDataFactory;
import org.apache.cloudstack.engine.subsystem.api.storage.TemplateService;
import org.apache.cloudstack.engine.subsystem.api.storage.VolumeDataFactory;
@@ -133,6 +134,9 @@
@Inject
PrimaryDataStoreDao primaryDataStoreDao;
+ @Inject
+ StorageStrategyFactory storageStrategyFactory;
+
public class CustomThreadPoolExecutor extends ThreadPoolExecutor {
AtomicInteger ai = new AtomicInteger(0);
public CustomThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit,
@@ -373,6 +377,11 @@ public VMTemplateDao vmTemplateDao() {
return Mockito.mock(VMTemplateDao.class);
}
+ @Bean
+ public StorageStrategyFactory storageStrategyFactory() {
+ return Mockito.mock(StorageStrategyFactory.class);
+ }
+
@Bean
public VMTemplatePoolDao vmTemplatePoolDao() {
return Mockito.mock(VMTemplatePoolDao.class);
diff --git a/server/test/com/cloud/vpc/MockNetworkManagerImpl.java b/server/test/com/cloud/vpc/MockNetworkManagerImpl.java
index a5d8a1ab584..6d2348f97d8 100644
--- a/server/test/com/cloud/vpc/MockNetworkManagerImpl.java
+++ b/server/test/com/cloud/vpc/MockNetworkManagerImpl.java
@@ -247,7 +247,7 @@ public IpAddress getIp(long id) {
*/
@Override
public Network updateGuestNetwork(long networkId, String name, String displayText, Account callerAccount, User callerUser, String domainSuffix,
- Long networkOfferingId, Boolean changeCidr, String guestVmCidr, Boolean displayNetwork, String newUUID) {
+ Long networkOfferingId, Boolean changeCidr, String guestVmCidr, Boolean displayNetwork, String newUUID,boolean updateInSequence, boolean forced) {
// TODO Auto-generated method stub
return null;
}
@@ -841,6 +841,31 @@ public void prepareAllNicsForMigration(VirtualMachineProfile vm, DeployDestinati
return;
}
+ @Override
+ public boolean canUpdateInSequence(Network network) {
+ return false;
+ }
+
+ @Override
+ public List<String> getServicesNotSupportedInNewOffering(Network network, long newNetworkOfferingId) {
+ return null;
+ }
+
+ @Override
+ public void cleanupConfigForServicesInNetwork(List<String> services, Network network) {
+ return;
+ }
+
+ @Override
+ public void configureUpdateInSequence(Network network) {
+ return;
+ }
+
+ @Override
+ public int getResourceCount(Network network) {
+ return 0;
+ }
+
@Override
public void prepareNicForMigration(VirtualMachineProfile vm, DeployDestination dest) {
// TODO Auto-generated method stub
diff --git a/server/test/com/cloud/vpc/MockNetworkModelImpl.java b/server/test/com/cloud/vpc/MockNetworkModelImpl.java
index 93b31e95f9c..50100014cb7 100644
--- a/server/test/com/cloud/vpc/MockNetworkModelImpl.java
+++ b/server/test/com/cloud/vpc/MockNetworkModelImpl.java
@@ -33,6 +33,7 @@
import com.cloud.network.Network;
import com.cloud.network.Network.Capability;
import com.cloud.network.Network.GuestType;
+import com.cloud.network.Network.IpAddresses;
import com.cloud.network.Network.Provider;
import com.cloud.network.Network.Service;
import com.cloud.network.NetworkModel;
@@ -840,7 +841,7 @@ public void checkIp6Parameters(String startIPv6, String endIPv6, String ip6Gatew
}
@Override
- public void checkRequestedIpAddresses(long networkId, String ip4, String ip6) throws InvalidParameterValueException {
+ public void checkRequestedIpAddresses(long networkId, IpAddresses ips) throws InvalidParameterValueException {
// TODO Auto-generated method stub
}
diff --git a/server/test/org/cloud/network/router/deployment/RouterDeploymentDefinitionTest.java b/server/test/org/cloud/network/router/deployment/RouterDeploymentDefinitionTest.java
index 1570a2e15a9..07d11e1fcee 100644
--- a/server/test/org/cloud/network/router/deployment/RouterDeploymentDefinitionTest.java
+++ b/server/test/org/cloud/network/router/deployment/RouterDeploymentDefinitionTest.java
@@ -684,7 +684,7 @@ public void testDeployAllVirtualRouters()
final DomainRouterVO routerVO2 = mock(DomainRouterVO.class);
when(mockNetworkHelper.deployRouter(deploymentUT, false))
.thenReturn(routerVO1).thenReturn(routerVO2);
-
+ when(networkDetailsDao.findById(anyLong())).thenReturn(null);
// Execute
deploymentUT.deployAllVirtualRouters();
diff --git a/server/test/org/cloud/network/router/deployment/RouterDeploymentDefinitionTestBase.java b/server/test/org/cloud/network/router/deployment/RouterDeploymentDefinitionTestBase.java
index 4225083ca2b..626c2d7acc6 100644
--- a/server/test/org/cloud/network/router/deployment/RouterDeploymentDefinitionTestBase.java
+++ b/server/test/org/cloud/network/router/deployment/RouterDeploymentDefinitionTestBase.java
@@ -23,6 +23,7 @@
import java.util.List;
import java.util.Map;
+import com.cloud.network.dao.NetworkDetailsDao;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
@@ -79,6 +80,8 @@
@Mock
protected NetworkHelper mockNetworkHelper;
@Mock
+ protected NetworkDetailsDao networkDetailsDao;
+ @Mock
protected VpcNetworkHelperImpl vpcNwHelper;
@Mock
protected VMInstanceDao mockVmDao;
diff --git a/services/console-proxy-rdp/rdpconsole/pom.xml b/services/console-proxy-rdp/rdpconsole/pom.xml
index a64b118630c..fbaf829cc7e 100755
--- a/services/console-proxy-rdp/rdpconsole/pom.xml
+++ b/services/console-proxy-rdp/rdpconsole/pom.xml
@@ -27,7 +27,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-services</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
diff --git a/services/console-proxy/plugin/pom.xml b/services/console-proxy/plugin/pom.xml
index 14a3ffc3e29..c24b31aafc4 100644
--- a/services/console-proxy/plugin/pom.xml
+++ b/services/console-proxy/plugin/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-service-console-proxy</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../pom.xml</relativePath>
</parent>
</project>
diff --git a/services/console-proxy/pom.xml b/services/console-proxy/pom.xml
index 8dddaeab702..aa649f31b9a 100644
--- a/services/console-proxy/pom.xml
+++ b/services/console-proxy/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-services</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../pom.xml</relativePath>
</parent>
<build>
diff --git a/services/console-proxy/server/pom.xml b/services/console-proxy/server/pom.xml
index 99d0f921b70..989db93fccc 100644
--- a/services/console-proxy/server/pom.xml
+++ b/services/console-proxy/server/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-service-console-proxy</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/services/iam/plugin/pom.xml b/services/iam/plugin/pom.xml
index c770ef26896..76fc98cdcb1 100644
--- a/services/iam/plugin/pom.xml
+++ b/services/iam/plugin/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-service-iam</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/services/iam/server/pom.xml b/services/iam/server/pom.xml
index 71bafed62e8..e7b160e6f3e 100644
--- a/services/iam/server/pom.xml
+++ b/services/iam/server/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-service-iam</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/services/pom.xml b/services/pom.xml
index c8812f75e21..f0ebd163682 100644
--- a/services/pom.xml
+++ b/services/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../pom.xml</relativePath>
</parent>
<build>
diff --git a/services/secondary-storage/controller/pom.xml b/services/secondary-storage/controller/pom.xml
index f242663b316..ae1bd1add7f 100644
--- a/services/secondary-storage/controller/pom.xml
+++ b/services/secondary-storage/controller/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-service-secondary-storage</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/services/secondary-storage/pom.xml b/services/secondary-storage/pom.xml
index 33b5860c11f..de1d5e14614 100644
--- a/services/secondary-storage/pom.xml
+++ b/services/secondary-storage/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-services</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modules>
diff --git a/services/secondary-storage/server/pom.xml b/services/secondary-storage/server/pom.xml
index 97e68a8c9da..80d632274ec 100644
--- a/services/secondary-storage/server/pom.xml
+++ b/services/secondary-storage/server/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack-service-secondary-storage</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/setup/db/db/schema-452to460.sql b/setup/db/db/schema-452to460.sql
index dfb629f95a0..3b380f397e6 100644
--- a/setup/db/db/schema-452to460.sql
+++ b/setup/db/db/schema-452to460.sql
@@ -420,3 +420,5 @@ INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervis
INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created, is_user_defined) VALUES (UUID(),'KVM', 'default', 'CentOS 7', 246, utc_timestamp(), 0);
UPDATE `cloud`.`hypervisor_capabilities` SET `max_data_volumes_limit` = '32' WHERE `hypervisor_capabilities`.`hypervisor_type` = 'KVM';
+
+
diff --git a/setup/db/db/schema-481to482-cleanup.sql b/setup/db/db/schema-481to482-cleanup.sql
new file mode 100644
index 00000000000..bd5fa428e72
--- /dev/null
+++ b/setup/db/db/schema-481to482-cleanup.sql
@@ -0,0 +1,20 @@
+-- Licensed to the Apache Software Foundation (ASF) under one
+-- or more contributor license agreements. See the NOTICE file
+-- distributed with this work for additional information
+-- regarding copyright ownership. The ASF licenses this file
+-- to you under the Apache License, Version 2.0 (the
+-- "License"); you may not use this file except in compliance
+-- with the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing,
+-- software distributed under the License is distributed on an
+-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+-- KIND, either express or implied. See the License for the
+-- specific language governing permissions and limitations
+-- under the License.
+
+--;
+-- Schema cleanup from 4.8.1 to 4.8.2;
+--;
diff --git a/setup/db/db/schema-481to482.sql b/setup/db/db/schema-481to482.sql
new file mode 100644
index 00000000000..274509707c7
--- /dev/null
+++ b/setup/db/db/schema-481to482.sql
@@ -0,0 +1,24 @@
+-- Licensed to the Apache Software Foundation (ASF) under one
+-- or more contributor license agreements. See the NOTICE file
+-- distributed with this work for additional information
+-- regarding copyright ownership. The ASF licenses this file
+-- to you under the Apache License, Version 2.0 (the
+-- "License"); you may not use this file except in compliance
+-- with the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing,
+-- software distributed under the License is distributed on an
+-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+-- KIND, either express or implied. See the License for the
+-- specific language governing permissions and limitations
+-- under the License.
+
+--;
+-- Schema upgrade from 4.8.1 to 4.8.2;
+--;
+
+INSERT IGNORE INTO `cloud`.`guest_os` (id, uuid, category_id, display_name, created) VALUES (275, UUID(), 6, 'Other PV Virtio-SCSI (64-bit)', now());
+INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid, hypervisor_type, hypervisor_version, guest_os_name, guest_os_id, created) VALUES (UUID(), 'KVM', 'default', 'Other PV Virtio-SCSI (64-bit)', 275, now());
+ALTER TABLE `cloud`.`domain_router` ADD COLUMN update_state varchar(64) DEFAULT NULL;
diff --git a/systemvm/patches/debian/config/etc/init.d/cloud-early-config b/systemvm/patches/debian/config/etc/init.d/cloud-early-config
index 5d456616657..d0d6ac6d4fa 100755
--- a/systemvm/patches/debian/config/etc/init.d/cloud-early-config
+++ b/systemvm/patches/debian/config/etc/init.d/cloud-early-config
@@ -1110,6 +1110,10 @@ EOF
echo 0 > /var/cache/cloud/dnsmasq_managed_lease
fi
load_modules
+
+ #setup hourly logrotate
+ mv -n /etc/cron.daily/logrotate /etc/cron.hourly 2>&1
+
}
diff --git a/systemvm/patches/debian/config/etc/logrotate.conf b/systemvm/patches/debian/config/etc/logrotate.conf
index 6b5fcc665cf..de70bf9334f 100644
--- a/systemvm/patches/debian/config/etc/logrotate.conf
+++ b/systemvm/patches/debian/config/etc/logrotate.conf
@@ -6,8 +6,8 @@ rotate 5
create
# use date as a suffix of the rotated file
#dateext
-# max size 50M
-size 50M
+# max size 20M
+size 20M
# RPM packages drop log rotation information into this directory
include /etc/logrotate.d
# no packages own wtmp and btmp -- we'll rotate them here
diff --git a/systemvm/patches/debian/config/etc/logrotate.d/apache2 b/systemvm/patches/debian/config/etc/logrotate.d/apache2
index 3932c274825..58ddb4dede5 100644
--- a/systemvm/patches/debian/config/etc/logrotate.d/apache2
+++ b/systemvm/patches/debian/config/etc/logrotate.d/apache2
@@ -4,6 +4,6 @@
rotate 3
compress
dateext
- size 10M
+ maxsize 10M
notifempty
}
diff --git a/systemvm/patches/debian/config/etc/logrotate.d/cloud b/systemvm/patches/debian/config/etc/logrotate.d/cloud
index 420fce23e18..85ee0b5b96d 100644
--- a/systemvm/patches/debian/config/etc/logrotate.d/cloud
+++ b/systemvm/patches/debian/config/etc/logrotate.d/cloud
@@ -15,8 +15,8 @@
# specific language governing permissions and limitations
# under the License.
/var/log/cloud.log {
- rotate 4
- daily
+ rotate 5
+ hourly
size 10M
missingok
notifempty
diff --git a/systemvm/patches/debian/config/etc/logrotate.d/conntrackd b/systemvm/patches/debian/config/etc/logrotate.d/conntrackd
index 0229cd7e8c5..931550c37e3 100644
--- a/systemvm/patches/debian/config/etc/logrotate.d/conntrackd
+++ b/systemvm/patches/debian/config/etc/logrotate.d/conntrackd
@@ -1,10 +1,9 @@
/var/log/conntrackd-stats.log {
daily
- size 10M
+ maxsize 10M
rotate 2
missingok
compress
- delaycompress
postrotate
if [ -e /var/run/conntrackd.sock ]; then
diff --git a/systemvm/patches/debian/config/etc/logrotate.d/dnsmasq b/systemvm/patches/debian/config/etc/logrotate.d/dnsmasq
index 2f917855190..53db2a94b60 100644
--- a/systemvm/patches/debian/config/etc/logrotate.d/dnsmasq
+++ b/systemvm/patches/debian/config/etc/logrotate.d/dnsmasq
@@ -1,10 +1,10 @@
/var/log/dnsmasq.log {
daily
- size 10M
+ maxsize 10M
missingok
rotate 5
notifempty
- delaycompress
+ compress
sharedscripts
postrotate
[ ! -f /var/run/dnsmasq/dnsmasq.pid ] || kill -USR2 `cat /var/run/dnsmasq/dnsmasq.pid`
diff --git a/systemvm/patches/debian/config/etc/logrotate.d/haproxy b/systemvm/patches/debian/config/etc/logrotate.d/haproxy
index 858fe2a1c3a..669c06cfe6a 100644
--- a/systemvm/patches/debian/config/etc/logrotate.d/haproxy
+++ b/systemvm/patches/debian/config/etc/logrotate.d/haproxy
@@ -3,7 +3,8 @@
rotate 5
missingok
notifempty
- size 10M
+ maxsize 10M
+ compress
postrotate
/bin/kill -HUP `cat /var/run/rsyslog.pid 2> /dev/null` 2> /dev/null || true
endscript
diff --git a/systemvm/patches/debian/config/etc/logrotate.d/ppp b/systemvm/patches/debian/config/etc/logrotate.d/ppp
index 2004e77ff0f..2d70f6aef49 100644
--- a/systemvm/patches/debian/config/etc/logrotate.d/ppp
+++ b/systemvm/patches/debian/config/etc/logrotate.d/ppp
@@ -1,6 +1,6 @@
/var/log/ppp-connect-errors {
daily
- size 10M
+ maxsize 10M
rotate 5
missingok
notifempty
diff --git a/systemvm/patches/debian/config/etc/logrotate.d/rsyslog b/systemvm/patches/debian/config/etc/logrotate.d/rsyslog
index 5803c43d875..9397f41d04a 100644
--- a/systemvm/patches/debian/config/etc/logrotate.d/rsyslog
+++ b/systemvm/patches/debian/config/etc/logrotate.d/rsyslog
@@ -2,10 +2,9 @@
{
rotate 7
daily
- size 50M
+ maxsize 10M
missingok
notifempty
- delaycompress
compress
postrotate
/usr/sbin/invoke-rc.d rsyslog rotate > /dev/null
@@ -27,11 +26,10 @@
{
rotate 10
daily
- size 50M
+ maxsize 10M
missingok
notifempty
compress
- delaycompress
sharedscripts
postrotate
/usr/sbin/invoke-rc.d rsyslog rotate > /dev/null
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/configure.py b/systemvm/patches/debian/config/opt/cloud/bin/configure.py
index b5f65e733cb..44a6ae16c49 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/configure.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/configure.py
@@ -313,6 +313,9 @@ def __createfile(self, ip, folder, file, data):
# base64 decode userdata
if folder == "userdata" or folder == "user-data":
if data is not None:
+ # need to pad data if it is not valid base 64
+ if len(data) % 4 != 0:
+ data += (4-(len(data) % 4)) * "="
data = base64.b64decode(data)
fh = open(dest, "w")
@@ -612,6 +615,13 @@ def process(self):
#Enable remote access vpn
if vpnconfig['create']:
logging.debug("Enabling remote access vpn on "+ public_ip)
+
+ dev = CsHelper.get_device(public_ip)
+ if dev == "":
+ logging.error("Request for ipsec to %s not possible because ip is not configured", public_ip)
+ continue
+
+ CsHelper.start_if_stopped("ipsec")
self.configure_l2tpIpsec(public_ip, self.dbag[public_ip])
logging.debug("Remote accessvpn data bag %s", self.dbag)
self.remoteaccessvpn_iptables(public_ip, self.dbag[public_ip])
@@ -904,104 +914,106 @@ def main(argv):
logging.basicConfig(filename=config.get_logger(),
level=config.get_level(),
format=config.get_format())
-
- # Load stored ip adresses from disk to CsConfig()
- config.set_address()
-
- logging.debug("Configuring ip addresses")
- config.address().compare()
- config.address().process()
-
- if process_file in ["cmd_line.json", "guest_network.json"]:
- logging.debug("Configuring Guest Network")
- iptables_change = True
-
- if process_file in ["cmd_line.json", "vm_password.json"]:
- logging.debug("Configuring vmpassword")
- password = CsPassword("vmpassword", config)
- password.process()
-
- if process_file in ["cmd_line.json", "vm_metadata.json"]:
- logging.debug("Configuring vmdata")
- metadata = CsVmMetadata('vmdata', config)
- metadata.process()
-
- if process_file in ["cmd_line.json", "network_acl.json"]:
- logging.debug("Configuring networkacl")
- iptables_change = True
-
- if process_file in ["cmd_line.json", "firewall_rules.json"]:
- logging.debug("Configuring firewall rules")
- iptables_change = True
-
- if process_file in ["cmd_line.json", "forwarding_rules.json", "staticnat_rules.json"]:
- logging.debug("Configuring PF rules")
- iptables_change = True
-
- if process_file in ["cmd_line.json", "site_2_site_vpn.json"]:
- logging.debug("Configuring s2s vpn")
- iptables_change = True
-
- if process_file in ["cmd_line.json", "remote_access_vpn.json"]:
- logging.debug("Configuring remote access vpn")
- iptables_change = True
-
- if process_file in ["cmd_line.json", "vpn_user_list.json"]:
- logging.debug("Configuring vpn users list")
- vpnuser = CsVpnUser("vpnuserlist", config)
- vpnuser.process()
-
- if process_file in ["cmd_line.json", "vm_dhcp_entry.json", "dhcp.json"]:
- logging.debug("Configuring dhcp entry")
- dhcp = CsDhcp("dhcpentry", config)
- dhcp.process()
-
- if process_file in ["cmd_line.json", "load_balancer.json"]:
- logging.debug("Configuring load balancer")
- iptables_change = True
-
- if process_file in ["cmd_line.json", "monitor_service.json"]:
- logging.debug("Configuring monitor service")
- mon = CsMonitor("monitorservice", config)
- mon.process()
-
- # If iptable rules have changed, apply them.
- if iptables_change:
- acls = CsAcl('networkacl', config)
- acls.process()
-
- acls = CsAcl('firewallrules', config)
- acls.process()
-
- fwd = CsForwardingRules("forwardingrules", config)
- fwd.process()
-
- vpns = CsSite2SiteVpn("site2sitevpn", config)
- vpns.process()
-
- rvpn = CsRemoteAccessVpn("remoteaccessvpn", config)
- rvpn.process()
-
- lb = CsLoadBalancer("loadbalancer", config)
- lb.process()
-
- logging.debug("Configuring iptables rules")
- nf = CsNetfilters()
- nf.compare(config.get_fw())
-
- logging.debug("Configuring iptables rules done ...saving rules")
-
- # Save iptables configuration - will be loaded on reboot by the iptables-restore that is configured on /etc/rc.local
- CsHelper.save_iptables("iptables-save", "/etc/iptables/router_rules.v4")
- CsHelper.save_iptables("ip6tables-save", "/etc/iptables/router_rules.v6")
-
- red = CsRedundant(config)
- red.set()
-
- if process_file in ["cmd_line.json", "static_routes.json"]:
- logging.debug("Configuring static routes")
- static_routes = CsStaticRoutes("staticroutes", config)
- static_routes.process()
+ try:
+ # Load stored ip adresses from disk to CsConfig()
+ config.set_address()
+
+ logging.debug("Configuring ip addresses")
+ config.address().compare()
+ config.address().process()
+
+ if process_file in ["cmd_line.json", "guest_network.json"]:
+ logging.debug("Configuring Guest Network")
+ iptables_change = True
+
+ if process_file in ["cmd_line.json", "vm_password.json"]:
+ logging.debug("Configuring vmpassword")
+ password = CsPassword("vmpassword", config)
+ password.process()
+
+ if process_file in ["cmd_line.json", "vm_metadata.json"]:
+ logging.debug("Configuring vmdata")
+ metadata = CsVmMetadata('vmdata', config)
+ metadata.process()
+
+ if process_file in ["cmd_line.json", "network_acl.json"]:
+ logging.debug("Configuring networkacl")
+ iptables_change = True
+
+ if process_file in ["cmd_line.json", "firewall_rules.json"]:
+ logging.debug("Configuring firewall rules")
+ iptables_change = True
+
+ if process_file in ["cmd_line.json", "forwarding_rules.json", "staticnat_rules.json"]:
+ logging.debug("Configuring PF rules")
+ iptables_change = True
+
+ if process_file in ["cmd_line.json", "site_2_site_vpn.json"]:
+ logging.debug("Configuring s2s vpn")
+ iptables_change = True
+
+ if process_file in ["cmd_line.json", "remote_access_vpn.json"]:
+ logging.debug("Configuring remote access vpn")
+ iptables_change = True
+
+ if process_file in ["cmd_line.json", "vpn_user_list.json"]:
+ logging.debug("Configuring vpn users list")
+ vpnuser = CsVpnUser("vpnuserlist", config)
+ vpnuser.process()
+
+ if process_file in ["cmd_line.json", "vm_dhcp_entry.json", "dhcp.json"]:
+ logging.debug("Configuring dhcp entry")
+ dhcp = CsDhcp("dhcpentry", config)
+ dhcp.process()
+
+ if process_file in ["cmd_line.json", "load_balancer.json"]:
+ logging.debug("Configuring load balancer")
+ iptables_change = True
+
+ if process_file in ["cmd_line.json", "monitor_service.json"]:
+ logging.debug("Configuring monitor service")
+ mon = CsMonitor("monitorservice", config)
+ mon.process()
+
+ # If iptable rules have changed, apply them.
+ if iptables_change:
+ acls = CsAcl('networkacl', config)
+ acls.process()
+
+ acls = CsAcl('firewallrules', config)
+ acls.process()
+
+ fwd = CsForwardingRules("forwardingrules", config)
+ fwd.process()
+
+ vpns = CsSite2SiteVpn("site2sitevpn", config)
+ vpns.process()
+
+ rvpn = CsRemoteAccessVpn("remoteaccessvpn", config)
+ rvpn.process()
+
+ lb = CsLoadBalancer("loadbalancer", config)
+ lb.process()
+
+ logging.debug("Configuring iptables rules")
+ nf = CsNetfilters()
+ nf.compare(config.get_fw())
+
+ logging.debug("Configuring iptables rules done ...saving rules")
+
+ # Save iptables configuration - will be loaded on reboot by the iptables-restore that is configured on /etc/rc.local
+ CsHelper.save_iptables("iptables-save", "/etc/iptables/router_rules.v4")
+ CsHelper.save_iptables("ip6tables-save", "/etc/iptables/router_rules.v6")
+
+ red = CsRedundant(config)
+ red.set()
+
+ if process_file in ["cmd_line.json", "static_routes.json"]:
+ logging.debug("Configuring static routes")
+ static_routes = CsStaticRoutes("staticroutes", config)
+ static_routes.process()
+ except Exception:
+ logging.exception("Exception while configuring router")
if __name__ == "__main__":
main(sys.argv)
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
index e4c5d1fe1fa..cae2e918156 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsAddress.py
@@ -433,6 +433,9 @@ def fw_vpcrouter(self):
self.fw.append(["mangle", "front", "-A PREROUTING " +
"-m state --state RELATED,ESTABLISHED " +
"-j CONNMARK --restore-mark --nfmask 0xffffffff --ctmask 0xffffffff"])
+
+ self.fw.append(["filter", "", "-A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT"])
+
if self.get_type() in ["guest"]:
self.fw.append(["filter", "", "-A FORWARD -d %s -o %s -j ACL_INBOUND_%s" %
(self.address['network'], self.dev, self.dev)])
@@ -440,6 +443,9 @@ def fw_vpcrouter(self):
["filter", "front", "-A ACL_INBOUND_%s -d 224.0.0.18/32 -j ACCEPT" % self.dev])
self.fw.append(
["filter", "front", "-A ACL_INBOUND_%s -d 225.0.0.50/32 -j ACCEPT" % self.dev])
+ self.fw.append(
+ ["filter", "", "-A ACL_INBOUND_%s -j DROP" % self.dev])
+
self.fw.append(
["mangle", "front", "-A ACL_OUTBOUND_%s -d 225.0.0.50/32 -j ACCEPT" % self.dev])
self.fw.append(
@@ -460,10 +466,12 @@ def fw_vpcrouter(self):
(self.dev, self.address[
'network'], self.address['gateway'], self.dev)
])
- self.fw.append(["", "front", "-A NETWORK_STATS_%s -o %s -s %s" %
+
+ self.fw.append(["", "front", "-A NETWORK_STATS_%s -i %s -d %s" %
("eth1", "eth1", self.address['network'])])
- self.fw.append(["", "front", "-A NETWORK_STATS_%s -o %s -d %s" %
+ self.fw.append(["", "front", "-A NETWORK_STATS_%s -o %s -s %s" %
("eth1", "eth1", self.address['network'])])
+
self.fw.append(["nat", "front",
"-A POSTROUTING -s %s -o %s -j SNAT --to-source %s" %
(self.address['network'], self.dev,
@@ -497,7 +505,10 @@ def fw_vpcrouter(self):
self.fw.append(["filter", "", "-A INPUT -d 225.0.0.50/32 -j ACCEPT"])
self.fw.append(["filter", "", "-A INPUT -p icmp -j ACCEPT"])
+ self.fw.append(["filter", "", "-A INPUT -i lo -j ACCEPT"])
+
self.fw.append(["filter", "", "-A INPUT -i eth0 -p tcp -m tcp --dport 3922 -m state --state NEW,ESTABLISHED -j ACCEPT"])
+ self.fw.append(["filter", "", "-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT"])
self.fw.append(["filter", "", "-P INPUT DROP"])
self.fw.append(["filter", "", "-P FORWARD DROP"])
@@ -534,7 +545,7 @@ def post_config_change(self, method):
if self.address["source_nat"]:
vpccidr = cmdline.get_vpccidr()
self.fw.append(
- ["filter", "", "-A FORWARD -s %s ! -d %s -j ACCEPT" % (vpccidr, vpccidr)])
+ ["filter", 3, "-A FORWARD -s %s ! -d %s -j ACCEPT" % (vpccidr, vpccidr)])
self.fw.append(
["nat", "", "-A POSTROUTING -j SNAT -o %s --to-source %s" % (self.dev, self.address['public_ip'])])
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDhcp.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDhcp.py
index 3f102e6e28d..f4cff6fb1d2 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDhcp.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsDhcp.py
@@ -103,12 +103,10 @@ def delete_leases(self):
return
def preseed(self):
- self.add_host("127.0.0.1", "localhost")
+ self.add_host("127.0.0.1", "localhost %s" % CsHelper.get_hostname())
self.add_host("::1", "localhost ip6-localhost ip6-loopback")
self.add_host("ff02::1", "ip6-allnodes")
self.add_host("ff02::2", "ip6-allrouters")
- if self.config.is_vpc():
- self.add_host("127.0.0.1", CsHelper.get_hostname())
if self.config.is_router():
self.add_host(self.config.address().get_guest_ip(), "%s data-server" % CsHelper.get_hostname())
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsHelper.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsHelper.py
index 1d6baff99e3..31becd19053 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsHelper.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsHelper.py
@@ -246,6 +246,6 @@ def copy(src, dest):
try:
shutil.copy2(src, dest)
except IOError:
- logging.Error("Could not copy %s to %s" % (src, dest))
+ logging.error("Could not copy %s to %s" % (src, dest))
else:
logging.info("Copied %s to %s" % (src, dest))
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsNetfilter.py b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsNetfilter.py
index 4b5b49231f2..3ee5174459c 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs/CsNetfilter.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs/CsNetfilter.py
@@ -133,24 +133,29 @@ def get_unseen(self):
def compare(self, list):
""" Compare reality with what is needed """
- for c in self.chain.get("filter"):
- # Ensure all inbound/outbound chains have a default drop rule
- if c.startswith("ACL_INBOUND") or c.startswith("ACL_OUTBOUND"):
- list.append(["filter", "", "-A %s -j DROP" % c])
# PASS 1: Ensure all chains are present
for fw in list:
new_rule = CsNetfilter()
new_rule.parse(fw[2])
new_rule.set_table(fw[0])
self.add_chain(new_rule)
+
+ ruleSet = set()
# PASS 2: Create rules
for fw in list:
+ tupledFw = tuple(fw)
+ if tupledFw in ruleSet :
+ logging.debug("Already processed : %s", tupledFw)
+ continue
+
new_rule = CsNetfilter()
new_rule.parse(fw[2])
new_rule.set_table(fw[0])
if isinstance(fw[1], int):
new_rule.set_count(fw[1])
+ rule_chain = new_rule.get_chain()
+
logging.debug("Checking if the rule already exists: rule=%s table=%s chain=%s", new_rule.get_rule(), new_rule.get_table(), new_rule.get_chain())
if self.has_rule(new_rule):
logging.debug("Exists: rule=%s table=%s", fw[2], new_rule.get_table())
@@ -162,9 +167,15 @@ def compare(self, list):
if fw[1] == "front":
cpy = cpy.replace('-A', '-I')
if isinstance(fw[1], int):
- cpy = cpy.replace("-A %s" % new_rule.get_chain(), '-I %s %s' % (new_rule.get_chain(), fw[1]))
-
+ # if the rule is for ACLs, we want to insert them in order, right before the DROP all
+ if rule_chain.startswith("ACL_INBOUND"):
+ rule_count = self.chain.get_count(rule_chain)
+ cpy = cpy.replace("-A %s" % new_rule.get_chain(), '-I %s %s' % (new_rule.get_chain(), rule_count))
+ else:
+ cpy = cpy.replace("-A %s" % new_rule.get_chain(), '-I %s %s' % (new_rule.get_chain(), fw[1]))
CsHelper.execute("iptables -t %s %s" % (new_rule.get_table(), cpy))
+ ruleSet.add(tupledFw)
+ self.chain.add_rule(rule_chain)
self.del_standard()
self.get_unseen()
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs_forwardingrules.py b/systemvm/patches/debian/config/opt/cloud/bin/cs_forwardingrules.py
index e30c012f10d..a5cb3e56531 100755
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs_forwardingrules.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs_forwardingrules.py
@@ -64,6 +64,10 @@ def merge(dbag, rules):
print "removing index %s" % str(index)
if not index == -1:
del dbag[source_ip][index]
+ # If all forwarding rules have been deleted
+ # remove IP from databag
+ if dbag[source_ip] == []:
+ del dbag[source_ip]
return dbag
diff --git a/systemvm/patches/debian/config/opt/cloud/bin/cs_ip.py b/systemvm/patches/debian/config/opt/cloud/bin/cs_ip.py
old mode 100755
new mode 100644
index efcf311296f..f83bf298c4d
--- a/systemvm/patches/debian/config/opt/cloud/bin/cs_ip.py
+++ b/systemvm/patches/debian/config/opt/cloud/bin/cs_ip.py
@@ -15,30 +15,38 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-from pprint import pprint
-from netaddr import *
+from netaddr import *
def merge(dbag, ip):
- added = False
+ nic_dev_id = None
for dev in dbag:
if dev == "id":
continue
for address in dbag[dev]:
if address['public_ip'] == ip['public_ip']:
+ if 'nic_dev_id' in address:
+ nic_dev_id = address['nic_dev_id']
dbag[dev].remove(address)
ipo = IPNetwork(ip['public_ip'] + '/' + ip['netmask'])
- ip['device'] = 'eth' + str(ip['nic_dev_id'])
+ if 'nic_dev_id' in ip:
+ nic_dev_id = ip['nic_dev_id']
+ ip['device'] = 'eth' + str(nic_dev_id)
ip['broadcast'] = str(ipo.broadcast)
ip['cidr'] = str(ipo.ip) + '/' + str(ipo.prefixlen)
ip['size'] = str(ipo.prefixlen)
ip['network'] = str(ipo.network) + '/' + str(ipo.prefixlen)
if 'nw_type' not in ip.keys():
ip['nw_type'] = 'public'
+ else:
+ ip['nw_type'] = ip['nw_type'].lower()
if ip['nw_type'] == 'control':
- dbag['eth' + str(ip['nic_dev_id'])] = [ip]
+ dbag[ip['device']] = [ip]
else:
- dbag.setdefault('eth' + str(ip['nic_dev_id']), []).append(ip)
+ if 'source_nat' in ip and ip['source_nat'] and ip['device'] in dbag and len(dbag[ip['device']]) > 0:
+ dbag[ip['device']].insert(0, ip) # make sure the source_nat ip is first (primary) on the device
+ else:
+ dbag.setdefault(ip['device'], []).append(ip)
return dbag
diff --git a/systemvm/pom.xml b/systemvm/pom.xml
index f0cb0dae0e3..70d9ba0b606 100644
--- a/systemvm/pom.xml
+++ b/systemvm/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../pom.xml</relativePath>
</parent>
<properties>
diff --git a/test/integration/component/maint/test_redundant_router.py b/test/integration/component/maint/test_redundant_router.py
index 98b0bae1ba0..cad1d341d55 100644
--- a/test/integration/component/maint/test_redundant_router.py
+++ b/test/integration/component/maint/test_redundant_router.py
@@ -29,6 +29,7 @@
get_zone,
get_process_status)
import time
+import multiprocessing
# Import Local Modules
from marvin.cloudstackTestCase import cloudstackTestCase
@@ -872,9 +873,16 @@ def setUpClass(cls):
cls.testdata["nw_off_isolated_RVR"],
conservemode=True
)
+ cls.network_offering_for_update=NetworkOffering.create(
+ cls.api_client,
+ cls.testdata["nw_off_isolated_RVR"],
+ conservemode=True
+ )
+ cls._cleanup.append(cls.network_offering_for_update)
cls._cleanup.append(cls.network_offering)
# Enable Network offering
cls.network_offering.update(cls.api_client, state='Enabled')
+ cls.network_offering_for_update.update(cls.api_client, state='Enabled')
return
@classmethod
@@ -1511,3 +1519,149 @@ def test_05_stopBackupRvR_startInstance(self):
"Redundant state of the router should be BACKUP but is %s" %
routers[0].redundantstate)
return
+
+ def updateNetwork(self, conn):
+ try:
+ self.network.update(
+ self.api_client,
+ networkofferingid=self.network_offering_for_update.id,
+ updateinsequence=True,
+ forced=True,
+ changecidr=False
+ )
+ except Exception as e:
+ conn.send("Failed to update network: %s due to %s"%(self.network.name, e))
+ conn.send("update Network Complete")
+ return
+
+
+
+ def get_master_and_backupRouter(self):
+ retry = 4
+ master_router = backup_router=None
+ while retry > 0:
+ routers = Router.list(
+ self.apiclient,
+ networkid=self.network.id,
+ listall=True
+ )
+ retry = retry-1
+ if not (routers[0].redundantstate == 'MASTER' or routers[1].redundantstate == 'MASTER'):
+ continue;
+ if routers[0].redundantstate == 'MASTER':
+ master_router = routers[0]
+ backup_router = routers[1]
+ break
+ else:
+ master_router = routers[1]
+ backup_router = routers[0]
+ break
+ return master_router, backup_router
+
+
+ def chek_for_new_backupRouter(self,old_backup_router):
+ master_router, backup_router = self.get_master_and_backupRouter()
+ retry = 4
+ self.info("Checking if new router is getting created.")
+ self.info("old_backup_router:"+old_backup_router.name+" new_backup_router:"+backup_router.name)
+ while old_backup_router.name == backup_router.name:
+ self.debug("waiting for new router old router:"+backup_router.name)
+ retry = retry-1
+ if retry == 0:
+ break;
+ time.sleep(self.testdata["sleep"])
+ master_router, backup_router = self.get_master_and_backupRouter()
+ if retry == 0:
+ self.fail("New router creation taking too long, timed out")
+
+ def wait_untill_router_stabilises(self):
+ retry=4
+ while retry > 0:
+ routers = Router.list(
+ self.apiclient,
+ networkid=self.network.id,
+ listall=True
+ )
+ retry = retry-1
+ self.info("waiting untill state of the routers is stable")
+ if routers[0].redundantstate != 'UNKNOWN' and routers[1].redundantstate != 'UNKNOWN':
+ return
+ elif retry==0:
+ self.fail("timedout while waiting for routers to stabilise")
+ return
+ time.sleep(self.testdata["sleep"])
+
+ @attr(tags=["bharat"])
+ def test_06_updateVRs_in_sequence(self):
+ """Test update network and check if VRs are updated in sequence
+ """
+
+ # Steps to validate
+ # update network to a new offering
+ # check if the master router is running while backup is starting.
+ # check if the backup is running while master is starting.
+ # check if both the routers are running after the update is complete.
+
+ #clean up the network to make sure it is in proper state.
+ self.network.restart(self.apiclient,cleanup=True)
+ time.sleep(self.testdata["sleep"])
+ self.wait_untill_router_stabilises()
+ old_master_router, old_backup_router = self.get_master_and_backupRouter()
+ self.info("old_master_router:"+old_master_router.name+" old_backup_router"+old_backup_router.name)
+ #chek if the network is in correct state
+ self.assertEqual(old_master_router.state, "Running", "The master router is not running, network is not in a correct state to start the test")
+ self.assertEqual(old_backup_router.state, "Running", "The backup router is not running, network is not in a correct state to start the test")
+
+ worker, monitor = multiprocessing.Pipe()
+ worker_process = multiprocessing.Process(target=self.updateNetwork, args=(worker,))
+ worker_process.start()
+ if not worker_process.is_alive():
+ message = monitor.recv()
+ if "Complete" not in message:
+ self.fail(message)
+
+ self.info("Network update Started, the old backup router will get destroyed and a new router will be created")
+
+ self.chek_for_new_backupRouter(old_backup_router)
+ master_router, new_backup_router=self.get_master_and_backupRouter()
+ #the state of the master router should be running. while backup is being updated
+ self.assertEqual(master_router.state, "Running", "State of the master router is not running")
+ self.assertEqual(master_router.redundantstate, 'MASTER', "Redundant state of the master router should be MASTER, but it is %s"%master_router.redundantstate)
+ self.info("Old backup router:"+old_backup_router.name+" is destroyed and new router:"+new_backup_router.name+" got created")
+
+ #wait for the new backup to become master.
+ retry = 4
+ while new_backup_router.name != master_router.name:
+ retry = retry-1
+ if retry == 0:
+ break
+ time.sleep(self.testdata["sleep"])
+ self.info("wating for backup router to become master router name:"+new_backup_router.name)
+ master_router, backup_router = self.get_master_and_backupRouter()
+ if retry == 0:
+ self.fail("timed out while waiting for new backup router to change state to MASTER.")
+
+ #new backup router has become master.
+ self.info("newly created router:"+new_backup_router.name+" has changed state to Master")
+ self.info("old master router:"+old_master_router.name+"is destroyed")
+ #old master will get destroyed and a new backup will be created.
+ #wait until new backup changes state from unknown to backup
+ master_router, backup_router = self.get_master_and_backupRouter()
+ retry = 4
+ while backup_router.redundantstate != 'BACKUP':
+ retry = retry-1
+ self.info("waiting for router:"+backup_router.name+" to change state to Backup")
+ if retry == 0:
+ break
+ time.sleep(self.testdata["sleep"])
+ master_router, backup_router = self.get_master_and_backupRouter()
+ self.assertEqual(master_router.state, "Running", "State of the master router is not running")
+ self.assertEqual(master_router.redundantstate, 'MASTER', "Redundant state of the master router should be MASTER, but it is %s"%master_router.redundantstate)
+ if retry == 0:
+ self.fail("timed out while waiting for new backup rotuer to change state to MASTER.")
+
+ #the network update is complete.finally both the router should be running.
+ new_master_router, new_backup_router=self.get_master_and_backupRouter()
+ self.assertEqual(new_master_router.state, "Running", "State of the master router:"+new_master_router.name+" is not running")
+ self.assertEqual(new_backup_router.state, "Running", "State of the backup router:"+new_backup_router.name+" is not running")
+ worker_process.join()
diff --git a/test/integration/component/test_vpn_service.py b/test/integration/component/test_vpn_service.py
new file mode 100644
index 00000000000..8d27624b766
--- /dev/null
+++ b/test/integration/component/test_vpn_service.py
@@ -0,0 +1,212 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+""" P1 tests for VPN service
+"""
+# Import Local Modules
+from nose.plugins.attrib import attr
+from marvin.cloudstackException import CloudstackAPIException
+from marvin.cloudstackTestCase import cloudstackTestCase
+from marvin.lib.base import (
+ Account,
+ ServiceOffering,
+ VirtualMachine,
+ PublicIPAddress,
+ Vpn,
+ VpnUser,
+ Configurations,
+ NATRule
+ )
+from marvin.lib.common import (get_domain,
+ get_zone,
+ get_template
+ )
+from marvin.lib.utils import cleanup_resources
+
+
+class Services:
+ """Test VPN Service
+ """
+
+ def __init__(self):
+ self.services = {
+ "account": {
+ "email": "test@test.com",
+ "firstname": "Test",
+ "lastname": "User",
+ "username": "test",
+ # Random characters are appended for unique
+ # username
+ "password": "password",
+ },
+ "service_offering": {
+ "name": "Tiny Instance",
+ "displaytext": "Tiny Instance",
+ "cpunumber": 1,
+ "cpuspeed": 100, # in MHz
+ "memory": 128, # In MBs
+ },
+ "disk_offering": {
+ "displaytext": "Small Disk Offering",
+ "name": "Small Disk Offering",
+ "disksize": 1
+ },
+ "virtual_machine": {
+ "displayname": "TestVM",
+ "username": "root",
+ "password": "password",
+ "ssh_port": 22,
+ "hypervisor": 'KVM',
+ "privateport": 22,
+ "publicport": 22,
+ "protocol": 'TCP',
+ },
+ "vpn_user": {
+ "username": "test",
+ "password": "test",
+ },
+ "natrule": {
+ "privateport": 1701,
+ "publicport": 1701,
+ "protocol": "UDP"
+ },
+ "ostype": 'CentOS 5.5 (64-bit)',
+ "sleep": 60,
+ "timeout": 10,
+ # Networking mode: Advanced, Basic
+ }
+
+
+class TestVPNService(cloudstackTestCase):
+ @classmethod
+ def setUpClass(cls):
+ cls.testClient = super(TestVPNService, cls).getClsTestClient()
+ cls.api_client = cls.testClient.getApiClient()
+
+ cls.services = Services().services
+ # Get Zone, Domain and templates
+ cls.domain = get_domain(cls.api_client)
+ cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
+
+ cls.services["mode"] = cls.zone.networktype
+
+ cls.template = get_template(
+ cls.api_client,
+ cls.zone.id,
+ cls.services["ostype"]
+ )
+
+ cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+ cls.service_offering = ServiceOffering.create(
+ cls.api_client,
+ cls.services["service_offering"]
+ )
+
+ cls._cleanup = [cls.service_offering, ]
+ return
+
+ @classmethod
+ def tearDownClass(cls):
+ try:
+ # Cleanup resources used
+ cleanup_resources(cls.api_client, cls._cleanup)
+ except Exception as e:
+ raise Exception("Warning: Exception during cleanup : %s" % e)
+ return
+
+ def setUp(self):
+ try:
+ self.apiclient = self.testClient.getApiClient()
+ self.dbclient = self.testClient.getDbConnection()
+ self.account = Account.create(
+ self.apiclient,
+ self.services["account"],
+ domainid=self.domain.id
+ )
+ self.cleanup = [
+ self.account,
+ ]
+ self.virtual_machine = VirtualMachine.create(
+ self.apiclient,
+ self.services["virtual_machine"],
+ templateid=self.template.id,
+ accountid=self.account.name,
+ domainid=self.account.domainid,
+ serviceofferingid=self.service_offering.id
+ )
+ self.public_ip = PublicIPAddress.create(
+ self.apiclient,
+ accountid=self.virtual_machine.account,
+ zoneid=self.virtual_machine.zoneid,
+ domainid=self.virtual_machine.domainid,
+ services=self.services["virtual_machine"]
+ )
+ return
+ except CloudstackAPIException as e:
+ self.tearDown()
+ raise e
+
+ def tearDown(self):
+ try:
+ # Clean up, terminate the created instance, volumes and snapshots
+ cleanup_resources(self.apiclient, self.cleanup)
+ except Exception as e:
+ raise Exception("Warning: Exception during cleanup : %s" % e)
+ return
+
+ def create_VPN(self, public_ip):
+ """Creates VPN for the network"""
+
+ self.debug("Creating VPN with public IP: %s" % public_ip.ipaddress.id)
+ try:
+ # Assign VPN to Public IP
+ vpn = Vpn.create(self.apiclient,
+ self.public_ip.ipaddress.id,
+ account=self.account.name,
+ domainid=self.account.domainid)
+
+ self.debug("Verifying the remote VPN access")
+ vpns = Vpn.list(self.apiclient,
+ publicipid=public_ip.ipaddress.id,
+ listall=True)
+ self.assertEqual(
+ isinstance(vpns, list),
+ True,
+ "List VPNs shall return a valid response"
+ )
+ return vpn
+ except Exception as e:
+ self.fail("Failed to create remote VPN access: %s" % e)
+
+
+ @attr(tags=["advanced", "advancedns"])
+ def test_01_VPN_service(self):
+ """Tests if VPN service is running"""
+
+ # Validate if IPSEC is running on the public
+ # IP by using ike-scan
+
+ self.create_VPN(self.public_ip)
+
+ cmd = ['ike-scan', self.public_ip, '-s', '4534'] # Random port
+
+ stdout = subprocess.check_output(cmd)
+
+ if "1 returned handshake" not in stdout:
+ self.fail("Unable to connect to VPN service")
+
+ return
diff --git a/test/integration/smoke/test_deploy_virtio_scsi_vm.py b/test/integration/smoke/test_deploy_virtio_scsi_vm.py
new file mode 100644
index 00000000000..2b4cc24faef
--- /dev/null
+++ b/test/integration/smoke/test_deploy_virtio_scsi_vm.py
@@ -0,0 +1,380 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Test from the Marvin - Testing in Python wiki
+
+# All tests inherit from cloudstackTestCase
+from marvin.cloudstackTestCase import cloudstackTestCase
+
+# Import Integration Libraries
+
+# base - contains all resources as entities and defines create, delete,
+# list operations on them
+from marvin.lib.base import (Account,
+ VirtualMachine,
+ ServiceOffering,
+ NetworkOffering,
+ Network,
+ Template,
+ DiskOffering,
+ StoragePool,
+ Volume,
+ Host,
+ GuestOs)
+
+
+
+# utils - utility classes for common cleanup, external library wrappers etc
+from marvin.lib.utils import cleanup_resources, get_hypervisor_type, validateList
+
+# common - commonly used methods for all tests are listed here
+from marvin.lib.common import get_zone, get_domain, get_template, list_hosts, get_pod
+
+from marvin.sshClient import SshClient
+
+from marvin.codes import FAILED, PASS
+
+from nose.plugins.attrib import attr
+
+import xml.etree.ElementTree as ET
+import code
+import logging
+
+class Templates:
+ """Test data for templates
+ """
+
+ def __init__(self):
+ self.templates = {
+ "kvmvirtioscsi": {
+ "kvm": {
+ "name": "tiny-kvm-scsi",
+ "displaytext": "virtio-scsi kvm",
+ "format": "qcow2",
+ "hypervisor": "kvm",
+ "ostype": "Other PV Virtio-SCSI (64-bit)",
+ "url": "http://dl.openvm.eu/cloudstack/ubuntu/vanilla/16.04/x86_64/ubuntu-16.04-server-cloudimg-amd64-disk1-kvm.qcow2.bz2",
+ "requireshvm": True,
+ "ispublic": True,
+ "passwordenabled": True
+ }
+ }
+ }
+
+class TestDeployVirtioSCSIVM(cloudstackTestCase):
+
+ """
+ Test deploy a kvm virtio scsi template
+ """
+ @classmethod
+ def setUpClass(cls):
+ cls.logger = logging.getLogger('TestDeployVirtioSCSIVM')
+ cls.stream_handler = logging.StreamHandler()
+ cls.logger.setLevel(logging.DEBUG)
+ cls.logger.addHandler(cls.stream_handler)
+
+ testClient = super(TestDeployVirtioSCSIVM, cls).getClsTestClient()
+ cls.apiclient = testClient.getApiClient()
+ cls.services = cls.testClient.getParsedTestDataConfig()
+
+ cls.hostConfig = cls.config.__dict__["zones"][0].__dict__["pods"][0].__dict__["clusters"][0].__dict__["hosts"][0].__dict__
+ cls.hypervisorNotSupported = False
+ cls.hypervisor = testClient.getHypervisorInfo()
+
+ # Get Zone, Domain and templates
+ cls.domain = get_domain(cls.apiclient)
+ cls.zone = get_zone(cls.apiclient, testClient.getZoneForTests())
+ cls.pod = get_pod(cls.apiclient, cls.zone.id)
+ cls.services['mode'] = cls.zone.networktype
+ if cls.hypervisor.lower() not in ['kvm']:
+ cls.hypervisorNotSupported = True
+ return
+ cls._cleanup = []
+ kvmvirtioscsi = Templates().templates["kvmvirtioscsi"]
+ cls.template = Template.register(
+ cls.apiclient,
+ kvmvirtioscsi[cls.hypervisor.lower()],
+ cls.zone.id,
+ hypervisor=cls.hypervisor.lower(),
+ domainid=cls.domain.id)
+ cls.template.download(cls.apiclient)
+
+ if cls.template == FAILED:
+ assert False, "get_template() failed to return template"
+
+ cls.services["domainid"] = cls.domain.id
+ cls.services["small"]["zoneid"] = cls.zone.id
+ cls.services["zoneid"] = cls.zone.id
+ cls.account = Account.create(
+ cls.apiclient,
+ cls.services["account"],
+ domainid=cls.domain.id
+ )
+
+ cls.service_offering = ServiceOffering.create(
+ cls.apiclient,
+ cls.services["service_offerings"]["tiny"]
+ )
+
+
+ cls.sparse_disk_offering = DiskOffering.create(
+ cls.apiclient,
+ cls.services["sparse_disk_offering"]
+ )
+
+ cls.virtual_machine = VirtualMachine.create(
+ cls.apiclient,
+ cls.services["small"],
+ templateid=cls.template.id,
+ accountid=cls.account.name,
+ domainid=cls.account.domainid,
+ zoneid=cls.zone.id,
+ serviceofferingid=cls.service_offering.id,
+ diskofferingid=cls.sparse_disk_offering.id,
+ mode=cls.zone.networktype
+ )
+
+ hosts = Host.list(cls.apiclient, id=cls.virtual_machine.hostid)
+ if len(hosts) != 1:
+ assert False, "Could not find host with id " + cls.virtual_machine.hostid
+
+ cls.vmhost = hosts[0]
+
+
+
+ password = cls.virtual_machine.resetPassword(cls.apiclient)
+ cls.virtual_machine.username = "ubuntu"
+ cls.virtual_machine.password = password
+ cls._cleanup = [
+ cls.template,
+ cls.service_offering,
+ cls.sparse_disk_offering,
+ cls.account
+ ]
+
+
+ @classmethod
+ def tearDownClass(cls):
+ try:
+ # Cleanup resources used
+ cleanup_resources(cls.apiclient, cls._cleanup)
+ except Exception as e:
+ raise Exception("Warning: Exception during cleanup : %s" % e)
+ return
+
+ def setUp(self):
+ self.apiclient = self.testClient.getApiClient()
+ self.dbclient = self.testClient.getDbConnection()
+ self.cleanup = []
+ return
+
+ def tearDown(self):
+ try:
+ # Clean up, terminate the created instance, volumes and snapshots
+ cleanup_resources(self.apiclient, self.cleanup)
+ except Exception as e:
+ raise Exception("Warning: Exception during cleanup : %s" % e)
+ return
+
+ def verifyVirshState(self, diskcount):
+ host = self.vmhost.ipaddress
+ instancename = self.virtual_machine.instancename
+ virshxml = self.getVirshXML(host, instancename)
+
+ root = ET.fromstring(virshxml)
+
+ scsis = root.findall("./devices/controller[@type='scsi']/alias[@name='scsi0']/..")
+
+ self.assertEqual(len(scsis), 1, "SCSI controller not found")
+
+ scsiindex = scsis[0].get('index')
+ self.assertNotEqual(scsiindex, None, "Could not find index of SCSI controller")
+
+ # find all scsi disks
+ disks = root.findall("./devices/disk[@device='disk']/target[@bus='scsi']/..")
+
+ self.assertEqual(len(disks), diskcount, "Could not find expected number of disks")
+
+ for disk in disks:
+ for child in disk:
+ if child.tag.lower() == "target":
+ dev = child.get("dev")
+ self.assert_(dev != None and dev.startswith("sd"), "disk dev is invalid")
+ elif child.tag.lower() == "address":
+ con = child.get("controller")
+ self.assertEqual(con, scsiindex, "disk controller not equal to SCSI " \
+ "controller index")
+ elif child.tag.lower() == "driver":
+ discard = child.get("discard")
+ self.assertEqual(discard, "unmap", "discard settings not unmap")
+
+ def verifyGuestState(self, diskcount):
+ ssh = self.virtual_machine.get_ssh_client(reconnect=True)
+ output = ssh.execute("lspci | grep \"Virtio SCSI\"")
+ self.assertTrue(len(output) > 0, "Could not find virtio scsi controller")
+ output = ssh.execute("lsblk -rS | grep sd")
+ for disk in output:
+ self.logger.debug("disk " + disk + " found")
+
+ self.assertEqual(len(output), diskcount,
+ "Could not find appropriate number of scsi disks in guest")
+
+ def getVirshXML(self, host, instancename):
+ if host == None:
+ self.logger.debug("getVirshXML: host is none")
+ return ""
+ else:
+ self.logger.debug("host is: " + host)
+ if instancename == None:
+ self.logger.debug("getVirshXML: instancename is none")
+ return ""
+ else:
+ self.logger.debug("instancename is: " + instancename)
+ sshc = SshClient(
+ host=host,
+ port=self.services['configurableData']['host']["publicport"],
+ user=self.hostConfig['username'],
+ passwd=self.hostConfig['password'])
+
+ ssh = sshc.ssh
+
+ chan = ssh.get_transport().open_session()
+ chan.exec_command("virsh dumpxml " + instancename)
+ stdout = ""
+ while True:
+ b = chan.recv(10000)
+ if len(b) == 0:
+ break
+ stdout += b
+
+ stderr = ""
+ while True:
+ b = chan.recv_stderr(10000)
+ if len(b) == 0:
+ break
+ stderr += b
+
+ xstatus = chan.recv_exit_status()
+ chan.close()
+ if xstatus != 0:
+ raise CommandNonzeroException(xstatus, stderr)
+
+ # rely on sshClient to close ssh
+ self.logger.debug("xml is: \n\n%s\n\n" % (stdout))
+ return stdout
+
+ @attr(tags=["advanced", "advancedns", "smoke"], required_hardware="true")
+ def test_01_verify_libvirt(self):
+ """Test that libvirt properly created domain with scsi controller
+ """
+
+ # Validate virsh dumpxml
+ if self.hypervisorNotSupported:
+ self.skipTest
+
+ self.verifyVirshState(2)
+
+ @attr(tags=["advanced", "advancedns", "smoke"], required_hardware="true")
+ def test_02_verify_libvirt_after_restart(self):
+ """ Verify that libvirt settings are as expected after a VM stop / start
+ """
+
+ if self.hypervisorNotSupported:
+ self.skipTest
+
+ self.virtual_machine.stop(self.apiclient)
+ self.virtual_machine.start(self.apiclient)
+ self.verifyVirshState(2)
+
+ @attr(tags=["advanced", "advancedns", "smoke"], required_hardware="true")
+ def test_03_verify_libvirt_attach_disk(self):
+ """ Verify that libvirt settings are expected after a disk add
+ """
+ if self.hypervisorNotSupported:
+ self.skipTest
+
+ self.volume = Volume.create(
+ self.apiclient,
+ self.services,
+ zoneid=self.zone.id,
+ account=self.account.name,
+ domainid=self.account.domainid,
+ diskofferingid=self.sparse_disk_offering.id
+ )
+
+ self.virtual_machine.attach_volume(
+ self.apiclient,
+ self.volume
+ )
+
+ self.verifyVirshState(3)
+
+ @attr(tags=["advanced", "advancedns", "smoke"], required_hardware="true")
+ def test_04_verify_guest_lspci(self):
+ """ Verify that guest sees scsi controller and disks
+ """
+
+ if self.hypervisorNotSupported:
+ self.skipTest
+
+ self.verifyGuestState(3)
+
+ @attr(tags=["advanced", "advancedns", "smoke"], required_hardware="true")
+ def test_05_change_vm_ostype_restart(self):
+ """ Update os type to Ubuntu, change vm details rootdiskController
+ explicitly to scsi.
+ """
+ if self.hypervisorNotSupported:
+ self.skipTest
+
+ self.virtual_machine.stop(self.apiclient)
+ ostypes = GuestOs.listMapping(self.apiclient, hypervisor="kvm")
+ self.assertTrue(len(ostypes) > 0)
+
+ ostypeid = None
+ for ostype in ostypes:
+ if ostype.osdisplayname == "Ubuntu 16.04 (64-bit)":
+ ostypeid = ostype.ostypeid
+ break
+
+ self.assertIsNotNone(ostypeid,
+ "Could not find ostypeid for Ubuntu 16.0.4 (64-bit) mapped to kvm")
+
+
+ self.virtual_machine.update(self.apiclient, ostypeid=ostypeid,
+ details=[{"rootDiskController":"scsi"}])
+
+ self.virtual_machine.start(self.apiclient)
+
+ self.verifyVirshState(3)
+
+ @attr(tags=["advanced", "advancedns", "smoke"], required_hardware="true")
+ def test_06_verify_guest_lspci_again(self):
+ """ Verify that guest sees scsi controller and disks after switching ostype and rdc
+ """
+ if self.hypervisorNotSupported:
+ self.skipTest
+
+ self.verifyGuestState(3)
+
+class CommandNonzeroException(Exception):
+ def __init__(self, code, stderr):
+ self.code = code
+ self.stderr = stderr
+
+ def __str__(self):
+ return "Status code %d: %s" % (self.code, self.stderr)
diff --git a/test/integration/smoke/test_nic.py b/test/integration/smoke/test_nic.py
index 7067074c78b..9dc385c5432 100644
--- a/test/integration/smoke/test_nic.py
+++ b/test/integration/smoke/test_nic.py
@@ -30,6 +30,7 @@
import signal
import sys
+import logging
import time
@@ -37,6 +38,11 @@ class TestNic(cloudstackTestCase):
def setUp(self):
self.cleanup = []
+ self.logger = logging.getLogger('TestNIC')
+ self.stream_handler = logging.StreamHandler()
+ self.logger.setLevel(logging.DEBUG)
+ self.logger.addHandler(self.stream_handler)
+
def signal_handler(signal, frame):
self.tearDown()
@@ -278,6 +284,38 @@ def test_01_nic(self):
return
+ def test_02_nic_with_mac(self):
+ """Test to add and update added nic to a virtual machine with specific mac"""
+
+ hypervisorIsVmware = False
+ isVmwareToolInstalled = False
+ if self.hypervisor.lower() == "vmware":
+ hypervisorIsVmware = True
+
+ self.virtual_machine2 = VirtualMachine.create(
+ self.apiclient,
+ self.services["small"],
+ accountid=self.account.name,
+ domainid=self.account.domainid,
+ serviceofferingid=self.service_offering.id,
+ networkids=[self.test_network.id],
+ macaddress="aa:bb:cc:dd:ee:ff",
+ mode=self.zone.networktype if hypervisorIsVmware else "default"
+ )
+ self.cleanup.insert(0, self.virtual_machine2)
+ self.assertEqual(self.virtual_machine2.nic[0].macaddress, "aa:bb:cc:dd:ee:ff", "Mac address not honored")
+ vmdata = self.virtual_machine2.add_nic(
+ self.apiclient,
+ self.test_network2.id,
+ macaddress="ee:ee:dd:cc:bb:aa")
+ found = False
+ for n in vmdata.nic:
+ if n.macaddress == "ee:ee:dd:cc:bb:aa":
+ found = True
+ break
+
+ self.assertTrue(found, "Nic not successfully added with specified mac address")
+
def tearDown(self):
try:
for obj in self.cleanup:
diff --git a/test/pom.xml b/test/pom.xml
index e582d3e8762..9c4b8dffe8d 100644
--- a/test/pom.xml
+++ b/test/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
</parent>
<dependencies>
<dependency>
diff --git a/tools/apidoc/pom.xml b/tools/apidoc/pom.xml
index fb84b7a5721..2ead1647219 100644
--- a/tools/apidoc/pom.xml
+++ b/tools/apidoc/pom.xml
@@ -17,7 +17,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-tools</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../pom.xml</relativePath>
</parent>
<properties>
diff --git a/tools/checkstyle/pom.xml b/tools/checkstyle/pom.xml
index 1c2655fe9fd..2abdaaf158d 100644
--- a/tools/checkstyle/pom.xml
+++ b/tools/checkstyle/pom.xml
@@ -24,7 +24,7 @@
<name>Apache CloudStack Developer Tools - Checkstyle Configuration</name>
<groupId>org.apache.cloudstack</groupId>
<artifactId>checkstyle</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<prerequisites>
diff --git a/tools/devcloud-kvm/pom.xml b/tools/devcloud-kvm/pom.xml
index ce01784211a..c55d4797d39 100644
--- a/tools/devcloud-kvm/pom.xml
+++ b/tools/devcloud-kvm/pom.xml
@@ -17,7 +17,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-tools</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/tools/devcloud/pom.xml b/tools/devcloud/pom.xml
index 38750e5ae1a..fe2f31aa17d 100644
--- a/tools/devcloud/pom.xml
+++ b/tools/devcloud/pom.xml
@@ -17,7 +17,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-tools</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/tools/devcloud4/pom.xml b/tools/devcloud4/pom.xml
index 586c195ae99..6e4d39f2aab 100644
--- a/tools/devcloud4/pom.xml
+++ b/tools/devcloud4/pom.xml
@@ -17,7 +17,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-tools</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/tools/marvin/marvin/lib/base.py b/tools/marvin/marvin/lib/base.py
index 835613d701f..977ad66072a 100755
--- a/tools/marvin/marvin/lib/base.py
+++ b/tools/marvin/marvin/lib/base.py
@@ -31,7 +31,6 @@
import hashlib
import base64
-
class Domain:
""" Domain Life Cycle """
def __init__(self, items):
@@ -361,7 +360,8 @@ def create(cls, apiclient, services, templateid=None, accountid=None,
affinitygroupnames=None, affinitygroupids=None, group=None,
hostid=None, keypair=None, ipaddress=None, mode='default',
method='GET', hypervisor=None, customcpunumber=None,
- customcpuspeed=None, custommemory=None, rootdisksize=None):
+ customcpuspeed=None, custommemory=None, rootdisksize=None,
+ rootdiskcontroller=None, macaddress=None):
"""Create the instance"""
cmd = deployVirtualMachine.deployVirtualMachineCmd()
@@ -465,6 +465,9 @@ def create(cls, apiclient, services, templateid=None, accountid=None,
if rootdisksize >= 0:
cmd.details[0]["rootdisksize"] = rootdisksize
+ if rootdiskcontroller:
+ cmd.details[0]["rootDiskController"] = rootdiskcontroller
+
if group:
cmd.group = group
@@ -472,6 +475,11 @@ def create(cls, apiclient, services, templateid=None, accountid=None,
if mode.lower() == 'basic':
cls.ssh_access_group(apiclient, cmd)
+ if macaddress:
+ cmd.macaddress = macaddress
+ elif macaddress in services:
+ cmd.macaddress = services["macaddress"]
+
virtual_machine = apiclient.deployVirtualMachine(cmd, method=method)
virtual_machine.ssh_ip = virtual_machine.nic[0].ipaddress
@@ -684,7 +692,7 @@ def detach_volume(self, apiclient, volume):
cmd.id = volume.id
return apiclient.detachVolume(cmd)
- def add_nic(self, apiclient, networkId, ipaddress=None):
+ def add_nic(self, apiclient, networkId, ipaddress=None, macaddress=None):
"""Add a NIC to a VM"""
cmd = addNicToVirtualMachine.addNicToVirtualMachineCmd()
cmd.virtualmachineid = self.id
@@ -693,6 +701,9 @@ def add_nic(self, apiclient, networkId, ipaddress=None):
if ipaddress:
cmd.ipaddress = ipaddress
+ if macaddress:
+ cmd.macaddress = macaddress
+
return apiclient.addNicToVirtualMachine(cmd)
def remove_nic(self, apiclient, nicId):
@@ -2173,6 +2184,33 @@ def list(cls, apiclient, **kwargs):
cmd.listall = True
return(apiclient.listSnapshotPolicies(cmd))
+class GuestOs:
+ """Guest OS calls (currently read-only implemented)"""
+ def __init(self, items):
+ self.__dict__.update(items)
+
+ @classmethod
+ def listMapping(cls, apiclient, **kwargs):
+ """List all Guest Os Mappings matching criteria"""
+ cmd = listGuestOsMapping.listGuestOsMappingCmd()
+ [setattr(cmd, k, v) for k, v in kwargs.items()]
+
+ return (apiclient.listGuestOsMapping(cmd))
+
+ @classmethod
+ def listCategories(cls, apiclient, **kwargs):
+ """List all Os Categories"""
+ [setattr(cmd, k, v) for k, v in kwargs.items()]
+
+ return (apiclient.listOsCategories(cmd))
+
+ @classmethod
+ def list(cls, apiclient, **kwargs):
+ """List all Os Types matching criteria"""
+
+ cmd = listOsTypes.listOsTypesCmd()
+ [setattr(cmd, k, v) for k, v in kwargs.items()]
+ return(apiclient.listOsTypes(cmd))
class Hypervisor:
"""Manage Hypervisor"""
diff --git a/tools/marvin/pom.xml b/tools/marvin/pom.xml
index e9c8c783476..1a41e71a878 100644
--- a/tools/marvin/pom.xml
+++ b/tools/marvin/pom.xml
@@ -16,7 +16,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-tools</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../pom.xml</relativePath>
</parent>
diff --git a/tools/pom.xml b/tools/pom.xml
index 6c8577f424c..5a0d93c92c0 100644
--- a/tools/pom.xml
+++ b/tools/pom.xml
@@ -27,7 +27,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../pom.xml</relativePath>
</parent>
<build>
diff --git a/tools/wix-cloudstack-maven-plugin/pom.xml b/tools/wix-cloudstack-maven-plugin/pom.xml
index 6359537e22d..057498414bc 100644
--- a/tools/wix-cloudstack-maven-plugin/pom.xml
+++ b/tools/wix-cloudstack-maven-plugin/pom.xml
@@ -16,7 +16,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../../pom.xml</relativePath>
</parent>
diff --git a/ui/scripts/templates.js b/ui/scripts/templates.js
index 96ef43aee1c..f27c55e7e24 100644
--- a/ui/scripts/templates.js
+++ b/ui/scripts/templates.js
@@ -217,21 +217,30 @@
$form.find('.form-item[rel=rootDiskControllerType]').css('display', 'inline-block');
$form.find('.form-item[rel=nicAdapterType]').css('display', 'inline-block');
$form.find('.form-item[rel=keyboardType]').css('display', 'inline-block');
-
$form.find('.form-item[rel=xenserverToolsVersion61plus]').hide();
+ $form.find('.form-item[rel=rootDiskControllerTypeKVM]').hide();
} else if ($(this).val() == "XenServer") {
$form.find('.form-item[rel=rootDiskControllerType]').hide();
$form.find('.form-item[rel=nicAdapterType]').hide();
$form.find('.form-item[rel=keyboardType]').hide();
+ $form.find('.form-item[rel=rootDiskControllerTypeKVM]').hide();
if (isAdmin())
$form.find('.form-item[rel=xenserverToolsVersion61plus]').css('display', 'inline-block');
+ } else if ($(this).val() == "KVM") {
+ $form.find('.form-item[rel=rootDiskControllerType]').hide();
+ $form.find('.form-item[rel=nicAdapterType]').hide();
+ $form.find('.form-item[rel=keyboardType]').hide();
+ $form.find('.form-item[rel=xenserverToolsVersion61plus]').hide();
+ $form.find('.form-item[rel=rootDiskControllerTypeKVM]').css('display', 'inline-block');
+
} else {
$form.find('.form-item[rel=rootDiskControllerType]').hide();
$form.find('.form-item[rel=nicAdapterType]').hide();
$form.find('.form-item[rel=keyboardType]').hide();
$form.find('.form-item[rel=xenserverToolsVersion61plus]').hide();
+ $form.find('.form-item[rel=rootDiskControllerTypeKVM]').hide();
}
});
@@ -263,6 +272,38 @@
isHidden: true
},
+ //fields for hypervisor == "KVM" (starts here)
+ rootDiskControllerTypeKVM: {
+ label: 'label.root.disk.controller',
+ isHidden: true,
+ select: function(args) {
+ var items = []
+ items.push({
+ id: "",
+ description: ""
+ });
+ items.push({
+ id: "ide",
+ description: "ide"
+ });
+ items.push({
+ id: "osdefault",
+ description: "osdefault"
+ });
+ items.push({
+ id: "scsi",
+ description: "virtio-scsi"
+ });
+ items.push({
+ id: "virtio",
+ description: "virtio"
+ });
+ args.response.success({
+ data: items
+ });
+ }
+ },
+
//fields for hypervisor == "VMware" (starts here)
rootDiskControllerType: {
label: 'label.root.disk.controller',
@@ -549,6 +590,14 @@
}
//XenServer only (ends here)
+ // KVM only (starts here)
+ if (args.$form.find('.form-item[rel=rootDiskControllerTypeKVM]').css("display") != "none" && args.data.rootDiskControllerTypeKVM != "") {
+ $.extend(data, {
+ 'details[0].rootDiskController': args.data.rootDiskControllerTypeKVM
+ });
+ }
+ // KVM only (ends here)
+
//VMware only (starts here)
if (args.$form.find('.form-item[rel=rootDiskControllerType]').css("display") != "none" && args.data.rootDiskControllerType != "") {
$.extend(data, {
diff --git a/usage/pom.xml b/usage/pom.xml
index 0e6f720ec92..26ebe2ee455 100644
--- a/usage/pom.xml
+++ b/usage/pom.xml
@@ -15,7 +15,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
</parent>
<dependencies>
<dependency>
diff --git a/utils/pom.xml b/utils/pom.xml
index 34ff4c39255..68ec3a3c39c 100755
--- a/utils/pom.xml
+++ b/utils/pom.xml
@@ -26,7 +26,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
diff --git a/utils/src/main/java/com/cloud/utils/net/NetUtils.java b/utils/src/main/java/com/cloud/utils/net/NetUtils.java
index a73813c28d8..a049efc4ae9 100644
--- a/utils/src/main/java/com/cloud/utils/net/NetUtils.java
+++ b/utils/src/main/java/com/cloud/utils/net/NetUtils.java
@@ -44,6 +44,7 @@
import org.apache.commons.lang.SystemUtils;
import org.apache.commons.net.util.SubnetUtils;
import org.apache.commons.validator.routines.InetAddressValidator;
+import org.apache.commons.validator.routines.RegexValidator;
import org.apache.log4j.Logger;
import com.cloud.utils.IteratorUtil;
@@ -1141,22 +1142,43 @@ public static boolean validateGuestCidr(final String cidr) {
// 10.0.0.0 - 10.255.255.255 (10/8 prefix)
// 172.16.0.0 - 172.31.255.255 (172.16/12 prefix)
// 192.168.0.0 - 192.168.255.255 (192.168/16 prefix)
-
- final String cidr1 = "10.0.0.0/8";
- final String cidr2 = "172.16.0.0/12";
- final String cidr3 = "192.168.0.0/16";
+ // RFC 6598 - The IETF detailed shared address space for use in ISP CGN
+ // deployments and NAT devices that can handle the same addresses occurring both on inbound and outbound interfaces.
+ // ARIN returned space to the IANA as needed for this allocation.
+ // The allocated address block is 100.64.0.0/10
+ final String[] allowedNetBlocks = {"10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "100.64.0.0/10"};
if (!isValidCIDR(cidr)) {
s_logger.warn("Cidr " + cidr + " is not valid");
return false;
}
- if (isNetworkAWithinNetworkB(cidr, cidr1) || isNetworkAWithinNetworkB(cidr, cidr2) || isNetworkAWithinNetworkB(cidr, cidr3)) {
- return true;
- } else {
- s_logger.warn("cidr " + cidr + " is not RFC 1918 compliant");
+ for (String block: allowedNetBlocks) {
+ if (isNetworkAWithinNetworkB(cidr, block)) {
+ return true;
+ }
+ }
+
+ // not in allowedNetBlocks - return false
+ s_logger.warn("cidr " + cidr + " is not RFC 1918 or 6598 compliant");
+ return false;
+ }
+
+ public static boolean isValidMac(final String macAddr) {
+ RegexValidator mv = new RegexValidator("^(?:[0-9a-f]{1,2}([-:\\.]))(?:[0-9a-f]{1,2}\\1){4}[0-9a-f]{1,2}$", false);
+ return mv.isValid(macAddr);
+ }
+
+ public static boolean isUnicastMac(final String macAddr) {
+ String std = standardizeMacAddress(macAddr);
+ if(std == null) {
return false;
}
+ long stdl = mac2Long(std);
+ // libvirt says that the last bit of first octet of mac address
+ // must be zero or this is a multicast MAC.
+ long mask = 0x1l << 40l;
+ return ((stdl & mask) == mask) ? false : true;
}
public static boolean verifyInstanceName(final String instanceName) {
@@ -1165,7 +1187,6 @@ public static boolean verifyInstanceName(final String instanceName) {
s_logger.warn("Instance name can not contain hyphen, spaces and \"+\" char");
return false;
}
-
return true;
}
@@ -1431,6 +1452,15 @@ public static String standardizeIp6Address(final String ip6Addr) {
}
}
+ public static String standardizeMacAddress(final String macAddr) {
+ if (!isValidMac(macAddr)) {
+ return null;
+ }
+ String norm = macAddr.replace('.', ':');
+ norm = norm.replace('-', ':');
+ return long2Mac(mac2Long(norm));
+ }
+
public static String standardizeIp6Cidr(final String ip6Cidr){
try {
return IPv6Network.fromString(ip6Cidr).toString();
diff --git a/utils/src/main/java/com/cloud/utils/script/Script.java b/utils/src/main/java/com/cloud/utils/script/Script.java
index b8cb4fe8ce4..76084751417 100644
--- a/utils/src/main/java/com/cloud/utils/script/Script.java
+++ b/utils/src/main/java/com/cloud/utils/script/Script.java
@@ -39,6 +39,7 @@
import org.apache.commons.io.IOUtils;
import org.apache.log4j.Logger;
+import org.joda.time.Duration;
import com.cloud.utils.PropertiesUtil;
import com.cloud.utils.concurrency.NamedThreadFactory;
@@ -64,10 +65,15 @@
Process _process;
Thread _thread;
- public int getExitValue() {
+ public int getExitValue() {
return _process.exitValue();
}
+ public Script(String command, Duration timeout, Logger logger) {
+ this(command, timeout.getMillis(), logger);
+ }
+
+ @Deprecated
public Script(String command, long timeout, Logger logger) {
_command = new ArrayList<String>();
_command.add(command);
@@ -80,6 +86,11 @@ public Script(String command, long timeout, Logger logger) {
_logger = logger != null ? logger : s_logger;
}
+ public Script(boolean runWithSudo, String command, Duration timeout, Logger logger) {
+ this(runWithSudo, command, timeout.getMillis(), logger);
+ }
+
+ @Deprecated
public Script(boolean runWithSudo, String command, long timeout, Logger logger) {
this(command, timeout, logger);
if (runWithSudo) {
@@ -95,6 +106,11 @@ public Script(String command) {
this(command, 0, s_logger);
}
+ public Script(String command, Duration timeout) {
+ this(command, timeout.getMillis(), s_logger);
+ }
+
+ @Deprecated
public Script(String command, long timeout) {
this(command, timeout, s_logger);
}
diff --git a/utils/src/main/java/com/cloud/utils/ssh/SshHelper.java b/utils/src/main/java/com/cloud/utils/ssh/SshHelper.java
index d3c88c8367a..8889016d055 100644
--- a/utils/src/main/java/com/cloud/utils/ssh/SshHelper.java
+++ b/utils/src/main/java/com/cloud/utils/ssh/SshHelper.java
@@ -23,6 +23,7 @@
import java.io.InputStream;
import org.apache.log4j.Logger;
+import org.joda.time.Duration;
import com.trilead.ssh2.ChannelCondition;
@@ -122,8 +123,13 @@ public static void scpTo(String host, int port, String user, File pemKeyFile, St
}
}
- public static Pair<Boolean, String> sshExecute(String host, int port, String user, File pemKeyFile, String password, String command, int connectTimeoutInMs,
- int kexTimeoutInMs, int waitResultTimeoutInMs) throws Exception {
+ public static Pair<Boolean, String> sshExecute(String host, int port, String user, File pemKeyFile, String password, String command, Duration connectTimeout,
+ Duration kexTimeout, Duration waitTime) throws Exception {
+ return sshExecute(host, port, user, pemKeyFile, password, command, (int)connectTimeout.getMillis(), (int)kexTimeout.getMillis(), (int)waitTime.getMillis());
+ }
+
+ public static Pair<Boolean, String> sshExecute(String host, int port, String user, File pemKeyFile, String password, String command, int connectTimeoutInMs, int kexTimeoutInMs,
+ int waitResultTimeoutInMs) throws Exception {
com.trilead.ssh2.Connection conn = null;
com.trilead.ssh2.Session sess = null;
diff --git a/utils/src/test/java/com/cloud/utils/net/NetUtilsTest.java b/utils/src/test/java/com/cloud/utils/net/NetUtilsTest.java
index 490d0df4eb0..fab0b9bcf7e 100644
--- a/utils/src/test/java/com/cloud/utils/net/NetUtilsTest.java
+++ b/utils/src/test/java/com/cloud/utils/net/NetUtilsTest.java
@@ -171,6 +171,24 @@ public void testIsValidIp6Cidr() {
assertFalse(NetUtils.isValidIp6Cidr("1234:5678::1"));
}
+ @Test
+ public void testIsValidMacAddr() {
+ assertTrue(NetUtils.isValidMac("ee:12:34:5:32:ff"));
+ assertTrue(NetUtils.isValidMac("ee.12.34.5.32.ff"));
+ assertTrue(NetUtils.isValidMac("ee-12-34-5-32-ff"));
+ assertFalse(NetUtils.isValidMac("aa.12:34:5:32:ff"));
+ assertFalse(NetUtils.isValidMac("gg.gg:gg:gg:gg:gg"));
+ }
+
+ @Test
+ public void testIsUnicastMac() {
+
+ assertTrue(NetUtils.isUnicastMac("ee:12:34:5:32:ff"));
+ assertFalse(NetUtils.isUnicastMac("ff:12:34:5:32:ff"));
+ assertFalse(NetUtils.isUnicastMac("01:12:34:5:32:ff"));
+ assertTrue(NetUtils.isUnicastMac("00:ff:ff:ff:ff:ff"));
+ }
+
@Test
public void testIsValidIpv6() {
assertTrue(NetUtils.isValidIpv6("fc00::1"));
diff --git a/vmware-base/pom.xml b/vmware-base/pom.xml
index 9df193a055a..f74185eb737 100644
--- a/vmware-base/pom.xml
+++ b/vmware-base/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack</artifactId>
- <version>4.8.1-SNAPSHOT</version>
+ <version>4.8.2</version>
</parent>
<dependencies>
<dependency>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services