From 6de271c754b86f48bb2fa5ff05e888ab638a53f4 Mon Sep 17 00:00:00 2001 From: Wei Zhou Date: Tue, 11 Jun 2013 00:03:03 +0200 Subject: [PATCH 01/36] fix disk I/O description mistake --- usage/src/com/cloud/usage/parser/VmDiskUsageParser.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usage/src/com/cloud/usage/parser/VmDiskUsageParser.java b/usage/src/com/cloud/usage/parser/VmDiskUsageParser.java index 74fa214324e..33ba2bbcdb3 100644 --- a/usage/src/com/cloud/usage/parser/VmDiskUsageParser.java +++ b/usage/src/com/cloud/usage/parser/VmDiskUsageParser.java @@ -132,7 +132,7 @@ public static final Logger s_logger = Logger.getLogger(VmDiskUsageParser.class.g usageRecords.add(usageRecord); // Create the usage record for bytes read - usageDesc = "disk bytes read"; + usageDesc = "disk io requests read"; if ((vmDiskInfo.getVmId() != 0) && (vmDiskInfo.getVolumeId() != 0)){ usageDesc += " for Vm: " + vmId + " and Volume: " + volumeId; } @@ -141,7 +141,7 @@ public static final Logger s_logger = Logger.getLogger(VmDiskUsageParser.class.g usageRecords.add(usageRecord); // Create the usage record for bytes write - usageDesc = "disk bytes write"; + usageDesc = "disk io requests write"; if ((vmDiskInfo.getVmId() != 0) && (vmDiskInfo.getVolumeId() != 0)){ usageDesc += " for Vm: " + vmId + " and Volume: " + volumeId; } From ab6bf0b20975e96696e5541e050e97819e003177 Mon Sep 17 00:00:00 2001 From: Wei Zhou Date: Tue, 11 Jun 2013 00:09:05 +0200 Subject: [PATCH 02/36] fix disk I/O description mistake --- .../cloud/usage/parser/VmDiskUsageParser.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/usage/src/com/cloud/usage/parser/VmDiskUsageParser.java b/usage/src/com/cloud/usage/parser/VmDiskUsageParser.java index 33ba2bbcdb3..84bdfd2950f 100644 --- a/usage/src/com/cloud/usage/parser/VmDiskUsageParser.java +++ b/usage/src/com/cloud/usage/parser/VmDiskUsageParser.java @@ -111,8 +111,8 @@ public static final Logger s_logger = Logger.getLogger(VmDiskUsageParser.class.g Long vmId = null; Long volumeId = null; - // Create the usage record for bytes read - String usageDesc = "disk bytes read"; + // Create the usage record for disk I/O read (io requests) + String usageDesc = "disk I/O read (io requests)"; if ((vmDiskInfo.getVmId() != 0) && (vmDiskInfo.getVolumeId() != 0)){ vmId = vmDiskInfo.getVmId(); volumeId = vmDiskInfo.getVolumeId(); @@ -122,8 +122,8 @@ public static final Logger s_logger = Logger.getLogger(VmDiskUsageParser.class.g UsageTypes.VM_DISK_IO_READ, new Double(ioRead), vmId, null, null, null, vmDiskInfo.getVolumeId(), startDate, endDate, "VirtualMachine"); usageRecords.add(usageRecord); - // Create the usage record for bytes write - usageDesc = "disk bytes write"; + // Create the usage record for disk I/O write (io requests) + usageDesc = "disk I/O write (io requests)"; if ((vmDiskInfo.getVmId() != 0) && (vmDiskInfo.getVolumeId() != 0)){ usageDesc += " for Vm: " + vmId + " and Volume: " + volumeId; } @@ -131,8 +131,8 @@ public static final Logger s_logger = Logger.getLogger(VmDiskUsageParser.class.g UsageTypes.VM_DISK_BYTES_WRITE, new Double(ioWrite), vmId, null, null, null, vmDiskInfo.getVolumeId(), startDate, endDate, "VirtualMachine"); usageRecords.add(usageRecord); - // Create the usage record for bytes read - usageDesc = "disk io requests read"; + // Create the usage record for disk I/O read (bytes) + usageDesc = "disk I/O read (bytes)"; if ((vmDiskInfo.getVmId() != 0) && (vmDiskInfo.getVolumeId() != 0)){ usageDesc += " for Vm: " + vmId + " and Volume: " + volumeId; } @@ -140,8 +140,8 @@ public static final Logger s_logger = Logger.getLogger(VmDiskUsageParser.class.g UsageTypes.VM_DISK_BYTES_READ, new Double(bytesRead), vmId, null, null, null, vmDiskInfo.getVolumeId(), startDate, endDate, "VirtualMachine"); usageRecords.add(usageRecord); - // Create the usage record for bytes write - usageDesc = "disk io requests write"; + // Create the usage record for disk I/O write (bytes) + usageDesc = "disk I/O write (bytes)"; if ((vmDiskInfo.getVmId() != 0) && (vmDiskInfo.getVolumeId() != 0)){ usageDesc += " for Vm: " + vmId + " and Volume: " + volumeId; } From a1a68ed0c4b722f6f83733d0b110debde2a1041e Mon Sep 17 00:00:00 2001 From: Alex Huang Date: Mon, 10 Jun 2013 16:07:05 -0700 Subject: [PATCH 03/36] Review 11752 applied --- utils/src/com/cloud/utils/Ternary.java | 2 +- utils/test/com/cloud/utils/TernaryTest.java | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 utils/test/com/cloud/utils/TernaryTest.java diff --git a/utils/src/com/cloud/utils/Ternary.java b/utils/src/com/cloud/utils/Ternary.java index fee69eeb3b7..115d0f4edfd 100644 --- a/utils/src/com/cloud/utils/Ternary.java +++ b/utils/src/com/cloud/utils/Ternary.java @@ -61,7 +61,7 @@ public class Ternary { @Override public boolean equals(Object obj) { - if (!(obj instanceof Pair)) { + if (!(obj instanceof Ternary)) { return false; } Ternary that = (Ternary)obj; diff --git a/utils/test/com/cloud/utils/TernaryTest.java b/utils/test/com/cloud/utils/TernaryTest.java new file mode 100644 index 00000000000..ec1c2f9bf52 --- /dev/null +++ b/utils/test/com/cloud/utils/TernaryTest.java @@ -0,0 +1,18 @@ +package com.cloud.utils; + +import org.junit.Assert; +import org.junit.Test; + +public class TernaryTest { + @Test + public void testEquals() { + Assert.assertEquals(new Ternary("a", "b", "c"), new Ternary( + "a", "b", "c")); + Assert.assertFalse(new Ternary("a", "b", "c") + .equals(new Ternary("a", "b", "d"))); + Assert.assertFalse(new Ternary("a", "b", "c").equals("")); + Assert.assertFalse(new Ternary("a", "b", "c").equals(null)); + Assert.assertFalse(new Ternary("a", "b", "c") + .equals(new Pair("a", "b"))); + } +} From 4fce6448e65d22587ba72f6bfa493b71ae0e2a08 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Mon, 10 Jun 2013 16:54:19 -0700 Subject: [PATCH 04/36] CLOUDSTACK-2021: UI - Network menu - listView - add IPv6 CIDR field. --- ui/scripts/network.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ui/scripts/network.js b/ui/scripts/network.js index 61468fcd05f..fb63e4b4f19 100755 --- a/ui/scripts/network.js +++ b/ui/scripts/network.js @@ -544,7 +544,8 @@ name: { label: 'label.name' }, account: { label: 'label.account' }, type: { label: 'label.type' }, - cidr: { label: 'label.cidr' } + cidr: { label: 'label.cidr' }, + ip6cidr: { label: 'IPv6 CIDR' } }, advSearchFields: { From f38c4e9ea684cdec22491858620072f13f4f0155 Mon Sep 17 00:00:00 2001 From: Kelven Yang Date: Mon, 10 Jun 2013 17:46:22 -0700 Subject: [PATCH 05/36] Bug CS-17825: Don't rely on XS to cleanup idle session but proactively close it from console proxy --- .../src/com/cloud/consoleproxy/ConsoleProxyClientBase.java | 4 +++- .../src/com/cloud/consoleproxy/ConsoleProxyGCThread.java | 5 ++++- .../src/com/cloud/consoleproxy/ConsoleProxyVncClient.java | 5 +++-- .../com/cloud/consoleproxy/vnc/VncClientPacketSender.java | 4 +++- .../com/cloud/consoleproxy/vnc/VncServerPacketReceiver.java | 4 +++- 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxyClientBase.java b/services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxyClientBase.java index f4c912a9e53..07a1b6f8f96 100644 --- a/services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxyClientBase.java +++ b/services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxyClientBase.java @@ -253,7 +253,8 @@ public abstract class ConsoleProxyClientBase implements ConsoleProxyClient, Cons if(s_logger.isTraceEnabled()) s_logger.trace("Ajax client start, frame buffer w: " + width + ", " + height); - + +/* int retry = 0; tracker.initCoverageTest(); while(!tracker.hasFullCoverage() && retry < 10) { @@ -263,6 +264,7 @@ public abstract class ConsoleProxyClientBase implements ConsoleProxyClient, Cons } retry++; } +*/ List tiles = tracker.scan(true); String imgUrl = prepareAjaxImage(tiles, true); diff --git a/services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxyGCThread.java b/services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxyGCThread.java index 7f82a965f69..9e637a51a13 100644 --- a/services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxyGCThread.java +++ b/services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxyGCThread.java @@ -64,6 +64,7 @@ public class ConsoleProxyGCThread extends Thread { public void run() { boolean bReportLoad = false; + long lastReportTick = System.currentTimeMillis(); while (true) { cleanupLogging(); bReportLoad = false; @@ -95,10 +96,12 @@ public class ConsoleProxyGCThread extends Thread { client.closeClient(); } - if(bReportLoad) { + if(bReportLoad || System.currentTimeMillis() - lastReportTick > 5000) { // report load changes String loadInfo = new ConsoleProxyClientStatsCollector(connMap).getStatsReport(); ConsoleProxy.reportLoadInfo(loadInfo); + lastReportTick = System.currentTimeMillis(); + if(s_logger.isDebugEnabled()) s_logger.debug("Report load change : " + loadInfo); } diff --git a/services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxyVncClient.java b/services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxyVncClient.java index 6a473b5f007..5c838a59517 100644 --- a/services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxyVncClient.java +++ b/services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxyVncClient.java @@ -46,7 +46,7 @@ public class ConsoleProxyVncClient extends ConsoleProxyClientBase { private VncClient client; private Thread worker; - private boolean workerDone = false; + private volatile boolean workerDone = false; private int lastModifierStates = 0; private int lastPointerMask = 0; @@ -80,7 +80,7 @@ public class ConsoleProxyVncClient extends ConsoleProxyClientBase { String tunnelUrl = getClientParam().getClientTunnelUrl(); String tunnelSession = getClientParam().getClientTunnelSession(); - for(int i = 0; i < 15; i++) { + for(int i = 0; i < 15 && !workerDone; i++) { try { if(tunnelUrl != null && !tunnelUrl.isEmpty() && tunnelSession != null && !tunnelSession.isEmpty()) { URI uri = new URI(tunnelUrl); @@ -136,6 +136,7 @@ public class ConsoleProxyVncClient extends ConsoleProxyClientBase { @Override public void closeClient() { + workerDone = true; if(client != null) client.shutdown(); } diff --git a/services/console-proxy/server/src/com/cloud/consoleproxy/vnc/VncClientPacketSender.java b/services/console-proxy/server/src/com/cloud/consoleproxy/vnc/VncClientPacketSender.java index d27b76d3468..ea15a608dfb 100644 --- a/services/console-proxy/server/src/com/cloud/consoleproxy/vnc/VncClientPacketSender.java +++ b/services/console-proxy/server/src/com/cloud/consoleproxy/vnc/VncClientPacketSender.java @@ -77,8 +77,10 @@ public class VncClientPacketSender implements Runnable, PaintNotificationListene s_logger.error("Unexpected exception: ", e); if (connectionAlive) { closeConnection(); - vncConnection.shutdown(); } + } finally { + s_logger.info("Sending thread exit processing, shutdown connection"); + vncConnection.shutdown(); } } diff --git a/services/console-proxy/server/src/com/cloud/consoleproxy/vnc/VncServerPacketReceiver.java b/services/console-proxy/server/src/com/cloud/consoleproxy/vnc/VncServerPacketReceiver.java index 57c8ff8efe2..2bd2c6f8cce 100644 --- a/services/console-proxy/server/src/com/cloud/consoleproxy/vnc/VncServerPacketReceiver.java +++ b/services/console-proxy/server/src/com/cloud/consoleproxy/vnc/VncServerPacketReceiver.java @@ -90,8 +90,10 @@ public class VncServerPacketReceiver implements Runnable { s_logger.error("Unexpected exception: ", e); if (connectionAlive) { closeConnection(); - vncConnection.shutdown(); } + } finally { + s_logger.info("Receiving thread exit processing, shutdown connection"); + vncConnection.shutdown(); } } From 923deba89b8c6624f7b108062a31550b19a9b08b Mon Sep 17 00:00:00 2001 From: Kelven Yang Date: Mon, 10 Jun 2013 17:52:14 -0700 Subject: [PATCH 06/36] Wire CreateSnapshotCmd with @Inject support in SnapshotSchedulerImpl --- .../src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java b/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java index 5af0af00ae4..7170a686800 100644 --- a/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java +++ b/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java @@ -56,6 +56,7 @@ import com.cloud.utils.DateUtil; import com.cloud.utils.DateUtil.IntervalType; import com.cloud.utils.NumbersUtil; +import com.cloud.utils.component.ComponentContext; import com.cloud.utils.component.ManagerBase; import com.cloud.utils.concurrency.TestClock; import com.cloud.utils.db.DB; @@ -246,6 +247,7 @@ public class SnapshotSchedulerImpl extends ManagerBase implements SnapshotSchedu params.put("ctxStartEventId", String.valueOf(eventId)); CreateSnapshotCmd cmd = new CreateSnapshotCmd(); + ComponentContext.inject(cmd); ApiDispatcher.getInstance().dispatchCreateCmd(cmd, params); params.put("id", ""+cmd.getEntityId()); params.put("ctxStartEventId", "1"); From 971c40d98e07ab6cddb8e6db5095c1acea935815 Mon Sep 17 00:00:00 2001 From: Chiradeep Vittal Date: Mon, 10 Jun 2013 20:38:24 -0700 Subject: [PATCH 07/36] Fix RAT check broken by a1a68ed0c4b722 --- utils/test/com/cloud/utils/TernaryTest.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/utils/test/com/cloud/utils/TernaryTest.java b/utils/test/com/cloud/utils/TernaryTest.java index ec1c2f9bf52..ce03d776cf6 100644 --- a/utils/test/com/cloud/utils/TernaryTest.java +++ b/utils/test/com/cloud/utils/TernaryTest.java @@ -1,3 +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 +// 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.utils; import org.junit.Assert; From bbfa9bfcbde78675a2aecb3736f76f11373f6084 Mon Sep 17 00:00:00 2001 From: Likitha Shetty Date: Fri, 7 Jun 2013 11:07:37 +0530 Subject: [PATCH 08/36] CLOUDSTACK-2862. EC2Engine is not injected correctly --- .../cloud/bridge/service/controller/s3/ServiceProvider.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/awsapi/src/com/cloud/bridge/service/controller/s3/ServiceProvider.java b/awsapi/src/com/cloud/bridge/service/controller/s3/ServiceProvider.java index 0f98518d8ef..a0892cc979b 100644 --- a/awsapi/src/com/cloud/bridge/service/controller/s3/ServiceProvider.java +++ b/awsapi/src/com/cloud/bridge/service/controller/s3/ServiceProvider.java @@ -91,8 +91,6 @@ public class ServiceProvider extends ManagerBase { // register service implementation object Transaction txn = Transaction.open(Transaction.AWSAPI_DB); txn.close(); - serviceMap.put(AmazonS3SkeletonInterface.class, new S3SerializableServiceImplementation(engine)); - serviceMap.put(AmazonEC2SkeletonInterface.class, new EC2SoapServiceImpl(EC2_engine)); } public synchronized static ServiceProvider getInstance() { @@ -101,7 +99,9 @@ public class ServiceProvider extends ManagerBase { @PostConstruct void initComponent() { - instance = this; + serviceMap.put(AmazonS3SkeletonInterface.class, new S3SerializableServiceImplementation(engine)); + serviceMap.put(AmazonEC2SkeletonInterface.class, new EC2SoapServiceImpl(EC2_engine)); + instance = this; } public boolean configure(String name, Map params) From 7b63894a0a2226c16de6ce2eaa5aa6f62746026c Mon Sep 17 00:00:00 2001 From: Likitha Shetty Date: Tue, 11 Jun 2013 11:45:31 +0530 Subject: [PATCH 09/36] CLOUDSTACK-2891. While adding a new vlan range if the new range extends an existing range then CS extends the existing range to include the new range. This is done by checking if the last vlan in the new range is same as the start vlan of any existing range. Since for a single vlan the start and the end vlan are the same the check goes to an infinite loop resulting in a java.lang.OutOfMemoryError: Java heap space error. Remove the check for a single vlan because if an existing range starts with the single vlan then it implies that the range already exists --- server/src/com/cloud/network/NetworkServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/com/cloud/network/NetworkServiceImpl.java b/server/src/com/cloud/network/NetworkServiceImpl.java index d5a59d62817..407bdc2d7f8 100755 --- a/server/src/com/cloud/network/NetworkServiceImpl.java +++ b/server/src/com/cloud/network/NetworkServiceImpl.java @@ -2663,7 +2663,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService { existingRanges.get(i).second(-1); } value = vnetMap.get((existingRanges.get(i).second())); - if (value != null) { + if (value != null && ( (existingRanges.get(i).second()) != (existingRanges.get(i).first()) )) { vnetMap.remove((existingRanges.get(i).second())); vnetMap.remove(existingRanges.get(i).first()); vnetMap.put(existingRanges.get(i).first(),value); From 07e5cbe81394fbd4e36d5ad2fff36cd8eea40a8e Mon Sep 17 00:00:00 2001 From: Nitin Mehta Date: Tue, 11 Jun 2013 15:39:14 +0530 Subject: [PATCH 10/36] CLOUDSTACK-2932 Allow deleting of snapshots that have errored out. Simply mark the removed column as there is no physiocal clean up required --- .../storage/snapshot/strategy/AncientSnapshotStrategy.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/strategy/AncientSnapshotStrategy.java b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/strategy/AncientSnapshotStrategy.java index 9e666d21515..4aba3d919b5 100644 --- a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/strategy/AncientSnapshotStrategy.java +++ b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/strategy/AncientSnapshotStrategy.java @@ -536,6 +536,11 @@ public class AncientSnapshotStrategy implements SnapshotStrategy { Long snapshotId = snapInfo.getId(); SnapshotObject snapshot = (SnapshotObject)snapInfo; + if (Snapshot.State.Error.equals(snapshot.getState())) { + _snapshotDao.remove(snapshotId); + return true; + } + if (!Snapshot.State.BackedUp.equals(snapshot.getState())) { throw new InvalidParameterValueException("Can't delete snapshotshot " + snapshotId + " due to it is not in BackedUp Status"); } From aa01ba75ca7baf35a7060f165439cfa78a401841 Mon Sep 17 00:00:00 2001 From: Radhika PC Date: Tue, 11 Jun 2013 14:55:39 +0530 Subject: [PATCH 11/36] CLOUDSTACK-2404 --- docs/en-US/networks.xml | 1 + docs/en-US/pvlan.xml | 108 ++++++++++++++++++++++++++++++++++------ 2 files changed, 93 insertions(+), 16 deletions(-) diff --git a/docs/en-US/networks.xml b/docs/en-US/networks.xml index b557088273f..d1fc541659a 100644 --- a/docs/en-US/networks.xml +++ b/docs/en-US/networks.xml @@ -48,6 +48,7 @@ + diff --git a/docs/en-US/pvlan.xml b/docs/en-US/pvlan.xml index e3f2ea3ace7..f0cdbac94e3 100644 --- a/docs/en-US/pvlan.xml +++ b/docs/en-US/pvlan.xml @@ -110,20 +110,16 @@ url="http://www.cisco.com/en/US/products/hw/switches/ps708/products_tech_note09186a0080094830.shtml" >Private VLAN Catalyst Switch Support Matrixfor more information. - - Connect a switch to the gateway; connect additional switches to the gateway via a - trunk port: Only Cisco Catalyst 4500 has the PVLAN promiscuous trunk mode to connect both - normal VLAN and PVLAN to a PVLAN-unaware switch. For other Catalyst PVLAN support switch, - connect the switch to upper switch by using cables. The number of cables should be greater - than the number of PVLANs used. - All the layer 2 switches, which are PVLAN-aware, are connected to each other, and one of them is connected to a router. All the ports connected to the host would be configured - in trunk mode. Allow Management VLAN, Primary VLAN (public) and secondary Isolated VLAN + in trunk mode. Open Management VLAN, Primary VLAN (public) and Secondary Isolated VLAN ports. Configure the switch port connected to the router in PVLAN promiscuous trunk mode, - which would translate an isolated VLAN to primary VLAN for router, which is PVLAN-unaware. - + which would translate an isolated VLAN to primary VLAN for the PVLAN-unaware router. + Note that only Cisco Catalyst 4500 has the PVLAN promiscuous trunk mode to connect + both normal VLAN and PVLAN to a PVLAN-unaware switch. For other Catalyst PVLAN support + switch, connect the switch to upper switch by using cables. The number of cables should be + greater than the number of PVLANs used. If your Catalyst switch supports PVLAN, but not PVLAN promiscuous trunk mode, perform @@ -137,15 +133,15 @@ For each PVLAN, perform the following: - Connect one port of the Catalyst switch to the upper switch. + Connect a port of the Catalyst switch to the upper switch. Set the port in the Catalyst Switch in promiscuous mode for one pair of - PVLAN + PVLAN. - Set the port in upper switch to access mode, and allow only the traffic of - primary VLAN of the PVLAN pair. + Set the port in the upper switch to access mode, and allow only the traffic of + the primary VLAN of the PVLAN pair. @@ -154,10 +150,90 @@ Configure private VLAN on your physical switches out-of-band. + + Open vSwitch (OVS) used by XenServer and KVM does not support PVLAN. Therefore, + simulate PVLAN on OVS for XenServer and KVM by modifying the flow table to achieve the + following: + + + For every traffic leaving user VMs, tag with the secondary isolated VLAN + ID. + + + Change the VLAN ID to primary VLAN ID. + This allows the traffic which is tagged with the secondary isolated VLAN ID reach + the DHCP server. + + + The gateway is PVLAN-unaware; therefore, the switch connected to the gateway + should translate all the secondary VLAN to primary VLAN for communicating with the + gateway. + + +
- - <para/> + <title>Creating a PVLAN-Enabled Guest Network + + + Log in to the CloudPlatform UI as administrator. + + + In the left navigation, choose Infrastructure. + + + On Zones, click View More. + + + Click the zone to which you want to add a guest network. + + + Click the Physical Network tab. + + + Click Add guest network. + The Add guest network window is displayed. + + + Specify the following: + + + Name: + + + Description: + + + VLAN ID: + + + Private VLAN ID: + + + Scope: + + + Network Offering: + + + Gateway: + + + Netmask: + + + IP Range: + + + IPv6 CIDR: + + + Network Domain: + + + + Click OK to confirm. +
From c12a8187af0613d990334fe0798e1a5d4e6ded80 Mon Sep 17 00:00:00 2001 From: Radhika PC Date: Tue, 11 Jun 2013 16:27:02 +0530 Subject: [PATCH 12/36] CLOUDSTACK-2404 --- docs/en-US/pvlan.xml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/en-US/pvlan.xml b/docs/en-US/pvlan.xml index f0cdbac94e3..c4d8f921c87 100644 --- a/docs/en-US/pvlan.xml +++ b/docs/en-US/pvlan.xml @@ -191,6 +191,15 @@ Click the Physical Network tab. + + Click the physical network you want to work with. + + + On the Guest node of the diagram, click Configure. + + + Click the Network tab. + Click Add guest network. The Add guest network window is displayed. From 358f3edc575b9f5ec70010316523a8edeb540d55 Mon Sep 17 00:00:00 2001 From: Jayapal Date: Tue, 11 Jun 2013 11:49:34 +0530 Subject: [PATCH 13/36] CLOUDSTACK-2609 Fixed accoundId, domainId for the secondary ip address for shared networks Signed-off-by: Abhinandan Prateek --- server/src/com/cloud/network/NetworkServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/src/com/cloud/network/NetworkServiceImpl.java b/server/src/com/cloud/network/NetworkServiceImpl.java index 407bdc2d7f8..024c969a043 100755 --- a/server/src/com/cloud/network/NetworkServiceImpl.java +++ b/server/src/com/cloud/network/NetworkServiceImpl.java @@ -670,8 +670,8 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService { if (network == null) { throw new InvalidParameterValueException("Invalid network id is given"); } - accountId = network.getAccountId(); - domainId = network.getDomainId(); + accountId = ipOwner.getAccountId(); + domainId = ipOwner.getDomainId(); // Validate network offering NetworkOfferingVO ntwkOff = _networkOfferingDao.findById(network.getNetworkOfferingId()); From 360eae368767f374fe13d5ba2b8a9056d0ef8633 Mon Sep 17 00:00:00 2001 From: Bharat Kumar Date: Wed, 5 Jun 2013 21:52:57 +0530 Subject: [PATCH 14/36] Cloudstack-2854 [Multiple_IP_Ranges] Failed to create ip alias on VR while deploying guest vm with ip address from new CIDR Signed-off-by: Abhinandan Prateek --- .../VirtualRoutingResource.java | 50 +++++++++++-------- scripts/network/domr/call_dnsmasq.sh | 29 +++++++++++ scripts/network/domr/createipAlias.sh | 26 ++++++++++ scripts/network/domr/deleteipAlias.sh | 25 ++++++++++ 4 files changed, 109 insertions(+), 21 deletions(-) create mode 100755 scripts/network/domr/call_dnsmasq.sh create mode 100755 scripts/network/domr/createipAlias.sh create mode 100755 scripts/network/domr/deleteipAlias.sh diff --git a/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java b/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java index 9e40eefc11a..dae1c8591f4 100755 --- a/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java +++ b/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java @@ -111,7 +111,7 @@ public class VirtualRoutingResource implements Manager { private String _routerProxyPath; private String _createIpAliasPath; private String _deleteIpAliasPath; - private String _configDhcpPath; + private String _callDnsMasqPath; private int _timeout; private int _startTimeout; @@ -625,7 +625,8 @@ public class VirtualRoutingResource implements Manager { String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); final Script command = new Script(_createIpAliasPath, _timeout, s_logger); List ipAliasTOs = cmd.getIpAliasList(); - String args=routerIp+" "; + String args = ""; + command.add(routerIp); for (IpAliasTO ipaliasto : ipAliasTOs) { args = args + ipaliasto.getAlias_count()+":"+ipaliasto.getRouterip()+":"+ipaliasto.getNetmask()+"-"; } @@ -637,7 +638,8 @@ public class VirtualRoutingResource implements Manager { protected Answer execute(final DeleteIpAliasCommand cmd) { final Script command = new Script(_deleteIpAliasPath, _timeout, s_logger); String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); - String args = ""; + String args =""; + command.add(routerIp); List revokedIpAliasTOs = cmd.getDeleteIpAliasTos(); for (IpAliasTO ipAliasTO : revokedIpAliasTOs) { args = args + ipAliasTO.getAlias_count()+":"+ipAliasTO.getRouterip()+":"+ipAliasTO.getNetmask()+"-"; @@ -653,32 +655,26 @@ public class VirtualRoutingResource implements Manager { } protected Answer execute(final DnsMasqConfigCommand cmd) { - final Script command = new Script(_configDhcpPath, _timeout, s_logger); + final Script command = new Script(_callDnsMasqPath, _timeout, s_logger); String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); DnsMasqConfigurator configurator = new DnsMasqConfigurator(); String [] config = configurator.generateConfiguration(cmd); - File tmpCfgFile = null; + String cfgFileName = routerIp.replace(".","-")+"dns.cgf"; + String tmpCfgFileContents = ""; + for (int i = 0; i < config.length; i++) { + tmpCfgFileContents += config[i]; + tmpCfgFileContents += "\n"; + } + File permKey = new File("/root/.ssh/id_rsa.cloud"); + String cfgFilePath = "/tmp/"+cfgFileName; try { - String cfgFilePath = ""; - if (routerIp != null) { - tmpCfgFile = File.createTempFile(routerIp.replace('.', '_'), "cfg"); - final PrintWriter out - = new PrintWriter(new BufferedWriter(new FileWriter(tmpCfgFile))); - for (int i=0; i < config.length; i++) { - out.println(config[i]); - } - out.close(); - cfgFilePath = tmpCfgFile.getAbsolutePath(); - } + SshHelper.scpTo(routerIp, 3922, "root", permKey, null, "/tmp/", tmpCfgFileContents.getBytes(), cfgFileName, null); + command.add(routerIp); command.add(cfgFilePath); final String result = command.execute(); return new Answer(cmd, result == null, result); - } catch (final IOException e) { + } catch (Exception e) { return new Answer(cmd, false, e.getMessage()); - } finally { - if (tmpCfgFile != null) { - tmpCfgFile.delete(); - } } } @@ -1209,6 +1205,18 @@ public class VirtualRoutingResource implements Manager { if (_routerProxyPath == null) { throw new ConfigurationException("Unable to find router_proxy.sh"); } + _createIpAliasPath = findScript("createipAlias.sh"); + if (_createIpAliasPath == null) { + throw new ConfigurationException("unable to find createipAlias.sh"); + } + _deleteIpAliasPath = findScript("deleteipAlias.sh"); + if (_deleteIpAliasPath == null) { + throw new ConfigurationException("unable to find deleteipAlias.sh"); + } + _callDnsMasqPath = findScript("call_dnsmasq.sh"); + if (_callDnsMasqPath == null) { + throw new ConfigurationException("unable to find call_dnsmasq.sh"); + } return true; } diff --git a/scripts/network/domr/call_dnsmasq.sh b/scripts/network/domr/call_dnsmasq.sh new file mode 100755 index 00000000000..097e18572a2 --- /dev/null +++ b/scripts/network/domr/call_dnsmasq.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash +# 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. + +usage() { + printf "Usage: %s: \n" $(basename $0) >&2 +} + +set -x + +cert="/root/.ssh/id_rsa.cloud" + +ssh -p 3922 -q -o StrictHostKeyChecking=no -i $cert root@$1 "/root/dnsmasq.sh $2" +exit $? + diff --git a/scripts/network/domr/createipAlias.sh b/scripts/network/domr/createipAlias.sh new file mode 100755 index 00000000000..c35658e6679 --- /dev/null +++ b/scripts/network/domr/createipAlias.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +# 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. + + +usage() { + printf " %s routerip \n" $(basename $0) >&2 +} + +set -x +cert="/root/.ssh/id_rsa.cloud" +ssh -p 3922 -q -o StrictHostKeyChecking=no -i $cert root@$1 "/root/createIpAlias.sh $2" diff --git a/scripts/network/domr/deleteipAlias.sh b/scripts/network/domr/deleteipAlias.sh new file mode 100755 index 00000000000..6816edd524c --- /dev/null +++ b/scripts/network/domr/deleteipAlias.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +# 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. + +usage() { + printf " %s routerip \n" $(basename $0) >&2 +} + +set -x +cert="/root/.ssh/id_rsa.cloud" +ssh -p 3922 -q -o StrictHostKeyChecking=no -i $cert root@$1 "/root/deleteIpAlias.sh $2 $3" From d21e0647244db9e76b11038e7b8c55e1aca3b6aa Mon Sep 17 00:00:00 2001 From: Nitin Mehta Date: Tue, 11 Jun 2013 17:27:55 +0530 Subject: [PATCH 15/36] CLOUDSTACK-2937 Scheduled snapshot events should be shown to users --- .../com/cloud/storage/snapshot/SnapshotSchedulerImpl.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java b/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java index 7170a686800..4696bb5d1c2 100644 --- a/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java +++ b/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java @@ -208,10 +208,6 @@ public class SnapshotSchedulerImpl extends ManagerBase implements SnapshotSchedu List snapshotsToBeExecuted = _snapshotScheduleDao.getSchedulesToExecute(_currentTimestamp); s_logger.debug("Got " + snapshotsToBeExecuted.size() + " snapshots to be executed at " + displayTime); - // This is done for recurring snapshots, which are executed by the system automatically - // Hence set user id to that of system - long userId = 1; - for (SnapshotScheduleVO snapshotToBeExecuted : snapshotsToBeExecuted) { SnapshotScheduleVO tmpSnapshotScheduleVO = null; long snapshotScheId = snapshotToBeExecuted.getId(); @@ -236,7 +232,7 @@ public class SnapshotSchedulerImpl extends ManagerBase implements SnapshotSchedu tmpSnapshotScheduleVO = _snapshotScheduleDao.acquireInLockTable(snapshotScheId); - Long eventId = ActionEventUtils.onScheduledActionEvent(User.UID_SYSTEM, Account.ACCOUNT_ID_SYSTEM, + Long eventId = ActionEventUtils.onScheduledActionEvent(User.UID_SYSTEM, volume.getAccountId(), EventTypes.EVENT_SNAPSHOT_CREATE, "creating snapshot for volume Id:" + volumeId, 0); Map params = new HashMap(); From e73aafc09ae3dc21dcbf8851f29c4b1977489fe6 Mon Sep 17 00:00:00 2001 From: Nitin Mehta Date: Thu, 11 Oct 2012 19:38:32 +0530 Subject: [PATCH 16/36] CLOUDSTACK-2940 Allowing Replacement of realhostip.com with a customized domain for SSVM. Though the config variable was there we were always hardcoding to realhostip.com Reviewed-by: Abhi --- .../storage/download/DownloadMonitorImpl.java | 20 +++++++++++-------- .../storage/upload/UploadMonitorImpl.java | 14 ++++++++----- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/server/src/com/cloud/storage/download/DownloadMonitorImpl.java b/server/src/com/cloud/storage/download/DownloadMonitorImpl.java index 663ab4a7fc0..f72a5634053 100755 --- a/server/src/com/cloud/storage/download/DownloadMonitorImpl.java +++ b/server/src/com/cloud/storage/download/DownloadMonitorImpl.java @@ -178,6 +178,7 @@ public class DownloadMonitorImpl extends ManagerBase implements DownloadMonitor protected AccountManager _accountMgr; private Boolean _sslCopy = new Boolean(false); + String _ssvmUrlDomain; private String _copyAuthPasswd; private String _proxy = null; protected SearchBuilder ReadyTemplateStatesSearch; @@ -198,11 +199,8 @@ public class DownloadMonitorImpl extends ManagerBase implements DownloadMonitor _sslCopy = Boolean.parseBoolean(configs.get("secstorage.encrypt.copy")); _proxy = configs.get(Config.SecStorageProxy.key()); - String cert = configs.get("secstorage.ssl.cert.domain"); - if (!"realhostip.com".equalsIgnoreCase(cert)) { - s_logger.warn("Only realhostip.com ssl cert is supported, ignoring self-signed and other certs"); - } - + _ssvmUrlDomain = configs.get("secstorage.ssl.cert.domain"); + _copyAuthPasswd = configs.get("secstorage.copy.password"); _agentMgr.registerForHostEvents(new DownloadListener(this), true, false, false); @@ -318,9 +316,15 @@ public class DownloadMonitorImpl extends ManagerBase implements DownloadMonitor String hostname = ipAddress; String scheme = "http"; if (_sslCopy) { - hostname = ipAddress.replace(".", "-"); - hostname = hostname + ".realhostip.com"; - scheme = "https"; + hostname = ipAddress.replace(".", "-"); + scheme = "https"; + + // Code for putting in custom certificates. + if(_ssvmUrlDomain != null && _ssvmUrlDomain.length() > 0){ + hostname = hostname + "." + _ssvmUrlDomain; + }else{ + hostname = hostname + ".realhostip.com"; + } } return scheme + "://" + hostname + "/copy/SecStorage/" + dir + "/" + path; } diff --git a/server/src/com/cloud/storage/upload/UploadMonitorImpl.java b/server/src/com/cloud/storage/upload/UploadMonitorImpl.java index 77f0d209918..31f3e74442a 100755 --- a/server/src/com/cloud/storage/upload/UploadMonitorImpl.java +++ b/server/src/com/cloud/storage/upload/UploadMonitorImpl.java @@ -106,6 +106,7 @@ public class UploadMonitorImpl extends ManagerBase implements UploadMonitor { private String _name; private Boolean _sslCopy = new Boolean(false); + private String _ssvmUrlDomain; private ScheduledExecutorService _executor = null; Timer _timer; @@ -329,8 +330,14 @@ public class UploadMonitorImpl extends ManagerBase implements UploadMonitor { String scheme = "http"; if (_sslCopy) { hostname = ipAddress.replace(".", "-"); - hostname = hostname + ".realhostip.com"; scheme = "https"; + + // Code for putting in custom certificates. + if(_ssvmUrlDomain != null && _ssvmUrlDomain.length() > 0){ + hostname = hostname + "." + _ssvmUrlDomain; + }else{ + hostname = hostname + ".realhostip.com"; + } } return scheme + "://" + hostname + "/userdata/" + uuid; } @@ -347,10 +354,7 @@ public class UploadMonitorImpl extends ManagerBase implements UploadMonitor { final Map configs = _configDao.getConfiguration("ManagementServer", params); _sslCopy = Boolean.parseBoolean(configs.get("secstorage.encrypt.copy")); - String cert = configs.get("secstorage.secure.copy.cert"); - if ("realhostip.com".equalsIgnoreCase(cert)) { - s_logger.warn("Only realhostip.com ssl cert is supported, ignoring self-signed and other certs"); - } + _ssvmUrlDomain = configs.get("secstorage.ssl.cert.domain"); _agentMgr.registerForHostEvents(new UploadListener(this), true, false, false); String cleanupInterval = configs.get("extract.url.cleanup.interval"); From 215b638e8eb22fd433ebdc396d4b7a38b0f6796a Mon Sep 17 00:00:00 2001 From: Harikrishna Patnala Date: Wed, 12 Jun 2013 13:35:16 +0530 Subject: [PATCH 17/36] CLOUDSTACK-2347: Zone filter for listSnapshots API Added new optional parameter zone id in listSnapshots API which allows to list snapshots with additional criteria. Signed off by :- Nitin Mehta --- .../api/command/user/snapshot/ListSnapshotsCmd.java | 8 ++++++++ .../apache/cloudstack/api/response/SnapshotResponse.java | 7 +++++++ server/src/com/cloud/api/ApiResponseHelper.java | 3 ++- .../com/cloud/storage/snapshot/SnapshotManagerImpl.java | 6 ++++++ 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java b/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java index d7e6bc87b7f..e4ae76908e8 100644 --- a/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java @@ -26,6 +26,7 @@ import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.SnapshotResponse; import org.apache.cloudstack.api.response.VolumeResponse; +import org.apache.cloudstack.api.response.ZoneResponse; import org.apache.log4j.Logger; import com.cloud.async.AsyncJob; @@ -62,6 +63,9 @@ public class ListSnapshotsCmd extends BaseListTaggedResourcesCmd { @Parameter(name=ApiConstants.ZONE_TYPE, type=CommandType.STRING, description="the network type of the zone that the virtual machine belongs to") private String zoneType; + @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "list snapshots by zone id") + private Long zoneId; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -89,6 +93,10 @@ public class ListSnapshotsCmd extends BaseListTaggedResourcesCmd { public String getZoneType() { return zoneType; } + + public Long getZoneId() { + return zoneId; + } ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// diff --git a/api/src/org/apache/cloudstack/api/response/SnapshotResponse.java b/api/src/org/apache/cloudstack/api/response/SnapshotResponse.java index 7484ac965fd..ca74a18043b 100644 --- a/api/src/org/apache/cloudstack/api/response/SnapshotResponse.java +++ b/api/src/org/apache/cloudstack/api/response/SnapshotResponse.java @@ -93,6 +93,10 @@ public class SnapshotResponse extends BaseResponse implements ControlledEntityRe @Param(description = "the state of the snapshot. BackedUp means that snapshot is ready to be used; Creating - the snapshot is being allocated on the primary storage; BackingUp - the snapshot is being backed up on secondary storage") private Snapshot.State state; + @SerializedName(ApiConstants.ZONE_ID) + @Param(description = "id of the availability zone") + private String zoneId; + @SerializedName(ApiConstants.ZONE_NAME) @Param(description = "name of the availability zone") private String zoneName; @@ -181,6 +185,9 @@ public class SnapshotResponse extends BaseResponse implements ControlledEntityRe this.projectName = projectName; } + public void setZoneId(String zoneId) { + this.zoneId = zoneId; + } public void setZoneName(String zoneName) { this.zoneName = zoneName; } diff --git a/server/src/com/cloud/api/ApiResponseHelper.java b/server/src/com/cloud/api/ApiResponseHelper.java index 0c98abc9400..4f75b99e0c4 100755 --- a/server/src/com/cloud/api/ApiResponseHelper.java +++ b/server/src/com/cloud/api/ApiResponseHelper.java @@ -439,7 +439,8 @@ public class ApiResponseHelper implements ResponseGenerator { DataCenter zone = ApiDBUtils.findZoneById(volume.getDataCenterId()); if (zone != null) { snapshotResponse.setZoneName(zone.getName()); - snapshotResponse.setZoneType(zone.getNetworkType().toString()); + snapshotResponse.setZoneType(zone.getNetworkType().toString()); + snapshotResponse.setZoneId(zone.getUuid()); } } snapshotResponse.setCreated(snapshot.getCreated()); diff --git a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java index 92d80ee6cc8..02e34288766 100755 --- a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java +++ b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java @@ -574,6 +574,7 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager, String intervalTypeStr = cmd.getIntervalType(); String zoneType = cmd.getZoneType(); Map tags = cmd.getTags(); + Long zoneId = cmd.getZoneId(); Account caller = UserContext.current().getCaller(); List permittedAccounts = new ArrayList(); @@ -602,6 +603,7 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager, sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ); sb.and("snapshotTypeEQ", sb.entity().getsnapshotType(), SearchCriteria.Op.IN); sb.and("snapshotTypeNEQ", sb.entity().getsnapshotType(), SearchCriteria.Op.NEQ); + sb.and("dataCenterId", sb.entity().getDataCenterId(), SearchCriteria.Op.EQ); if (tags != null && !tags.isEmpty()) { SearchBuilder tagSearch = _resourceTagDao.createSearchBuilder(); @@ -641,6 +643,10 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager, if(zoneType != null) { sc.setJoinParameters("zoneSb", "zoneNetworkType", zoneType); } + + if (zoneId != null) { + sc.setParameters("dataCenterId", zoneId); + } if (name != null) { sc.setParameters("name", "%" + name + "%"); From 83fcba9ee64cdf4fe28e2c751fcfb2f83f9938d2 Mon Sep 17 00:00:00 2001 From: Nitin Mehta Date: Wed, 12 Jun 2013 14:58:54 +0530 Subject: [PATCH 18/36] CLOUDSTACK-2946 CS-15158: Correcting the allocated size for local storage in listStoragePools --- .../src/com/cloud/api/query/dao/StoragePoolJoinDaoImpl.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/src/com/cloud/api/query/dao/StoragePoolJoinDaoImpl.java b/server/src/com/cloud/api/query/dao/StoragePoolJoinDaoImpl.java index a6355ad9867..6d0cde1ac6b 100644 --- a/server/src/com/cloud/api/query/dao/StoragePoolJoinDaoImpl.java +++ b/server/src/com/cloud/api/query/dao/StoragePoolJoinDaoImpl.java @@ -22,7 +22,9 @@ import java.util.List; import javax.ejb.Local; import javax.inject.Inject; +import com.cloud.capacity.Capacity; import org.apache.cloudstack.api.response.StoragePoolResponse; +import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType; import org.apache.log4j.Logger; import org.springframework.stereotype.Component; @@ -150,7 +152,8 @@ public class StoragePoolJoinDaoImpl extends GenericDaoBase Date: Mon, 10 Jun 2013 14:31:03 +0530 Subject: [PATCH 19/36] Fix for CLOUDSTACK-1704 and CLOUDSTACK-1622 Signed-off-by: Abhinandan Prateek --- .../cloud/capacity/dao/CapacityDaoImpl.java | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/engine/schema/src/com/cloud/capacity/dao/CapacityDaoImpl.java b/engine/schema/src/com/cloud/capacity/dao/CapacityDaoImpl.java index 0b9ff1a5ece..d14ad877ec9 100755 --- a/engine/schema/src/com/cloud/capacity/dao/CapacityDaoImpl.java +++ b/engine/schema/src/com/cloud/capacity/dao/CapacityDaoImpl.java @@ -116,11 +116,27 @@ public class CapacityDaoImpl extends GenericDaoBase implements private static final String LIST_CAPACITY_GROUP_BY_CLUSTER_TYPE_PART2 = " GROUP BY cluster_id, capacity_type order by percent desc limit "; private static final String UPDATE_CAPACITY_STATE = "UPDATE `cloud`.`op_host_capacity` SET capacity_state = ? WHERE "; + /* In the below query"LIST_CLUSTERS_CROSSING_THRESHOLD" the threshold value is getting from the cluster_details table if not present then it gets from the global configuration + * + * CASE statement works like + * if (cluster_details table has thershold value) + * then + * if (value from the cluster_details table is not null) + * then + * query from the cluster_details table + * else + * query from the configuration table + * else + * query from the configuration table + * + * */ private static final String LIST_CLUSTERS_CROSSING_THRESHOLD = "SELECT clusterList.cluster_id " + "FROM ( SELECT cluster.cluster_id cluster_id, ( (sum(cluster.used) + sum(cluster.reserved) + ?)/sum(cluster.total) ) ratio, cluster.configValue value " + "FROM ( SELECT capacity.cluster_id cluster_id, capacity.used_capacity used, capacity.reserved_capacity reserved, capacity.total_capacity total, " + "CASE (SELECT count(*) FROM `cloud`.`cluster_details` details WHERE details.cluster_id = capacity.cluster_id AND details.name = ? ) " + - "WHEN 1 THEN ( SELECT details.value FROM `cloud`.`cluster_details` details WHERE details.cluster_id = capacity.cluster_id AND details.name = ? ) " + + "WHEN 1 THEN ( CASE WHEN (SELECT details.value FROM `cloud`.`cluster_details` details WHERE details.cluster_id = capacity.cluster_id AND details.name = ?) is NULL " + + "THEN (SELECT config.value FROM `cloud`.`configuration` config WHERE config.name = ?)" + + "ELSE (SELECT details.value FROM `cloud`.`cluster_details` details WHERE details.cluster_id = capacity.cluster_id AND details.name = ? ) END )" + "ELSE ( SELECT config.value FROM `cloud`.`configuration` config WHERE config.name = ?) " + "END configValue " + "FROM `cloud`.`op_host_capacity` capacity " + @@ -168,8 +184,10 @@ public class CapacityDaoImpl extends GenericDaoBase implements pstmt.setString(2, configName); pstmt.setString(3, configName); pstmt.setString(4, configName); - pstmt.setLong(5,zoneId); - pstmt.setShort(6,capacityType); + pstmt.setString(5, configName); + pstmt.setString(6, configName); + pstmt.setLong(7,zoneId); + pstmt.setShort(8,capacityType); ResultSet rs = pstmt.executeQuery(); while (rs.next()) { From fe506d9b68395358457b17bd5788ed6cfbe589b7 Mon Sep 17 00:00:00 2001 From: venkataswamybabu budumuru Date: Thu, 23 May 2013 15:06:29 +0530 Subject: [PATCH 20/36] CLOUDSTACK-2642: [XenServer] Add support for XenServer 6.2.0 Currently XcpServerDiscoverer.java is only allowing till XenServer 6.1.0. Added code to support XenServer 6.2.0. Also, added support to allow the RC build of XenSever 6.2.0. Signed-off-by: venkataswamybabu budumuru Signed-off-by: Abhinandan Prateek --- .../xen/discoverer/XcpServerDiscoverer.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java index fd498365e3d..5b6b546b6d4 100755 --- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java +++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java @@ -447,6 +447,10 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L return new XenServer602Resource(); else if (prodBrand.equals("XenServer") && prodVersion.equals("6.1.0")) return new XenServer610Resource(); + else if (prodBrand.equals("XenServer") && prodVersion.equals("6.1.83")) + return new XenServer610Resource(); + else if (prodBrand.equals("XenServer") && prodVersion.equals("6.2.0")) + return new XenServer610Resource(); else if (prodBrand.equals("XenServer") && prodVersion.equals("5.6.100")) { String prodVersionTextShort = record.softwareVersion.get("product_version_text_short").trim(); if ("5.6 SP2".equals(prodVersionTextShort)) { @@ -458,7 +462,7 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L return new XcpOssResource(); } - String msg = "Only support XCP 1.0.0, 1.1.0, 1.4.x, 1.5 beta, 1.6.x; XenServer 5.6, XenServer 5.6 FP1, XenServer 5.6 SP2, Xenserver 6.0, 6.0.2, 6.1.0 but this one is " + prodBrand + " " + prodVersion; + String msg = "Only support XCP 1.0.0, 1.1.0, 1.4.x, 1.5 beta, 1.6.x; XenServer 5.6, XenServer 5.6 FP1, XenServer 5.6 SP2, Xenserver 6.0, 6.0.2, 6.1.0, 6.1.83, 6.2.0 but this one is " + prodBrand + " " + prodVersion; _alertMgr.sendAlert(AlertManager.ALERT_TYPE_HOST, dcId, podId, msg, msg); s_logger.debug(msg); throw new RuntimeException(msg); @@ -598,6 +602,10 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L resource = XenServer602Resource.class.getName(); } else if (prodBrand.equals("XenServer") && prodVersion.equals("6.1.0")) { resource = XenServer610Resource.class.getName(); + } else if (prodBrand.equals("XenServer") && prodVersion.equals("6.1.83")) { + resource = XenServer610Resource.class.getName(); + } else if (prodBrand.equals("XenServer") && prodVersion.equals("6.2.0")) { + resource = XenServer610Resource.class.getName(); } else if (prodBrand.equals("XenServer") && prodVersion.equals("5.6.100")) { String prodVersionTextShort = details.get("product_version_text_short").trim(); if ("5.6 SP2".equals(prodVersionTextShort)) { @@ -610,7 +618,7 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L } if( resource == null ){ - String msg = "Only support XCP 1.0.0, 1.1.0, 1.4.x, 1.5 beta, 1.6.x; XenServer 5.6, 5.6 FP1, 5.6 SP2 and Xenserver 6.0 , 6.0.2, 6.1.0 but this one is " + prodBrand + " " + prodVersion; + String msg = "Only support XCP 1.0.0, 1.1.0, 1.4.x, 1.5 beta, 1.6.x; XenServer 5.6, 5.6 FP1, 5.6 SP2 and Xenserver 6.0 , 6.0.2, 6.1.0, 6.1.83, 6.2.0 but this one is " + prodBrand + " " + prodVersion; s_logger.debug(msg); throw new RuntimeException(msg); } From 51a3a5a9b56426de4b3818b900d493cf9f439779 Mon Sep 17 00:00:00 2001 From: Wei Zhou Date: Wed, 12 Jun 2013 11:57:17 +0200 Subject: [PATCH 21/36] CLOUDSTACK-2945: ignore collect disk statistics if vm is not running on KVM or XenServer --- server/src/com/cloud/vm/UserVmManagerImpl.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java index b919f124b1b..1c8ab75f183 100755 --- a/server/src/com/cloud/vm/UserVmManagerImpl.java +++ b/server/src/com/cloud/vm/UserVmManagerImpl.java @@ -3421,6 +3421,10 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use @Override public void collectVmDiskStatistics (UserVmVO userVm) { + // support KVM and XenServer only + if (!userVm.getHypervisorType().equals(HypervisorType.XenServer) + && !userVm.getHypervisorType().equals(HypervisorType.KVM)) + return; // Collect vm disk statistics from host before stopping Vm long hostId = userVm.getHostId(); List vmNames = new ArrayList(); From ca13586331d215b0be269fea010536106d7fa67c Mon Sep 17 00:00:00 2001 From: Bharat Kumar Date: Mon, 3 Jun 2013 16:00:15 +0530 Subject: [PATCH 22/36] Cloudstack-2511 Multiple_Ip_Ranges: Adding guest ip range in subset/superset to existing CIDR is allowed Cloudstack-2651 [Shared n/w]Add IP range should ask for gateway and netmask Signed-off-by: Abhinandan Prateek --- .../ConfigurationManagerImpl.java | 119 ++++++++++++------ .../configuration/ValidateIpRangeTest.java | 11 +- utils/src/com/cloud/utils/net/NetUtils.java | 31 +++++ 3 files changed, 116 insertions(+), 45 deletions(-) diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java index 59e70cfcc5a..111586d7733 100755 --- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java +++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java @@ -39,6 +39,7 @@ import javax.naming.NamingException; import javax.naming.directory.DirContext; import javax.naming.directory.InitialDirContext; +import com.cloud.utils.Pair; import org.apache.cloudstack.acl.SecurityChecker; import org.apache.cloudstack.api.ApiConstants.LDAPParams; import org.apache.cloudstack.api.command.admin.config.UpdateCfgCmd; @@ -2473,7 +2474,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati } } - boolean sameSubnet=false; + Pair> sameSubnet= null; // Can add vlan range only to the network which allows it if (!network.getSpecifyIpRanges()) { throw new InvalidParameterValueException("Network " + network + " doesn't support adding ip ranges"); @@ -2508,7 +2509,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati sameSubnet=validateIpRange(startIP,endIP,newVlanGateway, newVlanNetmask, vlans, ipv4, ipv6, ip6Gateway, ip6Cidr, startIPv6, endIPv6, network); } - if (zoneId == null || (ipv4 && (newVlanGateway == null || newVlanNetmask == null)) || (ipv6 && (ip6Gateway == null || ip6Cidr == null))) { + if (zoneId == null || (ipv6 && (ip6Gateway == null || ip6Cidr == null))) { throw new InvalidParameterValueException("Gateway, netmask and zoneId have to be passed in for virtual and direct untagged networks"); } @@ -2527,54 +2528,80 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati } Transaction txn = Transaction.currentTxn(); txn.start(); - + if (sameSubnet.first() == false) { + s_logger.info("adding a new subnet to the network "+network.getId()); + } + else { + // if it is same subnet the user might not send the vlan and the netmask details. so we are + //figuring out while validation and setting them here. + newVlanGateway = sameSubnet.second().first(); + newVlanNetmask = sameSubnet.second().second(); + } Vlan vlan = createVlanAndPublicIpRange(zoneId, networkId, physicalNetworkId, forVirtualNetwork, podId, startIP, endIP, newVlanGateway, newVlanNetmask, vlanId, vlanOwner, startIPv6, endIPv6, ip6Gateway, ip6Cidr); //create an entry in the nic_secondary table. This will be the new gateway that will be configured on the corresponding routervm. - if (sameSubnet == false) { - s_logger.info("adding a new subnet to the network "+network.getId()); - } + txn.commit(); return vlan; } - public boolean validateIpRange(String startIP, String endIP, String newVlanGateway, String newVlanNetmask, List vlans, boolean ipv4, boolean ipv6, String ip6Gateway, String ip6Cidr, String startIPv6, String endIPv6, Network network) { - String vlanGateway; - String vlanNetmask; + public int checkIfSubsetOrSuperset(String newVlanGateway, String newVlanNetmask, VlanVO vlan, String startIP, String endIP) { + if (newVlanGateway == null && newVlanNetmask==null) { + newVlanGateway = vlan.getVlanGateway(); + newVlanNetmask = vlan.getVlanNetmask(); + //this means he is trying to add to the existing subnet. + if (NetUtils.sameSubnet(startIP, newVlanGateway, newVlanNetmask)) { + if (NetUtils.sameSubnet(endIP, newVlanGateway, newVlanNetmask)){ + return 3; + } + } + return 0; + } + else if (newVlanGateway == null || newVlanGateway ==null){ + throw new InvalidParameterValueException("either both netmask and gateway should be passed or both should me omited."); + } + else { + if (!NetUtils.sameSubnet(startIP, newVlanGateway, newVlanNetmask)) { + throw new InvalidParameterValueException("The start ip and gateway do not belong to the same subnet"); + } + if (!NetUtils.sameSubnet(endIP, newVlanGateway, newVlanNetmask)) { + throw new InvalidParameterValueException("The end ip and gateway do not belong to the same subnet"); + } + } + String cidrnew = NetUtils.getCidrFromGatewayAndNetmask(newVlanGateway, newVlanNetmask); + String existing_cidr = NetUtils.getCidrFromGatewayAndNetmask(vlan.getVlanGateway(), vlan.getVlanNetmask()); + + return (NetUtils.isNetowrkASubsetOrSupersetOfNetworkB(cidrnew, existing_cidr)); + } + + public Pair> validateIpRange(String startIP, String endIP, String newVlanGateway, String newVlanNetmask, List vlans, boolean ipv4, boolean ipv6, String ip6Gateway, String ip6Cidr, String startIPv6, String endIPv6, Network network) { + String vlanGateway=null; + String vlanNetmask=null; boolean sameSubnet = false; if ( vlans != null && vlans.size() > 0 ) { - for (VlanVO vlan : vlans) { if (ipv4) { vlanGateway = vlan.getVlanGateway(); vlanNetmask = vlan.getVlanNetmask(); - // Check if ip addresses are in network range - if (!NetUtils.sameSubnet(startIP, vlanGateway, vlanNetmask)) { - if (!NetUtils.sameSubnet(endIP, vlanGateway, vlanNetmask)) { - // check if the the new subnet is not a superset of the existing subnets. - if (NetUtils.isNetworkAWithinNetworkB(NetUtils.getCidrFromGatewayAndNetmask(vlanGateway,vlanNetmask), NetUtils.ipAndNetMaskToCidr(startIP, newVlanNetmask))){ - throw new InvalidParameterValueException ("The new subnet is a superset of the existing subnet"); - } - // check if the new subnet is not a subset of the existing subnet. - if (NetUtils.isNetworkAWithinNetworkB(NetUtils.ipAndNetMaskToCidr(startIP, newVlanNetmask), NetUtils.getCidrFromGatewayAndNetmask(vlanGateway,vlanNetmask))){ - throw new InvalidParameterValueException("The new subnet is a subset of the existing subnet"); - } - } - } else if (NetUtils.sameSubnet(endIP, vlanGateway, vlanNetmask)){ - // trying to add to the same subnet. - sameSubnet = true; - if (newVlanGateway == null) { - newVlanGateway = vlanGateway; - } - if (!newVlanGateway.equals(vlanGateway)){ - throw new InvalidParameterValueException("The gateway of the ip range is not same as the gateway of the subnet."); - } - break; + //check if subset or super set or neither. + int val = checkIfSubsetOrSuperset(newVlanGateway, newVlanNetmask, vlan, startIP, endIP); + if (val == 1) { + // this means that new cidr is a superset of the existing subnet. + throw new InvalidParameterValueException("The subnet you are trying to add is a superset of the existing subnet having gateway"+vlan.getVlanGateway()+" and netmask "+vlan.getVlanNetmask()); } - else { - throw new InvalidParameterValueException("Start ip and End ip is not in vlan range!"); + else if (val == 0) { + //this implies the user is trying to add a new subnet which is not a superset or subset of this subnet. + //checking with the other subnets. + continue; + } + else if (val == 2) { + //this means he is trying to add to the same subnet. + throw new InvalidParameterValueException("The subnet you are trying to add is a subset of the existing subnet having gateway"+vlan.getVlanGateway()+" and netmask "+vlan.getVlanNetmask()); + } + else if (val == 3) { + sameSubnet =true; } } if (ipv6) { @@ -2589,13 +2616,25 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati _networkModel.checkIp6Parameters(startIPv6, endIPv6, ip6Gateway, ip6Cidr); } } - if (sameSubnet == false) { - if (newVlanGateway ==null) { - throw new MissingParameterValueException("The gateway for the new subnet is not specified."); - } - } } - return sameSubnet; + if (newVlanGateway==null && newVlanNetmask ==null && sameSubnet == false) { + throw new InvalidParameterValueException("The ip range dose not belong to any of the existing subnets, Provide the netmask and gateway if you want to add new subnet"); + } + Pair vlanDetails=null; + + if (sameSubnet){ + vlanDetails = new Pair(vlanGateway, vlanNetmask); + } + else { + vlanDetails = new Pair(newVlanGateway, newVlanNetmask); + } + //check if the gatewayip is the part of the ip range being added. + if (NetUtils.ipRangesOverlap(startIP, endIP, vlanDetails.first(), vlanDetails.first())) { + throw new InvalidParameterValueException("The gateway ip should not be the part of the ip range being added."); + } + + Pair> result = new Pair>(sameSubnet, vlanDetails); + return result; } @Override diff --git a/server/test/com/cloud/configuration/ValidateIpRangeTest.java b/server/test/com/cloud/configuration/ValidateIpRangeTest.java index 768166719f2..a083cc643ad 100644 --- a/server/test/com/cloud/configuration/ValidateIpRangeTest.java +++ b/server/test/com/cloud/configuration/ValidateIpRangeTest.java @@ -19,6 +19,7 @@ package com.cloud.configuration; import com.cloud.dc.VlanVO; import com.cloud.network.Network; import com.cloud.network.NetworkModel; +import com.cloud.utils.Pair; import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -49,20 +50,20 @@ public class ValidateIpRangeTest { @Test public void SameSubnetTest() { - boolean sameSubnet=configurationMgr.validateIpRange("10.147.33.104", "10.147.33.105", "10.147.33.1", "255.255.255.128", vlanVOList, true, false, null, null, null, null,network); - Assert.assertTrue(sameSubnet); + Pair> sameSubnet=configurationMgr.validateIpRange("10.147.33.104", "10.147.33.105", "10.147.33.1", "255.255.255.128", vlanVOList, true, false, null, null, null, null,network); + Assert.assertTrue(sameSubnet.first()); } @Test public void NewSubnetTest() { - boolean sameSubnet= configurationMgr.validateIpRange("10.147.33.140", "10.147.33.145", "10.147.33.129", "255.255.255.191", vlanVOList, true, false, null, null, null, null,network); - Assert.assertTrue(!sameSubnet); + Pair> sameSubnet= configurationMgr.validateIpRange("10.147.33.140", "10.147.33.145", "10.147.33.129", "255.255.255.191", vlanVOList, true, false, null, null, null, null,network); + Assert.assertTrue(!sameSubnet.first()); } @Test public void SuperSetTest() { try { - configurationMgr.validateIpRange("10.147.33.140", "10.147.33.143", "10.147.33.140", "255.255.255.191", vlanVOList, true, false, null, null, null, null,network); + configurationMgr.validateIpRange("10.147.33.10", "10.147.33.20", "10.147.33.21", "255.255.255.127", vlanVOList, true, false, null, null, null, null,network); } catch (Exception e) { junit.framework.Assert.assertTrue(e.getMessage().contains("superset")); } diff --git a/utils/src/com/cloud/utils/net/NetUtils.java b/utils/src/com/cloud/utils/net/NetUtils.java index 12ac3e6eb08..ec0ff05fce8 100755 --- a/utils/src/com/cloud/utils/net/NetUtils.java +++ b/utils/src/com/cloud/utils/net/NetUtils.java @@ -795,6 +795,37 @@ public class NetUtils { return new Pair(tokens[0], Integer.parseInt(tokens[1])); } + public static int isNetowrkASubsetOrSupersetOfNetworkB (String cidrA, String cidrB) { + Long[] cidrALong = cidrToLong(cidrA); + Long[] cidrBLong = cidrToLong(cidrB); + long shift =0; + if (cidrALong == null || cidrBLong == null) { + //implies error in the cidr format + return -1; + } + if (cidrALong[1] >= cidrBLong[1]) { + shift = 32 - cidrBLong[1]; + } + else { + shift = 32 - cidrALong[1]; + } + long result = (cidrALong[0] >> shift) - (cidrBLong[0] >> shift); + if (result == 0) { + if (cidrALong[1] < cidrBLong[1]) { + //this implies cidrA is super set of cidrB + return 1; + } + else if (cidrALong[1] == cidrBLong[1]) { + //this implies both the cidrs are equal + return 3; + } + // implies cidrA is subset of cidrB + return 2; + } + //this implies no overlap. + return 0; + } + public static boolean isNetworkAWithinNetworkB(String cidrA, String cidrB) { Long[] cidrALong = cidrToLong(cidrA); Long[] cidrBLong = cidrToLong(cidrB); From 2aafc39f3d0570fac1ddcebf4623f1c37e8e47e5 Mon Sep 17 00:00:00 2001 From: Nitin Mehta Date: Wed, 12 Jun 2013 16:57:59 +0530 Subject: [PATCH 23/36] CLOUDSTACK-2957 deployVm API size attribute should be capped by the storage.max.volume.size as it is in createVolume. --- .../platform/orchestration/CloudOrchestrator.java | 8 +++++++- server/src/com/cloud/storage/VolumeManager.java | 2 ++ server/src/com/cloud/storage/VolumeManagerImpl.java | 3 ++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/engine/orchestration/src/org/apache/cloudstack/platform/orchestration/CloudOrchestrator.java b/engine/orchestration/src/org/apache/cloudstack/platform/orchestration/CloudOrchestrator.java index ca299ea45bc..96fb1d91936 100755 --- a/engine/orchestration/src/org/apache/cloudstack/platform/orchestration/CloudOrchestrator.java +++ b/engine/orchestration/src/org/apache/cloudstack/platform/orchestration/CloudOrchestrator.java @@ -25,6 +25,7 @@ import java.util.Map; import javax.inject.Inject; +import com.cloud.storage.VolumeManager; import org.apache.cloudstack.engine.cloud.entity.api.NetworkEntity; import org.apache.cloudstack.engine.cloud.entity.api.TemplateEntity; import org.apache.cloudstack.engine.cloud.entity.api.VirtualMachineEntity; @@ -87,6 +88,9 @@ public class CloudOrchestrator implements OrchestrationService { @Inject protected AccountDao _accountDao = null; + @Inject + VolumeManager _volumeMgr; + public CloudOrchestrator() { } @@ -200,6 +204,7 @@ public class CloudOrchestrator implements OrchestrationService { "Disk offering " + diskOffering + " requires size parameter."); } + _volumeMgr.validateVolumeSizeRange(size * 1024 * 1024 * 1024); } dataDiskOfferings.add(new Pair(diskOffering, size)); } @@ -246,7 +251,8 @@ public class CloudOrchestrator implements OrchestrationService { throw new InvalidParameterValueException("Disk offering " + diskOffering + " requires size parameter."); } - } + _volumeMgr.validateVolumeSizeRange(size * 1024 * 1024 * 1024); + } rootDiskOffering.first(diskOffering); rootDiskOffering.second(size); diff --git a/server/src/com/cloud/storage/VolumeManager.java b/server/src/com/cloud/storage/VolumeManager.java index 47fbda8df9f..56de408e6f5 100644 --- a/server/src/com/cloud/storage/VolumeManager.java +++ b/server/src/com/cloud/storage/VolumeManager.java @@ -109,4 +109,6 @@ public interface VolumeManager extends VolumeApiService { String getVmNameFromVolumeId(long volumeId); String getStoragePoolOfVolume(long volumeId); + + boolean validateVolumeSizeRange(long size); } diff --git a/server/src/com/cloud/storage/VolumeManagerImpl.java b/server/src/com/cloud/storage/VolumeManagerImpl.java index 43f36817d75..4297efb6e99 100644 --- a/server/src/com/cloud/storage/VolumeManagerImpl.java +++ b/server/src/com/cloud/storage/VolumeManagerImpl.java @@ -1311,7 +1311,8 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager { return true; } - private boolean validateVolumeSizeRange(long size) { + @Override + public boolean validateVolumeSizeRange(long size) { if (size < 0 || (size > 0 && size < (1024 * 1024 * 1024))) { throw new InvalidParameterValueException( "Please specify a size of at least 1 Gb."); From 75d446ccf7f20c76cebbb242ad11334a966d3013 Mon Sep 17 00:00:00 2001 From: Pranav Saxena Date: Wed, 12 Jun 2013 17:19:18 +0530 Subject: [PATCH 24/36] CLOUDSTACK-1726: UI hangs on invalid vlan range - provision of intelligence mechanism to go back and re enter the vlan values --- ui/scripts/zoneWizard.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ui/scripts/zoneWizard.js b/ui/scripts/zoneWizard.js index 5870a7bf418..046b12210ac 100755 --- a/ui/scripts/zoneWizard.js +++ b/ui/scripts/zoneWizard.js @@ -3282,6 +3282,8 @@ } else if(result.jobstatus == 2){ alert("error: " + _s(result.jobresult.errortext)); + error('configureGuestTraffic', result.jobresult.errortext, { fn: 'configureGuestTraffic', args: args }); + } } }, From 31f0e3453993ea24fab2d2c4ff938c867d23c74c Mon Sep 17 00:00:00 2001 From: Bharat Kumar Date: Wed, 12 Jun 2013 18:05:47 +0530 Subject: [PATCH 25/36] CLOUDSTACK-2963 Build failure due to validateIpRange test failure Signed-off-by: Abhinandan Prateek --- .../test/com/cloud/configuration/ValidateIpRangeTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/test/com/cloud/configuration/ValidateIpRangeTest.java b/server/test/com/cloud/configuration/ValidateIpRangeTest.java index a083cc643ad..ca9ef110151 100644 --- a/server/test/com/cloud/configuration/ValidateIpRangeTest.java +++ b/server/test/com/cloud/configuration/ValidateIpRangeTest.java @@ -50,20 +50,20 @@ public class ValidateIpRangeTest { @Test public void SameSubnetTest() { - Pair> sameSubnet=configurationMgr.validateIpRange("10.147.33.104", "10.147.33.105", "10.147.33.1", "255.255.255.128", vlanVOList, true, false, null, null, null, null,network); + Pair> sameSubnet = configurationMgr.validateIpRange("10.147.33.104", "10.147.33.105", "10.147.33.1", "255.255.255.128", vlanVOList, true, false, null, null, null, null,network); Assert.assertTrue(sameSubnet.first()); } @Test public void NewSubnetTest() { - Pair> sameSubnet= configurationMgr.validateIpRange("10.147.33.140", "10.147.33.145", "10.147.33.129", "255.255.255.191", vlanVOList, true, false, null, null, null, null,network); + Pair> sameSubnet = configurationMgr.validateIpRange("10.147.33.140", "10.147.33.145", "10.147.33.130", "255.255.255.192", vlanVOList, true, false, null, null, null, null,network); Assert.assertTrue(!sameSubnet.first()); } @Test public void SuperSetTest() { try { - configurationMgr.validateIpRange("10.147.33.10", "10.147.33.20", "10.147.33.21", "255.255.255.127", vlanVOList, true, false, null, null, null, null,network); + configurationMgr.validateIpRange("10.147.33.10", "10.147.33.20", "10.147.33.21", "255.255.255.0", vlanVOList, true, false, null, null, null, null,network); } catch (Exception e) { junit.framework.Assert.assertTrue(e.getMessage().contains("superset")); } From 1c6e1012dc8d741eb6e66f5c329561a3482cdbd8 Mon Sep 17 00:00:00 2001 From: Prasanna Santhanam Date: Tue, 11 Jun 2013 18:00:14 +0530 Subject: [PATCH 26/36] Fix the build system VM job When both systemvmtemplate64 and systemvmtemplate are present the grep match fails and returns (non-deterministically) the 64bit appliance instead of the 32bit one. Fix this by matching the path separater as well. Signed-off-by: Prasanna Santhanam --- tools/appliance/build.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/appliance/build.sh b/tools/appliance/build.sh index 0216c067a45..b546c3f8f55 100644 --- a/tools/appliance/build.sh +++ b/tools/appliance/build.sh @@ -46,7 +46,7 @@ done # Get appliance uuids machine_uuid=`vboxmanage showvminfo $appliance | grep UUID | head -1 | awk '{print $2}'` hdd_uuid=`vboxmanage showvminfo $appliance | grep vdi | head -1 | awk '{print $8}' | cut -d ')' -f 1` -hdd_path=`vboxmanage list hdds | grep $appliance | grep vdi | cut -c 14-` +hdd_path=`vboxmanage list hdds | grep "$appliance\/" | grep vdi | cut -c 14-` # Remove any shared folder shared_folders=`vboxmanage showvminfo $appliance | grep Name | grep Host` @@ -67,7 +67,7 @@ mkdir dist set -e # Export for Xen -vboxmanage internalcommands converttoraw "$hdd_path" img.raw +vboxmanage internalcommands converttoraw -format vdi "$hdd_path" img.raw faketime '2010-01-01' vhd-util convert -s 0 -t 1 -i img.raw -o stagefixed.vhd faketime '2010-01-01' vhd-util convert -s 1 -t 2 -i stagefixed.vhd -o $appliance-$build_date-$branch-xen.vhd rm *.bak @@ -75,7 +75,7 @@ bzip2 $appliance-$build_date-$branch-xen.vhd echo "$appliance exported for Xen: dist/$appliance-$build_date-$branch-xen.vhd.bz2" # Export for KVM -vboxmanage internalcommands converttoraw "$hdd_path" raw.img +vboxmanage internalcommands converttoraw -format vdi "$hdd_path" raw.img qemu-img convert -f raw -c -O qcow2 raw.img $appliance-$build_date-$branch-kvm.qcow2 rm raw.img bzip2 $appliance-$build_date-$branch-kvm.qcow2 From 19bed631939d7f17ec6e3d1393002b866a458104 Mon Sep 17 00:00:00 2001 From: Gaurav Aradhye Date: Fri, 7 Jun 2013 06:23:10 -0400 Subject: [PATCH 27/36] CLOUDSTACK-2898: Fixing test case issue test_network.py:test_delete_account When the router for an account is deleted listRouters throws an exception, handle the exception to pass the test. Signed-off-by: Prasanna Santhanam --- test/integration/smoke/test_network.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/integration/smoke/test_network.py b/test/integration/smoke/test_network.py index a65748d2e97..1c867fa0422 100644 --- a/test/integration/smoke/test_network.py +++ b/test/integration/smoke/test_network.py @@ -1734,6 +1734,9 @@ class TestDeleteAccount(cloudstackTestCase): None, "Check routers are properly deleted." ) + except cloudstackAPIException: + self.debug("Router is deleted") + except Exception as e: raise Exception( "Encountered %s raised while fetching routers for account: %s" % (e, From 862b955059b2f9f8913ffc6637bab1f839047e44 Mon Sep 17 00:00:00 2001 From: SrikanteswaraRao Talluri Date: Wed, 12 Jun 2013 21:31:40 +0530 Subject: [PATCH 28/36] CLOUDSTACK-2363: Fix to conform to library changes Several fixes for account.account references are fixed to the correct account. reference Signed-off-by: Prasanna Santhanam --- .../component/test_advancedsg_networks.py | 14 +-- .../component/test_custom_hostname.py | 20 ++-- .../component/test_netscaler_configs.py | 20 ++-- .../component/test_netscaler_lb.py | 80 ++++++++-------- .../component/test_netscaler_lb_algo.py | 56 +++++------ .../component/test_netscaler_lb_sticky.py | 6 +- .../component/test_shared_networks.py | 94 +++++++++---------- 7 files changed, 145 insertions(+), 145 deletions(-) diff --git a/test/integration/component/test_advancedsg_networks.py b/test/integration/component/test_advancedsg_networks.py index 229cfd6e5f9..e1694f12668 100644 --- a/test/integration/component/test_advancedsg_networks.py +++ b/test/integration/component/test_advancedsg_networks.py @@ -274,7 +274,7 @@ class TestNetworksInAdvancedSG(cloudstackTestCase): #verify that the account got created with state enabled list_accounts_response = Account.list( self.api_client, - id=self.admin_account.account.id, + id=self.admin_account.id, listall=True ) self.assertEqual( @@ -308,7 +308,7 @@ class TestNetworksInAdvancedSG(cloudstackTestCase): #verify that the account got created with state enabled list_accounts_response = Account.list( self.api_client, - id=self.user_account.account.id, + id=self.user_account.id, listall=True ) self.assertEqual( @@ -452,7 +452,7 @@ class TestNetworksInAdvancedSG(cloudstackTestCase): #verify that the account got created with state enabled list_accounts_response = Account.list( self.api_client, - id=self.admin_account.account.id, + id=self.admin_account.id, listall=True ) self.assertEqual( @@ -471,7 +471,7 @@ class TestNetworksInAdvancedSG(cloudstackTestCase): "The admin account created is not enabled." ) - self.debug("Domain admin account created: %s" % self.admin_account.account.id) + self.debug("Domain admin account created: %s" % self.admin_account.id) #Verify that there should be at least one physical network present in zone. list_physical_networks_response = PhysicalNetwork.list( @@ -599,7 +599,7 @@ class TestNetworksInAdvancedSG(cloudstackTestCase): #verify that the account got created with state enabled list_accounts_response = Account.list( self.api_client, - id=self.admin_account.account.id, + id=self.admin_account.id, liistall=True ) self.assertEqual( @@ -693,7 +693,7 @@ class TestNetworksInAdvancedSG(cloudstackTestCase): self.shared_network_sg = Network.create( self.api_client, self.services["shared_network_sg"], - domainid=self.admin_account.account.domainid, + domainid=self.admin_account.domainid, networkofferingid=self.shared_network_offering_sg.id, zoneid=self.zone.id ) @@ -726,7 +726,7 @@ class TestNetworksInAdvancedSG(cloudstackTestCase): self.api_client, self.services["virtual_machine"], accountid=self.admin_account.name, - domainid=self.admin_account.account.domainid, + domainid=self.admin_account.domainid, networkids=self.shared_network_sg.id, serviceofferingid=self.service_offering.id ) diff --git a/test/integration/component/test_custom_hostname.py b/test/integration/component/test_custom_hostname.py index a85f619fc00..c9db2154a94 100644 --- a/test/integration/component/test_custom_hostname.py +++ b/test/integration/component/test_custom_hostname.py @@ -169,13 +169,13 @@ class TestInstanceNameFlagTrue(cloudstackTestCase): # 2. Give the user provided user name. Internal name should be # i---display name - self.debug("Deploying VM in account: %s" % self.account.account.name) + self.debug("Deploying VM in account: %s" % self.account.name) # Spawn an instance in that network virtual_machine = VirtualMachine.create( self.apiclient, self.services["virtual_machine"], - accountid=self.account.account.name, - domainid=self.account.account.domainid, + accountid=self.account.name, + domainid=self.account.domainid, serviceofferingid=self.service_offering.id, ) self.debug( @@ -208,11 +208,11 @@ class TestInstanceNameFlagTrue(cloudstackTestCase): # Fetch account ID and VMID from database to check internal name self.debug("select id from account where uuid = '%s';" \ - % self.account.account.id) + % self.account.id) qresultset = self.dbclient.execute( "select id from account where uuid = '%s';" \ - % self.account.account.id + % self.account.id ) self.assertEqual( isinstance(qresultset, list), @@ -273,12 +273,12 @@ class TestInstanceNameFlagTrue(cloudstackTestCase): # Removing display name from config del self.services["virtual_machine"]["displayname"] - self.debug("Deploying VM in account: %s" % self.account.account.name) + self.debug("Deploying VM in account: %s" % self.account.name) virtual_machine = VirtualMachine.create( self.apiclient, self.services["virtual_machine"], - accountid=self.account.account.name, - domainid=self.account.account.domainid, + accountid=self.account.name, + domainid=self.account.domainid, serviceofferingid=self.service_offering.id, ) self.debug( @@ -307,11 +307,11 @@ class TestInstanceNameFlagTrue(cloudstackTestCase): ) # Fetch account ID and VMID from database to check internal name self.debug("select id from account where uuid = '%s';" \ - % self.account.account.id) + % self.account.id) qresultset = self.dbclient.execute( "select id from account where uuid = '%s';" \ - % self.account.account.id + % self.account.id ) self.assertEqual( isinstance(qresultset, list), diff --git a/test/integration/component/test_netscaler_configs.py b/test/integration/component/test_netscaler_configs.py index 1c67bc4c29e..3c18c0050fd 100644 --- a/test/integration/component/test_netscaler_configs.py +++ b/test/integration/component/test_netscaler_configs.py @@ -2135,7 +2135,7 @@ class TestGuestNetworkShutDown(cloudstackTestCase): cls.api_client, cls.services["network"], accountid=cls.account.name, - domainid=cls.account.account.domainid, + domainid=cls.account.domainid, networkofferingid=cls.network_offering.id, zoneid=cls.zone.id ) @@ -2145,7 +2145,7 @@ class TestGuestNetworkShutDown(cloudstackTestCase): cls.api_client, cls.services["virtual_machine"], accountid=cls.account.name, - domainid=cls.account.account.domainid, + domainid=cls.account.domainid, serviceofferingid=cls.service_offering.id, networkids=[str(cls.network.id)] ) @@ -2153,7 +2153,7 @@ class TestGuestNetworkShutDown(cloudstackTestCase): cls.api_client, cls.services["virtual_machine"], accountid=cls.account.name, - domainid=cls.account.account.domainid, + domainid=cls.account.domainid, serviceofferingid=cls.service_offering.id, networkids=[str(cls.network.id)] ) @@ -2161,7 +2161,7 @@ class TestGuestNetworkShutDown(cloudstackTestCase): cls.api_client, accountid=cls.account.name, zoneid=cls.zone.id, - domainid=cls.account.account.domainid, + domainid=cls.account.domainid, networkid=cls.network.id ) cls.lb_rule = LoadBalancerRule.create( @@ -2658,7 +2658,7 @@ class TestServiceProvider(cloudstackTestCase): self.apiclient, self.services["network"], accountid=self.account.name, - domainid=self.account.account.domainid, + domainid=self.account.domainid, networkofferingid=self.network_offering.id, zoneid=self.zone.id ) @@ -2691,7 +2691,7 @@ class TestServiceProvider(cloudstackTestCase): self.apiclient, self.services["network"], accountid=self.account.name, - domainid=self.account.account.domainid, + domainid=self.account.domainid, networkofferingid=self.network_offering.id, zoneid=self.zone.id ) @@ -2721,7 +2721,7 @@ class TestServiceProvider(cloudstackTestCase): self.apiclient, self.services["network"], accountid=self.account.name, - domainid=self.account.account.domainid, + domainid=self.account.domainid, networkofferingid=self.network_offering.id, zoneid=self.zone.id ) @@ -2734,7 +2734,7 @@ class TestServiceProvider(cloudstackTestCase): self.apiclient, self.services["virtual_machine"], accountid=self.account.name, - domainid=self.account.account.domainid, + domainid=self.account.domainid, serviceofferingid=self.service_offering.id, networkids=[str(self.network.id)] ) @@ -2766,7 +2766,7 @@ class TestServiceProvider(cloudstackTestCase): self.apiclient, accountid=self.account.name, zoneid=self.zone.id, - domainid=self.account.account.domainid, + domainid=self.account.domainid, networkid=self.network.id ) self.debug( @@ -2813,7 +2813,7 @@ class TestServiceProvider(cloudstackTestCase): self.apiclient, self.services["virtual_machine"], accountid=self.account.name, - domainid=self.account.account.domainid, + domainid=self.account.domainid, serviceofferingid=self.service_offering.id, networkids=[str(self.network.id)] ) diff --git a/test/integration/component/test_netscaler_lb.py b/test/integration/component/test_netscaler_lb.py index 19888972880..b4e6c30497f 100644 --- a/test/integration/component/test_netscaler_lb.py +++ b/test/integration/component/test_netscaler_lb.py @@ -245,7 +245,7 @@ class TestLbSourceNat(cloudstackTestCase): self.apiclient, self.services["network"], accountid=self.account.name, - domainid=self.account.account.domainid, + domainid=self.account.domainid, networkofferingid=self.network_offering.id, zoneid=self.zone.id ) @@ -258,7 +258,7 @@ class TestLbSourceNat(cloudstackTestCase): self.apiclient, self.services["virtual_machine"], accountid=self.account.name, - domainid=self.account.account.domainid, + domainid=self.account.domainid, serviceofferingid=self.service_offering.id, networkids=[str(self.network.id)] ) @@ -294,7 +294,7 @@ class TestLbSourceNat(cloudstackTestCase): self.apiclient, self.services["virtual_machine"], accountid=self.account.name, - domainid=self.account.account.domainid, + domainid=self.account.domainid, serviceofferingid=self.service_offering.id, networkids=[str(self.network.id)] ) @@ -325,7 +325,7 @@ class TestLbSourceNat(cloudstackTestCase): self.apiclient, associatednetworkid=self.network.id, account=self.account.name, - domainid=self.account.account.domainid, + domainid=self.account.domainid, listall=True, issourcenat=True, ) @@ -454,7 +454,7 @@ class TestLbOnIpWithPf(cloudstackTestCase): self.apiclient, self.services["network"], accountid=self.account.name, - domainid=self.account.account.domainid, + domainid=self.account.domainid, networkofferingid=self.network_offering.id, zoneid=self.zone.id ) @@ -467,7 +467,7 @@ class TestLbOnIpWithPf(cloudstackTestCase): self.apiclient, self.services["virtual_machine"], accountid=self.account.name, - domainid=self.account.account.domainid, + domainid=self.account.domainid, serviceofferingid=self.service_offering.id, networkids=[str(self.network.id)] ) @@ -503,7 +503,7 @@ class TestLbOnIpWithPf(cloudstackTestCase): self.apiclient, self.services["virtual_machine"], accountid=self.account.name, - domainid=self.account.account.domainid, + domainid=self.account.domainid, serviceofferingid=self.service_offering.id, networkids=[str(self.network.id)] ) @@ -535,7 +535,7 @@ class TestLbOnIpWithPf(cloudstackTestCase): self.apiclient, accountid=self.account.name, zoneid=self.zone.id, - domainid=self.account.account.domainid, + domainid=self.account.domainid, networkid=self.network.id ) @@ -665,7 +665,7 @@ class TestPfOnIpWithLb(cloudstackTestCase): self.apiclient, self.services["network"], accountid=self.account.name, - domainid=self.account.account.domainid, + domainid=self.account.domainid, networkofferingid=self.network_offering.id, zoneid=self.zone.id ) @@ -678,7 +678,7 @@ class TestPfOnIpWithLb(cloudstackTestCase): self.apiclient, self.services["virtual_machine"], accountid=self.account.name, - domainid=self.account.account.domainid, + domainid=self.account.domainid, serviceofferingid=self.service_offering.id, networkids=[str(self.network.id)] ) @@ -714,7 +714,7 @@ class TestPfOnIpWithLb(cloudstackTestCase): self.apiclient, self.services["virtual_machine"], accountid=self.account.name, - domainid=self.account.account.domainid, + domainid=self.account.domainid, serviceofferingid=self.service_offering.id, networkids=[str(self.network.id)] ) @@ -747,7 +747,7 @@ class TestPfOnIpWithLb(cloudstackTestCase): self.apiclient, accountid=self.account.name, zoneid=self.zone.id, - domainid=self.account.account.domainid, + domainid=self.account.domainid, networkid=self.network.id ) self.debug("Associated %s with network %s" % ( @@ -877,7 +877,7 @@ class TestLbOnNonSourceNat(cloudstackTestCase): self.apiclient, self.services["network"], accountid=self.account.name, - domainid=self.account.account.domainid, + domainid=self.account.domainid, networkofferingid=self.network_offering.id, zoneid=self.zone.id ) @@ -890,7 +890,7 @@ class TestLbOnNonSourceNat(cloudstackTestCase): self.apiclient, self.services["virtual_machine"], accountid=self.account.name, - domainid=self.account.account.domainid, + domainid=self.account.domainid, serviceofferingid=self.service_offering.id, networkids=[str(self.network.id)] ) @@ -926,7 +926,7 @@ class TestLbOnNonSourceNat(cloudstackTestCase): self.apiclient, self.services["virtual_machine"], accountid=self.account.name, - domainid=self.account.account.domainid, + domainid=self.account.domainid, serviceofferingid=self.service_offering.id, networkids=[str(self.network.id)] ) @@ -959,7 +959,7 @@ class TestLbOnNonSourceNat(cloudstackTestCase): self.apiclient, accountid=self.account.name, zoneid=self.zone.id, - domainid=self.account.account.domainid, + domainid=self.account.domainid, networkid=self.network.id ) self.debug("Associated %s with network %s" % ( @@ -1097,7 +1097,7 @@ class TestAddMultipleVmsLb(cloudstackTestCase): self.apiclient, self.services["network"], accountid=self.account.name, - domainid=self.account.account.domainid, + domainid=self.account.domainid, networkofferingid=self.network_offering.id, zoneid=self.zone.id ) @@ -1110,7 +1110,7 @@ class TestAddMultipleVmsLb(cloudstackTestCase): self.apiclient, self.services["virtual_machine"], accountid=self.account.name, - domainid=self.account.account.domainid, + domainid=self.account.domainid, serviceofferingid=self.service_offering.id, networkids=[str(self.network.id)] ) @@ -1146,7 +1146,7 @@ class TestAddMultipleVmsLb(cloudstackTestCase): self.apiclient, self.services["virtual_machine"], accountid=self.account.name, - domainid=self.account.account.domainid, + domainid=self.account.domainid, serviceofferingid=self.service_offering.id, networkids=[str(self.network.id)] ) @@ -1179,7 +1179,7 @@ class TestAddMultipleVmsLb(cloudstackTestCase): self.apiclient, accountid=self.account.name, zoneid=self.zone.id, - domainid=self.account.account.domainid, + domainid=self.account.domainid, networkid=self.network.id ) self.debug("Associated %s with network %s" % ( @@ -1371,7 +1371,7 @@ class TestMultipleLbRules(cloudstackTestCase): self.apiclient, self.services["network"], accountid=self.account.name, - domainid=self.account.account.domainid, + domainid=self.account.domainid, networkofferingid=self.network_offering.id, zoneid=self.zone.id ) @@ -1384,7 +1384,7 @@ class TestMultipleLbRules(cloudstackTestCase): self.apiclient, self.services["virtual_machine"], accountid=self.account.name, - domainid=self.account.account.domainid, + domainid=self.account.domainid, serviceofferingid=self.service_offering.id, networkids=[str(self.network.id)] ) @@ -1420,7 +1420,7 @@ class TestMultipleLbRules(cloudstackTestCase): self.apiclient, self.services["virtual_machine"], accountid=self.account.name, - domainid=self.account.account.domainid, + domainid=self.account.domainid, serviceofferingid=self.service_offering.id, networkids=[str(self.network.id)] ) @@ -1455,7 +1455,7 @@ class TestMultipleLbRules(cloudstackTestCase): self.apiclient, accountid=self.account.name, zoneid=self.zone.id, - domainid=self.account.account.domainid, + domainid=self.account.domainid, networkid=self.network.id ) self.debug("Associated %s with network %s" % ( @@ -1501,7 +1501,7 @@ class TestMultipleLbRules(cloudstackTestCase): self.apiclient, accountid=self.account.name, zoneid=self.zone.id, - domainid=self.account.account.domainid, + domainid=self.account.domainid, networkid=self.network.id ) self.debug("Associated %s with network %s" % ( @@ -1688,7 +1688,7 @@ class TestMultipleLbRulesSameIp(cloudstackTestCase): self.apiclient, self.services["network"], accountid=self.account.name, - domainid=self.account.account.domainid, + domainid=self.account.domainid, networkofferingid=self.network_offering.id, zoneid=self.zone.id ) @@ -1701,7 +1701,7 @@ class TestMultipleLbRulesSameIp(cloudstackTestCase): self.apiclient, self.services["virtual_machine"], accountid=self.account.name, - domainid=self.account.account.domainid, + domainid=self.account.domainid, serviceofferingid=self.service_offering.id, networkids=[str(self.network.id)] ) @@ -1737,7 +1737,7 @@ class TestMultipleLbRulesSameIp(cloudstackTestCase): self.apiclient, self.services["virtual_machine"], accountid=self.account.name, - domainid=self.account.account.domainid, + domainid=self.account.domainid, serviceofferingid=self.service_offering.id, networkids=[str(self.network.id)] ) @@ -1772,7 +1772,7 @@ class TestMultipleLbRulesSameIp(cloudstackTestCase): self.apiclient, accountid=self.account.name, zoneid=self.zone.id, - domainid=self.account.account.domainid, + domainid=self.account.domainid, networkid=self.network.id ) self.debug("Associated %s with network %s" % ( @@ -1953,7 +1953,7 @@ class TestLoadBalancingRule(cloudstackTestCase): cls.api_client, cls.services["network"], accountid=cls.account.name, - domainid=cls.account.account.domainid, + domainid=cls.account.domainid, networkofferingid=cls.network_offering.id, zoneid=cls.zone.id ) @@ -1963,7 +1963,7 @@ class TestLoadBalancingRule(cloudstackTestCase): cls.api_client, cls.services["virtual_machine"], accountid=cls.account.name, - domainid=cls.account.account.domainid, + domainid=cls.account.domainid, serviceofferingid=cls.service_offering.id, networkids=[str(cls.network.id)] ) @@ -1971,7 +1971,7 @@ class TestLoadBalancingRule(cloudstackTestCase): cls.api_client, accountid=cls.account.name, zoneid=cls.zone.id, - domainid=cls.account.account.domainid, + domainid=cls.account.domainid, networkid=cls.network.id ) cls.lb_rule = LoadBalancerRule.create( @@ -2176,7 +2176,7 @@ class TestDeleteCreateLBRule(cloudstackTestCase): cls.api_client, cls.services["network"], accountid=cls.account.name, - domainid=cls.account.account.domainid, + domainid=cls.account.domainid, networkofferingid=cls.network_offering.id, zoneid=cls.zone.id ) @@ -2186,7 +2186,7 @@ class TestDeleteCreateLBRule(cloudstackTestCase): cls.api_client, cls.services["virtual_machine"], accountid=cls.account.name, - domainid=cls.account.account.domainid, + domainid=cls.account.domainid, serviceofferingid=cls.service_offering.id, networkids=[str(cls.network.id)] ) @@ -2194,7 +2194,7 @@ class TestDeleteCreateLBRule(cloudstackTestCase): cls.api_client, accountid=cls.account.name, zoneid=cls.zone.id, - domainid=cls.account.account.domainid, + domainid=cls.account.domainid, networkid=cls.network.id ) cls._cleanup = [ @@ -2315,7 +2315,7 @@ class TestVmWithLb(cloudstackTestCase): cls.api_client, cls.services["network"], accountid=cls.account.name, - domainid=cls.account.account.domainid, + domainid=cls.account.domainid, networkofferingid=cls.network_offering.id, zoneid=cls.zone.id ) @@ -2325,7 +2325,7 @@ class TestVmWithLb(cloudstackTestCase): cls.api_client, cls.services["virtual_machine"], accountid=cls.account.name, - domainid=cls.account.account.domainid, + domainid=cls.account.domainid, serviceofferingid=cls.service_offering.id, networkids=[str(cls.network.id)] ) @@ -2333,7 +2333,7 @@ class TestVmWithLb(cloudstackTestCase): cls.api_client, cls.services["virtual_machine"], accountid=cls.account.name, - domainid=cls.account.account.domainid, + domainid=cls.account.domainid, serviceofferingid=cls.service_offering.id, networkids=[str(cls.network.id)] ) @@ -2341,7 +2341,7 @@ class TestVmWithLb(cloudstackTestCase): cls.api_client, accountid=cls.account.name, zoneid=cls.zone.id, - domainid=cls.account.account.domainid, + domainid=cls.account.domainid, networkid=cls.network.id ) cls.lb_rule_1 = LoadBalancerRule.create( @@ -2355,7 +2355,7 @@ class TestVmWithLb(cloudstackTestCase): cls.api_client, accountid=cls.account.name, zoneid=cls.zone.id, - domainid=cls.account.account.domainid, + domainid=cls.account.domainid, networkid=cls.network.id ) cls.lb_rule_2 = LoadBalancerRule.create( diff --git a/test/integration/component/test_netscaler_lb_algo.py b/test/integration/component/test_netscaler_lb_algo.py index 4a2d1fe4c2b..99a537d78e3 100644 --- a/test/integration/component/test_netscaler_lb_algo.py +++ b/test/integration/component/test_netscaler_lb_algo.py @@ -212,7 +212,7 @@ class TestLbWithRoundRobin(cloudstackTestCase): self.apiclient, self.services["network"], accountid=self.account.name, - domainid=self.account.account.domainid, + domainid=self.account.domainid, networkofferingid=self.network_offering.id, zoneid=self.zone.id ) @@ -225,7 +225,7 @@ class TestLbWithRoundRobin(cloudstackTestCase): self.apiclient, self.services["virtual_machine"], accountid=self.account.name, - domainid=self.account.account.domainid, + domainid=self.account.domainid, serviceofferingid=self.service_offering.id, networkids=[str(self.network.id)] ) @@ -259,7 +259,7 @@ class TestLbWithRoundRobin(cloudstackTestCase): self.apiclient, accountid=self.account.name, zoneid=self.zone.id, - domainid=self.account.account.domainid, + domainid=self.account.domainid, networkid=self.network.id ) self.debug("Associated %s with network %s" % ( @@ -425,7 +425,7 @@ class TestLbWithLeastConn(cloudstackTestCase): self.apiclient, self.services["network"], accountid=self.account.name, - domainid=self.account.account.domainid, + domainid=self.account.domainid, networkofferingid=self.network_offering.id, zoneid=self.zone.id ) @@ -438,7 +438,7 @@ class TestLbWithLeastConn(cloudstackTestCase): self.apiclient, self.services["virtual_machine"], accountid=self.account.name, - domainid=self.account.account.domainid, + domainid=self.account.domainid, serviceofferingid=self.service_offering.id, networkids=[str(self.network.id)] ) @@ -472,14 +472,14 @@ class TestLbWithLeastConn(cloudstackTestCase): self.apiclient, accountid=self.account.name, zoneid=self.zone.id, - domainid=self.account.account.domainid, + domainid=self.account.domainid, networkid=self.network.id ) ip_with_lb_rule = PublicIPAddress.create( self.apiclient, accountid=self.account.name, zoneid=self.zone.id, - domainid=self.account.account.domainid, + domainid=self.account.domainid, networkid=self.network.id ) self.debug("Associated %s with network %s" % ( @@ -644,7 +644,7 @@ class TestLbWithSourceIp(cloudstackTestCase): self.apiclient, self.services["network"], accountid=self.account.name, - domainid=self.account.account.domainid, + domainid=self.account.domainid, networkofferingid=self.network_offering.id, zoneid=self.zone.id ) @@ -657,7 +657,7 @@ class TestLbWithSourceIp(cloudstackTestCase): self.apiclient, self.services["virtual_machine"], accountid=self.account.name, - domainid=self.account.account.domainid, + domainid=self.account.domainid, serviceofferingid=self.service_offering.id, networkids=[str(self.network.id)] ) @@ -691,7 +691,7 @@ class TestLbWithSourceIp(cloudstackTestCase): self.apiclient, accountid=self.account.name, zoneid=self.zone.id, - domainid=self.account.account.domainid, + domainid=self.account.domainid, networkid=self.network.id ) self.debug("Associated %s with network %s" % ( @@ -791,7 +791,7 @@ class TestLbAlgoRrLc(cloudstackTestCase): cls.api_client, cls.services["network"], accountid=cls.account.name, - domainid=cls.account.account.domainid, + domainid=cls.account.domainid, networkofferingid=cls.network_offering.id, zoneid=cls.zone.id ) @@ -808,7 +808,7 @@ class TestLbAlgoRrLc(cloudstackTestCase): cls.api_client, cls.services["virtual_machine"], accountid=cls.account.name, - domainid=cls.account.account.domainid, + domainid=cls.account.domainid, serviceofferingid=cls.service_offering.id, networkids=[str(cls.network.id)] ) @@ -816,7 +816,7 @@ class TestLbAlgoRrLc(cloudstackTestCase): cls.api_client, accountid=cls.account.name, zoneid=cls.zone.id, - domainid=cls.account.account.domainid, + domainid=cls.account.domainid, networkid=cls.network.id ) cls._cleanup = [ @@ -1003,7 +1003,7 @@ class TestLbAlgoLcRr(cloudstackTestCase): cls.api_client, cls.services["network"], accountid=cls.account.name, - domainid=cls.account.account.domainid, + domainid=cls.account.domainid, networkofferingid=cls.network_offering.id, zoneid=cls.zone.id ) @@ -1020,7 +1020,7 @@ class TestLbAlgoLcRr(cloudstackTestCase): cls.api_client, cls.services["virtual_machine"], accountid=cls.account.name, - domainid=cls.account.account.domainid, + domainid=cls.account.domainid, serviceofferingid=cls.service_offering.id, networkids=[str(cls.network.id)] ) @@ -1028,7 +1028,7 @@ class TestLbAlgoLcRr(cloudstackTestCase): cls.api_client, accountid=cls.account.name, zoneid=cls.zone.id, - domainid=cls.account.account.domainid, + domainid=cls.account.domainid, networkid=cls.network.id ) cls._cleanup = [ @@ -1212,7 +1212,7 @@ class TestLbAlgoRrSb(cloudstackTestCase): cls.api_client, cls.services["network"], accountid=cls.account.name, - domainid=cls.account.account.domainid, + domainid=cls.account.domainid, networkofferingid=cls.network_offering.id, zoneid=cls.zone.id ) @@ -1229,7 +1229,7 @@ class TestLbAlgoRrSb(cloudstackTestCase): cls.api_client, cls.services["virtual_machine"], accountid=cls.account.name, - domainid=cls.account.account.domainid, + domainid=cls.account.domainid, serviceofferingid=cls.service_offering.id, networkids=[str(cls.network.id)] ) @@ -1238,7 +1238,7 @@ class TestLbAlgoRrSb(cloudstackTestCase): cls.api_client, accountid=cls.account.name, zoneid=cls.zone.id, - domainid=cls.account.account.domainid, + domainid=cls.account.domainid, networkid=cls.network.id ) cls._cleanup = [ @@ -1425,7 +1425,7 @@ class TestLbAlgoSbRr(cloudstackTestCase): cls.api_client, cls.services["network"], accountid=cls.account.name, - domainid=cls.account.account.domainid, + domainid=cls.account.domainid, networkofferingid=cls.network_offering.id, zoneid=cls.zone.id ) @@ -1442,7 +1442,7 @@ class TestLbAlgoSbRr(cloudstackTestCase): cls.api_client, cls.services["virtual_machine"], accountid=cls.account.name, - domainid=cls.account.account.domainid, + domainid=cls.account.domainid, serviceofferingid=cls.service_offering.id, networkids=[str(cls.network.id)] ) @@ -1451,7 +1451,7 @@ class TestLbAlgoSbRr(cloudstackTestCase): cls.api_client, accountid=cls.account.name, zoneid=cls.zone.id, - domainid=cls.account.account.domainid, + domainid=cls.account.domainid, networkid=cls.network.id ) cls._cleanup = [ @@ -1639,7 +1639,7 @@ class TestLbAlgoSbLc(cloudstackTestCase): cls.api_client, cls.services["network"], accountid=cls.account.name, - domainid=cls.account.account.domainid, + domainid=cls.account.domainid, networkofferingid=cls.network_offering.id, zoneid=cls.zone.id ) @@ -1656,7 +1656,7 @@ class TestLbAlgoSbLc(cloudstackTestCase): cls.api_client, cls.services["virtual_machine"], accountid=cls.account.name, - domainid=cls.account.account.domainid, + domainid=cls.account.domainid, serviceofferingid=cls.service_offering.id, networkids=[str(cls.network.id)] ) @@ -1665,7 +1665,7 @@ class TestLbAlgoSbLc(cloudstackTestCase): cls.api_client, accountid=cls.account.name, zoneid=cls.zone.id, - domainid=cls.account.account.domainid, + domainid=cls.account.domainid, networkid=cls.network.id ) cls._cleanup = [ @@ -1853,7 +1853,7 @@ class TestLbAlgoLcSb(cloudstackTestCase): cls.api_client, cls.services["network"], accountid=cls.account.name, - domainid=cls.account.account.domainid, + domainid=cls.account.domainid, networkofferingid=cls.network_offering.id, zoneid=cls.zone.id ) @@ -1870,7 +1870,7 @@ class TestLbAlgoLcSb(cloudstackTestCase): cls.api_client, cls.services["virtual_machine"], accountid=cls.account.name, - domainid=cls.account.account.domainid, + domainid=cls.account.domainid, serviceofferingid=cls.service_offering.id, networkids=[str(cls.network.id)] ) @@ -1878,7 +1878,7 @@ class TestLbAlgoLcSb(cloudstackTestCase): cls.api_client, accountid=cls.account.name, zoneid=cls.zone.id, - domainid=cls.account.account.domainid, + domainid=cls.account.domainid, networkid=cls.network.id ) cls._cleanup = [ diff --git a/test/integration/component/test_netscaler_lb_sticky.py b/test/integration/component/test_netscaler_lb_sticky.py index 7f391d0f79a..5c95fb8ff57 100644 --- a/test/integration/component/test_netscaler_lb_sticky.py +++ b/test/integration/component/test_netscaler_lb_sticky.py @@ -156,7 +156,7 @@ class TestLbStickyPolicy(cloudstackTestCase): cls.api_client, cls.services["network"], accountid=cls.account.name, - domainid=cls.account.account.domainid, + domainid=cls.account.domainid, networkofferingid=cls.network_offering.id, zoneid=cls.zone.id ) @@ -166,7 +166,7 @@ class TestLbStickyPolicy(cloudstackTestCase): cls.api_client, cls.services["virtual_machine"], accountid=cls.account.name, - domainid=cls.account.account.domainid, + domainid=cls.account.domainid, serviceofferingid=cls.service_offering.id, networkids=[str(cls.network.id)] ) @@ -174,7 +174,7 @@ class TestLbStickyPolicy(cloudstackTestCase): cls.api_client, accountid=cls.account.name, zoneid=cls.zone.id, - domainid=cls.account.account.domainid, + domainid=cls.account.domainid, networkid=cls.network.id ) cls._cleanup = [ diff --git a/test/integration/component/test_shared_networks.py b/test/integration/component/test_shared_networks.py index 5f964190356..cb2b55f705a 100644 --- a/test/integration/component/test_shared_networks.py +++ b/test/integration/component/test_shared_networks.py @@ -270,7 +270,7 @@ class TestSharedNetworks(cloudstackTestCase): #verify that the account got created with state enabled list_accounts_response = Account.list( self.api_client, - id=self.account.account.id, + id=self.account.id, listall=True ) self.assertEqual( @@ -406,7 +406,7 @@ class TestSharedNetworks(cloudstackTestCase): #verify that the account got created with state enabled list_accounts_response = Account.list( self.api_client, - id=self.account.account.id, + id=self.account.id, listall=True ) self.assertEqual( @@ -495,7 +495,7 @@ class TestSharedNetworks(cloudstackTestCase): #verify that the account got created with state enabled list_accounts_response = Account.list( self.api_client, - id=self.account.account.id, + id=self.account.id, listall=True ) self.assertEqual( @@ -597,7 +597,7 @@ class TestSharedNetworks(cloudstackTestCase): #verify that the account got created with state enabled list_accounts_response = Account.list( self.api_client, - id=self.admin_account.account.id, + id=self.admin_account.id, listall=True ) self.assertEqual( @@ -631,7 +631,7 @@ class TestSharedNetworks(cloudstackTestCase): #verify that the account got created with state enabled list_accounts_response = Account.list( self.api_client, - id=self.user_account.account.id, + id=self.user_account.id, listall=True ) self.assertEqual( @@ -807,7 +807,7 @@ class TestSharedNetworks(cloudstackTestCase): self.api_client, self.services["virtual_machine"], accountid=self.user_account.name, - domainid=self.user_account.account.domainid, + domainid=self.user_account.domainid, serviceofferingid=self.service_offering.id, networkids=self.network.id ) @@ -880,7 +880,7 @@ class TestSharedNetworks(cloudstackTestCase): #verify that the account got created with state enabled list_accounts_response = Account.list( self.api_client, - id=self.admin_account.account.id, + id=self.admin_account.id, listall=True ) self.assertEqual( @@ -914,7 +914,7 @@ class TestSharedNetworks(cloudstackTestCase): #verify that the account got created with state enabled list_accounts_response = Account.list( self.api_client, - id=self.user_account.account.id, + id=self.user_account.id, listall=True ) self.assertEqual( @@ -1027,7 +1027,7 @@ class TestSharedNetworks(cloudstackTestCase): self.api_client, self.services["network"], accountid=self.user_account.name, - domainid=self.user_account.account.domainid, + domainid=self.user_account.domainid, networkofferingid=self.shared_network_offering.id, zoneid=self.zone.id ) @@ -1061,7 +1061,7 @@ class TestSharedNetworks(cloudstackTestCase): self.api_client, self.services["virtual_machine"], accountid=self.admin_account.name, - domainid=self.admin_account.account.domainid, + domainid=self.admin_account.domainid, networkids=self.network.id, serviceofferingid=self.service_offering.id ) @@ -1073,7 +1073,7 @@ class TestSharedNetworks(cloudstackTestCase): self.api_client, self.services["virtual_machine"], accountid=self.user_account.name, - domainid=self.user_account.account.domainid, + domainid=self.user_account.domainid, networkids=self.network.id, serviceofferingid=self.service_offering.id ) @@ -1146,7 +1146,7 @@ class TestSharedNetworks(cloudstackTestCase): #verify that the account got created with state enabled list_accounts_response = Account.list( self.api_client, - id=self.admin_account.account.id, + id=self.admin_account.id, listall=True ) self.assertEqual( @@ -1165,7 +1165,7 @@ class TestSharedNetworks(cloudstackTestCase): "The admin account created is not enabled." ) - self.debug("Admin type account created: %s" % self.admin_account.account.id) + self.debug("Admin type account created: %s" % self.admin_account.id) #create domain self.dom_domain = Domain.create( @@ -1206,7 +1206,7 @@ class TestSharedNetworks(cloudstackTestCase): #verify that the account got created with state enabled list_accounts_response = Account.list( self.api_client, - id=self.domain_admin_account.account.id, + id=self.domain_admin_account.id, listall=True ) self.assertEqual( @@ -1225,7 +1225,7 @@ class TestSharedNetworks(cloudstackTestCase): "The domain admin account created is not enabled." ) - self.debug("Domain admin account created: %s" % self.domain_admin_account.account.id) + self.debug("Domain admin account created: %s" % self.domain_admin_account.id) #Create an user account self.domain_user_account = Account.create( @@ -1240,7 +1240,7 @@ class TestSharedNetworks(cloudstackTestCase): #verify that the account got created with state enabled list_accounts_response = Account.list( self.api_client, - id=self.domain_user_account.account.id, + id=self.domain_user_account.id, listall=True ) self.assertEqual( @@ -1259,7 +1259,7 @@ class TestSharedNetworks(cloudstackTestCase): "The domain user account created is not enabled." ) - self.debug("Domain user account created: %s" % self.domain_user_account.account.id) + self.debug("Domain user account created: %s" % self.domain_user_account.id) #Verify that there should be at least one physical network present in zone. list_physical_networks_response = PhysicalNetwork.list( @@ -1388,7 +1388,7 @@ class TestSharedNetworks(cloudstackTestCase): self.api_client, self.services["virtual_machine"], accountid=self.admin_account.name, - domainid=self.admin_account.account.domainid, + domainid=self.admin_account.domainid, networkids=self.network.id, serviceofferingid=self.service_offering.id ) @@ -1400,7 +1400,7 @@ class TestSharedNetworks(cloudstackTestCase): self.api_client, self.services["virtual_machine"], accountid=self.domain_user_account.name, - domainid=self.domain_user_account.account.domainid, + domainid=self.domain_user_account.domainid, networkids=self.network.id, serviceofferingid=self.service_offering.id ) @@ -1428,7 +1428,7 @@ class TestSharedNetworks(cloudstackTestCase): self.api_client, self.services["virtual_machine"], accountid=self.domain_admin_account.name, - domainid=self.domain_admin_account.account.domainid, + domainid=self.domain_admin_account.domainid, networkids=self.network.id, serviceofferingid=self.service_offering.id ) @@ -1500,7 +1500,7 @@ class TestSharedNetworks(cloudstackTestCase): #verify that the account got created with state enabled list_accounts_response = Account.list( self.api_client, - id=self.admin_account.account.id, + id=self.admin_account.id, listall=True ) self.assertEqual( @@ -1519,7 +1519,7 @@ class TestSharedNetworks(cloudstackTestCase): "The admin account created is not enabled." ) - self.debug("Admin account created: %s" % self.admin_account.account.id) + self.debug("Admin account created: %s" % self.admin_account.id) self.services["project"]["name"] = "proj-SADJKS" self.services["project"]["displaytext"] = "proj-SADJKS" @@ -1528,7 +1528,7 @@ class TestSharedNetworks(cloudstackTestCase): self.api_client, self.services["project"], account=self.admin_account.name, - domainid=self.admin_account.account.domainid + domainid=self.admin_account.domainid ) self.cleanup_projects.append(self.project1) @@ -1558,7 +1558,7 @@ class TestSharedNetworks(cloudstackTestCase): self.api_client, self.services["project"], account=self.admin_account.name, - domainid=self.admin_account.account.domainid + domainid=self.admin_account.domainid ) self.cleanup_projects.append(self.project2) @@ -1674,7 +1674,7 @@ class TestSharedNetworks(cloudstackTestCase): self.api_client, self.services["network"], projectid=self.project1.id, - domainid=self.admin_account.account.domainid, + domainid=self.admin_account.domainid, networkofferingid=self.shared_network_offering.id, zoneid=self.zone.id ) @@ -1709,7 +1709,7 @@ class TestSharedNetworks(cloudstackTestCase): self.api_client, self.services["virtual_machine"], accountid=self.admin_account.name, - domainid=self.admin_account.account.domainid, + domainid=self.admin_account.domainid, networkids=self.network.id, projectid=self.project2.id, serviceofferingid=self.service_offering.id @@ -1722,7 +1722,7 @@ class TestSharedNetworks(cloudstackTestCase): self.api_client, self.services["virtual_machine"], accountid=self.admin_account.name, - domainid=self.admin_account.account.domainid, + domainid=self.admin_account.domainid, networkids=self.network.id, projectid=self.project1.id, serviceofferingid=self.service_offering.id @@ -1784,7 +1784,7 @@ class TestSharedNetworks(cloudstackTestCase): #verify that the account got created with state enabled list_accounts_response = Account.list( self.api_client, - id=self.admin_account.account.id, + id=self.admin_account.id, listall=True ) self.assertEqual( @@ -1803,7 +1803,7 @@ class TestSharedNetworks(cloudstackTestCase): "The admin account created is not enabled." ) - self.debug("Domain admin account created: %s" % self.admin_account.account.id) + self.debug("Domain admin account created: %s" % self.admin_account.id) #Verify that there should be at least one physical network present in zone. list_physical_networks_response = PhysicalNetwork.list( @@ -1944,7 +1944,7 @@ class TestSharedNetworks(cloudstackTestCase): #verify that the account got created with state enabled list_accounts_response = Account.list( self.api_client, - id=self.admin_account.account.id, + id=self.admin_account.id, listall=True ) self.assertEqual( @@ -1963,7 +1963,7 @@ class TestSharedNetworks(cloudstackTestCase): "The admin account created is not enabled." ) - self.debug("Admin account created: %s" % self.admin_account.account.id) + self.debug("Admin account created: %s" % self.admin_account.id) #Verify that there should be at least one physical network present in zone. list_physical_networks_response = PhysicalNetwork.list( @@ -2129,7 +2129,7 @@ class TestSharedNetworks(cloudstackTestCase): #verify that the account got created with state enabled list_accounts_response = Account.list( self.api_client, - id=self.admin_account.account.id, + id=self.admin_account.id, listall=True ) self.assertEqual( @@ -2148,7 +2148,7 @@ class TestSharedNetworks(cloudstackTestCase): "The admin account created is not enabled." ) - self.debug("Admin account created: %s" % self.admin_account.account.id) + self.debug("Admin account created: %s" % self.admin_account.id) #Verify that there should be at least one physical network present in zone. list_physical_networks_response = PhysicalNetwork.list( @@ -2309,7 +2309,7 @@ class TestSharedNetworks(cloudstackTestCase): self.api_client, self.services["virtual_machine"], accountid=self.admin_account.name, - domainid=self.admin_account.account.domainid, + domainid=self.admin_account.domainid, networkids=self.network.id, serviceofferingid=self.service_offering.id ) @@ -2337,7 +2337,7 @@ class TestSharedNetworks(cloudstackTestCase): self.api_client, self.services["virtual_machine"], accountid=self.admin_account.name, - domainid=self.admin_account.account.domainid, + domainid=self.admin_account.domainid, networkids=self.network1.id, serviceofferingid=self.service_offering.id ) @@ -2392,7 +2392,7 @@ class TestSharedNetworks(cloudstackTestCase): #verify that the account got created with state enabled list_accounts_response = Account.list( self.api_client, - id=self.admin_account.account.id, + id=self.admin_account.id, liistall=True ) self.assertEqual( @@ -2540,7 +2540,7 @@ class TestSharedNetworks(cloudstackTestCase): self.shared_network = Network.create( self.api_client, self.services["network"], - domainid=self.admin_account.account.domainid, + domainid=self.admin_account.domainid, networkofferingid=self.shared_network_offering.id, zoneid=self.zone.id ) @@ -2573,7 +2573,7 @@ class TestSharedNetworks(cloudstackTestCase): self.api_client, self.services["isolated_network"], accountid=self.admin_account.name, - domainid=self.admin_account.account.domainid, + domainid=self.admin_account.domainid, networkofferingid=self.isolated_network_offering.id, zoneid=self.zone.id ) @@ -2601,7 +2601,7 @@ class TestSharedNetworks(cloudstackTestCase): self.api_client, self.services["virtual_machine"], accountid=self.admin_account.name, - domainid=self.admin_account.account.domainid, + domainid=self.admin_account.domainid, networkids=self.shared_network.id, serviceofferingid=self.service_offering.id ) @@ -2628,7 +2628,7 @@ class TestSharedNetworks(cloudstackTestCase): self.api_client, self.services["virtual_machine"], accountid=self.admin_account.name, - domainid=self.admin_account.account.domainid, + domainid=self.admin_account.domainid, networkids=self.isolated_network.id, serviceofferingid=self.service_offering.id ) @@ -2657,7 +2657,7 @@ class TestSharedNetworks(cloudstackTestCase): self.api_client, accountid=self.admin_account.name, zoneid=self.zone.id, - domainid=self.admin_account.account.domainid, + domainid=self.admin_account.domainid, networkid=self.isolated_network.id ) @@ -2730,7 +2730,7 @@ class TestSharedNetworks(cloudstackTestCase): #verify that the account got created with state enabled list_accounts_response = Account.list( self.api_client, - id=self.admin_account.account.id, + id=self.admin_account.id, listall=True ) self.assertEqual( @@ -2749,7 +2749,7 @@ class TestSharedNetworks(cloudstackTestCase): "The admin account created is not enabled." ) - self.debug("Admin type account created: %s" % self.admin_account.account.id) + self.debug("Admin type account created: %s" % self.admin_account.id) #Verify that there should be at least one physical network present in zone. list_physical_networks_response = PhysicalNetwork.list( @@ -2845,7 +2845,7 @@ class TestSharedNetworks(cloudstackTestCase): self.api_client, self.services["network"], accountid=self.admin_account.name, - domainid=self.admin_account.account.domainid, + domainid=self.admin_account.domainid, networkofferingid=self.shared_network_offering.id, zoneid=self.zone.id ) @@ -2875,7 +2875,7 @@ class TestSharedNetworks(cloudstackTestCase): #verify that the account got created with state enabled list_accounts_response = Account.list( self.api_client, - id=self.admin_account.account.id, + id=self.admin_account.id, listall=True ) self.assertEqual( @@ -2894,7 +2894,7 @@ class TestSharedNetworks(cloudstackTestCase): "The admin account created is not enabled." ) - self.debug("Admin type account created: %s" % self.admin_account.account.id) + self.debug("Admin type account created: %s" % self.admin_account.id) #Verify that there should be at least one physical network present in zone. list_physical_networks_response = PhysicalNetwork.list( @@ -2990,7 +2990,7 @@ class TestSharedNetworks(cloudstackTestCase): self.api_client, self.services["network"], accountid=self.admin_account.name, - domainid=self.admin_account.account.domainid, + domainid=self.admin_account.domainid, networkofferingid=self.shared_network_offering.id, zoneid=self.zone.id ) From 02399d9a2a2dd3b960b676a1ac435fb4bca14778 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Wed, 12 Jun 2013 10:55:06 -0700 Subject: [PATCH 29/36] CLOUDSTACK-2350: UI - Instances menu - change affinity action - list affinity groups that belongs to instance owner. --- ui/scripts/instances.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ui/scripts/instances.js b/ui/scripts/instances.js index 33a57675aee..da36de748ab 100644 --- a/ui/scripts/instances.js +++ b/ui/scripts/instances.js @@ -640,9 +640,14 @@ name: { label: 'label.name' }, type: { label: 'label.type' } }, - dataProvider: function(args) { + dataProvider: function(args) { + var data = { + domainid: args.context.instances[0].domainid, + account: args.context.instances[0].account + }; $.ajax({ url: createURL('listAffinityGroups'), + data: data, async: false, //make it sync to avoid dataProvider() being called twice which produces duplicate data success: function(json) { var items = []; From c2b5c98de0d911f04dad0d66a19c403c7493013b Mon Sep 17 00:00:00 2001 From: Pranav Saxena Date: Thu, 13 Jun 2013 10:59:30 +0530 Subject: [PATCH 30/36] CLOUDSTACK-2977: Update Default NIC for VM alert message --- ui/scripts/instances.js | 1 + 1 file changed, 1 insertion(+) diff --git a/ui/scripts/instances.js b/ui/scripts/instances.js index da36de748ab..54b3187680e 100644 --- a/ui/scripts/instances.js +++ b/ui/scripts/instances.js @@ -1518,6 +1518,7 @@ args.response.success({ _custom: { jobId: json.updatedefaultnicforvirtualmachineresponse.jobid } }); + cloudStack.dialog.notice({message:_l('Please manually update the default NIC on the VM now.')}); } }); }, From ff0a524bd689cc89f7ca48db84e6591edcd7c47c Mon Sep 17 00:00:00 2001 From: Vijayendra Bhamidipati Date: Wed, 12 Jun 2013 06:34:02 -0700 Subject: [PATCH 31/36] CLOUDSTACK-2969: Exception when creating vlan ip range Description: Putting in null pointer check when creating ip range. Signed-off-by: Sateesh Chodapuneedi --- .../src/com/cloud/configuration/ConfigurationManagerImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java index 111586d7733..b684e01ea0d 100755 --- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java +++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java @@ -2528,7 +2528,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati } Transaction txn = Transaction.currentTxn(); txn.start(); - if (sameSubnet.first() == false) { + if (sameSubnet == null || sameSubnet.first() == false) { s_logger.info("adding a new subnet to the network "+network.getId()); } else { From a1d7016b9d8d12ed4ed1724f5c39cb42c448e1c2 Mon Sep 17 00:00:00 2001 From: Sateesh Chodapuneedi Date: Thu, 13 Jun 2013 12:49:07 +0530 Subject: [PATCH 32/36] CLOUDSTACK-2962 [SM][VMWare]: migrate a virtualMachine with volumes is failing Checking if source and target hosts belongs to same vcenter datacenter. Signed-off-by: Sateesh Chodapuneedi --- .../com/cloud/hypervisor/vmware/resource/VmwareResource.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 46219c38d5f..31233824cbf 100755 --- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java +++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java @@ -3489,7 +3489,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa tgtHyperHost = new HostMO(getServiceContext(), morTgtHost); morDc = srcHyperHost.getHyperHostDatacenter(); morDcOfTargetHost = tgtHyperHost.getHyperHostDatacenter(); - if (morDc != morDcOfTargetHost) { + if (!morDc.getValue().equalsIgnoreCase(morDcOfTargetHost.getValue())) { String msg = "Source host & target host are in different datacentesr"; throw new CloudRuntimeException(msg); } From aeb024723a34e8c8386a62e5961ad5b99852de97 Mon Sep 17 00:00:00 2001 From: Jayapal Date: Thu, 13 Jun 2013 14:00:48 +0530 Subject: [PATCH 33/36] CLOUDSTACK-2942 Fixed issue in private gateway network acl Signed-off-by: Abhinandan Prateek --- .../com/cloud/hypervisor/vmware/resource/VmwareResource.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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 31233824cbf..1f5eac2e448 100755 --- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java +++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java @@ -1261,9 +1261,8 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa if (!result.first()) { String msg = "SetNetworkACLAnswer on domain router " + routerIp + " failed. message: " + result.second(); s_logger.error(msg); + return new SetNetworkACLAnswer(cmd, false, results); } - - return new SetNetworkACLAnswer(cmd, false, results); } else { args=""; args += " -d " + "eth" + ethDeviceNum; From b72c79b3702716b8202a0c592011d7e428c18160 Mon Sep 17 00:00:00 2001 From: Jayapal Date: Tue, 11 Jun 2013 20:01:23 +0530 Subject: [PATCH 34/36] CLOUDSTACK-2934 Fixed not showing uuid in list firewall rules response Signed-off-by: Abhinandan Prateek --- .../apache/cloudstack/api/response/FirewallResponse.java | 8 ++++---- server/src/com/cloud/api/ApiResponseHelper.java | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/api/src/org/apache/cloudstack/api/response/FirewallResponse.java b/api/src/org/apache/cloudstack/api/response/FirewallResponse.java index 26d243386fc..13a04b68f0b 100644 --- a/api/src/org/apache/cloudstack/api/response/FirewallResponse.java +++ b/api/src/org/apache/cloudstack/api/response/FirewallResponse.java @@ -39,10 +39,10 @@ public class FirewallResponse extends BaseResponse { private String endPort; @SerializedName(ApiConstants.IP_ADDRESS_ID) @Param(description="the public ip address id for the firewall rule") - private Long publicIpAddressId; + private String publicIpAddressId; @SerializedName(ApiConstants.NETWORK_ID) @Param(description="the network id of the firewall rule") - private Long networkId; + private String networkId; @SerializedName(ApiConstants.IP_ADDRESS) @Param(description="the public ip address for the firewall rule") private String publicIpAddress; @@ -78,7 +78,7 @@ public class FirewallResponse extends BaseResponse { this.endPort = endPort; } - public void setPublicIpAddressId(Long publicIpAddressId) { + public void setPublicIpAddressId(String publicIpAddressId) { this.publicIpAddressId = publicIpAddressId; } @@ -86,7 +86,7 @@ public class FirewallResponse extends BaseResponse { this.publicIpAddress = publicIpAddress; } - public void setNetworkId(Long networkId) { + public void setNetworkId(String networkId) { this.networkId = networkId; } diff --git a/server/src/com/cloud/api/ApiResponseHelper.java b/server/src/com/cloud/api/ApiResponseHelper.java index 4f75b99e0c4..94c5d6c1fa1 100755 --- a/server/src/com/cloud/api/ApiResponseHelper.java +++ b/server/src/com/cloud/api/ApiResponseHelper.java @@ -2399,11 +2399,12 @@ public class ApiResponseHelper implements ResponseGenerator { if (fwRule.getTrafficType() == FirewallRule.TrafficType.Ingress) { IpAddress ip = ApiDBUtils.findIpAddressById(fwRule.getSourceIpAddressId()); - response.setPublicIpAddressId(ip.getId()); + response.setPublicIpAddressId(ip.getUuid()); response.setPublicIpAddress(ip.getAddress().addr()); } else if (fwRule.getTrafficType() == FirewallRule.TrafficType.Egress) { response.setPublicIpAddress(null); - response.setNetworkId(fwRule.getNetworkId()); + Network network = ApiDBUtils.findNetworkById(fwRule.getNetworkId()); + response.setNetworkId(network.getUuid()); } FirewallRule.State state = fwRule.getState(); From b83b8eb838546197151d96e99ab3b9ee68db7df8 Mon Sep 17 00:00:00 2001 From: Harikrishna Patnala Date: Thu, 13 Jun 2013 15:56:21 +0530 Subject: [PATCH 35/36] CLOUDSTACK-2502: Scalevm and over provisioning should respect each other During Scale up of VM, memory/cpu calculations should consider the memory/cpu overprovisioning factors which are set per cluster. CLOUDSTACK-2939: CPU limit is not getting set for vm after scaleup to a service offering which have cpu cap enabled Signed-off-by: Abhinandan Prateek --- .../com/cloud/agent/api/ScaleVmCommand.java | 26 +++++++++++++------ .../vmware/resource/VmwareResource.java | 4 +-- .../vmware/resource/VmwareResourceTest.java | 7 ++--- .../xen/resource/CitrixResourceBase.java | 8 +++--- .../xen/resource/CitrixResourceBaseTest.java | 12 +++++++-- .../cloud/hypervisor/HypervisorGuruBase.java | 2 +- .../cloud/vm/VirtualMachineManagerImpl.java | 9 ++++++- .../vm/VirtualMachineManagerImplTest.java | 13 +++++++++- 8 files changed, 59 insertions(+), 22 deletions(-) diff --git a/core/src/com/cloud/agent/api/ScaleVmCommand.java b/core/src/com/cloud/agent/api/ScaleVmCommand.java index 35d22ad9d96..b3614856361 100644 --- a/core/src/com/cloud/agent/api/ScaleVmCommand.java +++ b/core/src/com/cloud/agent/api/ScaleVmCommand.java @@ -23,7 +23,8 @@ public class ScaleVmCommand extends Command { VirtualMachineTO vm; String vmName; int cpus; - Integer speed; + Integer minSpeed; + Integer maxSpeed; long minRam; long maxRam; @@ -40,14 +41,15 @@ public class ScaleVmCommand extends Command { } public ScaleVmCommand(String vmName, int cpus, - Integer speed, long minRam, long maxRam, boolean limitCpuUse) { + Integer minSpeed, Integer maxSpeed, long minRam, long maxRam, boolean limitCpuUse) { super(); this.vmName = vmName; this.cpus = cpus; - this.speed = speed; + this.minSpeed = minSpeed; + this.maxSpeed = maxSpeed; this.minRam = minRam; this.maxRam = maxRam; - this.vm = new VirtualMachineTO(1L, vmName, null, cpus, speed, minRam, maxRam, null, null, false, false, null); + this.vm = new VirtualMachineTO(1L, vmName, null, cpus, minSpeed, maxSpeed, minRam, maxRam, null, null, false, limitCpuUse, null); /*vm.setName(vmName); vm.setCpus(cpus); vm.setRam(minRam, maxRam);*/ @@ -57,14 +59,22 @@ public class ScaleVmCommand extends Command { this.cpus = cpus; } - public Integer getSpeed() { - return speed; + public Integer getMinSpeed() { + return minSpeed; } - public void setSpeed(Integer speed) { - this.speed = speed; + public void setMinSpeed(Integer minSpeed) { + this.minSpeed = minSpeed; } + public Integer getMaxSpeed() { + return minSpeed; + } + + public void setMaxSpeed(Integer maxSpeed) { + this.maxSpeed = maxSpeed; + } + public long getMinRam() { return minRam; } 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 1f5eac2e448..1af42390366 100755 --- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java +++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java @@ -2330,9 +2330,9 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa VmwareHypervisorHost hyperHost = getHyperHost(context); VirtualMachineMO vmMo = hyperHost.findVmOnHyperHost(cmd.getVmName()); VirtualMachineConfigSpec vmConfigSpec = new VirtualMachineConfigSpec(); - int ramMb = (int) (vmSpec.getMinRam()); + int ramMb = (int) (vmSpec.getMinRam()/(1024 * 1024)); - VmwareHelper.setVmScaleUpConfig(vmConfigSpec, vmSpec.getCpus(), vmSpec.getSpeed(), vmSpec.getSpeed(),(int) (vmSpec.getMaxRam()), ramMb, vmSpec.getLimitCpuUse()); + VmwareHelper.setVmScaleUpConfig(vmConfigSpec, vmSpec.getCpus(), vmSpec.getMaxSpeed(), vmSpec.getMinSpeed(),(int) (vmSpec.getMaxRam()/(1024 * 1024)), ramMb, vmSpec.getLimitCpuUse()); if(!vmMo.configureVm(vmConfigSpec)) { throw new Exception("Unable to execute ScaleVmCommand"); diff --git a/plugins/hypervisors/vmware/test/com/cloud/hypervisor/vmware/resource/VmwareResourceTest.java b/plugins/hypervisors/vmware/test/com/cloud/hypervisor/vmware/resource/VmwareResourceTest.java index 3ca0b600e36..2f7160873a8 100644 --- a/plugins/hypervisors/vmware/test/com/cloud/hypervisor/vmware/resource/VmwareResourceTest.java +++ b/plugins/hypervisors/vmware/test/com/cloud/hypervisor/vmware/resource/VmwareResourceTest.java @@ -68,10 +68,11 @@ public class VmwareResourceTest { when(_resource.getHyperHost(context, null)).thenReturn(hyperHost); doReturn("i-2-3-VM").when(cmd).getVmName(); when(hyperHost.findVmOnHyperHost("i-2-3-VM")).thenReturn(vmMo); - doReturn(1024L).when(vmSpec).getMinRam(); + doReturn(536870912L).when(vmSpec).getMinRam(); doReturn(1).when(vmSpec).getCpus(); - doReturn(1000).when(vmSpec).getSpeed(); - doReturn(1024L).when(vmSpec).getMaxRam(); + doReturn(1000).when(vmSpec).getMinSpeed(); + doReturn(1000).when(vmSpec).getMaxSpeed(); + doReturn(536870912L).when(vmSpec).getMaxRam(); doReturn(false).when(vmSpec).getLimitCpuUse(); when(vmMo.configureVm(vmConfigSpec)).thenReturn(true); diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java index e92c3fc55fe..5e8283ac35c 100644 --- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java +++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java @@ -635,16 +635,16 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe Long staticMemoryMax = vm.getMemoryStaticMax(conn); Long staticMemoryMin = vm.getMemoryStaticMin(conn); - Long newDynamicMemoryMin = vmSpec.getMinRam() * 1024 * 1024; - Long newDynamicMemoryMax = vmSpec.getMaxRam() * 1024 * 1024; + Long newDynamicMemoryMin = vmSpec.getMinRam(); + Long newDynamicMemoryMax = vmSpec.getMaxRam(); if (staticMemoryMin > newDynamicMemoryMin || newDynamicMemoryMax > staticMemoryMax) { throw new CloudRuntimeException("Cannot scale up the vm because of memory constraint violation: 0 <= memory-static-min <= memory-dynamic-min <= memory-dynamic-max <= memory-static-max "); } - vm.setMemoryDynamicRange(conn, vmSpec.getMinRam() * 1024 * 1024, vmSpec.getMaxRam() * 1024 * 1024); + vm.setMemoryDynamicRange(conn, newDynamicMemoryMin, newDynamicMemoryMax); vm.setVCPUsNumberLive(conn, (long)vmSpec.getCpus()); - Integer speed = vmSpec.getSpeed(); + Integer speed = vmSpec.getMinSpeed(); if (speed != null) { int cpuWeight = _maxWeight; //cpu_weight diff --git a/plugins/hypervisors/xen/test/com/cloud/hypervisor/xen/resource/CitrixResourceBaseTest.java b/plugins/hypervisors/xen/test/com/cloud/hypervisor/xen/resource/CitrixResourceBaseTest.java index 3328d4be50c..cb16ae2be15 100644 --- a/plugins/hypervisors/xen/test/com/cloud/hypervisor/xen/resource/CitrixResourceBaseTest.java +++ b/plugins/hypervisors/xen/test/com/cloud/hypervisor/xen/resource/CitrixResourceBaseTest.java @@ -113,10 +113,14 @@ public class CitrixResourceBaseTest { @Test public void testScaleVMF2() throws Types.XenAPIException, XmlRpcException { + when(vm.getMemoryStaticMax(conn)).thenReturn(1073741824L); + when(vm.getMemoryStaticMin(conn)).thenReturn(268435456L); + doReturn(536870912L).when(vmSpec).getMinRam(); + doReturn(536870912L).when(vmSpec).getMaxRam(); doNothing().when(vm).setMemoryDynamicRange(conn, 536870912L, 536870912L); doReturn(1).when(vmSpec).getCpus(); doNothing().when(vm).setVCPUsNumberLive(conn, 1L); - doReturn(500).when(vmSpec).getSpeed(); + doReturn(500).when(vmSpec).getMinSpeed(); doReturn(false).when(vmSpec).getLimitCpuUse(); Map args = (Map)mock(HashMap.class); when(host.callPlugin(conn, "vmops", "add_to_VCPUs_params_live", args)).thenReturn("Success"); @@ -132,10 +136,14 @@ public class CitrixResourceBaseTest { @Test public void testScaleVMF3() throws Types.XenAPIException, XmlRpcException { + when(vm.getMemoryStaticMax(conn)).thenReturn(1073741824L); + when(vm.getMemoryStaticMin(conn)).thenReturn(268435456L); + doReturn(536870912L).when(vmSpec).getMinRam(); + doReturn(536870912L).when(vmSpec).getMaxRam(); doNothing().when(vm).setMemoryDynamicRange(conn, 536870912L, 536870912L); doReturn(1).when(vmSpec).getCpus(); doNothing().when(vm).setVCPUsNumberLive(conn, 1L); - doReturn(500).when(vmSpec).getSpeed(); + doReturn(500).when(vmSpec).getMinSpeed(); doReturn(true).when(vmSpec).getLimitCpuUse(); doReturn(null).when(_resource).callHostPlugin(conn, "vmops", "add_to_VCPUs_params_live", "key", "cap", "value", "100", "vmname", "i-2-3-VM"); Map args = (Map)mock(HashMap.class); diff --git a/server/src/com/cloud/hypervisor/HypervisorGuruBase.java b/server/src/com/cloud/hypervisor/HypervisorGuruBase.java index d8945af9b8c..1ad9a1fb7c4 100644 --- a/server/src/com/cloud/hypervisor/HypervisorGuruBase.java +++ b/server/src/com/cloud/hypervisor/HypervisorGuruBase.java @@ -86,7 +86,7 @@ public abstract class HypervisorGuruBase extends AdapterBase implements Hypervis } - protected VirtualMachineTO toVirtualMachineTO(VirtualMachineProfile vmProfile) { + protected VirtualMachineTO toVirtualMachineTO(VirtualMachineProfile vmProfile) { ServiceOffering offering = vmProfile.getServiceOffering(); VirtualMachine vm = vmProfile.getVirtualMachine(); diff --git a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java index 568fe558247..f946cd1ebf6 100755 --- a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java +++ b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java @@ -129,6 +129,7 @@ import com.cloud.network.rules.RulesManager; import com.cloud.offering.ServiceOffering; import com.cloud.org.Cluster; import com.cloud.resource.ResourceManager; +import com.cloud.server.ConfigurationServer; import com.cloud.service.ServiceOfferingVO; import com.cloud.service.dao.ServiceOfferingDao; import com.cloud.storage.DiskOfferingVO; @@ -256,6 +257,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac protected RulesManager rulesMgr; @Inject protected AffinityGroupVMMapDao _affinityGroupVMMapDao; + @Inject + protected ConfigurationServer _configServer; protected List _planners; public List getPlanners() { @@ -3226,8 +3229,12 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac long newServiceofferingId = vm.getServiceOfferingId(); ServiceOffering newServiceOffering = _configMgr.getServiceOffering(newServiceofferingId); + HostVO hostVo = _hostDao.findById(vm.hostId); + Float memoryOvercommitRatio = Float.parseFloat(_configServer.getConfigValue(Config.MemOverprovisioningFactor.key(), Config.ConfigurationParameterScope.cluster.toString(), hostVo.getClusterId())); + Float cpuOvercommitRatio = Float.parseFloat(_configServer.getConfigValue(Config.CPUOverprovisioningFactor.key(), Config.ConfigurationParameterScope.cluster.toString(), hostVo.getClusterId())); + long minMemory = (long) (newServiceOffering.getRamSize()/memoryOvercommitRatio); ScaleVmCommand reconfigureCmd = new ScaleVmCommand(vm.getInstanceName(), newServiceOffering.getCpu(), - newServiceOffering.getSpeed(), newServiceOffering.getRamSize(), newServiceOffering.getRamSize(), newServiceOffering.getLimitCpuUse()); + (int) (newServiceOffering.getSpeed()/cpuOvercommitRatio), newServiceOffering.getSpeed(), minMemory * 1024 * 1024, newServiceOffering.getRamSize() * 1024 * 1024, newServiceOffering.getLimitCpuUse()); Long dstHostId = vm.getHostId(); ItWorkVO work = new ItWorkVO(UUID.randomUUID().toString(), _nodeId, State.Running, vm.getType(), vm.getId()); diff --git a/server/test/com/cloud/vm/VirtualMachineManagerImplTest.java b/server/test/com/cloud/vm/VirtualMachineManagerImplTest.java index dd51e74a618..8715c9e8663 100644 --- a/server/test/com/cloud/vm/VirtualMachineManagerImplTest.java +++ b/server/test/com/cloud/vm/VirtualMachineManagerImplTest.java @@ -22,11 +22,13 @@ import com.cloud.agent.api.Answer; import com.cloud.agent.api.ScaleVmAnswer; import com.cloud.agent.api.ScaleVmCommand; import com.cloud.capacity.CapacityManager; +import com.cloud.configuration.Config; import com.cloud.configuration.ConfigurationManager; import com.cloud.configuration.dao.ConfigurationDao; import com.cloud.deploy.DeployDestination; import com.cloud.host.HostVO; import com.cloud.host.dao.HostDao; +import com.cloud.server.ConfigurationServer; import com.cloud.service.ServiceOfferingVO; import com.cloud.storage.VMTemplateVO; import com.cloud.storage.VolumeManager; @@ -154,6 +156,10 @@ public class VirtualMachineManagerImplTest { List _rootVols; @Mock ItWorkVO _work; + @Mock + ConfigurationServer _configServer; + @Mock + HostVO hostVO; @Mock ClusterDao _clusterDao; @Mock HostPodDao _podDao; @@ -199,6 +205,7 @@ public class VirtualMachineManagerImplTest { _vmMgr._hvGuruMgr = _hvGuruMgr; _vmMgr._vmSnapshotMgr = _vmSnapshotMgr; _vmMgr._vmDao = _vmInstanceDao; + _vmMgr._configServer = _configServer; when(_vmMock.getId()).thenReturn(314l); when(_vmInstance.getId()).thenReturn(1L); @@ -239,8 +246,12 @@ public class VirtualMachineManagerImplTest { when(_vmInstanceDao.findById(anyLong())).thenReturn(_vmInstance); ServiceOfferingVO newServiceOffering = getSvcoffering(512); + when(_hostDao.findById(_vmInstance.hostId)).thenReturn(hostVO); + doReturn(1L).when(hostVO).getClusterId(); + when(_configServer.getConfigValue(Config.MemOverprovisioningFactor.key(), Config.ConfigurationParameterScope.cluster.toString(), 1L)).thenReturn("1.0"); + when(_configServer.getConfigValue(Config.CPUOverprovisioningFactor.key(), Config.ConfigurationParameterScope.cluster.toString(), 1L)).thenReturn("1.0"); ScaleVmCommand reconfigureCmd = new ScaleVmCommand("myVmName", newServiceOffering.getCpu(), - newServiceOffering.getSpeed(), newServiceOffering.getRamSize(), newServiceOffering.getRamSize(), newServiceOffering.getLimitCpuUse()); + newServiceOffering.getSpeed(), newServiceOffering.getSpeed(), newServiceOffering.getRamSize(), newServiceOffering.getRamSize(), newServiceOffering.getLimitCpuUse()); Answer answer = new ScaleVmAnswer(reconfigureCmd, true, "details"); when(_agentMgr.send(2l, reconfigureCmd)).thenReturn(null); _vmMgr.reConfigureVm(_vmInstance, getSvcoffering(256), false); From 7004bdc40a6cbc7efe1c224f05da9aa3a5abb7c5 Mon Sep 17 00:00:00 2001 From: Radhika PC Date: Thu, 13 Jun 2013 17:09:42 +0530 Subject: [PATCH 36/36] CLOUDSTACK-2986 --- docs/en-US/add-remove-nic-ui.xml | 147 +++++++++++++++++++ docs/en-US/images/remove-nic.png | Bin 0 -> 735 bytes docs/en-US/images/set-default-nic.png | Bin 0 -> 1012 bytes docs/en-US/using-multiple-guest-networks.xml | 1 + 4 files changed, 148 insertions(+) create mode 100644 docs/en-US/add-remove-nic-ui.xml create mode 100644 docs/en-US/images/remove-nic.png create mode 100644 docs/en-US/images/set-default-nic.png diff --git a/docs/en-US/add-remove-nic-ui.xml b/docs/en-US/add-remove-nic-ui.xml new file mode 100644 index 00000000000..777ac7919fa --- /dev/null +++ b/docs/en-US/add-remove-nic-ui.xml @@ -0,0 +1,147 @@ + + +%BOOK_ENTITIES; +]> + +
+ Reconfiguring Physical Networks in VMs + &PRODUCT; provides you the ability to move VMs between networks and reconfigure a VM's + network. You can remove a VM from a physical network and add to a new physical network. You can + also change the default physical network of a virtual machine. With this functionality, hybrid + or traditional server loads can be accommodated with ease. + This feature is supported on XenServer and KVM hypervisors. +
+ Adding a Physical Network + + + Log in to the CloudPlatform UI as an administrator or end user. + + + In the left navigation, click Instances. + + + Choose the VM that you want to work with. + + + Click the NICs tab. + + + Click Add network to VM. + The Add network to VM dialog is displayed. + + + In the drop-down list, select the network that you would like to add this VM + to. + A new NIC is added for this network. You can view the following details in the NICs + page: + + + ID + + + Network Name + + + Type + + + IP Address + + + Gateway + + + Netmask + + + Is default + + + CIDR (for IPv6) + + + + +
+
+ Removing a Physical Network + + + Log in to the CloudPlatform UI as an administrator or end user. + + + In the left navigation, click Instances. + + + Choose the VM that you want to work with. + + + Click the NICs tab. + + + Locate the NIC you want to remove. + + + Click Remove NIC button. + + + + + remove-nic.png: button to remove a NIC + + + + + Click Yes to confirm. + + +
+
+ Selecting the Default Physical Network + + + Log in to the CloudPlatform UI as an administrator or end user. + + + In the left navigation, click Instances. + + + Choose the VM that you want to work with. + + + Click the NICs tab. + + + Locate the NIC you want to work with. + + + Click the Set default NIC button. + + + + + set-default-nic.png: button to set a NIC as default one. + + + + + Click Yes to confirm. + + +
+
diff --git a/docs/en-US/images/remove-nic.png b/docs/en-US/images/remove-nic.png new file mode 100644 index 0000000000000000000000000000000000000000..27145cebbc70cd07c7358995151f276569cc08e0 GIT binary patch literal 735 zcmV<50wDc~P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D0(414K~zXft(03& z8bKI_=TEk2MFkHSn%-Eo(sEwWa#owhG{GtqNGYYILbWT)K@lyoEU@cx5IIzllg9ps zesnKcxalU(#bjsRXD0Jb7G?9SKZyT7J8s|RmOTMp5X_hJRvhj9HDtrD?uAE<39-9!G zEbG{+5p?s5%kUAVV1vP6_$Y<0Z(3Bozza#y_74t~W(5Gzv{W`VGxuUiuF~q2niZ$Z zlcDIr;9=|x)f+ddOrDo?mZ90wj?)De@XBASy z<2ZT7n+oAkRIS#NztX%MM&l|qHZGoCTvosVwg04Qt$tzY6+8({{{|072ZO<%Bc%qD z6}s*>16^tLo=-l9%fq$Ay$6L_J1E^dh>SX^*XLKLbez%g(ZjGsV0+iedDU7Bw&9Z! zqoh=hIV55Rvvt?$%F!2G9xAeLJB$|FQ6dRr9x42!N8Bj{GC8_hZ?L6HD4NT|pjfV4 z)f#Ck&)Y=*&p%o^tiuuCzyH96mwx^l6j+KAam(g=!K6ei;rkY}Y;2`S>Mx&)`~?;a R*6#oS002ovPDHLkV1iG*OS%96 literal 0 HcmV?d00001 diff --git a/docs/en-US/images/set-default-nic.png b/docs/en-US/images/set-default-nic.png new file mode 100644 index 0000000000000000000000000000000000000000..f329aef4a25923f117e8e1c1338e9e5a53bdbfd5 GIT binary patch literal 1012 zcmVX0ssI2-)+0b00001b5ch_0Itp) z=>Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D1BppQK~zXfwO0E} zQ*ji(uf49@(rHfexhc9W#ZWAWFuWN?Ap}uT&@cUAK}AuRTK>|cGSq%D(=^SgNxs_L z-0W`czII=o-RY|BIwRKMaCiCcoX>fDKKE|ub}*zU%JRzE;!?n7KW4Yvks?`iH?p;{ zjzWRynRx|4T`m_%l0^bf!vurh7Uw=jOGJf3Dx3%J+gvDvJv zfdHh8y?He`{`T>shtNSj0`Q98x^ve+V5G$a`^xdPwbkLFfxXz?@yg1k#-<*Ms?n?( zy!u3g+r98<-sN_SsnmCxRutLoZu}h~`6ChC-OUh?o*;ik?gBw2>+gBVd12cJEy ztFLc&o|>2#cRHQj=ev^(mjjXk#nR}9JYNKg0WdF!a8iY({is0u6xNLD0S5+yO;WmV+`PDlxSN)W^p1h5=CFz}?driL&QfZp8F z+;^!DV06z7>Jnnx1}7(=?6~v$G#h`h2}qPm*B{Nz7&;ScYI-&(NOzD!dZ`Ed>J0 zt*x!6ySj!3hheRUe<-bT;JG$dPlzA(-RzQ zBR5#v(Y}1mX7lY^H?LmpZ)x$+@dRYqtkxsZApjkEF^b_xxuY~c+VA(%aoS3fJjWZ1 zMzhHzf-)otMNwIiR9U%p{YHTr;qcCvl@)aGg&)UJ-2zPVM-q5s7|{RzB-+B@0uO=J zZYwP<^orasFf{TKMUjefM}99RqY)=?=vSvr6#;GYf^g&n7)e?LA*CB9q*5%)F$}BY zEL#{o3y3u~)NgGEVHJPF*gwQzWQpb6*{+4frC?}>Each VM has just one default network. The virtual router's DHCP reply will set the guest's default gateway as that for the default network. Multiple non-default networks may be added to a guest in addition to the single, required default network. The administrator can control which networks are available as the default network. Additional networks can either be available to all accounts or be assigned to a specific account. Networks that are available to all accounts are zone-wide. Any user with access to the zone can create a VM with access to that network. These zone-wide networks provide little or no isolation between guests.Networks that are assigned to a specific account provide strong isolation. +