You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by sa...@apache.org on 2015/01/07 11:17:22 UTC

[01/14] git commit: updated refs/heads/vmware-disk-controllers to 85bd96c

Repository: cloudstack
Updated Branches:
  refs/heads/vmware-disk-controllers e8a54f471 -> 85bd96c6b


CID-1114613 dead code removed


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/682c3af7
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/682c3af7
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/682c3af7

Branch: refs/heads/vmware-disk-controllers
Commit: 682c3af710ef002d49153f6e8b9db273378ab78d
Parents: e8a54f4
Author: Daan Hoogland <da...@onecht.net>
Authored: Tue Jan 6 16:38:41 2015 +0100
Committer: Daan Hoogland <da...@onecht.net>
Committed: Tue Jan 6 16:38:41 2015 +0100

----------------------------------------------------------------------
 .../src/com/cloud/deploy/ImplicitDedicationPlanner.java            | 2 --
 1 file changed, 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/682c3af7/plugins/deployment-planners/implicit-dedication/src/com/cloud/deploy/ImplicitDedicationPlanner.java
----------------------------------------------------------------------
diff --git a/plugins/deployment-planners/implicit-dedication/src/com/cloud/deploy/ImplicitDedicationPlanner.java b/plugins/deployment-planners/implicit-dedication/src/com/cloud/deploy/ImplicitDedicationPlanner.java
index bc3ff0a..9500cac 100644
--- a/plugins/deployment-planners/implicit-dedication/src/com/cloud/deploy/ImplicitDedicationPlanner.java
+++ b/plugins/deployment-planners/implicit-dedication/src/com/cloud/deploy/ImplicitDedicationPlanner.java
@@ -308,8 +308,6 @@ public class ImplicitDedicationPlanner extends FirstFitPlanner implements Deploy
                 // But the host where system vms are running is marked as shared and still be part of empty Hosts.
                 // The scenario will fail where actual Empty hosts and uservms not running host.
                 return PlannerResourceUsage.Dedicated;
-            } else if (!preferred) {
-                return PlannerResourceUsage.Dedicated;
             } else {
                 if (!allOtherHosts.isEmpty() && (hostsToAvoid == null || !hostsToAvoid.containsAll(allOtherHosts))) {
                     return PlannerResourceUsage.Shared;


[03/14] git commit: updated refs/heads/vmware-disk-controllers to 85bd96c

Posted by sa...@apache.org.
CLOUDSTACK-5485. Cannot process more than 5 concurrent snapshots.
Number of threads on SSVM agent for connection with MS (Agent->NioClient) should be configurable using global config 'workers'.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/bc235ed5
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/bc235ed5
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/bc235ed5

Branch: refs/heads/vmware-disk-controllers
Commit: bc235ed5eb0f88c3c62542a3e06bdc28c7b49eac
Parents: 3cba1c4
Author: Likitha Shetty <li...@citrix.com>
Authored: Tue Jan 6 15:33:47 2015 +0530
Committer: Likitha Shetty <li...@citrix.com>
Committed: Wed Jan 7 09:41:24 2015 +0530

----------------------------------------------------------------------
 agent/src/com/cloud/agent/AgentShell.java                         | 3 +++
 .../cloudstack/secondarystorage/SecondaryStorageManagerImpl.java  | 2 ++
 2 files changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bc235ed5/agent/src/com/cloud/agent/AgentShell.java
----------------------------------------------------------------------
diff --git a/agent/src/com/cloud/agent/AgentShell.java b/agent/src/com/cloud/agent/AgentShell.java
index 34e73ed..7f83476 100644
--- a/agent/src/com/cloud/agent/AgentShell.java
+++ b/agent/src/com/cloud/agent/AgentShell.java
@@ -229,6 +229,9 @@ public class AgentShell implements IAgentShell, Daemon {
         }
 
         _workers = NumberUtils.toInt(workers, 5);
+        if (_workers <= 0) {
+            _workers = 5;
+        }
 
         if (host == null) {
             host = getProperty(null, "host");

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bc235ed5/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java
----------------------------------------------------------------------
diff --git a/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java b/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java
index ccf3dcd..9883932 100644
--- a/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java
+++ b/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java
@@ -1052,6 +1052,8 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
 
         buf.append(" guid=").append(profile.getVirtualMachine().getHostName());
 
+        buf.append(" workers=").append(_configDao.getValue("workers"));
+
         if (_configDao.isPremium()) {
             s_logger.debug("VmWare hypervisor configured, telling the ssvm to load the PremiumSecondaryStorageResource");
             buf.append(" resource=com.cloud.storage.resource.PremiumSecondaryStorageResource");


[04/14] git commit: updated refs/heads/vmware-disk-controllers to 85bd96c

Posted by sa...@apache.org.
Trigger user stats aggregation job at midnight in usage aggregation timezone


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/4ac96d63
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/4ac96d63
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/4ac96d63

Branch: refs/heads/vmware-disk-controllers
Commit: 4ac96d637c9efe0db50dd707dd161426aeb54a13
Parents: bc235ed
Author: Kishan Kavala <ki...@apache.org>
Authored: Thu Nov 20 17:08:17 2014 +0530
Committer: Kishan Kavala <ki...@apache.org>
Committed: Wed Jan 7 11:17:24 2015 +0530

----------------------------------------------------------------------
 .../VirtualNetworkApplianceManagerImpl.java     | 25 +++++++++++++-------
 1 file changed, 17 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4ac96d63/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
index c505755..c9590fe 100644
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -651,34 +651,36 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine> {
             s_logger.debug("router.stats.interval - " + _routerStatsInterval + " so not scheduling the router stats thread");
         }
 
-        // Schedule Network stats update task
+        //Schedule Network stats update task
+        //Network stats aggregation should align with aggregation range
+        //For daily aggregation, update stats at the end of the day
+        //For hourly aggregation, update stats at the end of the hour
         final TimeZone usageTimezone = TimeZone.getTimeZone(_usageTimeZone);
         final Calendar cal = Calendar.getInstance(usageTimezone);
         cal.setTime(new Date());
-        long endDate = 0;
+        //aggDate is the time in millis when the aggregation should happen
+        long aggDate = 0;
         final int HOURLY_TIME = 60;
         final int DAILY_TIME = 60 * 24;
         if (_usageAggregationRange == DAILY_TIME) {
-            cal.roll(Calendar.DAY_OF_YEAR, false);
             cal.set(Calendar.HOUR_OF_DAY, 0);
             cal.set(Calendar.MINUTE, 0);
             cal.set(Calendar.SECOND, 0);
             cal.set(Calendar.MILLISECOND, 0);
             cal.roll(Calendar.DAY_OF_YEAR, true);
             cal.add(Calendar.MILLISECOND, -1);
-            endDate = cal.getTime().getTime();
+            aggDate = cal.getTime().getTime();
             _dailyOrHourly = true;
         } else if (_usageAggregationRange == HOURLY_TIME) {
-            cal.roll(Calendar.HOUR_OF_DAY, false);
             cal.set(Calendar.MINUTE, 0);
             cal.set(Calendar.SECOND, 0);
             cal.set(Calendar.MILLISECOND, 0);
             cal.roll(Calendar.HOUR_OF_DAY, true);
             cal.add(Calendar.MILLISECOND, -1);
-            endDate = cal.getTime().getTime();
+            aggDate = cal.getTime().getTime();
             _dailyOrHourly = true;
         } else {
-            endDate = cal.getTime().getTime();
+            aggDate = cal.getTime().getTime();
             _dailyOrHourly = false;
         }
 
@@ -687,7 +689,14 @@ Configurable, StateListener<State, VirtualMachine.Event, VirtualMachine> {
             _usageAggregationRange = UsageUtils.USAGE_AGGREGATION_RANGE_MIN;
         }
 
-        _networkStatsUpdateExecutor.scheduleAtFixedRate(new NetworkStatsUpdateTask(), endDate - System.currentTimeMillis(), _usageAggregationRange * 60 * 1000,
+        // We cannot schedule a job at specific time. Provide initial delay instead, from current time, so that the job runs at desired time
+        long initialDelay = aggDate - System.currentTimeMillis();
+
+        if( initialDelay < 0){
+            s_logger.warn("Initial delay for network usage stats update task is incorrect. Stats update task will run immediately");
+        }
+
+        _networkStatsUpdateExecutor.scheduleAtFixedRate(new NetworkStatsUpdateTask(), initialDelay, (_usageAggregationRange * 60 * 1000),
                 TimeUnit.MILLISECONDS);
 
         if (_routerCheckInterval > 0) {


[05/14] git commit: updated refs/heads/vmware-disk-controllers to 85bd96c

Posted by sa...@apache.org.
Skip older records which generate negative duration usage


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/84c25f70
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/84c25f70
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/84c25f70

Branch: refs/heads/vmware-disk-controllers
Commit: 84c25f7025ca0eb22c8229d9e9cb7e987cffffbe
Parents: 4ac96d6
Author: Kishan Kavala <ki...@apache.org>
Authored: Thu Nov 20 17:34:44 2014 +0530
Committer: Kishan Kavala <ki...@apache.org>
Committed: Wed Jan 7 11:49:50 2015 +0530

----------------------------------------------------------------------
 usage/src/com/cloud/usage/parser/IPAddressUsageParser.java      | 5 +++++
 usage/src/com/cloud/usage/parser/LoadBalancerUsageParser.java   | 5 +++++
 .../src/com/cloud/usage/parser/NetworkOfferingUsageParser.java  | 5 +++++
 usage/src/com/cloud/usage/parser/PortForwardingUsageParser.java | 5 +++++
 usage/src/com/cloud/usage/parser/SecurityGroupUsageParser.java  | 5 +++++
 usage/src/com/cloud/usage/parser/StorageUsageParser.java        | 5 +++++
 usage/src/com/cloud/usage/parser/VMInstanceUsageParser.java     | 5 +++++
 usage/src/com/cloud/usage/parser/VPNUserUsageParser.java        | 5 +++++
 usage/src/com/cloud/usage/parser/VolumeUsageParser.java         | 5 +++++
 9 files changed, 45 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/84c25f70/usage/src/com/cloud/usage/parser/IPAddressUsageParser.java
----------------------------------------------------------------------
diff --git a/usage/src/com/cloud/usage/parser/IPAddressUsageParser.java b/usage/src/com/cloud/usage/parser/IPAddressUsageParser.java
index adeff01..feee16b 100644
--- a/usage/src/com/cloud/usage/parser/IPAddressUsageParser.java
+++ b/usage/src/com/cloud/usage/parser/IPAddressUsageParser.java
@@ -101,6 +101,11 @@ public class IPAddressUsageParser {
                 IpAssignDate = startDate;
             }
 
+            if (IpAssignDate.after(endDate)) {
+                //Ignore records created after endDate
+                continue;
+            }
+
             long currentDuration = (IpReleaseDeleteDate.getTime() - IpAssignDate.getTime()) + 1; // make sure this is an inclusive check for milliseconds (i.e. use n - m + 1 to find total number of millis to charge)
 
             updateIpUsageData(usageMap, key, usageIp.getId(), currentDuration);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/84c25f70/usage/src/com/cloud/usage/parser/LoadBalancerUsageParser.java
----------------------------------------------------------------------
diff --git a/usage/src/com/cloud/usage/parser/LoadBalancerUsageParser.java b/usage/src/com/cloud/usage/parser/LoadBalancerUsageParser.java
index 1b813b7..31ff97d 100644
--- a/usage/src/com/cloud/usage/parser/LoadBalancerUsageParser.java
+++ b/usage/src/com/cloud/usage/parser/LoadBalancerUsageParser.java
@@ -98,6 +98,11 @@ public class LoadBalancerUsageParser {
                 lbCreateDate = startDate;
             }
 
+            if (lbCreateDate.after(endDate)) {
+                //Ignore records created after endDate
+                continue;
+            }
+
             long currentDuration = (lbDeleteDate.getTime() - lbCreateDate.getTime()) + 1; // make sure this is an inclusive check for milliseconds (i.e. use n - m + 1 to find total number of millis to charge)
 
             updateLBUsageData(usageMap, key, usageLB.getId(), currentDuration);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/84c25f70/usage/src/com/cloud/usage/parser/NetworkOfferingUsageParser.java
----------------------------------------------------------------------
diff --git a/usage/src/com/cloud/usage/parser/NetworkOfferingUsageParser.java b/usage/src/com/cloud/usage/parser/NetworkOfferingUsageParser.java
index 4a5a1d2..e54cd53 100644
--- a/usage/src/com/cloud/usage/parser/NetworkOfferingUsageParser.java
+++ b/usage/src/com/cloud/usage/parser/NetworkOfferingUsageParser.java
@@ -99,6 +99,11 @@ public class NetworkOfferingUsageParser {
                 noCreateDate = startDate;
             }
 
+            if (noCreateDate.after(endDate)) {
+                //Ignore records created after endDate
+                continue;
+            }
+
             long currentDuration = (noDeleteDate.getTime() - noCreateDate.getTime()) + 1; // make sure this is an inclusive check for milliseconds (i.e. use n - m + 1 to find total number of millis to charge)
 
             updateNOUsageData(usageMap, key, usageNO.getVmInstanceId(), currentDuration);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/84c25f70/usage/src/com/cloud/usage/parser/PortForwardingUsageParser.java
----------------------------------------------------------------------
diff --git a/usage/src/com/cloud/usage/parser/PortForwardingUsageParser.java b/usage/src/com/cloud/usage/parser/PortForwardingUsageParser.java
index 37c7751..9abf8a7 100644
--- a/usage/src/com/cloud/usage/parser/PortForwardingUsageParser.java
+++ b/usage/src/com/cloud/usage/parser/PortForwardingUsageParser.java
@@ -98,6 +98,11 @@ public class PortForwardingUsageParser {
                 pfCreateDate = startDate;
             }
 
+            if (pfCreateDate.after(endDate)) {
+                //Ignore records created after endDate
+                continue;
+            }
+
             long currentDuration = (pfDeleteDate.getTime() - pfCreateDate.getTime()) + 1; // make sure this is an inclusive check for milliseconds (i.e. use n - m + 1 to find total number of millis to charge)
 
             updatePFUsageData(usageMap, key, usagePF.getId(), currentDuration);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/84c25f70/usage/src/com/cloud/usage/parser/SecurityGroupUsageParser.java
----------------------------------------------------------------------
diff --git a/usage/src/com/cloud/usage/parser/SecurityGroupUsageParser.java b/usage/src/com/cloud/usage/parser/SecurityGroupUsageParser.java
index ea86d49..99d764d 100644
--- a/usage/src/com/cloud/usage/parser/SecurityGroupUsageParser.java
+++ b/usage/src/com/cloud/usage/parser/SecurityGroupUsageParser.java
@@ -99,6 +99,11 @@ public class SecurityGroupUsageParser {
                 sgCreateDate = startDate;
             }
 
+            if (sgCreateDate.after(endDate)) {
+                //Ignore records created after endDate
+                continue;
+            }
+
             long currentDuration = (sgDeleteDate.getTime() - sgCreateDate.getTime()) + 1; // make sure this is an inclusive check for milliseconds (i.e. use n - m + 1 to find total number of millis to charge)
 
             updateSGUsageData(usageMap, key, usageSG.getVmInstanceId(), currentDuration);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/84c25f70/usage/src/com/cloud/usage/parser/StorageUsageParser.java
----------------------------------------------------------------------
diff --git a/usage/src/com/cloud/usage/parser/StorageUsageParser.java b/usage/src/com/cloud/usage/parser/StorageUsageParser.java
index f1091a1..fccd00c 100644
--- a/usage/src/com/cloud/usage/parser/StorageUsageParser.java
+++ b/usage/src/com/cloud/usage/parser/StorageUsageParser.java
@@ -107,6 +107,11 @@ public class StorageUsageParser {
                 storageCreateDate = startDate;
             }
 
+            if (storageCreateDate.after(endDate)) {
+                //Ignore records created after endDate
+                continue;
+            }
+
             long currentDuration = (storageDeleteDate.getTime() - storageCreateDate.getTime()) + 1; // make sure this is an inclusive check for milliseconds (i.e. use n - m + 1 to find total number of millis to charge)
 
             updateStorageUsageData(usageMap, key, usageStorage.getId(), currentDuration);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/84c25f70/usage/src/com/cloud/usage/parser/VMInstanceUsageParser.java
----------------------------------------------------------------------
diff --git a/usage/src/com/cloud/usage/parser/VMInstanceUsageParser.java b/usage/src/com/cloud/usage/parser/VMInstanceUsageParser.java
index 684412f..8c30e99 100644
--- a/usage/src/com/cloud/usage/parser/VMInstanceUsageParser.java
+++ b/usage/src/com/cloud/usage/parser/VMInstanceUsageParser.java
@@ -104,6 +104,11 @@ public class VMInstanceUsageParser {
                 vmStartDate = startDate;
             }
 
+            if (vmStartDate.after(endDate)) {
+                //Ignore records created after endDate
+                continue;
+            }
+
             long currentDuration = (vmEndDate.getTime() - vmStartDate.getTime()) + 1; // make sure this is an inclusive check for milliseconds (i.e. use n - m + 1 to find total number of millis to charge)
 
             switch (usageType) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/84c25f70/usage/src/com/cloud/usage/parser/VPNUserUsageParser.java
----------------------------------------------------------------------
diff --git a/usage/src/com/cloud/usage/parser/VPNUserUsageParser.java b/usage/src/com/cloud/usage/parser/VPNUserUsageParser.java
index 619c861..24997ec 100644
--- a/usage/src/com/cloud/usage/parser/VPNUserUsageParser.java
+++ b/usage/src/com/cloud/usage/parser/VPNUserUsageParser.java
@@ -94,6 +94,11 @@ public class VPNUserUsageParser {
                 vuCreateDate = startDate;
             }
 
+            if (vuCreateDate.after(endDate)) {
+                //Ignore records created after endDate
+                continue;
+            }
+
             long currentDuration = (vuDeleteDate.getTime() - vuCreateDate.getTime()) + 1; // make sure this is an inclusive check for milliseconds (i.e. use n - m + 1 to find total number of millis to charge)
 
             updateVUUsageData(usageMap, key, usageVU.getUserId(), currentDuration);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/84c25f70/usage/src/com/cloud/usage/parser/VolumeUsageParser.java
----------------------------------------------------------------------
diff --git a/usage/src/com/cloud/usage/parser/VolumeUsageParser.java b/usage/src/com/cloud/usage/parser/VolumeUsageParser.java
index 81ebdc0..8e8c89c 100644
--- a/usage/src/com/cloud/usage/parser/VolumeUsageParser.java
+++ b/usage/src/com/cloud/usage/parser/VolumeUsageParser.java
@@ -103,6 +103,11 @@ public class VolumeUsageParser {
                 volCreateDate = startDate;
             }
 
+            if (volCreateDate.after(endDate)) {
+                //Ignore records created after endDate
+                continue;
+            }
+
             long currentDuration = (volDeleteDate.getTime() - volCreateDate.getTime()) + 1; // make sure this is an inclusive check for milliseconds (i.e. use n - m + 1 to find total number of millis to charge)
 
             updateVolUsageData(usageMap, key, usageVol.getId(), currentDuration);


[06/14] git commit: updated refs/heads/vmware-disk-controllers to 85bd96c

Posted by sa...@apache.org.
Network offering usage event should be logged for UserVms only


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/42cecbb0
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/42cecbb0
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/42cecbb0

Branch: refs/heads/vmware-disk-controllers
Commit: 42cecbb000416978a7edcef5d8c664dac4b52277
Parents: 84c25f7
Author: Kishan Kavala <ki...@apache.org>
Authored: Fri Nov 21 12:10:50 2014 +0530
Committer: Kishan Kavala <ki...@apache.org>
Committed: Wed Jan 7 12:29:11 2015 +0530

----------------------------------------------------------------------
 .../src/com/cloud/vm/VirtualMachineManagerImpl.java           | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/42cecbb0/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
index e9cd79c..8accebe 100644
--- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -2925,8 +2925,11 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
                     s_logger.debug("Nic is plugged successfully for vm " + vm + " in network " + network + ". Vm  is a part of network now");
                     long isDefault = (nic.isDefaultNic()) ? 1 : 0;
                     // insert nic's Id into DB as resource_name
-                    UsageEventUtils.publishUsageEvent(EventTypes.EVENT_NETWORK_OFFERING_ASSIGN, vmVO.getAccountId(), vmVO.getDataCenterId(), vmVO.getId(),
-                            Long.toString(nic.getId()), network.getNetworkOfferingId(), null, isDefault, VirtualMachine.class.getName(), vmVO.getUuid(), vm.isDisplay());
+                    if(VirtualMachine.Type.User.equals(vmVO.getType())) {
+                        //Log usage event for user Vms only
+                        UsageEventUtils.publishUsageEvent(EventTypes.EVENT_NETWORK_OFFERING_ASSIGN, vmVO.getAccountId(), vmVO.getDataCenterId(), vmVO.getId(),
+                                Long.toString(nic.getId()), network.getNetworkOfferingId(), null, isDefault, VirtualMachine.class.getName(), vmVO.getUuid(), vm.isDisplay());
+                    }
                     return nic;
                 } else {
                     s_logger.warn("Failed to plug nic to the vm " + vm + " in network " + network);


[10/14] git commit: updated refs/heads/vmware-disk-controllers to 85bd96c

Posted by sa...@apache.org.
Network Id for direct-network should not be included in usage record response. Direct network stats have network_id = 0. Ignore network with id = 0 in usage record


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/01a325b2
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/01a325b2
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/01a325b2

Branch: refs/heads/vmware-disk-controllers
Commit: 01a325b2bfde3f82faca1361cfab3f66ee78a524
Parents: 30ab4d3
Author: Kishan Kavala <ki...@apache.org>
Authored: Mon Nov 24 11:35:36 2014 +0530
Committer: Kishan Kavala <ki...@apache.org>
Committed: Wed Jan 7 14:17:30 2015 +0530

----------------------------------------------------------------------
 server/src/com/cloud/api/ApiResponseHelper.java | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/01a325b2/server/src/com/cloud/api/ApiResponseHelper.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiResponseHelper.java b/server/src/com/cloud/api/ApiResponseHelper.java
index dd55486..4726c24 100644
--- a/server/src/com/cloud/api/ApiResponseHelper.java
+++ b/server/src/com/cloud/api/ApiResponseHelper.java
@@ -3169,9 +3169,11 @@ public class ApiResponseHelper implements ResponseGenerator {
                 }
             }
             //Network ID
-            NetworkVO network = _entityMgr.findByIdIncludingRemoved(NetworkVO.class, usageRecord.getNetworkId().toString());
-            if (network != null) {
-                usageRecResponse.setNetworkId(network.getUuid());
+            if((usageRecord.getNetworkId() != null) && (usageRecord.getNetworkId() != 0)) {
+                NetworkVO network = _entityMgr.findByIdIncludingRemoved(NetworkVO.class, usageRecord.getNetworkId().toString());
+                if (network != null) {
+                    usageRecResponse.setNetworkId(network.getUuid());
+                }
             }
 
         } else if (usageRecord.getUsageType() == UsageTypes.VM_DISK_IO_READ || usageRecord.getUsageType() == UsageTypes.VM_DISK_IO_WRITE


[14/14] git commit: updated refs/heads/vmware-disk-controllers to 85bd96c

Posted by sa...@apache.org.
While deploying Vm with DataDisk in LXC, if the rbd image mapping on the host fails, deploy Vm should fail


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/85bd96c6
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/85bd96c6
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/85bd96c6

Branch: refs/heads/vmware-disk-controllers
Commit: 85bd96c6b28922702dca8014edf9b922a7462eee
Parents: f767adf
Author: Kishan Kavala <ki...@apache.org>
Authored: Mon Nov 24 16:03:23 2014 +0530
Committer: Kishan Kavala <ki...@apache.org>
Committed: Wed Jan 7 15:09:57 2015 +0530

----------------------------------------------------------------------
 .../cloud/hypervisor/kvm/resource/LibvirtComputingResource.java    | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/85bd96c6/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
index c80ccc3..9ae7a17 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
@@ -4030,6 +4030,8 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
                             diskdef.defBlockBasedDisk(device, devId, DiskDef.diskBus.VIRTIO);
                             diskdef.setQemuDriver(false);
                             vm.getDevices().addDevice(diskdef);
+                        } else {
+                            throw new InternalErrorException("Error while mapping RBD device on host");
                         }
                     }
                 }


[09/14] git commit: updated refs/heads/vmware-disk-controllers to 85bd96c

Posted by sa...@apache.org.
For Vm snapshot delete event, check for null size and set it as zero


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/30ab4d3d
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/30ab4d3d
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/30ab4d3d

Branch: refs/heads/vmware-disk-controllers
Commit: 30ab4d3d6623af3c6075a9dbee4f474932008bf5
Parents: 438f90a
Author: Kishan Kavala <ki...@apache.org>
Authored: Mon Nov 24 11:28:56 2014 +0530
Committer: Kishan Kavala <ki...@apache.org>
Committed: Wed Jan 7 14:15:59 2015 +0530

----------------------------------------------------------------------
 usage/src/com/cloud/usage/UsageManagerImpl.java | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/30ab4d3d/usage/src/com/cloud/usage/UsageManagerImpl.java
----------------------------------------------------------------------
diff --git a/usage/src/com/cloud/usage/UsageManagerImpl.java b/usage/src/com/cloud/usage/UsageManagerImpl.java
index 8429c60..5453be9 100644
--- a/usage/src/com/cloud/usage/UsageManagerImpl.java
+++ b/usage/src/com/cloud/usage/UsageManagerImpl.java
@@ -1726,7 +1726,8 @@ public class UsageManagerImpl extends ManagerBase implements UsageManager, Runna
         Long offeringId = event.getOfferingId();
         Long zoneId = event.getZoneId();
         Long accountId = event.getAccountId();
-        long size = event.getSize();
+        //Size could be null for VM snapshot delete events
+        long size = (event.getSize() == null) ? 0 : event.getSize();
         Date created = event.getCreateDate();
         Account acct = _accountDao.findByIdIncludingRemoved(event.getAccountId());
         Long domainId = acct.getDomainId();


[08/14] git commit: updated refs/heads/vmware-disk-controllers to 85bd96c

Posted by sa...@apache.org.
Close transaction while fetching recent events


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/438f90a2
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/438f90a2
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/438f90a2

Branch: refs/heads/vmware-disk-controllers
Commit: 438f90a2627c4a7408f02fc4b59be7eb566443be
Parents: 9eb8d53
Author: Kishan Kavala <ki...@apache.org>
Authored: Fri Nov 21 15:14:26 2014 +0530
Committer: Kishan Kavala <ki...@apache.org>
Committed: Wed Jan 7 14:14:44 2015 +0530

----------------------------------------------------------------------
 engine/schema/src/com/cloud/event/dao/UsageEventDaoImpl.java | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/438f90a2/engine/schema/src/com/cloud/event/dao/UsageEventDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/event/dao/UsageEventDaoImpl.java b/engine/schema/src/com/cloud/event/dao/UsageEventDaoImpl.java
index 4e35bf5..1739254 100644
--- a/engine/schema/src/com/cloud/event/dao/UsageEventDaoImpl.java
+++ b/engine/schema/src/com/cloud/event/dao/UsageEventDaoImpl.java
@@ -124,6 +124,8 @@ public class UsageEventDaoImpl extends GenericDaoBase<UsageEventVO, Long> implem
             txn.rollback();
             s_logger.error("error copying events from cloud db to usage db", ex);
             throw new CloudRuntimeException(ex.getMessage());
+        } finally {
+            txn.close();
         }
 
         // Copy event details from cloud db to usage db
@@ -150,6 +152,8 @@ public class UsageEventDaoImpl extends GenericDaoBase<UsageEventVO, Long> implem
             txn.rollback();
             s_logger.error("error copying event details from cloud db to usage db", ex);
             throw new CloudRuntimeException(ex.getMessage());
+        } finally {
+            txn.close();
         }
 
         return findRecentEvents(endDate);


[13/14] git commit: updated refs/heads/vmware-disk-controllers to 85bd96c

Posted by sa...@apache.org.
Bug-Id: CLOUDSTACK-3439: Include dynamically created nics in Prepare for migration command in KVM


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/f767adfe
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f767adfe
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f767adfe

Branch: refs/heads/vmware-disk-controllers
Commit: f767adfe71dda82c45cf376ba71518e2ad84cc98
Parents: a520309
Author: Kishan Kavala <ki...@apache.org>
Authored: Wed Jan 7 14:52:42 2015 +0530
Committer: Kishan Kavala <ki...@apache.org>
Committed: Wed Jan 7 14:52:42 2015 +0530

----------------------------------------------------------------------
 api/src/com/cloud/vm/NicProfile.java            |  8 ++
 .../service/NetworkOrchestrationService.java    |  2 +
 .../com/cloud/vm/VirtualMachineManagerImpl.java |  1 +
 .../orchestration/NetworkOrchestrator.java      | 86 ++++++++++++++++++++
 .../src/com/cloud/network/dao/IPAddressDao.java |  1 +
 .../com/cloud/network/dao/IPAddressDaoImpl.java |  7 ++
 .../cloud/hypervisor/HypervisorGuruBase.java    |  4 +
 .../com/cloud/vpc/MockNetworkManagerImpl.java   |  5 ++
 8 files changed, 114 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f767adfe/api/src/com/cloud/vm/NicProfile.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/vm/NicProfile.java b/api/src/com/cloud/vm/NicProfile.java
index 4dd7f68..e9e9dc5 100644
--- a/api/src/com/cloud/vm/NicProfile.java
+++ b/api/src/com/cloud/vm/NicProfile.java
@@ -70,6 +70,10 @@ public class NicProfile implements InternalIdentity, Serializable {
         return name;
     }
 
+    public void setName(String name) {
+        this.name = name;
+    }
+
     public String getDns2() {
         return dns2;
     }
@@ -371,4 +375,8 @@ public class NicProfile implements InternalIdentity, Serializable {
         this.ip6Dns2 = ip6Dns2;
     }
 
+    public void setNetworId(long networkId){
+        this.networkId = networkId;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f767adfe/engine/api/src/org/apache/cloudstack/engine/orchestration/service/NetworkOrchestrationService.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/engine/orchestration/service/NetworkOrchestrationService.java b/engine/api/src/org/apache/cloudstack/engine/orchestration/service/NetworkOrchestrationService.java
index b2108ac..5412ee4 100644
--- a/engine/api/src/org/apache/cloudstack/engine/orchestration/service/NetworkOrchestrationService.java
+++ b/engine/api/src/org/apache/cloudstack/engine/orchestration/service/NetworkOrchestrationService.java
@@ -217,4 +217,6 @@ public interface NetworkOrchestrationService {
     void removeDhcpServiceInSubnet(Nic nic);
 
     boolean resourceCountNeedsUpdate(NetworkOffering ntwkOff, ACLType aclType);
+
+    void prepareAllNicsForMigration(VirtualMachineProfile vm, DeployDestination dest);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f767adfe/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
index 8accebe..ca60529 100644
--- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -3284,6 +3284,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
 
         VirtualMachineProfile profile = new VirtualMachineProfileImpl(vm);
         _networkMgr.prepareNicForMigration(profile, dest);
+
         volumeMgr.prepareForMigration(profile, dest);
 
         VirtualMachineTO to = toVmTO(profile);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f767adfe/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
index 4e42750..9feaa80 100644
--- a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
@@ -37,6 +37,7 @@ import javax.ejb.Local;
 import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
+import com.cloud.network.Networks;
 import org.apache.log4j.Logger;
 import org.apache.cloudstack.acl.ControlledEntity.ACLType;
 import org.apache.cloudstack.context.CallContext;
@@ -1376,6 +1377,11 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
 
     @Override
     public void prepareNicForMigration(VirtualMachineProfile vm, DeployDestination dest) {
+        if(vm.getType().equals(VirtualMachine.Type.DomainRouter) && vm.getHypervisorType().equals(HypervisorType.KVM)){
+            //Include nics hot plugged and not stored in DB
+            prepareAllNicsForMigration(vm, dest);
+            return;
+        }
         List<NicVO> nics = _nicDao.listByVmId(vm.getId());
         ReservationContext context = new ReservationContextImpl(UUID.randomUUID().toString(), null, null);
         for (NicVO nic : nics) {
@@ -1409,6 +1415,86 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
         }
     }
 
+    /*
+    Prepare All Nics for migration including the nics dynamically created and not stored in DB
+    This is a temporary workaround work KVM migration
+    Once clean fix is added by stored dynamically nics is DB, this workaround won't be needed
+     */
+    @Override
+    public void prepareAllNicsForMigration(VirtualMachineProfile vm, DeployDestination dest) {
+        List<NicVO> nics = _nicDao.listByVmId(vm.getId());
+        ReservationContext context = new ReservationContextImpl(UUID.randomUUID().toString(), null, null);
+        Long guestNetworkId = null;
+        for (NicVO nic : nics) {
+            NetworkVO network = _networksDao.findById(nic.getNetworkId());
+            if(network.getTrafficType().equals(TrafficType.Guest) && network.getGuestType().equals(GuestType.Isolated)){
+                guestNetworkId = network.getId();
+            }
+            Integer networkRate = _networkModel.getNetworkRate(network.getId(), vm.getId());
+
+            NetworkGuru guru = AdapterBase.getAdapterByName(networkGurus, network.getGuruName());
+            NicProfile profile = new NicProfile(nic, network, nic.getBroadcastUri(), nic.getIsolationUri(), networkRate,
+                    _networkModel.isSecurityGroupSupportedInNetwork(network), _networkModel.getNetworkTag(vm.getHypervisorType(), network));
+            if(guru instanceof NetworkMigrationResponder){
+                if(!((NetworkMigrationResponder) guru).prepareMigration(profile, network, vm, dest, context)){
+                    s_logger.error("NetworkGuru "+guru+" prepareForMigration failed."); // XXX: Transaction error
+                }
+            }
+            List<Provider> providersToImplement = getNetworkProviders(network.getId());
+            for (NetworkElement element : networkElements) {
+                if (providersToImplement.contains(element.getProvider())) {
+                    if (!_networkModel.isProviderEnabledInPhysicalNetwork(_networkModel.getPhysicalNetworkId(network), element.getProvider().getName())) {
+                        throw new CloudRuntimeException("Service provider " + element.getProvider().getName() + " either doesn't exist or is not enabled in physical network id: " + network.getPhysicalNetworkId());
+                    }
+                    if(element instanceof NetworkMigrationResponder){
+                        if(!((NetworkMigrationResponder) element).prepareMigration(profile, network, vm, dest, context)){
+                            s_logger.error("NetworkElement "+element+" prepareForMigration failed."); // XXX: Transaction error
+                        }
+                    }
+                }
+            }
+            guru.updateNicProfile(profile, network);
+            vm.addNic(profile);
+        }
+
+        List<String> addedURIs = new ArrayList<String>();
+        if(guestNetworkId != null){
+            List<IPAddressVO> publicIps = _ipAddressDao.listByAssociatedNetwork(guestNetworkId, null);
+            for (IPAddressVO userIp : publicIps){
+                PublicIp publicIp = PublicIp.createFromAddrAndVlan(userIp, _vlanDao.findById(userIp.getVlanId()));
+                URI broadcastUri = BroadcastDomainType.Vlan.toUri(publicIp.getVlanTag());
+                long ntwkId = publicIp.getNetworkId();
+                Nic nic = _nicDao.findByNetworkIdInstanceIdAndBroadcastUri(ntwkId, vm.getId(),
+                        broadcastUri.toString());
+                if(nic == null && !addedURIs.contains(broadcastUri.toString())){
+                    //Nic details are not available in DB
+                    //Create nic profile for migration
+                    s_logger.debug("Creating nic profile for migration. BroadcastUri: "+broadcastUri.toString()+" NetworkId: "+ntwkId+" Vm: "+vm.getId());
+                    NetworkVO network = _networksDao.findById(ntwkId);
+                    Integer networkRate = _networkModel.getNetworkRate(network.getId(), vm.getId());
+                    NetworkGuru guru = AdapterBase.getAdapterByName(networkGurus, network.getGuruName());
+                    NicProfile profile = new NicProfile();
+                    profile.setDeviceId(255); //dummyId
+                    profile.setIp4Address(userIp.getAddress().toString());
+                    profile.setNetmask(publicIp.getNetmask());
+                    profile.setGateway(publicIp.getGateway());
+                    profile.setMacAddress(publicIp.getMacAddress());
+                    profile.setBroadcastType(network.getBroadcastDomainType());
+                    profile.setTrafficType(network.getTrafficType());
+                    profile.setBroadcastUri(broadcastUri);
+                    profile.setIsolationUri(Networks.IsolationType.Vlan.toUri(publicIp.getVlanTag()));
+                    profile.setSecurityGroupEnabled(_networkModel.isSecurityGroupSupportedInNetwork(network));
+                    profile.setName(_networkModel.getNetworkTag(vm.getHypervisorType(), network));
+                    profile.setNetworId(network.getId());
+
+                    guru.updateNicProfile(profile, network);
+                    vm.addNic(profile);
+                    addedURIs.add(broadcastUri.toString());
+                }
+            }
+        }
+    }
+
     private NicProfile findNicProfileById(VirtualMachineProfile vm, long id) {
         for (NicProfile nic : vm.getNics()) {
             if (nic.getId() == id) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f767adfe/engine/schema/src/com/cloud/network/dao/IPAddressDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/IPAddressDao.java b/engine/schema/src/com/cloud/network/dao/IPAddressDao.java
index 8d60b57..cb07656 100644
--- a/engine/schema/src/com/cloud/network/dao/IPAddressDao.java
+++ b/engine/schema/src/com/cloud/network/dao/IPAddressDao.java
@@ -84,4 +84,5 @@ public interface IPAddressDao extends GenericDao<IPAddressVO, Long> {
 
     void lockRange(long vlandbId);
 
+    List<IPAddressVO> listByAssociatedVmId(long vmId);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f767adfe/engine/schema/src/com/cloud/network/dao/IPAddressDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/network/dao/IPAddressDaoImpl.java b/engine/schema/src/com/cloud/network/dao/IPAddressDaoImpl.java
index 6f6bfd2..5122876 100644
--- a/engine/schema/src/com/cloud/network/dao/IPAddressDaoImpl.java
+++ b/engine/schema/src/com/cloud/network/dao/IPAddressDaoImpl.java
@@ -431,6 +431,13 @@ public class IPAddressDaoImpl extends GenericDaoBase<IPAddressVO, Long> implemen
     }
 
     @Override
+    public List<IPAddressVO> listByAssociatedVmId(long vmId) {
+        SearchCriteria<IPAddressVO> sc = AllFieldsSearch.create();
+        sc.setParameters("associatedWithVmId", vmId);
+        return listBy(sc);
+    }
+
+    @Override
     public void lockRange(long vlandbId) {
         SearchCriteria<IPAddressVO> sc = AllFieldsSearch.create();
         sc.setParameters("vlan", vlandbId);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f767adfe/server/src/com/cloud/hypervisor/HypervisorGuruBase.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/hypervisor/HypervisorGuruBase.java b/server/src/com/cloud/hypervisor/HypervisorGuruBase.java
index 308c327..0cb9af5 100644
--- a/server/src/com/cloud/hypervisor/HypervisorGuruBase.java
+++ b/server/src/com/cloud/hypervisor/HypervisorGuruBase.java
@@ -18,6 +18,7 @@ package com.cloud.hypervisor;
 
 import java.util.List;
 import java.util.Map;
+import java.util.UUID;
 
 import javax.inject.Inject;
 
@@ -112,6 +113,9 @@ public abstract class HypervisorGuruBase extends AdapterBase implements Hypervis
             to.setNicSecIps(secIps);
         } else {
             s_logger.warn("Unabled to load NicVO for NicProfile " + profile.getId());
+            //Workaround for dynamically created nics
+            //FixMe: uuid and secondary IPs can be made part of nic profile
+            to.setUuid(UUID.randomUUID().toString());
         }
 
         //check whether the this nic has secondary ip addresses set

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f767adfe/server/test/com/cloud/vpc/MockNetworkManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/vpc/MockNetworkManagerImpl.java b/server/test/com/cloud/vpc/MockNetworkManagerImpl.java
index 097019d..e4c97a0 100644
--- a/server/test/com/cloud/vpc/MockNetworkManagerImpl.java
+++ b/server/test/com/cloud/vpc/MockNetworkManagerImpl.java
@@ -839,6 +839,11 @@ public class MockNetworkManagerImpl extends ManagerBase implements NetworkOrches
     }
 
     @Override
+    public void prepareAllNicsForMigration(VirtualMachineProfile vm, DeployDestination dest) {
+        return;
+    }
+
+    @Override
     public void prepareNicForMigration(VirtualMachineProfile vm, DeployDestination dest) {
         // TODO Auto-generated method stub
 


[12/14] git commit: updated refs/heads/vmware-disk-controllers to 85bd96c

Posted by sa...@apache.org.
Bug-Id: CLOUDSTACK-7395: reverted 0560254c04425705530a23a93002daede4b6dc3c partially. Allow multiple networks with LB service


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/a5203091
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/a5203091
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/a5203091

Branch: refs/heads/vmware-disk-controllers
Commit: a5203091902f2be033663358b8d5083b6488b879
Parents: dc17e4e
Author: Kishan Kavala <ki...@apache.org>
Authored: Mon Dec 15 17:18:09 2014 +0530
Committer: Kishan Kavala <ki...@apache.org>
Committed: Wed Jan 7 14:33:31 2015 +0530

----------------------------------------------------------------------
 server/src/com/cloud/network/vpc/VpcManagerImpl.java | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a5203091/server/src/com/cloud/network/vpc/VpcManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/vpc/VpcManagerImpl.java b/server/src/com/cloud/network/vpc/VpcManagerImpl.java
index fbb94c7..6bc75e4 100644
--- a/server/src/com/cloud/network/vpc/VpcManagerImpl.java
+++ b/server/src/com/cloud/network/vpc/VpcManagerImpl.java
@@ -1309,9 +1309,7 @@ public class VpcManagerImpl extends ManagerBase implements VpcManager, VpcProvis
                     continue;
                 } else {
                     NetworkOffering otherOff = _entityMgr.findById(NetworkOffering.class, network.getNetworkOfferingId());
-                    //throw only if networks have different offerings with public lb support
-                    if (_ntwkModel.areServicesSupportedInNetwork(network.getId(), Service.Lb) && otherOff.getPublicLb() &&
-                                   guestNtwkOff.getId() != otherOff.getId()) {
+                    if (_ntwkModel.areServicesSupportedInNetwork(network.getId(), Service.Lb) && otherOff.getPublicLb()) {
                         throw new InvalidParameterValueException("Public LB service is already supported " + "by network " + network + " in VPC " + vpc);
                     }
                 }


[11/14] git commit: updated refs/heads/vmware-disk-controllers to 85bd96c

Posted by sa...@apache.org.
Increased SSL handshake timeout to 30 seconds


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/dc17e4ef
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/dc17e4ef
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/dc17e4ef

Branch: refs/heads/vmware-disk-controllers
Commit: dc17e4ef39e8422a4e86eb0d2976ae3b4e380867
Parents: 01a325b
Author: Kishan Kavala <ki...@cloud.com>
Authored: Wed Apr 16 23:55:26 2014 +0530
Committer: Kishan Kavala <ki...@apache.org>
Committed: Wed Jan 7 14:27:51 2015 +0530

----------------------------------------------------------------------
 utils/src/com/cloud/utils/nio/Link.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dc17e4ef/utils/src/com/cloud/utils/nio/Link.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/nio/Link.java b/utils/src/com/cloud/utils/nio/Link.java
index a15b8a4..0127ec7 100644
--- a/utils/src/com/cloud/utils/nio/Link.java
+++ b/utils/src/com/cloud/utils/nio/Link.java
@@ -465,7 +465,7 @@ public class Link {
         ByteBuffer out_pkgBuf = ByteBuffer.allocate(sslSession.getPacketBufferSize() + 40);
         ByteBuffer out_appBuf = ByteBuffer.allocate(sslSession.getApplicationBufferSize() + 40);
         int count;
-        ch.socket().setSoTimeout(10 * 1000);
+        ch.socket().setSoTimeout(30 * 1000);
         InputStream inStream = ch.socket().getInputStream();
         // Use readCh to make sure the timeout on reading is working
         ReadableByteChannel readCh = Channels.newChannel(inStream);


[02/14] git commit: updated refs/heads/vmware-disk-controllers to 85bd96c

Posted by sa...@apache.org.
CID-1114614 dead code removed


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/3cba1c41
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/3cba1c41
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/3cba1c41

Branch: refs/heads/vmware-disk-controllers
Commit: 3cba1c41fbcbae6612940714ad9e2e2a7ce4d7bf
Parents: 682c3af
Author: Daan Hoogland <da...@onecht.net>
Authored: Tue Jan 6 16:47:32 2015 +0100
Committer: Daan Hoogland <da...@onecht.net>
Committed: Tue Jan 6 16:47:32 2015 +0100

----------------------------------------------------------------------
 server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java | 3 ---
 1 file changed, 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3cba1c41/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java b/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
index f9a1586..3c0188d 100644
--- a/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
+++ b/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
@@ -266,9 +266,6 @@ public class RemoteAccessVpnManagerImpl extends ManagerBase implements RemoteAcc
         Integer pskLength = _pskLength;
         if (pskLength != null && (pskLength < 8 || pskLength > 256)) {
             throw new ConfigurationException("Remote Access VPN: IPSec preshared key length should be between 8 and 256");
-        } else if (pskLength == null) {
-            s_logger.warn("Remote Access VPN configuration missing Preshared Key Length -- ignoring");
-            return;
         }
 
         String[] range = ipRange.split("-");


[07/14] git commit: updated refs/heads/vmware-disk-controllers to 85bd96c

Posted by sa...@apache.org.
For volumes created from template, do not log offering ID in VOLUME.CREATE in usage_event. Moved offering type to DiskOffering interface


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/9eb8d538
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/9eb8d538
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/9eb8d538

Branch: refs/heads/vmware-disk-controllers
Commit: 9eb8d538dd196f27e5194dd2e657afffdb9347eb
Parents: 42cecbb
Author: Kishan Kavala <ki...@apache.org>
Authored: Fri Nov 21 14:33:39 2014 +0530
Committer: Kishan Kavala <ki...@apache.org>
Committed: Wed Jan 7 12:31:41 2015 +0530

----------------------------------------------------------------------
 api/src/com/cloud/offering/DiskOffering.java                   | 6 ++++++
 .../cloudstack/engine/orchestration/VolumeOrchestrator.java    | 4 +++-
 engine/schema/src/com/cloud/storage/DiskOfferingVO.java        | 3 ---
 .../schema/src/com/cloud/storage/dao/DiskOfferingDaoImpl.java  | 2 +-
 server/src/com/cloud/api/query/vo/DiskOfferingJoinVO.java      | 2 +-
 5 files changed, 11 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9eb8d538/api/src/com/cloud/offering/DiskOffering.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/offering/DiskOffering.java b/api/src/com/cloud/offering/DiskOffering.java
index 928f713..c2069c2 100644
--- a/api/src/com/cloud/offering/DiskOffering.java
+++ b/api/src/com/cloud/offering/DiskOffering.java
@@ -34,6 +34,10 @@ public interface DiskOffering extends InfrastructureEntity, Identity, InternalId
         Inactive, Active,
     }
 
+    public enum Type {
+        Disk, Service
+    };
+
     State getState();
 
     public enum DiskCacheMode {
@@ -114,4 +118,6 @@ public interface DiskOffering extends InfrastructureEntity, Identity, InternalId
     DiskCacheMode getCacheMode();
 
     void setCacheMode(DiskCacheMode cacheMode);
+
+    Type getType();
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9eb8d538/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
index 1b87ccf..396a49c 100644
--- a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
@@ -712,7 +712,9 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati
 
             Long offeringId = null;
 
-            offeringId = offering.getId();
+            if (offering.getType() == DiskOffering.Type.Disk) {
+                offeringId = offering.getId();
+            }
 
             UsageEventUtils.publishUsageEvent(EventTypes.EVENT_VOLUME_CREATE, vol.getAccountId(), vol.getDataCenterId(), vol.getId(), vol.getName(), offeringId, vol.getTemplateId(), size,
                     Volume.class.getName(), vol.getUuid(), vol.isDisplayVolume());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9eb8d538/engine/schema/src/com/cloud/storage/DiskOfferingVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/DiskOfferingVO.java b/engine/schema/src/com/cloud/storage/DiskOfferingVO.java
index 74f65ab..5de7f98 100644
--- a/engine/schema/src/com/cloud/storage/DiskOfferingVO.java
+++ b/engine/schema/src/com/cloud/storage/DiskOfferingVO.java
@@ -44,9 +44,6 @@ import com.cloud.utils.db.GenericDao;
 @Inheritance(strategy = InheritanceType.JOINED)
 @DiscriminatorColumn(name = "type", discriminatorType = DiscriminatorType.STRING, length = 32)
 public class DiskOfferingVO implements DiskOffering {
-    public enum Type {
-        Disk, Service
-    };
 
     @Id
     @GeneratedValue(strategy = GenerationType.IDENTITY)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9eb8d538/engine/schema/src/com/cloud/storage/dao/DiskOfferingDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/dao/DiskOfferingDaoImpl.java b/engine/schema/src/com/cloud/storage/dao/DiskOfferingDaoImpl.java
index 818a5b5..ba84062 100644
--- a/engine/schema/src/com/cloud/storage/dao/DiskOfferingDaoImpl.java
+++ b/engine/schema/src/com/cloud/storage/dao/DiskOfferingDaoImpl.java
@@ -25,7 +25,7 @@ import javax.persistence.EntityExistsException;
 import org.springframework.stereotype.Component;
 
 import com.cloud.storage.DiskOfferingVO;
-import com.cloud.storage.DiskOfferingVO.Type;
+import com.cloud.offering.DiskOffering.Type;
 import com.cloud.utils.db.Attribute;
 import com.cloud.utils.db.Filter;
 import com.cloud.utils.db.GenericDaoBase;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9eb8d538/server/src/com/cloud/api/query/vo/DiskOfferingJoinVO.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/vo/DiskOfferingJoinVO.java b/server/src/com/cloud/api/query/vo/DiskOfferingJoinVO.java
index 58eeef9..e846b0b 100644
--- a/server/src/com/cloud/api/query/vo/DiskOfferingJoinVO.java
+++ b/server/src/com/cloud/api/query/vo/DiskOfferingJoinVO.java
@@ -27,7 +27,7 @@ import com.cloud.storage.Storage;
 import org.apache.cloudstack.api.Identity;
 import org.apache.cloudstack.api.InternalIdentity;
 
-import com.cloud.storage.DiskOfferingVO.Type;
+import com.cloud.offering.DiskOffering.Type;
 import com.cloud.utils.db.GenericDao;
 
 @Entity