andrijapanicsb commented on code in PR #9773:
URL: https://github.com/apache/cloudstack/pull/9773#discussion_r1810730876
##########
server/src/main/java/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java:
##########
@@ -324,13 +311,51 @@ public Site2SiteVpnConnection
createVpnConnection(CreateVpnConnectionCmd cmd) th
return conn;
}
+ private Site2SiteCustomerGateway
getAndValidateSite2SiteCustomerGateway(Long customerGatewayId, Account caller) {
+ Site2SiteCustomerGateway customerGateway =
_customerGatewayDao.findById(customerGatewayId);
+ if (customerGateway == null) {
+ throw new InvalidParameterValueException(String.format("Unable to
find specified Site to Site VPN customer gateway %s !", customerGatewayId));
+ }
+ _accountMgr.checkAccess(caller, null, false, customerGateway);
+ return customerGateway;
+ }
+
+ private Site2SiteVpnGateway getAndValidateSite2SiteVpnGateway(Long
vpnGatewayId, Account caller) {
+ Site2SiteVpnGateway vpnGateway = _vpnGatewayDao.findById(vpnGatewayId);
+ if (vpnGateway == null) {
+ throw new InvalidParameterValueException(String.format("Unable to
find specified Site to Site VPN gateway %s !", vpnGatewayId));
+ }
+ _accountMgr.checkAccess(caller, null, false, vpnGateway);
+ return vpnGateway;
+ }
+
+ private void
validateVpnConnectionOfTheRightAccount(Site2SiteCustomerGateway
customerGateway, Site2SiteVpnGateway vpnGateway) {
+ if (customerGateway.getAccountId() != vpnGateway.getAccountId() ||
customerGateway.getDomainId() != vpnGateway.getDomainId()) {
+ throw new InvalidParameterValueException("VPN connection can only
be established between same account's VPN gateway and customer gateway!");
+ }
+ }
+
+ private void validateVpnConnectionDoesntExist(Long vpnGatewayId, Long
customerGatewayId) {
+ if
(_vpnConnectionDao.findByVpnGatewayIdAndCustomerGatewayId(vpnGatewayId,
customerGatewayId) != null) {
+ throw new InvalidParameterValueException("The vpn connection with
customer gateway id " + customerGatewayId + " and vpn gateway id " +
vpnGatewayId +
+ " already existed!");
+ }
+ }
+
+ private void validatePrerequisiteVpnGateway(Site2SiteVpnGateway
vpnGateway) {
+ // check if gateway has been defined on the VPC
+ if (_vpnGatewayDao.findByVpcId(vpnGateway.getVpcId()) == null) {
+ throw new InvalidParameterValueException("we can not create a VPN
connection for a VPC that does not have a VPN gateway defined");
Review Comment:
```suggestion
throw new InvalidParameterValueException("We can not create a
VPN connection for a VPC that does not have a VPN gateway defined");
```
##########
server/src/main/java/com/cloud/configuration/Config.java:
##########
@@ -506,7 +506,7 @@ public enum Config {
"The time interval in seconds when the management server polls for
snapshots to be scheduled.",
null),
SnapshotDeltaMax("Snapshots", SnapshotManager.class, Integer.class,
"snapshot.delta.max", "16", "max delta snapshots between two full snapshots.",
null),
- KVMSnapshotEnabled("Hidden", SnapshotManager.class, Boolean.class,
"kvm.snapshot.enabled", "false", "whether snapshot is enabled for KVM hosts",
null),
+ KVMSnapshotEnabled("Hidden", SnapshotManager.class, Boolean.class,
"kvm.snapshot.enabled", "false", "whether volume snapshot is enabled on running
instances on KVM hosts", null),
Review Comment:
```suggestion
KVMSnapshotEnabled("Hidden", SnapshotManager.class, Boolean.class,
"kvm.snapshot.enabled", "false", "Whether volume snapshot is enabled on running
instance on a KVM hosts", null),
```
##########
ui/public/locales/en.json:
##########
@@ -402,7 +402,7 @@
"label.attaching": "Attaching",
"label.authentication.method": "Authentication Method",
"label.authentication.sshkey": "System SSH Key",
-"label.autofill.vcenter.credentials": "Autofill vCenter credentials",
+"label.autofill.vcenter.credentials.from.zone": "Autofill vCenter credentials
from Zone",
Review Comment:
Would it make more sense (language-wise) something like "Use existing
vCenter details from the Zone" ?
##########
ui/public/locales/en.json:
##########
@@ -402,7 +402,7 @@
"label.attaching": "Attaching",
"label.authentication.method": "Authentication Method",
"label.authentication.sshkey": "System SSH Key",
-"label.autofill.vcenter.credentials": "Autofill vCenter credentials",
+"label.autofill.vcenter.credentials.from.zone": "Autofill vCenter credentials
from Zone",
Review Comment:
or ".... from this Zone"
##########
server/src/main/java/com/cloud/network/vpn/Site2SiteVpnManagerImpl.java:
##########
@@ -576,7 +592,7 @@ public boolean deleteVpnConnection(DeleteVpnConnectionCmd
cmd) throws ResourceUn
private void stopVpnConnection(Long id) throws
ResourceUnavailableException {
Site2SiteVpnConnectionVO conn =
_vpnConnectionDao.acquireInLockTable(id);
if (conn == null) {
- throw new CloudRuntimeException("Unable to acquire lock on " +
conn);
+ throw new CloudRuntimeException("Unable to acquire lock for
stopping of VPN connection with ID " + id);
Review Comment:
```suggestion
throw new CloudRuntimeException("Unable to acquire lock for
stopping VPN connection with ID " + id);
```
##########
server/src/main/java/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java:
##########
@@ -380,9 +381,14 @@ public VMSnapshot allocVMSnapshot(Long vmId, String
vsDisplayName, String vsDesc
//StorageVMSnapshotStrategy - allows volume snapshots without
memory; VM has to be in Running state; No limitation of the image format if the
storage plugin supports volume snapshots; "kvm.vmstoragesnapshot.enabled" has
to be enabled
//Other Storage volume plugins could integrate this with their own
functionality for group snapshots
VMSnapshotStrategy snapshotStrategy =
storageStrategyFactory.getVmSnapshotStrategy(userVmVo.getId(),
rootVolumePool.getId(), snapshotMemory);
-
if (snapshotStrategy == null) {
- String message = "KVM does not support the type of snapshot
requested";
+ String message;
+ if (!SnapshotManager.VmStorageSnapshotKvm.value() &&
!snapshotMemory) {
+ message = "KVM does not support instance snapshot without
snapshot memory";
Review Comment:
Is this true for only running VMs? If so, perhaps reword "KVM does not
support instance snapshot without memory snapshot, for a running VM" or similar?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]