You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ah...@apache.org on 2013/06/18 05:06:26 UTC

[01/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1

Updated Branches:
  refs/heads/vmsync 309f8da6d -> e2edae171


CLOUDSTACK-3004: remove duplicate ssvm-check.sh

ssvm_check.sh remove the duplicate file from consoleproxy and include the
script from secondary storage folder while packing iso

Signed-off-by: Prasanna Santhanam <ts...@apache.org>


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

Branch: refs/heads/vmsync
Commit: 6d140538c5efc394fda8a4ddc7cb72832470d0b3
Parents: 8925d39
Author: Rajesh Battala <ra...@citrix.com>
Authored: Sat Jun 15 11:21:46 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Sat Jun 15 11:21:46 2013 +0530

----------------------------------------------------------------------
 .../console-proxy/server/scripts/ssvm-check.sh  | 136 -------------------
 .../server/systemvm-descriptor.xml              |   9 ++
 2 files changed, 9 insertions(+), 136 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6d140538/services/console-proxy/server/scripts/ssvm-check.sh
----------------------------------------------------------------------
diff --git a/services/console-proxy/server/scripts/ssvm-check.sh b/services/console-proxy/server/scripts/ssvm-check.sh
deleted file mode 100644
index a401164..0000000
--- a/services/console-proxy/server/scripts/ssvm-check.sh
+++ /dev/null
@@ -1,136 +0,0 @@
-#!/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.
- 
-
-# Health check script for the Secondary Storage VM
-
-# DNS server is specified.
-
-
-CMDLINE=/var/cache/cloud/cmdline
-for i in `cat $CMDLINE`
-do
-   key=`echo $i | cut -d= -f1`
-   value=`echo $i | cut -d= -f2`
-   case $key in
-      host)
-         MGMTSERVER=$value       
-         ;;
-   esac
-done
-
-
-# ping dns server
-echo ================================================
-DNSSERVER=`egrep '^nameserver' /etc/resolv.conf  | awk '{print $2}'| head -1`
-echo "First DNS server is " $DNSSERVER
-ping -c 2  $DNSSERVER
-if [ $? -eq 0 ]
-then
-    echo "Good: Can ping DNS server"
-else
-    echo "WARNING: cannot ping DNS server"
-    echo "route follows"
-    route -n
-fi
-
-
-# check dns resolve
-echo ================================================
-nslookup download.cloud.com 1> /tmp/dns 2>&1
-grep 'no servers could' /tmp/dns 1> /dev/null 2>&1
-if [ $? -eq 0 ]
-then
-    echo "ERROR: DNS not resolving download.cloud.com"
-    echo resolv.conf follows
-    cat /etc/resolv.conf
-    exit 2
-else
-    echo "Good: DNS resolves download.cloud.com"
-fi
-
-
-# check to see if we have the NFS volume mounted
-echo ================================================
-mount|grep -v sunrpc|grep nfs 1> /dev/null 2>&1
-if [ $? -eq 0 ]
-then
-    echo "NFS is currently mounted"
-    # check for write access
-    for MOUNTPT in `mount|grep -v sunrpc|grep nfs| awk '{print $3}'`
-    do
-        if [ $MOUNTPT != "/proc/xen" ] # mounted by xen
-        then
-            echo Mount point is $MOUNTPT
-            touch $MOUNTPT/foo
-            if [ $? -eq 0 ]
-            then
-                echo "Good: Can write to mount point"
-                rm $MOUNTPT/foo
-            else
-                echo "ERROR: Cannot write to mount point"
-                echo "You need to export with norootsquash"
-            fi
-        fi
-     done
-else
-    echo "ERROR: NFS is not currently mounted"
-    echo "Try manually mounting from inside the VM"
-    NFSSERVER=`awk '{print $17}' $CMDLINE|awk -F= '{print $2}'|awk -F: '{print $1}'`
-    echo "NFS server is " $NFSSERVER
-    ping -c 2  $NFSSERVER
-    if [ $? -eq 0 ]
-    then
-	echo "Good: Can ping NFS server"
-    else
-	echo "WARNING: cannot ping NFS server"
-	echo routing table follows
-	route -n
-    fi
-fi
-
-
-# check for connectivity to the management server
-echo ================================================
-echo Management server is $MGMTSERVER.  Checking connectivity.
-socatout=$(echo | socat - TCP:$MGMTSERVER:8250,connect-timeout=3 2>&1)
-if [ $? -eq 0 ]
-then
-    echo "Good: Can connect to management server port 8250"
-else
-    echo "ERROR: Cannot connect to $MGMTSERVER port 8250"
-    echo $socatout
-    exit 4
-fi
-
-
-# check for the java process running
-echo ================================================
-ps -eaf|grep -v grep|grep java 1> /dev/null 2>&1
-if [ $? -eq 0 ]
-then
-    echo "Good: Java process is running"
-else
-    echo "ERROR: Java process not running.  Try restarting the SSVM."
-    exit 3
-fi
-
-echo ================================================
-echo Tests Complete.  Look for ERROR or WARNING above.  
-
-exit 0

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6d140538/services/console-proxy/server/systemvm-descriptor.xml
----------------------------------------------------------------------
diff --git a/services/console-proxy/server/systemvm-descriptor.xml b/services/console-proxy/server/systemvm-descriptor.xml
index e34026b..6c98d2d 100644
--- a/services/console-proxy/server/systemvm-descriptor.xml
+++ b/services/console-proxy/server/systemvm-descriptor.xml
@@ -37,6 +37,15 @@
       <fileMode>555</fileMode>
     </fileSet>
     <fileSet>
+      <directory>../../secondary-storage/scripts/</directory>
+      <outputDirectory></outputDirectory>
+      <directoryMode>555</directoryMode>
+      <fileMode>555</fileMode>
+      <includes>
+        <include>ssvm-check.sh</include>
+      </includes>
+    </fileSet>
+    <fileSet>
       <directory>../../../scripts/storage/secondary/</directory>
       <outputDirectory>scripts/storage/secondary</outputDirectory>
       <directoryMode>555</directoryMode>


[22/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1

Posted by ah...@apache.org.
CLOUDSTACK-2935: Corrected VPC code related to cleanup

Signed-off-by: Prasanna Santhanam <ts...@apache.org>


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

Branch: refs/heads/vmsync
Commit: 6a5c9d777f979fe62b0ff45d88f8a44fd4e5057b
Parents: 3a02942
Author: Gaurav Aradhye <ga...@clogeny.com>
Authored: Mon Jun 17 03:04:23 2013 -0400
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Mon Jun 17 19:40:03 2013 +0530

----------------------------------------------------------------------
 test/integration/component/test_vpc_network_lbrules.py | 2 +-
 test/integration/component/test_vpc_network_pfrules.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a5c9d77/test/integration/component/test_vpc_network_lbrules.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc_network_lbrules.py b/test/integration/component/test_vpc_network_lbrules.py
index 66d6c4d..3461bb4 100644
--- a/test/integration/component/test_vpc_network_lbrules.py
+++ b/test/integration/component/test_vpc_network_lbrules.py
@@ -408,7 +408,7 @@ class TestVPCNetworkLBRules(cloudstackTestCase):
                                     self.services["vpc_offering"]
                                     )
 
-        self._cleanup.append(self.vpc_off)
+        self._cleanup.append(vpc_off)
         self.debug("Enabling the VPC offering created")
         vpc_off.update(self.apiclient, state='Enabled')
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6a5c9d77/test/integration/component/test_vpc_network_pfrules.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc_network_pfrules.py b/test/integration/component/test_vpc_network_pfrules.py
index 92b04ad..8d1d9ec 100644
--- a/test/integration/component/test_vpc_network_pfrules.py
+++ b/test/integration/component/test_vpc_network_pfrules.py
@@ -406,7 +406,7 @@ class TestVPCNetworkPFRules(cloudstackTestCase):
                                                 self.services["vpc_offering"]
                                                 )
 
-        self._cleanup.append(self.vpc_off)
+        self._cleanup.append(vpc_off)
         self.debug("Enabling the VPC offering created")
         vpc_off.update(self.apiclient, state='Enabled')
 


[39/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1

Posted by ah...@apache.org.
CLOUDSTACK-3016: remove zonetype parameter from listSnapshots API.


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

Branch: refs/heads/vmsync
Commit: 9e7356c686d098185e2481338e4e4169dcb95813
Parents: d4477ba
Author: Jessica Wang <je...@apache.org>
Authored: Mon Jun 17 14:58:51 2013 -0700
Committer: Jessica Wang <je...@apache.org>
Committed: Mon Jun 17 15:00:44 2013 -0700

----------------------------------------------------------------------
 .../command/user/snapshot/ListSnapshotsCmd.java | 11 ++-----
 .../storage/snapshot/SnapshotManagerImpl.java   | 34 +++++++-------------
 2 files changed, 13 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9e7356c6/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java
----------------------------------------------------------------------
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 e4ae769..611b127 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
@@ -59,9 +59,6 @@ public class ListSnapshotsCmd extends BaseListTaggedResourcesCmd {
     @Parameter(name=ApiConstants.VOLUME_ID, type=CommandType.UUID, entityType = VolumeResponse.class,
             description="the ID of the disk volume")
     private Long volumeId;
-    
-    @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;
@@ -90,14 +87,10 @@ public class ListSnapshotsCmd extends BaseListTaggedResourcesCmd {
         return volumeId;
     }
 
-    public String getZoneType() {
-        return zoneType;
-    }
-
     public Long getZoneId() {
         return zoneId;
-    }
-    
+    }    
+
     /////////////////////////////////////////////////////
     /////////////// API Implementation///////////////////
     /////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9e7356c6/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
index 02e3428..c720169 100755
--- a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
+++ b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
@@ -58,7 +58,6 @@ import com.cloud.configuration.Resource.ResourceType;
 import com.cloud.configuration.dao.ConfigurationDao;
 import com.cloud.dc.ClusterVO;
 import com.cloud.dc.DataCenter;
-import com.cloud.dc.DataCenterVO;
 import com.cloud.dc.dao.ClusterDao;
 import com.cloud.dc.dao.DataCenterDao;
 import com.cloud.domain.dao.DomainDao;
@@ -572,7 +571,6 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager,
         String keyword = cmd.getKeyword();
         String snapshotTypeStr = cmd.getSnapshotType();
         String intervalTypeStr = cmd.getIntervalType();
-        String zoneType = cmd.getZoneType();
         Map<String, String> tags = cmd.getTags();
         Long zoneId = cmd.getZoneId();
         
@@ -606,23 +604,17 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager,
         sb.and("dataCenterId", sb.entity().getDataCenterId(), SearchCriteria.Op.EQ);
         
         if (tags != null && !tags.isEmpty()) {
-            SearchBuilder<ResourceTagVO> tagSearch = _resourceTagDao.createSearchBuilder();
-            for (int count=0; count < tags.size(); count++) {
-                tagSearch.or().op("key" + String.valueOf(count), tagSearch.entity().getKey(), SearchCriteria.Op.EQ);
-                tagSearch.and("value" + String.valueOf(count), tagSearch.entity().getValue(), SearchCriteria.Op.EQ);
-                tagSearch.cp();
-            }
-            tagSearch.and("resourceType", tagSearch.entity().getResourceType(), SearchCriteria.Op.EQ);
-            sb.groupBy(sb.entity().getId());
-            sb.join("tagSearch", tagSearch, sb.entity().getId(), tagSearch.entity().getResourceId(), JoinBuilder.JoinType.INNER);
-        }
+        SearchBuilder<ResourceTagVO> tagSearch = _resourceTagDao.createSearchBuilder();
+        for (int count=0; count < tags.size(); count++) {
+            tagSearch.or().op("key" + String.valueOf(count), tagSearch.entity().getKey(), SearchCriteria.Op.EQ);
+            tagSearch.and("value" + String.valueOf(count), tagSearch.entity().getValue(), SearchCriteria.Op.EQ);
+            tagSearch.cp();
+        }
+        tagSearch.and("resourceType", tagSearch.entity().getResourceType(), SearchCriteria.Op.EQ);
+        sb.groupBy(sb.entity().getId());
+        sb.join("tagSearch", tagSearch, sb.entity().getId(), tagSearch.entity().getResourceId(), JoinBuilder.JoinType.INNER);
+    }
 
-        if(zoneType != null) {
-            SearchBuilder<DataCenterVO> zoneSb = _dcDao.createSearchBuilder();
-            zoneSb.and("zoneNetworkType", zoneSb.entity().getNetworkType(), SearchCriteria.Op.EQ);    
-            sb.join("zoneSb", zoneSb, sb.entity().getDataCenterId(), zoneSb.entity().getId(), JoinBuilder.JoinType.INNER);
-        }
-        
         SearchCriteria<SnapshotVO> sc = sb.create();
         _accountMgr.buildACLSearchCriteria(sc, domainId, isRecursive, permittedAccounts, listProjectResourcesCriteria);
 
@@ -640,14 +632,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 + "%");
         }


[06/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1

Posted by ah...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/cloudstack


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

Branch: refs/heads/vmsync
Commit: ae27d664f8249773f9c5c266b76073dd871331e5
Parents: 2fb18db 10f9516
Author: Isaac Chiang <is...@gmail.com>
Authored: Sun Jun 16 23:07:10 2013 +0800
Committer: Isaac Chiang <is...@gmail.com>
Committed: Sun Jun 16 23:07:10 2013 +0800

----------------------------------------------------------------------
 tools/cli/cloudmonkey/config.py    |  2 +-
 tools/cli/cloudmonkey/requester.py | 47 ++++++++-------------------------
 2 files changed, 12 insertions(+), 37 deletions(-)
----------------------------------------------------------------------



[30/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1

Posted by ah...@apache.org.
Correcting ID in the release notes from issues-fixed-4.0 to issues-fixed-4.1


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

Branch: refs/heads/vmsync
Commit: bd699390a6b1c84c0467c94bc0fdba2ed4e28177
Parents: 9ef366e
Author: Chip Childers <ch...@apache.org>
Authored: Mon Jun 17 13:50:53 2013 -0400
Committer: Chip Childers <ch...@apache.org>
Committed: Mon Jun 17 13:50:53 2013 -0400

----------------------------------------------------------------------
 docs/en-US/Release_Notes.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bd699390/docs/en-US/Release_Notes.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/Release_Notes.xml b/docs/en-US/Release_Notes.xml
index 2ae8732..8843f4c 100644
--- a/docs/en-US/Release_Notes.xml
+++ b/docs/en-US/Release_Notes.xml
@@ -398,7 +398,7 @@ under the License.
           SSH keypair assigned to a virtual machine.</para>
       </section>
     </section>
-    <section id="issues-fixed-4.0">
+    <section id="issues-fixed-4.1">
       <title>Issues Fixed in 4.1.0</title>
       <para>Apache CloudStack uses <ulink url="https://issues.apache.org/jira/browse/CLOUDSTACK"
           >Jira</ulink> to track its issues. All new features and bugs for 4.1.0 have been tracked


[37/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1

Posted by ah...@apache.org.
Small fix to satisfy the xml validation requirements

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

Branch: refs/heads/vmsync
Commit: 84b92f890ca1647f331da459fe09a28d8a4cecdb
Parents: 202cd15
Author: Hugo Trippaers <ht...@schubergphilis.com>
Authored: Mon Jun 17 11:25:22 2013 -0700
Committer: Hugo Trippaers <ht...@schubergphilis.com>
Committed: Mon Jun 17 11:26:13 2013 -0700

----------------------------------------------------------------------
 awsapi/web/web.xml | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/84b92f89/awsapi/web/web.xml
----------------------------------------------------------------------
diff --git a/awsapi/web/web.xml b/awsapi/web/web.xml
index 7efe43d..5ded12b 100644
--- a/awsapi/web/web.xml
+++ b/awsapi/web/web.xml
@@ -22,16 +22,17 @@
 <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
 
 <web-app>
-
-	<listener>
-  	  <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
-	</listener>
+    <display-name>CloudBridge</display-name>
+    
     <context-param>    
         <param-name>contextConfigLocation</param-name>    
         <param-value>classpath:applicationContext.xml</param-value>    
     </context-param>
     
-    <display-name>CloudBridge</display-name>
+    <listener>
+        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
+    </listener>
+
     <servlet>
         <servlet-name>EC2MainServlet</servlet-name>
         <display-name>EC2 Main Servlet</display-name>


[45/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1

Posted by ah...@apache.org.
CLOUDSTACK-2883: create default network offering with internal lb support (if doesn't exist already)


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

Branch: refs/heads/vmsync
Commit: 5d0a1cee13fb3006f3e35cd221e553587ea20ce2
Parents: 8800298
Author: Alena Prokharchyk <al...@citrix.com>
Authored: Mon Jun 17 16:10:12 2013 -0700
Committer: Alena Prokharchyk <al...@citrix.com>
Committed: Mon Jun 17 16:13:19 2013 -0700

----------------------------------------------------------------------
 api/src/com/cloud/offering/NetworkOffering.java |  4 +-
 .../com/cloud/offerings/NetworkOfferingVO.java  |  4 ++
 .../configuration/ConfigurationManagerImpl.java |  3 +-
 .../com/cloud/network/NetworkManagerImpl.java   | 65 ++++++++++++++------
 .../cloud/server/ConfigurationServerImpl.java   | 25 ++++++++
 5 files changed, 78 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5d0a1cee/api/src/com/cloud/offering/NetworkOffering.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/offering/NetworkOffering.java b/api/src/com/cloud/offering/NetworkOffering.java
index 72e2a2b..5f522eb 100644
--- a/api/src/com/cloud/offering/NetworkOffering.java
+++ b/api/src/com/cloud/offering/NetworkOffering.java
@@ -16,8 +16,6 @@
 // under the License.
 package com.cloud.offering;
 
-import java.util.Map;
-
 import org.apache.cloudstack.acl.InfrastructureEntity;
 import org.apache.cloudstack.api.Identity;
 import org.apache.cloudstack.api.InternalIdentity;
@@ -61,6 +59,8 @@ public interface NetworkOffering extends InfrastructureEntity, InternalIdentity,
     public final static String DefaultSharedEIPandELBNetworkOffering = "DefaultSharedNetscalerEIPandELBNetworkOffering";
     public final static String DefaultIsolatedNetworkOfferingForVpcNetworks = "DefaultIsolatedNetworkOfferingForVpcNetworks";
     public final static String DefaultIsolatedNetworkOfferingForVpcNetworksNoLB = "DefaultIsolatedNetworkOfferingForVpcNetworksNoLB";
+    public final static String DefaultIsolatedNetworkOfferingForVpcNetworksWithInternalLB = "DefaultIsolatedNetworkOfferingForVpcNetworksWithInternalLB";
+
 
     /**
      * @return name for the network offering.

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5d0a1cee/engine/schema/src/com/cloud/offerings/NetworkOfferingVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/offerings/NetworkOfferingVO.java b/engine/schema/src/com/cloud/offerings/NetworkOfferingVO.java
index 3ae0bf3..fae315b 100755
--- a/engine/schema/src/com/cloud/offerings/NetworkOfferingVO.java
+++ b/engine/schema/src/com/cloud/offerings/NetworkOfferingVO.java
@@ -414,4 +414,8 @@ public class NetworkOfferingVO implements NetworkOffering {
         return publicLb;
     }
 
+    public void setInternalLb(boolean internalLb) {
+        this.internalLb = internalLb;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5d0a1cee/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
index 12164a2..6dac26c 100755
--- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
@@ -39,7 +39,6 @@ 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;
@@ -125,7 +124,6 @@ import com.cloud.exception.ConcurrentOperationException;
 import com.cloud.exception.InsufficientAddressCapacityException;
 import com.cloud.exception.InsufficientCapacityException;
 import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.exception.MissingParameterValueException;
 import com.cloud.exception.PermissionDeniedException;
 import com.cloud.exception.ResourceAllocationException;
 import com.cloud.exception.ResourceUnavailableException;
@@ -193,6 +191,7 @@ import com.cloud.user.User;
 import com.cloud.user.UserContext;
 import com.cloud.user.dao.AccountDao;
 import com.cloud.utils.NumbersUtil;
+import com.cloud.utils.Pair;
 import com.cloud.utils.StringUtils;
 import com.cloud.utils.component.ManagerBase;
 import com.cloud.utils.crypt.DBEncryptionUtil;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5d0a1cee/server/src/com/cloud/network/NetworkManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java
index f563335..274e794 100755
--- a/server/src/com/cloud/network/NetworkManagerImpl.java
+++ b/server/src/com/cloud/network/NetworkManagerImpl.java
@@ -1239,9 +1239,6 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
 
         _networkLockTimeout = NumbersUtil.parseInt(_configs.get(Config.NetworkLockTimeout.key()), 600);
 
-        
-
-
         // populate providers
         Map<Network.Service, Set<Network.Provider>> defaultSharedNetworkOfferingProviders = new HashMap<Network.Service, Set<Network.Provider>>();
         Set<Network.Provider> defaultProviders = new HashSet<Network.Provider>();
@@ -1252,6 +1249,15 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
         defaultSharedNetworkOfferingProviders.put(Service.UserData, defaultProviders);
 
         Map<Network.Service, Set<Network.Provider>> defaultIsolatedNetworkOfferingProviders = defaultSharedNetworkOfferingProviders;
+        defaultIsolatedNetworkOfferingProviders.put(Service.Dhcp, defaultProviders);
+        defaultIsolatedNetworkOfferingProviders.put(Service.Dns, defaultProviders);
+        defaultIsolatedNetworkOfferingProviders.put(Service.UserData, defaultProviders);
+        defaultIsolatedNetworkOfferingProviders.put(Service.Firewall, defaultProviders);
+        defaultIsolatedNetworkOfferingProviders.put(Service.Gateway, defaultProviders);
+        defaultIsolatedNetworkOfferingProviders.put(Service.Lb, defaultProviders);
+        defaultIsolatedNetworkOfferingProviders.put(Service.StaticNat, defaultProviders);
+        defaultIsolatedNetworkOfferingProviders.put(Service.PortForwarding, defaultProviders);
+        defaultIsolatedNetworkOfferingProviders.put(Service.Vpn, defaultProviders);
 
         Map<Network.Service, Set<Network.Provider>> defaultSharedSGEnabledNetworkOfferingProviders = new HashMap<Network.Service, Set<Network.Provider>>();
         defaultSharedSGEnabledNetworkOfferingProviders.put(Service.Dhcp, defaultProviders);
@@ -1294,9 +1300,9 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
 
         Transaction txn = Transaction.currentTxn();
         txn.start();
-        // diff between offering #1 and #2 - securityGroup is enabled for the first, and disabled for the third
 
         NetworkOfferingVO offering = null;
+        //#1 - quick cloud network offering
         if (_networkOfferingDao.findByUniqueName(NetworkOffering.QuickCloudNoServices) == null) {
             offering =
                     _configMgr.createNetworkOffering(NetworkOffering.QuickCloudNoServices,
@@ -1306,6 +1312,8 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
             offering.setState(NetworkOffering.State.Enabled);
             _networkOfferingDao.update(offering.getId(), offering);
         }
+        
+        //#2 - SG enabled network offering
         if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultSharedNetworkOfferingWithSGService) == null) {
             offering =
                     _configMgr.createNetworkOffering(NetworkOffering.DefaultSharedNetworkOfferingWithSGService,
@@ -1316,36 +1324,26 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
             _networkOfferingDao.update(offering.getId(), offering);
         }
 
+        //#3 - shared network offering with no SG service
         if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultSharedNetworkOffering) == null) {
             offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultSharedNetworkOffering, "Offering for Shared networks", TrafficType.Guest, null, true, Availability.Optional, null,
                     defaultSharedNetworkOfferingProviders, true, Network.GuestType.Shared, false, null, true, null, true, false, null);
             offering.setState(NetworkOffering.State.Enabled);
             _networkOfferingDao.update(offering.getId(), offering);
         }
+        
 
-        Map<Network.Service, Set<Network.Provider>> defaultINetworkOfferingProvidersForVpcNetwork = new HashMap<Network.Service, Set<Network.Provider>>();
-        defaultProviders.clear();
-        defaultProviders.add(Network.Provider.VPCVirtualRouter);
-        defaultINetworkOfferingProvidersForVpcNetwork.put(Service.Dhcp, defaultProviders);
-        defaultINetworkOfferingProvidersForVpcNetwork.put(Service.Dns, defaultProviders);
-        defaultINetworkOfferingProvidersForVpcNetwork.put(Service.UserData, defaultProviders);
-        defaultINetworkOfferingProvidersForVpcNetwork.put(Service.Firewall, defaultProviders);
-        defaultINetworkOfferingProvidersForVpcNetwork.put(Service.Gateway, defaultProviders);
-        defaultINetworkOfferingProvidersForVpcNetwork.put(Service.Lb, defaultProviders);
-        defaultINetworkOfferingProvidersForVpcNetwork.put(Service.SourceNat, defaultProviders);
-        defaultINetworkOfferingProvidersForVpcNetwork.put(Service.StaticNat, defaultProviders);
-        defaultINetworkOfferingProvidersForVpcNetwork.put(Service.PortForwarding, defaultProviders);
-        defaultINetworkOfferingProvidersForVpcNetwork.put(Service.Vpn, defaultProviders);
-
+        //#4 - default isolated offering with Source nat service
         if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOfferingWithSourceNatService) == null) {
             offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingWithSourceNatService,
                     "Offering for Isolated networks with Source Nat service enabled", TrafficType.Guest,
-                    null, false, Availability.Required, null, defaultINetworkOfferingProvidersForVpcNetwork,
+                    null, false, Availability.Required, null, defaultIsolatedSourceNatEnabledNetworkOfferingProviders,
                     true, Network.GuestType.Isolated, false, null, true, null, false, false, null);
             offering.setState(NetworkOffering.State.Enabled);
             _networkOfferingDao.update(offering.getId(), offering);
         }
 
+        //#5 - default vpc offering with LB service
         if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworks) == null) {
             offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworks,
                     "Offering for Isolated VPC networks with Source Nat service enabled", TrafficType.Guest,
@@ -1355,6 +1353,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
             _networkOfferingDao.update(offering.getId(), offering);
         }
 
+        //#6 - default vpc offering with no LB service
         if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworksNoLB) == null) {
             //remove LB service
             defaultVPCOffProviders.remove(Service.Lb);
@@ -1366,6 +1365,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
             _networkOfferingDao.update(offering.getId(), offering);
         }
 
+        //#7 - isolated offering with source nat disabled
         if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOffering) == null) {
             offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOffering,
                     "Offering for Isolated networks with no Source Nat service", TrafficType.Guest, null, true,
@@ -1374,6 +1374,33 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
             offering.setState(NetworkOffering.State.Enabled);
             _networkOfferingDao.update(offering.getId(), offering);
         }
+        
+        //#8 - network offering with internal lb service
+        Map<Network.Service, Set<Network.Provider>> internalLbOffProviders =
+                new HashMap<Network.Service, Set<Network.Provider>>();
+        Set<Network.Provider> defaultVpcProvider = new HashSet<Network.Provider>();
+        defaultVpcProvider.add(Network.Provider.VPCVirtualRouter);
+        
+        Set<Network.Provider> defaultInternalLbProvider = new HashSet<Network.Provider>();
+        defaultInternalLbProvider.add(Network.Provider.InternalLbVm);
+
+        internalLbOffProviders.put(Service.Dhcp, defaultVpcProvider);
+        internalLbOffProviders.put(Service.Dns, defaultVpcProvider);
+        internalLbOffProviders.put(Service.UserData, defaultVpcProvider);
+        internalLbOffProviders.put(Service.NetworkACL, defaultVpcProvider);
+        internalLbOffProviders.put(Service.Gateway, defaultVpcProvider);
+        internalLbOffProviders.put(Service.Lb, defaultInternalLbProvider);
+        internalLbOffProviders.put(Service.SourceNat, defaultVpcProvider);
+        
+        if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworksWithInternalLB) == null) {
+            offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworksWithInternalLB,
+                    "Offering for Isolated VPC networks with Internal Lb support", TrafficType.Guest,
+                    null, false, Availability.Optional, null, internalLbOffProviders,
+                    true, Network.GuestType.Isolated, false, null, false, null, false, false, null);
+            offering.setState(NetworkOffering.State.Enabled);
+            offering.setInternalLb(true);
+            _networkOfferingDao.update(offering.getId(), offering);
+        }
 
         Map<Network.Service, Set<Network.Provider>> netscalerServiceProviders = new HashMap<Network.Service, Set<Network.Provider>>();
         Set<Network.Provider> vrProvider = new HashSet<Network.Provider>();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5d0a1cee/server/src/com/cloud/server/ConfigurationServerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/ConfigurationServerImpl.java b/server/src/com/cloud/server/ConfigurationServerImpl.java
index d334d7e..510455b 100755
--- a/server/src/com/cloud/server/ConfigurationServerImpl.java
+++ b/server/src/com/cloud/server/ConfigurationServerImpl.java
@@ -1151,8 +1151,33 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
             _ntwkOfferingServiceMapDao.persist(offService);
             s_logger.trace("Added service for the network offering: " + offService);
         }
+        
+        //offering #8 - network offering with internal lb service
+        NetworkOfferingVO internalLbOff = new NetworkOfferingVO(
+                NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworksWithInternalLB,
+                "Offering for Isolated Vpc networks with Internal LB support",
+                TrafficType.Guest,
+                false, false, null, null, true, Availability.Optional,
+                null, Network.GuestType.Isolated, false, false, false, true, false);
 
+        internalLbOff.setState(NetworkOffering.State.Enabled);
+        internalLbOff = _networkOfferingDao.persistDefaultNetworkOffering(internalLbOff);
 
+        Map<Network.Service, Network.Provider> internalLbOffProviders = new HashMap<Network.Service, Network.Provider>();
+        internalLbOffProviders.put(Service.Dhcp, Provider.VPCVirtualRouter);
+        internalLbOffProviders.put(Service.Dns, Provider.VPCVirtualRouter);
+        internalLbOffProviders.put(Service.UserData, Provider.VPCVirtualRouter);
+        internalLbOffProviders.put(Service.NetworkACL, Provider.VPCVirtualRouter);
+        internalLbOffProviders.put(Service.Gateway, Provider.VPCVirtualRouter);
+        internalLbOffProviders.put(Service.Lb, Provider.InternalLbVm);
+        internalLbOffProviders.put(Service.SourceNat, Provider.VPCVirtualRouter);
+
+        for (Service service : internalLbOffProviders.keySet()) {
+            NetworkOfferingServiceMapVO offService = new NetworkOfferingServiceMapVO
+                    (internalLbOff.getId(), service, internalLbOffProviders.get(service));
+            _ntwkOfferingServiceMapDao.persist(offService);
+            s_logger.trace("Added service for the network offering: " + offService);
+        }
 
         txn.commit();
     }


[43/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1

Posted by ah...@apache.org.
CLOUDSTACK-3016: remove zonetype parameter from listSystemVMs API.


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

Branch: refs/heads/vmsync
Commit: cb35ec6f4d640d8864c4c0b0e8f52750d7f00ca9
Parents: 4c26dd6
Author: Jessica Wang <je...@apache.org>
Authored: Mon Jun 17 15:57:20 2013 -0700
Committer: Jessica Wang <je...@apache.org>
Committed: Mon Jun 17 15:58:33 2013 -0700

----------------------------------------------------------------------
 .../api/command/admin/systemvm/ListSystemVMsCmd.java     |  7 -------
 server/src/com/cloud/server/ManagementServerImpl.java    | 11 -----------
 2 files changed, 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cb35ec6f/api/src/org/apache/cloudstack/api/command/admin/systemvm/ListSystemVMsCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/systemvm/ListSystemVMsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/systemvm/ListSystemVMsCmd.java
index b5a0f3f..f230a20 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/systemvm/ListSystemVMsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/systemvm/ListSystemVMsCmd.java
@@ -74,9 +74,6 @@ public class ListSystemVMsCmd extends BaseListCmd {
             description="the storage ID where vm's volumes belong to", since="3.0.1")
     private Long storageId;
 
-    @Parameter(name=ApiConstants.ZONE_TYPE, type=CommandType.STRING, description="the network type of the zone that the virtual machine belongs to")
-    private String zoneType;
-    
     /////////////////////////////////////////////////////
     /////////////////// Accessors ///////////////////////
     /////////////////////////////////////////////////////
@@ -113,10 +110,6 @@ public class ListSystemVMsCmd extends BaseListCmd {
         return storageId;
     }
 
-    public String getZoneType() {
-        return zoneType;
-    }
-    
     /////////////////////////////////////////////////////
     /////////////// API Implementation///////////////////
     /////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cb35ec6f/server/src/com/cloud/server/ManagementServerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java
index 2099d2f..5a332b4 100755
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@ -3078,7 +3078,6 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
     public Pair<List<? extends VirtualMachine>, Integer> searchForSystemVm(ListSystemVMsCmd cmd) {
         String type = cmd.getSystemVmType();
         Long zoneId = _accountMgr.checkAccessAndSpecifyAuthority(UserContext.current().getCaller(), cmd.getZoneId());
-        String zoneType = cmd.getZoneType();
         Long id = cmd.getId();
         String name = cmd.getSystemVmName();
         String state = cmd.getState();
@@ -3105,12 +3104,6 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
             sb.join("volumeSearch", volumeSearch, sb.entity().getId(), volumeSearch.entity().getInstanceId(), JoinBuilder.JoinType.INNER);
         }
 
-        if(zoneType != null) {
-            SearchBuilder<DataCenterVO> zoneSb = _dcDao.createSearchBuilder();
-            zoneSb.and("zoneNetworkType", zoneSb.entity().getNetworkType(), SearchCriteria.Op.EQ);
-            sb.join("zoneSb", zoneSb, sb.entity().getDataCenterId(), zoneSb.entity().getId(), JoinBuilder.JoinType.INNER);
-        }
-
         SearchCriteria<VMInstanceVO> sc = sb.create();
 
         if (keyword != null) {
@@ -3151,10 +3144,6 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
             sc.setJoinParameters("volumeSearch", "poolId", storageId);
         }
 
-        if(zoneType != null) {
-            sc.setJoinParameters("zoneSb", "zoneNetworkType", zoneType);
-        }
-
         Pair<List<VMInstanceVO>, Integer> result = _vmInstanceDao.searchAndCount(sc, searchFilter);
         return new Pair<List<? extends VirtualMachine>, Integer>(result.first(), result.second());
     }


[10/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1

Posted by ah...@apache.org.
CLOUDSTACK-769 review comments fixed


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

Branch: refs/heads/vmsync
Commit: 2f1ed47213014f2462d7add0bec6a2437e336899
Parents: 776301c
Author: Radhika PC <ra...@citrix.com>
Authored: Mon Jun 17 11:08:59 2013 +0530
Committer: Radhika PC <ra...@citrix.com>
Committed: Mon Jun 17 11:08:59 2013 +0530

----------------------------------------------------------------------
 docs/en-US/add-loadbalancer-rule-vpc.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2f1ed472/docs/en-US/add-loadbalancer-rule-vpc.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/add-loadbalancer-rule-vpc.xml b/docs/en-US/add-loadbalancer-rule-vpc.xml
index b7b9e3e..82e8702 100644
--- a/docs/en-US/add-loadbalancer-rule-vpc.xml
+++ b/docs/en-US/add-loadbalancer-rule-vpc.xml
@@ -25,16 +25,16 @@
     External LB is nothing but a LB rule created to redirect the traffic received at a public IP of
     the VPC virtual router. The traffic is load balanced within a tier based on your configuration.
     Citrix NetScaler and VPC virtual router are supported for external LB. When you use internal LB
-    service, traffic received at a tier is load balanced across different tiers within the VPC. For
-    example, traffic reached at Web tier is redirected to Application tier. External load balancing
-    devices are not supported for internal LB. The service is provided by a internal LB VM
+    service, traffic received at a tier is load balanced across different VMs within that tier. For
+    example, traffic reached at Web tier is redirected to another VM in that tier. External load
+    balancing devices are not supported for internal LB. The service is provided by a internal LB VM
     configured on the target tier.</para>
   <section id="curent-lb-vpc">
     <title>Load Balancing Within a Tier (External LB)</title>
     <para>A &PRODUCT; user or administrator may create load balancing rules that balance traffic
       received at a public IP to one or more VMs that belong to a network tier that provides load
       balancing service in a VPC. A user creates a rule, specifies an algorithm, and assigns the
-      rule to a set of VMs within a VPC.</para>
+      rule to a set of VMs within a tier.</para>
     <orderedlist>
       <listitem>
         <para>Log in to the &PRODUCT; UI as an administrator or end user.</para>


[48/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1

Posted by ah...@apache.org.
CLOUDSTACK-2900: Ubuntu 13.04 - Migrate Virtual Router fail - Unable to find the VM by id=

Changes:
- Have to search the vm_instance table to find the instance


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

Branch: refs/heads/vmsync
Commit: fb31a39efe7d93a67c7b8c141f434b938a491222
Parents: fea9a0e
Author: Prachi Damle <pr...@cloud.com>
Authored: Mon Jun 17 16:58:42 2013 -0700
Committer: Prachi Damle <pr...@cloud.com>
Committed: Mon Jun 17 16:59:32 2013 -0700

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fb31a39e/server/src/com/cloud/vm/UserVmManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java
index 44a7d06..e8ea024 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -3804,7 +3804,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
                     "No permission to migrate VM, Only Root Admin can migrate a VM!");
         }
 
-        UserVmVO vm = _vmDao.findById(vmId);
+        VMInstanceVO vm = _vmInstanceDao.findById(vmId);
         if (vm == null) {
             throw new InvalidParameterValueException(
                     "Unable to find the VM by id=" + vmId);
@@ -3895,7 +3895,10 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
                             + " already has max Running VMs(count includes system VMs), cannot migrate to this host");
         }
 
-        collectVmDiskStatistics(vm);
+        UserVmVO uservm = _vmDao.findById(vmId);
+        if (uservm != null) {
+            collectVmDiskStatistics(uservm);
+        }
         VMInstanceVO migratedVm = _itMgr.migrate(vm, srcHostId, dest);
         return migratedVm;
     }


[41/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1

Posted by ah...@apache.org.
CLOUDSTACK-3016: remove zonetype parameter from listPods API.


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

Branch: refs/heads/vmsync
Commit: 56d390d54e07aff4aebf85960a89dd2d68f9143f
Parents: 9d0d022
Author: Jessica Wang <je...@apache.org>
Authored: Mon Jun 17 15:51:07 2013 -0700
Committer: Jessica Wang <je...@apache.org>
Committed: Mon Jun 17 15:51:07 2013 -0700

----------------------------------------------------------------------
 .../api/command/admin/pod/ListPodsByCmd.java    |  7 -----
 .../com/cloud/server/ManagementServerImpl.java  | 32 +++++---------------
 2 files changed, 8 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/56d390d5/api/src/org/apache/cloudstack/api/command/admin/pod/ListPodsByCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/pod/ListPodsByCmd.java b/api/src/org/apache/cloudstack/api/command/admin/pod/ListPodsByCmd.java
index db233ae..3dace42 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/pod/ListPodsByCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/pod/ListPodsByCmd.java
@@ -55,9 +55,6 @@ public class ListPodsByCmd extends BaseListCmd {
     @Parameter(name=ApiConstants.ALLOCATION_STATE, type=CommandType.STRING, description="list pods by allocation state")
     private String allocationState;
 
-    @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.SHOW_CAPACITIES, type=CommandType.BOOLEAN, description="flag to display the capacity of the pods")
     private Boolean showCapacities;
 
@@ -81,10 +78,6 @@ public class ListPodsByCmd extends BaseListCmd {
         return allocationState;
     }
 
-    public String getZoneType() {
-        return zoneType;
-    }
-    
     public Boolean getShowCapacities() {
         return showCapacities;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/56d390d5/server/src/com/cloud/server/ManagementServerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java
index f09aa21..2099d2f 100755
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@ -1448,29 +1448,17 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
 
     @Override
     public Pair<List<? extends Pod>, Integer> searchForPods(ListPodsByCmd cmd) {
+        Filter searchFilter = new Filter(HostPodVO.class, "dataCenterId", true, cmd.getStartIndex(), cmd.getPageSizeVal());
+        SearchCriteria<HostPodVO> sc = _hostPodDao.createSearchCriteria();
+
         String podName = cmd.getPodName();
         Long id = cmd.getId();
         Long zoneId = cmd.getZoneId();
         Object keyword = cmd.getKeyword();
         Object allocationState = cmd.getAllocationState();
-        String zoneType = cmd.getZoneType();
-        zoneId = _accountMgr.checkAccessAndSpecifyAuthority(UserContext.current().getCaller(), zoneId);
-
-
-    	Filter searchFilter = new Filter(HostPodVO.class, "dataCenterId", true, cmd.getStartIndex(), cmd.getPageSizeVal());
-        SearchBuilder<HostPodVO> sb = _hostPodDao.createSearchBuilder();
-        sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ);
-        sb.and("name", sb.entity().getName(), SearchCriteria.Op.LIKE);
-        sb.and("dataCenterId", sb.entity().getDataCenterId(), SearchCriteria.Op.EQ);
-        sb.and("allocationState", sb.entity().getAllocationState(), SearchCriteria.Op.EQ);
 
-        if(zoneType != null) {
-            SearchBuilder<DataCenterVO> zoneSb = _dcDao.createSearchBuilder();
-            zoneSb.and("zoneNetworkType", zoneSb.entity().getNetworkType(), SearchCriteria.Op.EQ);
-            sb.join("zoneSb", zoneSb, sb.entity().getDataCenterId(), zoneSb.entity().getId(), JoinBuilder.JoinType.INNER);
-        }
+        zoneId = _accountMgr.checkAccessAndSpecifyAuthority(UserContext.current().getCaller(), zoneId);
 
-        SearchCriteria<HostPodVO> sc = sb.create();
         if (keyword != null) {
             SearchCriteria<HostPodVO> ssc = _hostPodDao.createSearchCriteria();
             ssc.addOr("name", SearchCriteria.Op.LIKE, "%" + keyword + "%");
@@ -1480,23 +1468,19 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
         }
 
         if (id != null) {
-            sc.setParameters("id", id);
+            sc.addAnd("id", SearchCriteria.Op.EQ, id);
         }
 
         if (podName != null) {
-            sc.setParameters("name", "%" + podName + "%");
+            sc.addAnd("name", SearchCriteria.Op.LIKE, "%" + podName + "%");
         }
 
         if (zoneId != null) {
-            sc.setParameters("dataCenterId", zoneId);
+            sc.addAnd("dataCenterId", SearchCriteria.Op.EQ, zoneId);
         }
 
         if (allocationState != null) {
-            sc.setParameters("allocationState", allocationState);
-        }
-
-        if(zoneType != null) {
-            sc.setJoinParameters("zoneSb", "zoneNetworkType", zoneType);
+            sc.addAnd("allocationState", SearchCriteria.Op.EQ, allocationState);
         }
 
         Pair<List<HostPodVO>, Integer> result = _hostPodDao.searchAndCount(sc, searchFilter);


[14/50] [abbrv] Moving maintenance mode into component/maint

Posted by ah...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0587d3a4/test/integration/component/test_host_high_availability.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_host_high_availability.py b/test/integration/component/test_host_high_availability.py
deleted file mode 100644
index 2fe07b1..0000000
--- a/test/integration/component/test_host_high_availability.py
+++ /dev/null
@@ -1,810 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-""" P1 tests for dedicated Host high availability 
-"""
-#Import Local Modules
-from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import *
-from marvin.cloudstackAPI import *
-from marvin.integration.lib.utils import *
-from marvin.integration.lib.base import *
-from marvin.integration.lib.common import *
-
-
-class Services:
-    """ Dedicated host HA test cases """
-
-    def __init__(self):
-        self.services = {
-            "account": {
-                "email": "test@test.com",
-                "firstname": "HA",
-                "lastname": "HA",
-                "username": "HA",
-                # Random characters are appended for unique
-                # username
-                "password": "password",
-            },
-            "service_offering_with_ha": {
-                "name": "Tiny Instance With HA Enabled",
-                "displaytext": "Tiny Instance",
-                "cpunumber": 1,
-                "cpuspeed": 100, # in MHz
-                "memory": 128, # In MBs
-            },
-            "service_offering_without_ha": {
-                "name": "Tiny Instance Without HA",
-                "displaytext": "Tiny Instance",
-                "cpunumber": 1,
-                "cpuspeed": 100, # in MHz
-                "memory": 128, # In MBs
-            },
-            "virtual_machine": {
-                "displayname": "VM",
-                "username": "root",
-                "password": "password",
-                "ssh_port": 22,
-                "hypervisor": 'XenServer',
-                # Hypervisor type should be same as
-                # hypervisor type of cluster
-                "privateport": 22,
-                "publicport": 22,
-                "protocol": 'TCP',
-            },
-            "ostype": 'CentOS 5.3 (64-bit)',
-            "timeout": 100,
-        }
-
-
-class TestHostHighAvailability(cloudstackTestCase):
-    """ Dedicated host HA test cases """
-
-    @classmethod
-    def setUpClass(cls):
-        cls.api_client = super(
-            TestHostHighAvailability,
-            cls
-        ).getClsTestClient().getApiClient()
-        cls.services = Services().services
-        # Get Zone, Domain and templates
-        cls.domain = get_domain(
-            cls.api_client,
-            cls.services
-        )
-        cls.zone = get_zone(
-            cls.api_client,
-            cls.services
-        )
-
-        cls.template = get_template(
-            cls.api_client,
-            cls.zone.id,
-            cls.services["ostype"]
-        )
-        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
-        cls.services["virtual_machine"]["template"] = cls.template.id
-
-        cls.service_offering_with_ha = ServiceOffering.create(
-            cls.api_client,
-            cls.services["service_offering_with_ha"],
-            offerha=True
-        )
-
-        cls.service_offering_without_ha = ServiceOffering.create(
-            cls.api_client,
-            cls.services["service_offering_without_ha"],
-            offerha=False
-        )
-
-        cls._cleanup = [
-            cls.service_offering_with_ha,
-            cls.service_offering_without_ha,
-        ]
-        return
-
-    @classmethod
-    def tearDownClass(cls):
-        try:
-            #Cleanup resources used
-            cleanup_resources(cls.api_client, cls._cleanup)
-        except Exception as e:
-            raise Exception("Warning: Exception during cleanup : %s" % e)
-        return
-
-    def setUp(self):
-        self.apiclient = self.testClient.getApiClient()
-        self.dbclient = self.testClient.getDbConnection()
-        self.account = Account.create(
-            self.apiclient,
-            self.services["account"],
-            admin=True,
-            domainid=self.domain.id
-        )
-        self.cleanup = [self.account]
-        return
-
-    def tearDown(self):
-        try:
-            #Clean up, terminate the created accounts, domains etc
-            cleanup_resources(self.apiclient, self.cleanup)
-        except Exception as e:
-            raise Exception("Warning: Exception during cleanup : %s" % e)
-        return
-
-    @attr(configuration="ha.tag")
-    @attr(tags=["advanced", "advancedns", "sg", "basic", "eip", "simulator"])
-    def test_01_vm_deployment_with_compute_offering_with_ha_enabled(self):
-        """ Test VM deployments (Create HA enabled Compute Service Offering and VM) """
-
-        # Steps,
-        #1. Create a Compute service offering with the 'Offer HA' option selected.
-        #2. Create a Guest VM with the compute service offering created above.
-        # Validations,
-        #1. Ensure that the offering is created and that in the UI the 'Offer HA' field is enabled (Yes)
-        #The listServiceOffering API should list 'offerha' as true.
-        #2. Select the newly created VM and ensure that the Compute offering field value lists the compute service offering that was selected. 
-        #    Also, check that the HA Enabled field is enabled 'Yes'.
-
-        #list and validate above created service offering with Ha enabled
-        list_service_response = list_service_offering(
-            self.apiclient,
-            id=self.service_offering_with_ha.id
-        )
-        self.assertEqual(
-            isinstance(list_service_response, list),
-            True,
-            "listServiceOfferings returned invalid object in response."
-        )
-        self.assertNotEqual(
-            len(list_service_response),
-            0,
-            "listServiceOfferings returned empty list."
-        )
-        self.assertEqual(
-            list_service_response[0].offerha,
-            True,
-            "The service offering is not HA enabled"
-        )
-
-        #create virtual machine with the service offering with Ha enabled
-        virtual_machine = VirtualMachine.create(
-            self.apiclient,
-            self.services["virtual_machine"],
-            accountid=self.account.name,
-            domainid=self.account.domainid,
-            serviceofferingid=self.service_offering_with_ha.id
-        )
-        vms = VirtualMachine.list(
-            self.apiclient,
-            id=virtual_machine.id,
-            listall=True
-        )
-        self.assertEqual(
-            isinstance(vms, list),
-            True,
-            "listVirtualMachines returned invalid object in response."
-        )
-        self.assertNotEqual(
-            len(vms),
-            0,
-            "listVirtualMachines returned empty list."
-        )
-        self.debug("Deployed VM on host: %s" % vms[0].hostid)
-        self.assertEqual(
-            vms[0].haenable,
-            True,
-            "VM not created with HA enable tag"
-        )
-
-    @attr(configuration="ha.tag")
-    @attr(tags=["advanced", "advancedns", "sg", "basic", "eip", "simulator", "multihost"])
-    def test_02_no_vm_creation_on_host_with_haenabled(self):
-        """ Verify you can not create new VMs on hosts with an ha.tag """
-
-        # Steps,
-        #1. Fresh install CS (Bonita) that supports this feature
-        #2. Create Basic zone, pod, cluster, add 3 hosts to cluster (host1, host2, host3), secondary & primary Storage
-        #3. When adding host3, assign the HA host tag.
-        #4. You should already have a compute service offering with HA already create from above. If not, create one for HA.
-        #5. Create VMs with the service offering with and without the HA tag
-        # Validations,
-        #Check to make sure the newly created VM is not on any HA enabled hosts
-        #The  VM should be created only on host1 or host2 and never host3 (HA enabled)
-
-        #create and verify virtual machine with HA enabled service offering
-        virtual_machine_with_ha = VirtualMachine.create(
-            self.apiclient,
-            self.services["virtual_machine"],
-            accountid=self.account.name,
-            domainid=self.account.domainid,
-            serviceofferingid=self.service_offering_with_ha.id
-        )
-
-        vms = VirtualMachine.list(
-            self.apiclient,
-            id=virtual_machine_with_ha.id,
-            listall=True
-        )
-
-        self.assertEqual(
-            isinstance(vms, list),
-            True,
-            "listVirtualMachines returned invalid object in response."
-        )
-
-        self.assertNotEqual(
-            len(vms),
-            0,
-            "listVirtualMachines returned empty list."
-        )
-
-        vm = vms[0]
-
-        self.debug("Deployed VM on host: %s" % vm.hostid)
-
-        #validate the virtual machine created is host Ha enabled 
-        list_hosts_response = list_hosts(
-            self.apiclient,
-            id=vm.hostid
-        )
-        self.assertEqual(
-            isinstance(list_hosts_response, list),
-            True,
-            "listHosts returned invalid object in response."
-        )
-
-        self.assertNotEqual(
-            len(list_hosts_response),
-            0,
-            "listHosts retuned empty list in response."
-        )
-
-        self.assertEqual(
-            list_hosts_response[0].hahost,
-            False,
-            "VM created on HA enabled host."
-        )
-
-        #create and verify virtual machine with Ha disabled service offering
-        virtual_machine_without_ha = VirtualMachine.create(
-            self.apiclient,
-            self.services["virtual_machine"],
-            accountid=self.account.name,
-            domainid=self.account.domainid,
-            serviceofferingid=self.service_offering_without_ha.id
-        )
-
-        vms = VirtualMachine.list(
-            self.apiclient,
-            id=virtual_machine_without_ha.id,
-            listall=True
-        )
-
-        self.assertEqual(
-            isinstance(vms, list),
-            True,
-            "listVirtualMachines returned invalid object in response."
-        )
-
-        self.assertNotEqual(
-            len(vms),
-            0,
-            "listVirtualMachines returned empty list."
-        )
-
-        vm = vms[0]
-
-        self.debug("Deployed VM on host: %s" % vm.hostid)
-
-        #verify that the virtual machine created on the host is Ha disabled
-        list_hosts_response = list_hosts(
-            self.apiclient,
-            id=vm.hostid
-        )
-        self.assertEqual(
-            isinstance(list_hosts_response, list),
-            True,
-            "listHosts returned invalid object in response."
-        )
-
-        self.assertNotEqual(
-            len(list_hosts_response),
-            0,
-            "listHosts returned empty list."
-        )
-
-        host = list_hosts_response[0]
-
-        self.assertEqual(
-            host.hahost,
-            False,
-            "VM migrated to HA enabled host."
-        )
-
-    @attr(configuration="ha.tag")
-    @attr(tags=["advanced", "advancedns", "sg", "basic", "eip", "simulator", "multihost"])
-    def test_03_cant_migrate_vm_to_host_with_ha_positive(self):
-        """ Verify you can not migrate VMs to hosts with an ha.tag (positive) """
-
-        # Steps,
-        #1. Create a Compute service offering with the 'Offer HA' option selected.
-        #2. Create a Guest VM with the compute service offering created above.
-        #3. Select the VM and migrate VM to another host. Choose a 'Suitable' host (i.e. host2)
-        # Validations
-        #The option from the 'Migrate instance to another host' dialog box' should list host3 as 'Not Suitable' for migration.
-        #Confirm that the VM is migrated to the 'Suitable' host you selected (i.e. host2)
-
-        #create and verify the virtual machine with HA enabled service offering
-        virtual_machine_with_ha = VirtualMachine.create(
-            self.apiclient,
-            self.services["virtual_machine"],
-            accountid=self.account.name,
-            domainid=self.account.domainid,
-            serviceofferingid=self.service_offering_with_ha.id
-        )
-
-        vms = VirtualMachine.list(
-            self.apiclient,
-            id=virtual_machine_with_ha.id,
-            listall=True,
-        )
-
-        self.assertEqual(
-            isinstance(vms, list),
-            True,
-            "List VMs should return valid response for deployed VM"
-        )
-
-        self.assertNotEqual(
-            len(vms),
-            0,
-            "List VMs should return valid response for deployed VM"
-        )
-
-        vm = vms[0]
-
-        self.debug("Deployed VM on host: %s" % vm.hostid)
-
-        #Find out a Suitable host for VM migration
-        list_hosts_response = list_hosts(
-            self.apiclient,
-        )
-        self.assertEqual(
-            isinstance(list_hosts_response, list),
-            True,
-            "The listHosts API returned the invalid list"
-        )
-
-        self.assertNotEqual(
-            len(list_hosts_response),
-            0,
-            "The listHosts returned nothing."
-        )
-        suitableHost = None
-        for host in list_hosts_response:
-            if host.suitableformigration == True and host.hostid != vm.hostid:
-                suitableHost = host
-                break
-
-        self.assertTrue(suitableHost is not None, "suitablehost should not be None")
-
-        #Migration of the VM to a suitable host
-        self.debug("Migrating VM-ID: %s to Host: %s" % (self.vm.id, suitableHost.id))
-
-        cmd = migrateVirtualMachine.migrateVirtualMachineCmd()
-        cmd.hostid = suitableHost.id
-        cmd.virtualmachineid = self.vm.id
-        self.apiclient.migrateVirtualMachine(cmd)
-
-        #Verify that the VM migrated to a targeted Suitable host
-        list_vm_response = list_virtual_machines(
-            self.apiclient,
-            id=vm.id
-        )
-        self.assertEqual(
-            isinstance(list_vm_response, list),
-            True,
-            "The listVirtualMachines returned the invalid list."
-        )
-
-        self.assertNotEqual(
-            list_vm_response,
-            None,
-            "The listVirtualMachines API returned nothing."
-        )
-
-        vm_response = list_vm_response[0]
-
-        self.assertEqual(
-            vm_response.id,
-            vm.id,
-            "The virtual machine id and the the virtual machine from listVirtualMachines is not matching."
-        )
-
-        self.assertEqual(
-            vm_response.hostid,
-            suitableHost.id,
-            "The VM is not migrated to targeted suitable host."
-        )
-
-    @attr(configuration="ha.tag")
-    @attr(tags=["advanced", "advancedns", "sg", "basic", "eip", "simulator", "multihost"])
-    def test_04_cant_migrate_vm_to_host_with_ha_negative(self):
-        """ Verify you can not migrate VMs to hosts with an ha.tag (negative) """
-
-        # Steps,
-        #1. Create a Compute service offering with the 'Offer HA' option selected.
-        #2. Create a Guest VM with the compute service offering created above.
-        #3. Select the VM and migrate VM to another host. Choose a 'Not Suitable' host.
-        # Validations,
-        #The option from the 'Migrate instance to another host' dialog box should list host3 as 'Not Suitable' for migration.
-        #By design, The Guest VM can STILL can be migrated to host3 if the admin chooses to do so.
-
-        #create and verify virtual machine with HA enabled service offering
-        virtual_machine_with_ha = VirtualMachine.create(
-            self.apiclient,
-            self.services["virtual_machine"],
-            accountid=self.account.name,
-            domainid=self.account.domainid,
-            serviceofferingid=self.service_offering_with_ha.id
-        )
-
-        vms = VirtualMachine.list(
-            self.apiclient,
-            id=virtual_machine_with_ha.id,
-            listall=True
-        )
-
-        self.assertEqual(
-            isinstance(vms, list),
-            True,
-            "The listVirtualMachines returned invalid object in response."
-        )
-
-        self.assertNotEqual(
-            len(vms),
-            0,
-            "The listVirtualMachines returned empty response."
-        )
-
-        vm = vms[0]
-
-        self.debug("Deployed VM on host: %s" % vm.hostid)
-
-        #Find out Non-Suitable host for VM migration
-        list_hosts_response = list_hosts(
-            self.apiclient,
-        )
-        self.assertEqual(
-            isinstance(list_hosts_response, list),
-            True,
-            "listHosts returned invalid object in response."
-        )
-
-        self.assertNotEqual(
-            len(list_hosts_response),
-            0,
-            "listHosts returned empty response."
-        )
-
-        notSuitableHost = None
-        for host in list_hosts_response:
-            if not host.suitableformigration and host.hostid != vm.hostid:
-                notSuitableHost = host
-                break
-
-        self.assertTrue(notSuitableHost is not None, "notsuitablehost should not be None")
-
-        #Migrate VM to Non-Suitable host
-        self.debug("Migrating VM-ID: %s to Host: %s" % (vm.id, notSuitableHost.id))
-
-        cmd = migrateVirtualMachine.migrateVirtualMachineCmd()
-        cmd.hostid = notSuitableHost.id
-        cmd.virtualmachineid = vm.id
-        self.apiclient.migrateVirtualMachine(cmd)
-
-        #Verify that the virtual machine got migrated to targeted Non-Suitable host
-        list_vm_response = list_virtual_machines(
-            self.apiclient,
-            id=vm.id
-        )
-        self.assertEqual(
-            isinstance(list_vm_response, list),
-            True,
-            "listVirtualMachine returned invalid object in response."
-        )
-
-        self.assertNotEqual(
-            len(list_vm_response),
-            0,
-            "listVirtualMachines returned empty response."
-        )
-
-        self.assertEqual(
-            list_vm_response[0].id,
-            vm.id,
-            "Virtual machine id with the virtual machine from listVirtualMachine is not matching."
-        )
-
-        self.assertEqual(
-            list_vm_response[0].hostid,
-            notSuitableHost.id,
-            "The detination host id of migrated VM is not matching."
-        )
-
-    @attr(configuration="ha.tag")
-    @attr(speed="slow")
-    @attr(tags=["advanced", "advancedns", "sg", "basic", "eip", "simulator", "multihost"])
-    def test_05_no_vm_with_ha_gets_migrated_to_ha_host_in_live_migration(self):
-        """ Verify that none of the VMs with HA enabled migrate to an ha tagged host during live migration """
-
-        # Steps,
-        #1. Fresh install CS that supports this feature
-        #2. Create Basic zone, pod, cluster, add 3 hosts to cluster (host1, host2, host3), secondary & primary Storage
-        #3. When adding host3, assign the HA host tag.
-        #4. Create VMs with and without the Compute Service Offering with the HA tag.
-        #5. Note the VMs on host1 and whether any of the VMs have their 'HA enabled' flags enabled.
-        #6. Put host1 into maintenance mode.
-        # Validations,
-        #1. Make sure the VMs are created on either host1 or host2 and not on host3
-        #2. Putting host1 into maintenance mode should trigger a live migration. Make sure the VMs are not migrated to HA enabled host3.
-
-        # create and verify virtual machine with HA disabled service offering
-        virtual_machine_with_ha = VirtualMachine.create(
-            self.apiclient,
-            self.services["virtual_machine"],
-            accountid=self.account.name,
-            domainid=self.account.domainid,
-            serviceofferingid=self.service_offering_with_ha.id
-        )
-
-        vms = VirtualMachine.list(
-            self.apiclient,
-            id=virtual_machine_with_ha.id,
-            listall=True
-        )
-
-        self.assertEqual(
-            isinstance(vms, list),
-            True,
-            "List VMs should return valid response for deployed VM"
-        )
-
-        self.assertNotEqual(
-            len(vms),
-            0,
-            "List VMs should return valid response for deployed VM"
-        )
-
-        vm_with_ha_enabled = vms[0]
-
-        #Verify the virtual machine got created on non HA host 
-        list_hosts_response = list_hosts(
-            self.apiclient,
-            id=vm_with_ha_enabled.hostid
-        )
-        self.assertEqual(
-            isinstance(list_hosts_response, list),
-            True,
-            "Check list response returns a valid list"
-        )
-
-        self.assertNotEqual(
-            len(list_hosts_response),
-            0,
-            "Check Host is available"
-        )
-
-        self.assertEqual(
-            list_hosts_response[0].hahost,
-            False,
-            "The virtual machine is not ha enabled so check if VM is created on host which is also not ha enabled"
-        )
-
-        #put the Host in maintainance mode
-        self.debug("Enabling maintenance mode for host %s" % vm_with_ha_enabled.hostid)
-        cmd = prepareHostForMaintenance.prepareHostForMaintenanceCmd()
-        cmd.id = vm_with_ha_enabled.hostid
-        self.apiclient.prepareHostForMaintenance(cmd)
-
-        timeout = self.services["timeout"]
-
-        #verify the VM live migration happened to another running host
-        self.debug("Waiting for VM to come up")
-        wait_for_vm(
-            self.apiclient,
-            virtualmachineid=vm_with_ha_enabled.id,
-            interval=timeout
-        )
-
-        vms = VirtualMachine.list(
-            self.apiclient,
-            id=vm_with_ha_enabled.id,
-            listall=True,
-        )
-
-        self.assertEqual(
-            isinstance(vms, list),
-            True,
-            "List VMs should return valid response for deployed VM"
-        )
-
-        self.assertNotEqual(
-            len(vms),
-            0,
-            "List VMs should return valid response for deployed VM"
-        )
-
-        vm_with_ha_enabled1 = vms[0]
-
-        list_hosts_response = list_hosts(
-            self.apiclient,
-            id=vm_with_ha_enabled1.hostid
-        )
-        self.assertEqual(
-            isinstance(list_hosts_response, list),
-            True,
-            "Check list response returns a valid list"
-        )
-
-        self.assertNotEqual(
-            len(list_hosts_response),
-            0,
-            "Check Host is available"
-        )
-
-        self.assertEqual(
-            list_hosts_response[0].hahost,
-            False,
-            "The virtual machine is not ha enabled so check if VM is created on host which is also not ha enabled"
-        )
-
-        self.debug("Disabling the maintenance mode for host %s" % vm_with_ha_enabled.hostid)
-        cmd = cancelHostMaintenance.cancelHostMaintenanceCmd()
-        cmd.id = vm_with_ha_enabled.hostid
-        self.apiclient.cancelHostMaintenance(cmd)
-
-    @attr(configuration="ha.tag")
-    @attr(speed="slow")
-    @attr(tags=["advanced", "advancedns", "sg", "basic", "eip", "simulator", "multihost"])
-    def test_06_no_vm_without_ha_gets_migrated_to_ha_host_in_live_migration(self):
-        """ Verify that none of the VMs without HA enabled migrate to an ha tagged host during live migration """
-
-        # Steps,
-        #1. Fresh install CS that supports this feature
-        #2. Create Basic zone, pod, cluster, add 3 hosts to cluster (host1, host2, host3), secondary & primary Storage
-        #3. When adding host3, assign the HA host tag.
-        #4. Create VMs with and without the Compute Service Offering with the HA tag.
-        #5. Note the VMs on host1 and whether any of the VMs have their 'HA enabled' flags enabled.
-        #6. Put host1 into maintenance mode.
-        # Validations,
-        #1. Make sure the VMs are created on either host1 or host2 and not on host3
-        #2. Putting host1 into maintenance mode should trigger a live migration. Make sure the VMs are not migrated to HA enabled host3.
-
-        # create and verify virtual machine with HA disabled service offering
-        virtual_machine_without_ha = VirtualMachine.create(
-            self.apiclient,
-            self.services["virtual_machine"],
-            accountid=self.account.name,
-            domainid=self.account.domainid,
-            serviceofferingid=self.service_offering_without_ha.id
-        )
-
-        vms = VirtualMachine.list(
-            self.apiclient,
-            id=virtual_machine_without_ha.id,
-            listall=True
-        )
-
-        self.assertEqual(
-            isinstance(vms, list),
-            True,
-            "List VMs should return valid response for deployed VM"
-        )
-
-        self.assertNotEqual(
-            len(vms),
-            0,
-            "List VMs should return valid response for deployed VM"
-        )
-
-        vm_with_ha_disabled = vms[0]
-
-        #Verify the virtual machine got created on non HA host 
-        list_hosts_response = list_hosts(
-            self.apiclient,
-            id=vm_with_ha_disabled.hostid
-        )
-        self.assertEqual(
-            isinstance(list_hosts_response, list),
-            True,
-            "Check list response returns a valid list"
-        )
-
-        self.assertNotEqual(
-            len(list_hosts_response),
-            0,
-            "Check Host is available"
-        )
-
-        self.assertEqual(
-            list_hosts_response[0].hahost,
-            False,
-            "The virtual machine is not ha enabled so check if VM is created on host which is also not ha enabled"
-        )
-
-        #put the Host in maintainance mode
-        self.debug("Enabling maintenance mode for host %s" % vm_with_ha_disabled.hostid)
-        cmd = prepareHostForMaintenance.prepareHostForMaintenanceCmd()
-        cmd.id = vm_with_ha_disabled.hostid
-        self.apiclient.prepareHostForMaintenance(cmd)
-
-        timeout = self.services["timeout"]
-
-        #verify the VM live migration happened to another running host
-        self.debug("Waiting for VM to come up")
-        wait_for_vm(
-            self.apiclient,
-            virtualmachineid=vm_with_ha_disabled.id,
-            interval=timeout
-        )
-
-        vms = VirtualMachine.list(
-            self.apiclient,
-            id=vm_with_ha_disabled.id,
-            listall=True
-        )
-
-        self.assertEqual(
-            isinstance(vms, list),
-            True,
-            "List VMs should return valid response for deployed VM"
-        )
-
-        self.assertNotEqual(
-            len(vms),
-            0,
-            "List VMs should return valid response for deployed VM"
-        )
-
-        list_hosts_response = list_hosts(
-            self.apiclient,
-            id=vms[0].hostid
-        )
-        self.assertEqual(
-            isinstance(list_hosts_response, list),
-            True,
-            "Check list response returns a valid list"
-        )
-
-        self.assertNotEqual(
-            len(list_hosts_response),
-            0,
-            "Check Host is available"
-        )
-
-        self.assertEqual(
-            list_hosts_response[0].hahost,
-            False,
-            "The virtual machine is not ha enabled so check if VM is created on host which is also not ha enabled"
-        )
-
-        self.debug("Disabling the maintenance mode for host %s" % vm_with_ha_disabled.hostid)
-        cmd = cancelHostMaintenance.cancelHostMaintenanceCmd()
-        cmd.id = vm_with_ha_disabled.hostid
-        self.apiclient.cancelHostMaintenance(cmd)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0587d3a4/test/integration/component/test_vpc.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc.py b/test/integration/component/test_vpc.py
index 3fc0cc5..acf7a8e 100644
--- a/test/integration/component/test_vpc.py
+++ b/test/integration/component/test_vpc.py
@@ -18,16 +18,12 @@
 """ Component tests for VPC functionality
 """
 #Import Local Modules
-import marvin
-import unittest
 from nose.plugins.attrib import attr
 from marvin.cloudstackTestCase import *
 from marvin.cloudstackAPI import *
 from marvin.integration.lib.utils import *
 from marvin.integration.lib.base import *
 from marvin.integration.lib.common import *
-from marvin.remoteSSHClient import remoteSSHClient
-import datetime
 
 
 class Services:
@@ -331,7 +327,7 @@ class TestVPC(cloudstackTestCase):
 
     @attr(tags=["advanced", "intervlan"])
     def test_02_restart_vpc_with_networks(self):
-        """ Test restart VPC having with networks
+        """ Test restart VPC having networks
         """
 
         # Validate the following
@@ -2474,250 +2470,4 @@ class TestVPC(cloudstackTestCase):
              "Updation of VPC display text failed.")
 
 
-class TestVPCHostMaintenance(cloudstackTestCase):
 
-    @classmethod
-    def setUpClass(cls):
-        cls.api_client = super(
-                               TestVPCHostMaintenance,
-                               cls
-                               ).getClsTestClient().getApiClient()
-        cls.services = Services().services
-        # Get Zone, Domain and templates
-        cls.domain = get_domain(cls.api_client, cls.services)
-        cls.zone = get_zone(cls.api_client, cls.services)
-        cls.template = get_template(
-                            cls.api_client,
-                            cls.zone.id,
-                            cls.services["ostype"]
-                            )
-        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
-        cls.services["virtual_machine"]["template"] = cls.template.id
-
-        cls.service_offering = ServiceOffering.create(
-                                            cls.api_client,
-                                            cls.services["service_offering"]
-                                            )
-        cls.vpc_off = VpcOffering.create(
-                                     cls.api_client,
-                                     cls.services["vpc_offering"]
-                                     )
-        cls.vpc_off.update(cls.api_client, state='Enabled')
-        hosts = Host.list(
-                          cls.api_client,
-                          zoneid=cls.zone.id,
-                          listall=True,
-                          type='Routing'
-                          )
-
-        if isinstance(hosts, list):
-            for host in hosts:
-                Host.enableMaintenance(
-                                   cls.api_client,
-                                   id=host.id
-                                   )
-
-                timeout = cls.services["timeout"]
-                while True:
-                    time.sleep(cls.services["sleep"])
-                    hosts_states = Host.list(
-                                     cls.api_client,
-                                     id=host.id,
-                                     listall=True
-                                     )
-                    if hosts_states[0].resourcestate == 'PrepareForMaintenance':
-                        # Wait for sometimetill host goes in maintenance state
-                        time.sleep(cls.services["sleep"])
-                    elif hosts_states[0].resourcestate == 'Maintenance':
-                        time.sleep(cls.services["sleep"])
-                        break
-                    elif timeout == 0:
-                        raise unittest.SkipTest(
-                        "Failed to enable maintenance mode on %s" % host.name)
-                    timeout = timeout - 1
-
-        cls._cleanup = [
-                        cls.service_offering,
-                        cls.vpc_off
-                        ]
-        return
-
-    @classmethod
-    def tearDownClass(cls):
-        try:
-            #Cleanup resources used
-            cleanup_resources(cls.api_client, cls._cleanup)
-            hosts = Host.list(
-                          cls.api_client,
-                          zoneid=cls.zone.id,
-                          listall=True,
-                          type='Routing'
-                          )
-            if isinstance(hosts, list):
-                for host in hosts:
-                    Host.cancelMaintenance(
-                                   cls.api_client,
-                                   id=host.id
-                                   )
-                hosts_states = Host.list(
-                                     cls.api_client,
-                                     id=host.id,
-                                     listall=True
-                                     )
-                if hosts_states[0].resourcestate != 'Enabled':
-                    raise Exception(
-                    "Failed to cancel maintenance mode on %s" % (host.name))
-        except Exception as e:
-            raise Exception("Warning: Exception during cleanup : %s" % e)
-        return
-
-    def setUp(self):
-        self.apiclient = self.testClient.getApiClient()
-        self.dbclient = self.testClient.getDbConnection()
-        self.account = Account.create(
-                                     self.apiclient,
-                                     self.services["account"],
-                                     admin=True,
-                                     domainid=self.domain.id
-                                     )
-        self.cleanup = [self.account]
-        return
-
-    def tearDown(self):
-        try:
-            #Clean up, terminate the created network offerings
-            cleanup_resources(self.apiclient, self.cleanup)
-            interval = list_configurations(
-                                    self.apiclient,
-                                    name='network.gc.interval'
-                                    )
-            wait = list_configurations(
-                                    self.apiclient,
-                                    name='network.gc.wait'
-                                   )
-            # Sleep to ensure that all resources are deleted
-            time.sleep(int(interval[0].value) + int(wait[0].value))
-        except Exception as e:
-            raise Exception("Warning: Exception during cleanup : %s" % e)
-        return
-
-    def validate_vpc_offering(self, vpc_offering):
-        """Validates the VPC offering"""
-
-        self.debug("Check if the VPC offering is created successfully?")
-        vpc_offs = VpcOffering.list(
-                                    self.apiclient,
-                                    id=vpc_offering.id
-                                    )
-        self.assertEqual(
-                         isinstance(vpc_offs, list),
-                         True,
-                         "List VPC offerings should return a valid list"
-                         )
-        self.assertEqual(
-                 vpc_offering.name,
-                 vpc_offs[0].name,
-                "Name of the VPC offering should match with listVPCOff data"
-                )
-        self.debug(
-                "VPC offering is created successfully - %s" %
-                                                        vpc_offering.name)
-        return
-
-    def validate_vpc_network(self, network, state=None):
-        """Validates the VPC network"""
-
-        self.debug("Check if the VPC network is created successfully?")
-        vpc_networks = VPC.list(
-                                    self.apiclient,
-                                    id=network.id
-                          )
-        self.assertEqual(
-                         isinstance(vpc_networks, list),
-                         True,
-                         "List VPC network should return a valid list"
-                         )
-        self.assertEqual(
-                 network.name,
-                 vpc_networks[0].name,
-                "Name of the VPC network should match with listVPC data"
-                )
-        if state:
-            self.assertEqual(
-                 vpc_networks[0].state,
-                 state,
-                "VPC state should be '%s'" % state
-                )
-        self.debug("VPC network validated - %s" % network.name)
-        return
-
-    @attr(tags=["advanced", "intervlan"])
-    def test_01_create_vpc_host_maintenance(self):
-        """ Test VPC when host is in maintenance mode
-        """
-
-        # Validate the following
-        # 1. Put the host in maintenance mode.
-        # 2. Attempt to Create a VPC with cidr - 10.1.1.1/16
-        # 3. VPC will be created but will be in "Disabled" state
-
-        self.debug("creating a VPC network in the account: %s" %
-                                                    self.account.name)
-        self.services["vpc"]["cidr"] = '10.1.1.1/16'
-        vpc = VPC.create(
-                         self.apiclient,
-                         self.services["vpc"],
-                         vpcofferingid=self.vpc_off.id,
-                         zoneid=self.zone.id,
-                         account=self.account.name,
-                         domainid=self.account.domainid
-                         )
-        self.validate_vpc_network(vpc, state='Disabled')
-        return
-
-    @attr(tags=["advanced", "intervlan"])
-    def test_02_create_vpc_wait_gc(self):
-        """ Test VPC when host is in maintenance mode and wait till nw gc
-        """
-
-        # Validate the following
-        # 1. Put the host in maintenance mode.
-        # 2. Attempt to Create a VPC with cidr - 10.1.1.1/16
-        # 3. Wait for the VPC GC thread to run.
-        # 3. VPC will be created but will be in "Disabled" state and should
-        #    get deleted
-
-        self.debug("creating a VPC network in the account: %s" %
-                                                    self.account.name)
-        self.services["vpc"]["cidr"] = '10.1.1.1/16'
-        vpc = VPC.create(
-                         self.apiclient,
-                         self.services["vpc"],
-                         vpcofferingid=self.vpc_off.id,
-                         zoneid=self.zone.id,
-                         account=self.account.name,
-                         domainid=self.account.domainid
-                         )
-        self.validate_vpc_network(vpc, state='Disabled')
-        interval = list_configurations(
-                                    self.apiclient,
-                                    name='network.gc.interval'
-                                    )
-        wait = list_configurations(
-                                    self.apiclient,
-                                    name='network.gc.wait'
-                                   )
-        self.debug("Sleep till network gc thread runs..")
-        # Sleep to ensure that all resources are deleted
-        time.sleep(int(interval[0].value) + int(wait[0].value))
-        vpcs = VPC.list(
-                        self.apiclient,
-                        id=vpc.id,
-                        listall=True
-                        )
-        self.assertEqual(
-                         vpcs,
-                         None,
-                         "List VPC should not return anything after network gc"
-                         )
-        return

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0587d3a4/test/integration/component/test_vpc_host_maintenance.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc_host_maintenance.py b/test/integration/component/test_vpc_host_maintenance.py
deleted file mode 100644
index d28b798..0000000
--- a/test/integration/component/test_vpc_host_maintenance.py
+++ /dev/null
@@ -1,889 +0,0 @@
-# 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.
-
-""" Component tests VM life cycle in VPC network functionality
-"""
-#Import Local Modules
-import marvin
-from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import *
-from marvin.cloudstackAPI import *
-from marvin.integration.lib.utils import *
-from marvin.integration.lib.base import *
-from marvin.integration.lib.common import *
-from marvin.remoteSSHClient import remoteSSHClient
-import datetime
-
-
-class Services:
-    """Test VM life cycle in VPC network services
-    """
-
-    def __init__(self):
-        self.services = {
-                         "account": {
-                                    "email": "test@test.com",
-                                    "firstname": "Test",
-                                    "lastname": "User",
-                                    "username": "test",
-                                    # Random characters are appended for unique
-                                    # username
-                                    "password": "password",
-                                    },
-                         "service_offering": {
-                                    "name": "Tiny Instance",
-                                    "displaytext": "Tiny Instance",
-                                    "cpunumber": 1,
-                                    "cpuspeed": 100,
-                                    "memory": 64,
-                                    },
-                        "service_offering_1": {
-                                    "name": "Tiny Instance- tagged host 1",
-                                    "displaytext": "Tiny off-tagged host2",
-                                    "cpunumber": 1,
-                                    "cpuspeed": 100,
-                                    "memory": 64,
-                                    "tags": "HOST_TAGS_HERE"
-                                    },
-                         "service_offering_2": {
-                                    "name": "Tiny Instance- tagged host 2",
-                                    "displaytext": "Tiny off-tagged host2",
-                                    "cpunumber": 1,
-                                    "cpuspeed": 100,
-                                    "memory": 64,
-                                    "tags": "HOST_TAGS_HERE"
-                                    },
-                         "network_offering": {
-                                    "name": 'VPC Network offering',
-                                    "displaytext": 'VPC Network off',
-                                    "guestiptype": 'Isolated',
-                                    "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding,Lb,UserData,StaticNat,NetworkACL',
-                                    "traffictype": 'GUEST',
-                                    "availability": 'Optional',
-                                    "useVpc": 'on',
-                                    "serviceProviderList": {
-                                            "Dhcp": 'VpcVirtualRouter',
-                                            "Dns": 'VpcVirtualRouter',
-                                            "SourceNat": 'VpcVirtualRouter',
-                                            "PortForwarding": 'VpcVirtualRouter',
-                                            "Lb": 'VpcVirtualRouter',
-                                            "UserData": 'VpcVirtualRouter',
-                                            "StaticNat": 'VpcVirtualRouter',
-                                            "NetworkACL": 'VpcVirtualRouter'
-                                        },
-                                },
-                         "network_offering_no_lb": {
-                                    "name": 'VPC Network offering',
-                                    "displaytext": 'VPC Network off',
-                                    "guestiptype": 'Isolated',
-                                    "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding,UserData,StaticNat,NetworkACL',
-                                    "traffictype": 'GUEST',
-                                    "availability": 'Optional',
-                                    "useVpc": 'on',
-                                    "serviceProviderList": {
-                                            "Dhcp": 'VpcVirtualRouter',
-                                            "Dns": 'VpcVirtualRouter',
-                                            "SourceNat": 'VpcVirtualRouter',
-                                            "PortForwarding": 'VpcVirtualRouter',
-                                            "UserData": 'VpcVirtualRouter',
-                                            "StaticNat": 'VpcVirtualRouter',
-                                            "NetworkACL": 'VpcVirtualRouter'
-                                        },
-                                },
-                         "network_off_shared": {
-                                    "name": 'Shared Network offering',
-                                    "displaytext": 'Shared Network offering',
-                                    "guestiptype": 'Shared',
-                                    "traffictype": 'GUEST',
-                                    "availability": 'Optional',
-                                    "useVpc": 'on',
-                                    "specifyIpRanges": True,
-                                    "specifyVlan": True
-                                    },
-                         "vpc_offering": {
-                                    "name": 'VPC off',
-                                    "displaytext": 'VPC off',
-                                    "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding,Lb,UserData,StaticNat',
-                                },
-                         "vpc": {
-                                 "name": "TestVPC",
-                                 "displaytext": "TestVPC",
-                                 "cidr": '10.0.0.1/24'
-                                 },
-                         "network": {
-                                  "name": "Test Network",
-                                  "displaytext": "Test Network",
-                                  "netmask": '255.255.255.0',
-                                  "limit": 5,
-                                  # Max networks allowed as per hypervisor
-                                  # Xenserver -> 5, VMWare -> 9
-                                },
-                         "lbrule": {
-                                    "name": "SSH",
-                                    "alg": "leastconn",
-                                    # Algorithm used for load balancing
-                                    "privateport": 22,
-                                    "publicport": 2222,
-                                    "openfirewall": False,
-                                    "startport": 2222,
-                                    "endport": 2222,
-                                    "protocol": "TCP",
-                                    "cidrlist": '0.0.0.0/0',
-                                },
-                         "natrule": {
-                                    "privateport": 22,
-                                    "publicport": 22,
-                                    "startport": 22,
-                                    "endport": 22,
-                                    "protocol": "TCP",
-                                    "cidrlist": '0.0.0.0/0',
-                                },
-                         "fw_rule": {
-                                    "startport": 1,
-                                    "endport": 6000,
-                                    "cidr": '0.0.0.0/0',
-                                    # Any network (For creating FW rule)
-                                    "protocol": "TCP"
-                                },
-                         "http_rule": {
-                                    "startport": 80,
-                                    "endport": 80,
-                                    "cidrlist": '0.0.0.0/0',
-                                    "protocol": "ICMP"
-                                },
-                         "virtual_machine": {
-                                    "displayname": "Test VM",
-                                    "username": "root",
-                                    "password": "password",
-                                    "ssh_port": 22,
-                                    "hypervisor": 'XenServer',
-                                    # Hypervisor type should be same as
-                                    # hypervisor type of cluster
-                                    "privateport": 22,
-                                    "publicport": 22,
-                                    "protocol": 'TCP',
-                                    "userdata": 'This is sample data',
-                                },
-                         "ostype": 'CentOS 5.3 (64-bit)',
-                         # Cent OS 5.3 (64 bit)
-                         "sleep": 60,
-                         "timeout": 10,
-                         "mode": 'advanced'
-                    }
-
-
-class TestVMLifeCycleHostmaintenance(cloudstackTestCase):
-
-    @classmethod
-    def setUpClass(cls):
-        cls.api_client = super(
-                               TestVMLifeCycleHostmaintenance,
-                               cls
-                               ).getClsTestClient().getApiClient()
-        cls.services = Services().services
-        # Get Zone, Domain and templates
-        cls.domain = get_domain(cls.api_client, cls.services)
-        cls.zone = get_zone(cls.api_client, cls.services)
-        cls.template = get_template(
-                            cls.api_client,
-                            cls.zone.id,
-                            cls.services["ostype"]
-                            )
-        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
-        cls.services["virtual_machine"]["template"] = cls.template.id
-
-        cls.service_offering_1 = ServiceOffering.create(
-                                            cls.api_client,
-                                            cls.services["service_offering_1"]
-                                            )
-        cls.service_offering_2 = ServiceOffering.create(
-                                            cls.api_client,
-                                            cls.services["service_offering_2"]
-                                            )
-        cls.vpc_off = VpcOffering.create(
-                                     cls.api_client,
-                                     cls.services["vpc_offering"]
-                                     )
-        cls.vpc_off.update(cls.api_client, state='Enabled')
-
-        cls.account = Account.create(
-                                     cls.api_client,
-                                     cls.services["account"],
-                                     admin=True,
-                                     domainid=cls.domain.id
-                                     )
-
-        cls.vpc_off = VpcOffering.create(
-                                     cls.api_client,
-                                     cls.services["vpc_offering"]
-                                     )
-
-        cls.vpc_off.update(cls.api_client, state='Enabled')
-
-        cls.services["vpc"]["cidr"] = '10.1.1.1/16'
-        cls.vpc = VPC.create(
-                         cls.api_client,
-                         cls.services["vpc"],
-                         vpcofferingid=cls.vpc_off.id,
-                         zoneid=cls.zone.id,
-                         account=cls.account.name,
-                         domainid=cls.account.domainid
-                         )
-
-        cls.nw_off = NetworkOffering.create(
-                                            cls.api_client,
-                                            cls.services["network_offering"],
-                                            conservemode=False
-                                            )
-        # Enable Network offering
-        cls.nw_off.update(cls.api_client, state='Enabled')
-
-        # Creating network using the network offering created
-        cls.network_1 = Network.create(
-                                cls.api_client,
-                                cls.services["network"],
-                                accountid=cls.account.name,
-                                domainid=cls.account.domainid,
-                                networkofferingid=cls.nw_off.id,
-                                zoneid=cls.zone.id,
-                                gateway='10.1.1.1',
-                                vpcid=cls.vpc.id
-                                )
-        cls.nw_off_no_lb = NetworkOffering.create(
-                                    cls.api_client,
-                                    cls.services["network_offering_no_lb"],
-                                    conservemode=False
-                                    )
-        # Enable Network offering
-        cls.nw_off_no_lb.update(cls.api_client, state='Enabled')
-
-        # Creating network using the network offering created
-        cls.network_2 = Network.create(
-                                cls.api_client,
-                                cls.services["network"],
-                                accountid=cls.account.name,
-                                domainid=cls.account.domainid,
-                                networkofferingid=cls.nw_off_no_lb.id,
-                                zoneid=cls.zone.id,
-                                gateway='10.1.2.1',
-                                vpcid=cls.vpc.id
-                                )
-        # Spawn an instance in that network
-        cls.vm_1 = VirtualMachine.create(
-                                  cls.api_client,
-                                  cls.services["virtual_machine"],
-                                  accountid=cls.account.name,
-                                  domainid=cls.account.domainid,
-                                  serviceofferingid=cls.service_offering_1.id,
-                                  networkids=[str(cls.network_1.id)]
-                                  )
-        # Spawn an instance in that network
-        cls.vm_2 = VirtualMachine.create(
-                                  cls.api_client,
-                                  cls.services["virtual_machine"],
-                                  accountid=cls.account.name,
-                                  domainid=cls.account.domainid,
-                                  serviceofferingid=cls.service_offering_1.id,
-                                  networkids=[str(cls.network_1.id)]
-                                  )
-        cls.vm_3 = VirtualMachine.create(
-                                  cls.api_client,
-                                  cls.services["virtual_machine"],
-                                  accountid=cls.account.name,
-                                  domainid=cls.account.domainid,
-                                  serviceofferingid=cls.service_offering_2.id,
-                                  networkids=[str(cls.network_2.id)]
-                                  )
-        routers = Router.list(
-                              cls.api_client,
-                              account=cls.account.name,
-                              domainid=cls.account.domainid,
-                              listall=True
-                              )
-        if isinstance(routers, list):
-            cls.vpcvr = routers[0]
-
-        cls._cleanup = [
-                        cls.service_offering_1,
-                        cls.service_offering_2,
-                        cls.nw_off,
-                        cls.nw_off_no_lb,
-                        ]
-        return
-
-    @classmethod
-    def tearDownClass(cls):
-        try:
-            cls.account.delete(cls.api_client)
-            wait_for_cleanup(cls.api_client, ["account.cleanup.interval"])
-            #Cleanup resources used
-            cleanup_resources(cls.api_client, cls._cleanup)
-
-            # Waiting for network cleanup to delete vpc offering
-            wait_for_cleanup(cls.api_client, ["network.gc.wait",
-                                              "network.gc.interval"])
-            cls.vpc_off.delete(cls.api_client)
-        except Exception as e:
-            raise Exception("Warning: Exception during cleanup : %s" % e)
-        return
-
-    def setUp(self):
-
-        self.apiclient = self.testClient.getApiClient()
-        self.dbclient = self.testClient.getDbConnection()
-        self.debug("Check the status of VPC virtual router")
-        routers = Router.list(
-                              self.apiclient,
-                              networkid=self.network_1.id,
-                              listall=True
-                              )
-        if not isinstance(routers, list):
-            raise Exception("No response from list routers API")
-
-        self.router = routers[0]
-        if self.router.state == "Running":
-            Router.stop(self.apiclient, id=self.router.id)
-
-        self.cleanup = []
-        return
-
-    def tearDown(self):
-        try:
-            #Clean up, terminate the created network offerings
-            cleanup_resources(self.apiclient, self.cleanup)
-        except Exception as e:
-            raise Exception("Warning: Exception during cleanup : %s" % e)
-        return
-
-    def validate_vm_deployment(self):
-        """Validates VM deployment on different hosts"""
-
-        vms = VirtualMachine.list(
-                                  self.apiclient,
-                                  account=self.account.name,
-                                  domainid=self.account.domainid,
-                                  networkid=self.network_1.id,
-                                  listall=True
-                                  )
-        self.assertEqual(
-                         isinstance(vms, list),
-                         True,
-                         "List VMs shall return a valid response"
-                         )
-        host_1 = vms[0].hostid
-        self.debug("Host for network 1: %s" % vms[0].hostid)
-
-        vms = VirtualMachine.list(
-                                  self.apiclient,
-                                  account=self.account.name,
-                                  domainid=self.account.domainid,
-                                  networkid=self.network_2.id,
-                                  listall=True
-                                  )
-        self.assertEqual(
-                         isinstance(vms, list),
-                         True,
-                         "List VMs shall return a valid response"
-                         )
-        host_2 = vms[0].hostid
-        self.debug("Host for network 2: %s" % vms[0].hostid)
-
-        self.assertNotEqual(
-                host_1,
-                host_2,
-                "Both the virtual machines should be deployed on diff hosts "
-                )
-        return
-
-    @attr(tags=["advanced", "intervlan"])
-    def test_01_enable_maintenance_with_vpc_nw(self):
-        """ Test enable Maintenance Mode on Hosts which have VPC elements
-        """
-
-        # Validate the following
-        # 1. Create a VPC with cidr - 10.1.1.1/16
-        # 2. Add network1(10.1.1.1/24) and network2(10.1.2.1/24) to this VPC.
-        # 3. Deploy vm1 and vm2 in network1 and vm3 and vm4 in network2. Make
-        #    sure vm1 and vm3 are deployed on one host in the cluster while
-        #    vm2 and vm4 are deployed on the other host in the cluster. This
-        #    can be done using host's tags & service offerings with host tags
-        # Steps:
-        # 1.Enable Maintenance on one of host on which VPCVR is present
-        # Validations:
-        # 1. Successfully push the host into maintenance mode.
-        # 2. VMs present on the above host should successfully migrate to the
-        #    other host present in the cluster
-
-        self.validate_vm_deployment()
-        self.debug("Stop the host on which the VPC virtual router is running")
-        try:
-            Host.enableMaintenance(self.apiclient, id=self.vpcvr.hostid)
-        except Exception as e:
-            self.fail("Failed to enable maintenance mode on host: %s" % e)
-
-        self.debug(
-            "Check if all instances belonging to the account are up again?")
-        routers = Router.list(
-                              self.apiclient,
-                              account=self.account.name,
-                              domainid=self.account.domainid,
-                              listall=True
-                              )
-        self.assertEqual(
-                         isinstance(routers, list),
-                         True,
-                         "List routers shall return a valid VPCVR for account"
-                         )
-        for router in routers:
-            self.assertEqual(
-                             router.state,
-                             "Running",
-                             "Router state should be running after migration"
-                             )
-        vms = VirtualMachine.list(
-                                  self.apiclient,
-                                  account=self.account.name,
-                                  domainid=self.account.domainid,
-                                  listall=True
-                                  )
-        self.assertEqual(
-                    isinstance(vms, list),
-                    True,
-                    "VM response should return instances running for account"
-                    )
-        for vm in vms:
-            self.assertEqual(
-                             vm.state,
-                             "Ruuning",
-                             "Vm state should be running after migration"
-                             )
-        return
-
-    @attr(tags=["advanced", "intervlan"])
-    def test_02_cancel_maintenance(self):
-        """ Test cancel Maintenance Mode on the above Hosts + Migrate VMs Back
-        """
-
-        # Steps
-        # 1. Cancel Maintenance Mode on the host.
-        # 2. Migrate the VMs back onto the host on which Maintenance mode is
-        #    cancelled.
-        # Validate the following
-        # 1. Successfully cancel the Maintenance mode on the host.
-        # 2. Migrate the VMs back successfully onto the host.
-        # 3. Check that the network connectivity exists with the migrated VMs.
-
-        self.debug("Cancel host maintenence on which the VPCVR is running")
-        try:
-            Host.cancelMaintenance(self.apiclient, id=self.vpcvr.hostid)
-        except Exception as e:
-            self.fail("Failed to enable maintenance mode on host: %s" % e)
-
-        self.debug(
-            "Migrating the instances back to the host: %s" %
-                                                        self.vpcvr.hostid)
-        try:
-            cmd = migrateSystemVm.migrateSystemVmCmd()
-            cmd.hostid = self.vpcvr.hostid
-            cmd.virtualmachineid = self.vpcvr.id
-            self.apiclient.migrateSystemVm(cmd)
-        except Exception as e:
-            self.fail("Failed to migrate VPCVR back: %s" % e)
-
-        self.debug("Check the status of router after migration")
-        routers = Router.list(
-                              self.apiclient,
-                              id=self.vpcvr.id,
-                              listall=True
-                              )
-        self.assertEqual(
-                         isinstance(routers, list),
-                         True,
-                         "List routers shall return the valid response"
-                         )
-        self.assertEqual(
-                         routers[0].state,
-                         "Running",
-                         "Router state should be running"
-                         )
-        #  TODO: Check for the network connectivity
-        return
-
-    @attr(tags=["advanced", "intervlan"])
-    def test_03_reconnect_host(self):
-        """ Test reconnect Host which has VPC elements
-        """
-
-        # Steps:
-        # 1.Reconnect one of the host on which VPC Virtual Router is present.
-        # Validate the following
-        # 1. Host should successfully reconnect.
-        # 2. Network connectivity to all the VMs on the host should not be
-        #    effected due to reconnection.
-
-        self.debug("Reconnecting the host where VPC VR is running")
-        try:
-            Host.reconnect(self.apiclient, id=self.vpcvr.hostid)
-        except Exception as e:
-            self.fail("Failed to reconnect to host: %s" % e)
-
-        self.debug("Check the status of router after migration")
-        routers = Router.list(
-                              self.apiclient,
-                              id=self.vpcvr.id,
-                              listall=True
-                              )
-        self.assertEqual(
-                         isinstance(routers, list),
-                         True,
-                         "List routers shall return the valid response"
-                         )
-        self.assertEqual(
-                         routers[0].state,
-                         "Running",
-                         "Router state should be running"
-                         )
-        #  TODO: Check for the network connectivity
-        return
-
-
-class TestVPCNetworkRules(cloudstackTestCase):
-
-    @classmethod
-    def setUpClass(cls):
-        cls.api_client = super(
-                               TestVPCNetworkRules,
-                               cls
-                               ).getClsTestClient().getApiClient()
-        cls.services = Services().services
-        # Get Zone, Domain and templates
-        cls.domain = get_domain(cls.api_client, cls.services)
-        cls.zone = get_zone(cls.api_client, cls.services)
-        cls.template = get_template(
-                            cls.api_client,
-                            cls.zone.id,
-                            cls.services["ostype"]
-                            )
-        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
-        cls.services["virtual_machine"]["template"] = cls.template.id
-
-        cls.service_offering_1 = ServiceOffering.create(
-                                            cls.api_client,
-                                            cls.services["service_offering_1"]
-                                            )
-        cls.service_offering_2 = ServiceOffering.create(
-                                            cls.api_client,
-                                            cls.services["service_offering_2"]
-                                            )
-        cls.vpc_off = VpcOffering.create(
-                                     cls.api_client,
-                                     cls.services["vpc_offering"]
-                                     )
-        cls.vpc_off.update(cls.api_client, state='Enabled')
-
-        cls.account = Account.create(
-                                     cls.api_client,
-                                     cls.services["account"],
-                                     admin=True,
-                                     domainid=cls.domain.id
-                                     )
-
-        cls.vpc_off = VpcOffering.create(
-                                     cls.api_client,
-                                     cls.services["vpc_offering"]
-                                     )
-
-        cls.vpc_off.update(cls.api_client, state='Enabled')
-
-        cls.services["vpc"]["cidr"] = '10.1.1.1/16'
-        cls.vpc = VPC.create(
-                         cls.api_client,
-                         cls.services["vpc"],
-                         vpcofferingid=cls.vpc_off.id,
-                         zoneid=cls.zone.id,
-                         account=cls.account.name,
-                         domainid=cls.account.domainid
-                         )
-
-        cls.nw_off = NetworkOffering.create(
-                                            cls.api_client,
-                                            cls.services["network_offering"],
-                                            conservemode=False
-                                            )
-        # Enable Network offering
-        cls.nw_off.update(cls.api_client, state='Enabled')
-
-        # Creating network using the network offering created
-        cls.network_1 = Network.create(
-                                cls.api_client,
-                                cls.services["network"],
-                                accountid=cls.account.name,
-                                domainid=cls.account.domainid,
-                                networkofferingid=cls.nw_off.id,
-                                zoneid=cls.zone.id,
-                                gateway='10.1.1.1',
-                                vpcid=cls.vpc.id
-                                )
-        cls.nw_off_no_lb = NetworkOffering.create(
-                                    cls.api_client,
-                                    cls.services["network_offering_no_lb"],
-                                    conservemode=False
-                                    )
-        # Enable Network offering
-        cls.nw_off_no_lb.update(cls.api_client, state='Enabled')
-
-        # Creating network using the network offering created
-        cls.network_2 = Network.create(
-                                cls.api_client,
-                                cls.services["network"],
-                                accountid=cls.account.name,
-                                domainid=cls.account.domainid,
-                                networkofferingid=cls.nw_off_no_lb.id,
-                                zoneid=cls.zone.id,
-                                gateway='10.1.2.1',
-                                vpcid=cls.vpc.id
-                                )
-        # Spawn an instance in that network
-        cls.vm_1 = VirtualMachine.create(
-                                  cls.api_client,
-                                  cls.services["virtual_machine"],
-                                  accountid=cls.account.name,
-                                  domainid=cls.account.domainid,
-                                  serviceofferingid=cls.service_offering_1.id,
-                                  networkids=[str(cls.network_1.id)]
-                                  )
-        # Spawn an instance in that network
-        cls.vm_2 = VirtualMachine.create(
-                                  cls.api_client,
-                                  cls.services["virtual_machine"],
-                                  accountid=cls.account.name,
-                                  domainid=cls.account.domainid,
-                                  serviceofferingid=cls.service_offering_2.id,
-                                  networkids=[str(cls.network_1.id)]
-                                  )
-        cls.vm_3 = VirtualMachine.create(
-                                  cls.api_client,
-                                  cls.services["virtual_machine"],
-                                  accountid=cls.account.name,
-                                  domainid=cls.account.domainid,
-                                  serviceofferingid=cls.service_offering_1.id,
-                                  networkids=[str(cls.network_2.id)]
-                                  )
-        cls.vm_4 = VirtualMachine.create(
-                                  cls.api_client,
-                                  cls.services["virtual_machine"],
-                                  accountid=cls.account.name,
-                                  domainid=cls.account.domainid,
-                                  serviceofferingid=cls.service_offering_2.id,
-                                  networkids=[str(cls.network_2.id)]
-                                  )
-
-        cls._cleanup = [
-                        cls.service_offering_1,
-                        cls.service_offering_2,
-                        cls.nw_off,
-                        cls.nw_off_no_lb,
-                        ]
-        return
-
-    @classmethod
-    def tearDownClass(cls):
-        try:
-            cls.account.delete(cls.api_client)
-            wait_for_cleanup(cls.api_client, ["account.cleanup.interval"])
-            #Cleanup resources used
-            cleanup_resources(cls.api_client, cls._cleanup)
-
-            # Waiting for network cleanup to delete vpc offering
-            wait_for_cleanup(cls.api_client, ["network.gc.wait",
-                                              "network.gc.interval"])
-            cls.vpc_off.delete(cls.api_client)
-        except Exception as e:
-            raise Exception("Warning: Exception during cleanup : %s" % e)
-        return
-
-    def setUp(self):
-
-        self.apiclient = self.testClient.getApiClient()
-        self.dbclient = self.testClient.getDbConnection()
-        self.cleanup = []
-        return
-
-    def tearDown(self):
-        try:
-            #Clean up, terminate the created network offerings
-            cleanup_resources(self.apiclient, self.cleanup)
-        except Exception as e:
-            raise Exception("Warning: Exception during cleanup : %s" % e)
-        return
-
-    def validate_vm_deployment(self):
-        """Validates VM deployment on different hosts"""
-
-        vms = VirtualMachine.list(
-                                  self.apiclient,
-                                  account=self.account.name,
-                                  domainid=self.account.domainid,
-                                  networkid=self.network_1.id,
-                                  listall=True
-                                  )
-        self.assertEqual(
-                         isinstance(vms, list),
-                         True,
-                         "List VMs shall return a valid response"
-                         )
-        host_1 = vms[0].hostid
-        self.debug("Host for network 1: %s" % vms[0].hostid)
-
-        vms = VirtualMachine.list(
-                                  self.apiclient,
-                                  account=self.account.name,
-                                  domainid=self.account.domainid,
-                                  networkid=self.network_2.id,
-                                  listall=True
-                                  )
-        self.assertEqual(
-                         isinstance(vms, list),
-                         True,
-                         "List VMs shall return a valid response"
-                         )
-        host_2 = vms[0].hostid
-        self.debug("Host for network 2: %s" % vms[0].hostid)
-
-        self.assertNotEqual(
-                host_1,
-                host_2,
-                "Both the virtual machines should be deployed on diff hosts "
-                )
-        return
-
-    @attr(tags=["advanced", "intervlan"])
-    def test_list_pf_rules_for_vpc(self):
-        """ Test List Port Forwarding Rules & vms belonging to a VPC
-        """
-
-        # Validate the following
-        # 1. Create a VPC with cidr - 10.1.1.1/16
-        # 2. Add network1(10.1.1.1/24) and network2(10.1.2.1/24) to this VPC.
-        # 3. Deploy vm1 and vm2 in network1 and vm3 and vm4 in network2.
-        #    Make sure vm1 and vm3 are deployed on one host in the cluster
-        #    while vm2 and vm4 are deployed on the other host in the cluster.
-        #    This can be done using host's tags and service offerings with
-        #    host tags.
-        # 4. Create a PF rule for vms in network1.
-        # 5. Create a PF rule for vms in network2.
-        # Steps:
-        # 1. List all the Port Forwarding Rules belonging to a VPC
-        # 2. Successfully List the Port Forwarding Rules belonging to the VPC
-        # 3. List the VMs on network1 for selection for the PF Rule
-        # 4. Successfully list the VMs for Port Forwarding Rule creation
-
-        self.debug("Associating public IP for network: %s" %
-                                                        self.network_1.name)
-        public_ip_1 = PublicIPAddress.create(
-                                self.apiclient,
-                                accountid=self.account.name,
-                                zoneid=self.zone.id,
-                                domainid=self.account.domainid,
-                                networkid=self.network_1.id,
-                                vpcid=self.vpc.id
-                                )
-        self.debug("Associated %s with network %s" % (
-                                        public_ip_1.ipaddress.ipaddress,
-                                        self.network_1.id
-                                        ))
-
-        nat_rule_1 = NATRule.create(
-                                  self.apiclient,
-                                  self.vm_1,
-                                  self.services["natrule"],
-                                  ipaddressid=public_ip_1.ipaddress.id,
-                                  openfirewall=False,
-                                  networkid=self.network_1.id,
-                                  vpcid=self.vpc.id
-                                  )
-
-        self.debug("Associating public IP for network: %s" %
-                                                        self.network_2.name)
-        public_ip_2 = PublicIPAddress.create(
-                                self.apiclient,
-                                accountid=self.account.name,
-                                zoneid=self.zone.id,
-                                domainid=self.account.domainid,
-                                networkid=self.network_2.id,
-                                vpcid=self.vpc.id
-                                )
-        self.debug("Associated %s with network %s" % (
-                                        public_ip_2.ipaddress.ipaddress,
-                                        self.network_2.id
-                                        ))
-
-        nat_rule_2 = NATRule.create(
-                                  self.apiclient,
-                                  self.vm_3,
-                                  self.services["natrule"],
-                                  ipaddressid=public_ip_2.ipaddress.id,
-                                  openfirewall=False,
-                                  networkid=self.network_2.id,
-                                  vpcid=self.vpc.id
-                                  )
-
-        self.debug("Listing all the PF rules belonging to VPC")
-        nat_rules = NATRule.list(
-                                 self.apiclient,
-                                 vpcid=self.vpc.id,
-                                 listall=True
-                                 )
-        self.assertEqual(
-                         isinstance(nat_rules, list),
-                         True,
-                         "List NAT rules should return the valid list"
-                         )
-        self.assertEqual(
-            len(nat_rules),
-            2,
-            "List NAT for VPC shall return all NAT rules belonging to VPC"
-            )
-        for nat_rule in nat_rules:
-            self.assertEqual(
-                             nat_rule.vpcid,
-                             self.vpc.id,
-                             "NAT rules should belong to VPC"
-                             )
-
-        self.debug(
-            "Listing all the VMs belonging to VPC for network: %s" %
-                                                        self.network_1.name)
-        vms = VirtualMachine.list(
-                                 self.apiclient,
-                                 networkid=self.network_1.id,
-                                 vpcid=self.vpc.id,
-                                 listall=True
-                                 )
-        self.assertEqual(
-                         isinstance(vms, list),
-                         True,
-                         "List virtual machines should return the valid list"
-                         )
-        for vm in vms:
-            self.assertEqual(
-                        vm.networkid,
-                        self.network_1.id,
-                        "List VMs should return vms belonging to network_1"
-                        )
-        return
-


[35/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1

Posted by ah...@apache.org.
use commons-lang StringUtils

commons-lang is already a transitive dependency of the utils project, which allows removing some duplicated functionality.
This patch replaces StringUtils.join(String, Object...) with it's commons-lang counterpart.
It also replaces calls to String join(Iterable<? extends Object>, String) in cases where an array is already exist and it is only wrapped into a List.

Signed-off-by: Laszlo Hornyak <la...@gmail.com>


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

Branch: refs/heads/vmsync
Commit: c88d8fb3a2f6c418c6c7af8ff702a93bcdb2d752
Parents: 564013b
Author: Laszlo Hornyak <la...@gmail.com>
Authored: Sun Jun 9 21:40:28 2013 +0200
Committer: Chip Childers <ch...@gmail.com>
Committed: Mon Jun 17 19:17:22 2013 +0100

----------------------------------------------------------------------
 .../src/com/cloud/storage/s3/S3ManagerImpl.java  | 10 +++-------
 .../resource/NfsSecondaryStorageResource.java    | 19 ++++++-------------
 utils/src/com/cloud/utils/S3Utils.java           |  4 ++--
 utils/src/com/cloud/utils/StringUtils.java       |  6 +-----
 utils/test/com/cloud/utils/StringUtilsTest.java  |  5 +++++
 5 files changed, 17 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c88d8fb3/server/src/com/cloud/storage/s3/S3ManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/s3/S3ManagerImpl.java b/server/src/com/cloud/storage/s3/S3ManagerImpl.java
index 61e5573..91fa9c3 100644
--- a/server/src/com/cloud/storage/s3/S3ManagerImpl.java
+++ b/server/src/com/cloud/storage/s3/S3ManagerImpl.java
@@ -41,7 +41,6 @@ import java.util.Map;
 import java.util.UUID;
 import java.util.concurrent.Callable;
 
-import javax.annotation.PostConstruct;
 import javax.ejb.Local;
 import javax.inject.Inject;
 import javax.naming.ConfigurationException;
@@ -193,13 +192,12 @@ public class S3ManagerImpl extends ManagerBase implements S3Manager {
 
     }
 
-    @SuppressWarnings("unchecked")
-    private String determineLockId(final long accountId, final long templateId) {
+    static String determineLockId(final long accountId, final long templateId) {
 
         // TBD The lock scope may be too coarse grained. Deletes need to lock
         // the template across all zones where upload and download could
         // probably safely scoped to the zone ...
-        return join(asList("S3_TEMPLATE", accountId, templateId), "_");
+        return join("_", "S3_TEMPLATE", accountId, templateId);
 
     }
 
@@ -397,9 +395,7 @@ public class S3ManagerImpl extends ManagerBase implements S3Manager {
                         throw new CloudRuntimeException(errMsg);
                     }
 
-                    final String installPath = join(
-                            asList("template", "tmpl", accountId,
-                                    templateId), File.separator);
+                    final String installPath = join(File.separator, "template", "tmpl", accountId, templateId);
                     final VMTemplateHostVO tmpltHost = new VMTemplateHostVO(
                             secondaryStorageHost.getId(), templateId,
                             now(), 100, Status.DOWNLOADED, null, null,

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c88d8fb3/services/secondary-storage/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
----------------------------------------------------------------------
diff --git a/services/secondary-storage/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java b/services/secondary-storage/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
index e7fa5b2..9ddba83 100755
--- a/services/secondary-storage/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
+++ b/services/secondary-storage/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java
@@ -22,7 +22,6 @@ import static com.cloud.utils.S3Utils.putDirectory;
 import static com.cloud.utils.StringUtils.join;
 import static com.cloud.utils.db.GlobalLock.executeWithNoWaitLock;
 import static java.lang.String.format;
-import static java.util.Arrays.asList;
 import static org.apache.commons.lang.StringUtils.substringAfterLast;
 
 import java.io.BufferedWriter;
@@ -217,19 +216,16 @@ SecondaryStorageResource {
         }
     }
 
-    @SuppressWarnings("unchecked")
-    private String determineS3TemplateDirectory(final Long accountId,
+    static String determineS3TemplateDirectory(final Long accountId,
             final Long templateId) {
-        return join(asList(TEMPLATE_ROOT_DIR, accountId, templateId),
-                S3Utils.SEPARATOR);
+        return join(S3Utils.SEPARATOR, TEMPLATE_ROOT_DIR, accountId, templateId);
     }
 
-    @SuppressWarnings("unchecked")
     private String determineStorageTemplatePath(final String storagePath,
             final Long accountId, final Long templateId) {
-        return join(
-                asList(getRootDir(storagePath), TEMPLATE_ROOT_DIR, accountId,
-                        templateId), File.separator);
+        return join(File.separator, 
+                getRootDir(storagePath), TEMPLATE_ROOT_DIR, accountId,
+                        templateId);
     }
 
     private Answer execute(
@@ -405,10 +401,7 @@ SecondaryStorageResource {
                     s_logger.debug(String
                             .format("Determining key using account id %1$s and template id %2$s",
                                     accountId, templateId));
-                    return join(
-                            asList(determineS3TemplateDirectory(
-                                    accountId, templateId), file
-                                    .getName()), S3Utils.SEPARATOR);
+                    return join(S3Utils.SEPARATOR, determineS3TemplateDirectory(accountId, templateId), file.getName());
                 }
             });
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c88d8fb3/utils/src/com/cloud/utils/S3Utils.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/S3Utils.java b/utils/src/com/cloud/utils/S3Utils.java
index b7273a1..33a3ebd 100644
--- a/utils/src/com/cloud/utils/S3Utils.java
+++ b/utils/src/com/cloud/utils/S3Utils.java
@@ -155,8 +155,8 @@ public final class S3Utils {
         try {
 
             tempFile = createTempFile(
-                    join(asList(targetDirectory.getName(), currentTimeMillis(),
-                            "part"), "-"), "tmp", targetDirectory);
+                    join("-", targetDirectory.getName(), currentTimeMillis(),
+                            "part"), "tmp", targetDirectory);
             tempFile.deleteOnExit();
 
             if (LOGGER.isDebugEnabled()) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c88d8fb3/utils/src/com/cloud/utils/StringUtils.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/StringUtils.java b/utils/src/com/cloud/utils/StringUtils.java
index 14ff4b1..359b169 100644
--- a/utils/src/com/cloud/utils/StringUtils.java
+++ b/utils/src/com/cloud/utils/StringUtils.java
@@ -16,8 +16,6 @@
 // under the License.
 package com.cloud.utils;
 
-import static java.util.Arrays.asList;
-
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
@@ -25,8 +23,6 @@ import java.util.regex.Pattern;
 
 import org.owasp.esapi.StringUtilities;
 
-// StringUtils exists in Apache Commons Lang, but rather than import the entire JAR to our system, for now
-// just implement the method needed
 public class StringUtils {
     private static final char[] hexChar = {
         '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'
@@ -50,7 +46,7 @@ public class StringUtils {
 
     public static String join(final String delimiter,
             final Object... components) {
-        return join(asList(components), delimiter);
+        return org.apache.commons.lang.StringUtils.join(components, delimiter);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c88d8fb3/utils/test/com/cloud/utils/StringUtilsTest.java
----------------------------------------------------------------------
diff --git a/utils/test/com/cloud/utils/StringUtilsTest.java b/utils/test/com/cloud/utils/StringUtilsTest.java
index 3c162c7..796efba 100644
--- a/utils/test/com/cloud/utils/StringUtilsTest.java
+++ b/utils/test/com/cloud/utils/StringUtilsTest.java
@@ -103,4 +103,9 @@ public class StringUtilsTest {
         assertEquals(result, expected);
     }
 
+    @Test
+    public void testJoin() {
+        assertEquals("a-b-c", StringUtils.join("-", "a", "b", "c"));
+        assertEquals("", StringUtils.join("-"));
+    }
 }


[36/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1

Posted by ah...@apache.org.
NPE fix

- fixes an NPE in case the pool.scope = null
- replaces null checks around toString with ObjectUtils.toString call

Signed-off-by: Laszlo Hornyak <la...@gmail.com>


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

Branch: refs/heads/vmsync
Commit: 202cd1529054fe60acce0cce54686268797b65bd
Parents: c88d8fb
Author: Laszlo Hornyak <la...@gmail.com>
Authored: Sun Jun 16 10:42:17 2013 +0200
Committer: Chip Childers <ch...@gmail.com>
Committed: Mon Jun 17 19:19:43 2013 +0100

----------------------------------------------------------------------
 .../com/cloud/api/query/dao/StoragePoolJoinDaoImpl.java | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/202cd152/server/src/com/cloud/api/query/dao/StoragePoolJoinDaoImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/dao/StoragePoolJoinDaoImpl.java b/server/src/com/cloud/api/query/dao/StoragePoolJoinDaoImpl.java
index 6d0cde1..f2b9525 100644
--- a/server/src/com/cloud/api/query/dao/StoragePoolJoinDaoImpl.java
+++ b/server/src/com/cloud/api/query/dao/StoragePoolJoinDaoImpl.java
@@ -25,6 +25,7 @@ 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.commons.lang.ObjectUtils;
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
 
@@ -79,17 +80,12 @@ public class StoragePoolJoinDaoImpl extends GenericDaoBase<StoragePoolJoinVO, Lo
         poolResponse.setZoneId(pool.getZoneUuid());
         poolResponse.setZoneName(pool.getZoneName());
         poolResponse.setZoneType(pool.getZoneType());
-        if (pool.getPoolType() != null) {
-            poolResponse.setType(pool.getPoolType().toString());
-        }
+        poolResponse.setType(ObjectUtils.toString(pool.getPoolType(), null));
         poolResponse.setPodId(pool.getPodUuid());
         poolResponse.setPodName(pool.getPodName());
         poolResponse.setCreated(pool.getCreated());
-        poolResponse.setScope(pool.getScope().toString());
-        if (pool.getHypervisor() != null) {
-            poolResponse.setHypervisor(pool.getHypervisor().toString());
-        }
-
+        poolResponse.setScope(ObjectUtils.toString(pool.getScope(), null));
+        poolResponse.setHypervisor(ObjectUtils.toString(pool.getHypervisor(), null));
 
         long allocatedSize = pool.getUsedCapacity() +  pool.getReservedCapacity();
         poolResponse.setDiskSizeTotal(pool.getCapacityBytes());


[09/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1

Posted by ah...@apache.org.
Change listAll to return a boolean and fix a typo

Signed-off-by: Abhinandan Prateek <ap...@apache.org>


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

Branch: refs/heads/vmsync
Commit: 776301ce6f124767d42fcd58f9c411a002dc310d
Parents: e405703
Author: Ian Duffy <ia...@ianduffy.ie>
Authored: Wed Jun 12 17:31:23 2013 +0100
Committer: Abhinandan Prateek <ap...@apache.org>
Committed: Mon Jun 17 10:23:48 2013 +0530

----------------------------------------------------------------------
 .../api/command/admin/ldap/LDAPConfigCmd.java   | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/776301ce/api/src/org/apache/cloudstack/api/command/admin/ldap/LDAPConfigCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/ldap/LDAPConfigCmd.java b/api/src/org/apache/cloudstack/api/command/admin/ldap/LDAPConfigCmd.java
index 2976de4..2726f84 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/ldap/LDAPConfigCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/ldap/LDAPConfigCmd.java
@@ -43,10 +43,9 @@ public class LDAPConfigCmd extends BaseCmd  {
     /////////////////////////////////////////////////////
     //////////////// API parameters /////////////////////
     /////////////////////////////////////////////////////
-
-    @Parameter(name=ApiConstants.LIST_ALL, type=CommandType.STRING,  description="Hostname or ip address of the ldap server eg: my.ldap.com")
-    private String listall;
-
+    @Parameter(name=ApiConstants.LIST_ALL, type=CommandType.BOOLEAN,  description="If true return current LDAP configuration")
+    private Boolean listAll;
+    
     @Parameter(name=ApiConstants.HOST_NAME, type=CommandType.STRING,  description="Hostname or ip address of the ldap server eg: my.ldap.com")
     private String hostname;
 
@@ -78,10 +77,10 @@ public class LDAPConfigCmd extends BaseCmd  {
     /////////////////// Accessors ///////////////////////
     /////////////////////////////////////////////////////
 
-    public String getListAll() {
-        return listall == null ? "false" : listall;
+    public Boolean getListAll() {
+    	return listAll == null ? Boolean.FALSE : listAll;
     }
-
+    
     public String getBindPassword() {
         return bindPassword;
     }
@@ -156,16 +155,15 @@ public class LDAPConfigCmd extends BaseCmd  {
             InsufficientCapacityException, ServerApiException,
             ConcurrentOperationException, ResourceAllocationException {
           try {
-              if ("true".equalsIgnoreCase(getListAll())){
+              if (getListAll()){
                   // return the existing conf
                   LDAPConfigCmd cmd = _configService.listLDAPConfig(this);
-                  LDAPConfigResponse lr = _responseGenerator.createLDAPConfigResponse(cmd.getHostname(), cmd.getPort(), cmd.getUseSSL(),
-                          cmd.getQueryFilter(), cmd.getSearchBase(), cmd.getBindDN());
+                  LDAPConfigResponse lr = _responseGenerator.createLDAPConfigResponse(cmd.getHostname(), cmd.getPort(), cmd.getUseSSL(), cmd.getQueryFilter(), cmd.getSearchBase(), cmd.getBindDN());
                   lr.setResponseName(getCommandName());
                   this.setResponseObject(lr);
               }
               else if (getHostname()==null || getSearchBase() == null || getQueryFilter() == null) {
-                  throw new InvalidParameterValueException("You need to provide hostname, serachbase and queryfilter to configure your LDAP server");
+                  throw new InvalidParameterValueException("You need to provide hostname, searchbase and queryfilter to configure your LDAP server");
               }
               else {
                   boolean result = _configService.updateLDAP(this);


[31/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1

Posted by ah...@apache.org.
LOUDSTACK-2914: handle situation when serviceProvider map is empty


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

Branch: refs/heads/vmsync
Commit: 952fa2464da9f10b63fbba869922ee735c231c42
Parents: bd69939
Author: Alena Prokharchyk <al...@citrix.com>
Authored: Mon Jun 17 10:50:22 2013 -0700
Committer: Alena Prokharchyk <al...@citrix.com>
Committed: Mon Jun 17 10:55:33 2013 -0700

----------------------------------------------------------------------
 server/src/com/cloud/configuration/ConfigurationManagerImpl.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/952fa246/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
index 68745bf..12164a2 100755
--- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
@@ -4007,7 +4007,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
             }
         }
         
-        if (serviceProviderMap.containsKey(Service.Lb) && !internalLb && !publicLb) {
+        if (serviceProviderMap != null && serviceProviderMap.containsKey(Service.Lb) && !internalLb && !publicLb) {
             //if not specified, default public lb to true
             publicLb = true;
         }


[11/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1

Posted by ah...@apache.org.
CLOUDSTACK-758


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

Branch: refs/heads/vmsync
Commit: fcafe28d7b9231282161e326e9dfa8528054f5fd
Parents: 2f1ed47
Author: Radhika PC <ra...@citrix.com>
Authored: Mon Jun 17 11:41:07 2013 +0530
Committer: Radhika PC <ra...@citrix.com>
Committed: Mon Jun 17 11:41:07 2013 +0530

----------------------------------------------------------------------
 docs/en-US/create-vpn-connection-vpc.xml  | 31 +++++++++++++++++++++-----
 docs/en-US/create-vpn-gateway-for-vpc.xml | 30 ++++++++++++++++++++-----
 docs/en-US/delete-reset-vpn.xml           | 28 ++++++++++++++++++-----
 3 files changed, 72 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fcafe28d/docs/en-US/create-vpn-connection-vpc.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/create-vpn-connection-vpc.xml b/docs/en-US/create-vpn-connection-vpc.xml
index 1fba09e..88a058c 100644
--- a/docs/en-US/create-vpn-connection-vpc.xml
+++ b/docs/en-US/create-vpn-connection-vpc.xml
@@ -20,6 +20,7 @@
 -->
 <section id="create-vpn-connection-vpc">
   <title>Creating a VPN Connection</title>
+  <note><para>&PRODUCT; supports creating up to 8 VPN connections.</para></note>
   <orderedlist>
     <listitem>
       <para>Log in to the &PRODUCT; UI as an administrator or end user.</para>
@@ -38,19 +39,37 @@
     </listitem>
     <listitem>
       <para>Click the Settings icon.</para>
-      <para>The following options are displayed.</para>
+      <para>For each tier, the following options are displayed:</para>
       <itemizedlist>
         <listitem>
-          <para>IP Addresses</para>
+          <para>Internal LB</para>
         </listitem>
         <listitem>
-          <para>Gateways</para>
+          <para>Public LB IP</para>
         </listitem>
         <listitem>
-          <para>Site-to-Site VPN</para>
+          <para>Static NAT</para>
         </listitem>
         <listitem>
-          <para>Network ASLs</para>
+          <para>Virtual Machines</para>
+        </listitem>
+        <listitem>
+          <para>CIDR</para>
+        </listitem>
+      </itemizedlist>
+      <para>The following router information is displayed:</para>
+      <itemizedlist>
+        <listitem>
+          <para>Private Gateways</para>
+        </listitem>
+        <listitem>
+          <para>Public IP Addresses</para>
+        </listitem>
+        <listitem>
+          <para>Site-to-Site VPNs</para>
+        </listitem>
+        <listitem>
+          <para>Network ACL Lists</para>
         </listitem>
       </itemizedlist>
     </listitem>
@@ -100,4 +119,4 @@
       </itemizedlist>
     </listitem>
   </orderedlist>
-</section>
\ No newline at end of file
+</section>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fcafe28d/docs/en-US/create-vpn-gateway-for-vpc.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/create-vpn-gateway-for-vpc.xml b/docs/en-US/create-vpn-gateway-for-vpc.xml
index 396a7d9..0f8a0dc 100644
--- a/docs/en-US/create-vpn-gateway-for-vpc.xml
+++ b/docs/en-US/create-vpn-gateway-for-vpc.xml
@@ -38,19 +38,37 @@
     </listitem>
     <listitem>
       <para>Click the Settings icon.</para>
-      <para>The following options are displayed.</para>
+      <para>For each tier, the following options are displayed:</para>
       <itemizedlist>
         <listitem>
-          <para>IP Addresses</para>
+          <para>Internal LB</para>
         </listitem>
         <listitem>
-          <para>Gateways</para>
+          <para>Public LB IP</para>
         </listitem>
         <listitem>
-          <para>Site-to-Site VPN</para>
+          <para>Static NAT</para>
         </listitem>
         <listitem>
-          <para>Network ACLs</para>
+          <para>Virtual Machines</para>
+        </listitem>
+        <listitem>
+          <para>CIDR</para>
+        </listitem>
+      </itemizedlist>
+      <para>The following router information is displayed:</para>
+      <itemizedlist>
+        <listitem>
+          <para>Private Gateways</para>
+        </listitem>
+        <listitem>
+          <para>Public IP Addresses</para>
+        </listitem>
+        <listitem>
+          <para>Site-to-Site VPNs</para>
+        </listitem>
+        <listitem>
+          <para>Network ACL Lists</para>
         </listitem>
       </itemizedlist>
     </listitem>
@@ -77,4 +95,4 @@
       </itemizedlist>
     </listitem>
   </orderedlist>
-</section>
\ No newline at end of file
+</section>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fcafe28d/docs/en-US/delete-reset-vpn.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/delete-reset-vpn.xml b/docs/en-US/delete-reset-vpn.xml
index 318e5fe..2fe85d2 100644
--- a/docs/en-US/delete-reset-vpn.xml
+++ b/docs/en-US/delete-reset-vpn.xml
@@ -38,19 +38,37 @@
     </listitem>
     <listitem>
       <para>Click the Settings icon.</para>
-      <para>The following options are displayed.</para>
+      <para>For each tier, the following options are displayed:</para>
       <itemizedlist>
         <listitem>
-          <para>IP Addresses</para>
+          <para>Internal LB</para>
         </listitem>
         <listitem>
-          <para>Gateways</para>
+          <para>Public LB IP</para>
         </listitem>
         <listitem>
-          <para>Site-to-Site VPN</para>
+          <para>Static NAT</para>
         </listitem>
         <listitem>
-          <para>Network ASLs</para>
+          <para>Virtual Machines</para>
+        </listitem>
+        <listitem>
+          <para>CIDR</para>
+        </listitem>
+      </itemizedlist>
+      <para>The following router information is displayed:</para>
+      <itemizedlist>
+        <listitem>
+          <para>Private Gateways</para>
+        </listitem>
+        <listitem>
+          <para>Public IP Addresses</para>
+        </listitem>
+        <listitem>
+          <para>Site-to-Site VPNs</para>
+        </listitem>
+        <listitem>
+          <para>Network ACL Lists</para>
         </listitem>
       </itemizedlist>
     </listitem>


[32/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1

Posted by ah...@apache.org.
CLOUDSTACK-869: Add VPC dialog - add Public LB Provider dropdown, remove VPC Offering dropdown. When Public LB Provider is selected as Netscaler, pass "Default VPC offering with Netscaler" to createVPC API. When Public LB Provider is selected as VpcVirtualRouter, pass "Default VPC Offering" to createVPC API.


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

Branch: refs/heads/vmsync
Commit: a2c7d3a8a75b2cec266cef566b8828be7a1ebc72
Parents: 952fa24
Author: Jessica Wang <je...@apache.org>
Authored: Mon Jun 17 10:55:50 2013 -0700
Committer: Jessica Wang <je...@apache.org>
Committed: Mon Jun 17 10:58:58 2013 -0700

----------------------------------------------------------------------
 ui/scripts/network.js | 125 +++++++++++++++++++++------------------------
 1 file changed, 57 insertions(+), 68 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a2c7d3a8/ui/scripts/network.js
----------------------------------------------------------------------
diff --git a/ui/scripts/network.js b/ui/scripts/network.js
index fb63e4b..ddde9c9 100755
--- a/ui/scripts/network.js
+++ b/ui/scripts/network.js
@@ -4532,78 +4532,67 @@
                     docID: 'helpVPCDomain',
                     label: 'label.DNS.domain.for.guest.networks'
                   },
-
-                  loadbalancer:{        //Support for Netscaler as an external device for load balancing
-                    label:'Load Balancer',
+                  publicLoadBalancerProvider:{        
+                    label:'Public Load Balancer Provider',
                     select:function(args){
-                         $.ajax({
-                          url:createURL('listVPCOfferings&listall=true'),
-                          dataType:'json',
-                          success:function(json){
-                        var items=[];
-                        var vpcObj = json.listvpcofferingsresponse.vpcoffering;
-                        $(vpcObj).each(function(){
-                          items.push({id:this.id , description:this.name});
-                          });
-                        args.response.success({data:items});
-
-                         }
-
-                     });
-
-                   }
-
-                }
-
+                      var items = [];
+                      items.push({id: 'VpcVirtualRouter', description: 'VpcVirtualRouter'});
+                      items.push({id: 'Netscaler', description: 'Netscaler'});
+                      args.response.success({data: items});
+                    }
+                  }
                 }
               },              
-              action: function(args) {										
-						/*		var defaultvpcofferingid;
-								$.ajax({
-								  url: createURL("listVPCOfferings"),
-									dataType: "json",
-									data: {
-									  isdefault: true
-									},
-								  async: false,
-									success: function(json) {
-									  defaultvpcofferingid = json.listvpcofferingsresponse.vpcoffering[0].id;
-									}
-								});*/
-								
-								var dataObj = {
-									name: args.data.name,
-									displaytext: args.data.displaytext,
-									zoneid: args.data.zoneid,
-									cidr: args.data.cidr,
-									vpcofferingid: args.data.loadbalancer    // Support for external load balancer
-								};
-								
-								if(args.data.networkdomain != null && args.data.networkdomain.length > 0)
-								  $.extend(dataObj, { networkdomain: args.data.networkdomain });								
-								
-								$.ajax({
-                  url: createURL("createVPC"),
-                  dataType: "json",
-									data: dataObj,
-                  async: true,
-                  success: function(json) {
-                    var jid = json.createvpcresponse.jobid;
-                    args.response.success(
-                      {_custom:
-                        {jobId: jid,
-                          getUpdatedItem: function(json) {													  
-                            return json.queryasyncjobresultresponse.jobresult.vpc;
-                          }
+              action: function(args) {	
+                var vpcOfferingName;
+                if (args.data.publicLoadBalancerProvider == 'VpcVirtualRouter')
+                  vpcOfferingName = 'Default VPC offering';
+                else if (args.data.publicLoadBalancerProvider == 'Netscaler')
+                  vpcOfferingName = 'Default VPC  offering with Netscaler';
+                                
+                $.ajax({
+                  url:createURL('listVPCOfferings'),
+                  data: {
+                    name: vpcOfferingName
+                  },                  
+                  success:function(json){   
+                    var vpcofferingid = json.listvpcofferingsresponse.vpcoffering[0].id;     
+                                       
+                    var dataObj = {
+                      name: args.data.name,
+                      displaytext: args.data.displaytext,
+                      zoneid: args.data.zoneid,
+                      cidr: args.data.cidr,
+                      vpcofferingid: vpcofferingid    
+                    };
+                    
+                    if(args.data.networkdomain != null && args.data.networkdomain.length > 0)
+                      $.extend(dataObj, { networkdomain: args.data.networkdomain });                
+                    
+                    $.ajax({
+                      url: createURL("createVPC"),
+                      dataType: "json",
+                      data: dataObj,
+                      async: true,
+                      success: function(json) {
+                        var jid = json.createvpcresponse.jobid;
+                        args.response.success(
+                          {_custom:
+                            {jobId: jid,
+                              getUpdatedItem: function(json) {                            
+                                return json.queryasyncjobresultresponse.jobresult.vpc;
+                              }
+                            }
+                          });
+                      },
+                      error: function(data) {
+                          args.response.error(parseXMLHttpResponse(data));
                         }
-                      });
-                  },
-                  error: function(data) {
-                      args.response.error(parseXMLHttpResponse(data));
-                    }
-                });								
-              },
-             
+                    });     
+                  }
+                });
+                
+              },             
 							notification: {
                 poll: pollAsyncJobResult
               }							


[26/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1

Posted by ah...@apache.org.
Allow DSA public keys.

DSA can't be used for encryption with the bouncycastle library, so make
sure this situation is properly handled.


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

Branch: refs/heads/vmsync
Commit: b0ea02e65a01cf62004de0851284da7a8868d406
Parents: 76d3c27
Author: Hugo Trippaers <tr...@gmail.com>
Authored: Sun Jun 16 14:37:48 2013 -0700
Committer: Hugo Trippaers <tr...@gmail.com>
Committed: Mon Jun 17 10:04:59 2013 -0700

----------------------------------------------------------------------
 server/src/com/cloud/vm/UserVmManagerImpl.java  | 63 +++++++-----------
 .../src/com/cloud/utils/ssh/SSHKeysHelper.java  |  2 +-
 .../com/cloud/utils/crypto/RSAHelperTest.java   | 50 ++++++++++++++
 .../com/cloud/utils/ssh/SSHKeysHelperTest.java  | 69 ++++++++++++++++++++
 4 files changed, 143 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b0ea02e6/server/src/com/cloud/vm/UserVmManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java
index 1c8ab75..44a7d06 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -509,18 +509,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
             // update the password in vm_details table too
             // Check if an SSH key pair was selected for the instance and if so
             // use it to encrypt & save the vm password
-            String sshPublicKey = userVm.getDetail("SSH.PublicKey");
-            if (sshPublicKey != null && !sshPublicKey.equals("")
-                    && password != null && !password.equals("saved_password")) {
-                String encryptedPasswd = RSAHelper.encryptWithSSHPublicKey(
-                        sshPublicKey, password);
-                if (encryptedPasswd == null) {
-                    throw new CloudRuntimeException("Error encrypting password");
-                }
-
-                userVm.setDetail("Encrypted.Password", encryptedPasswd);
-                _vmDao.saveDetails(userVm);
-            }
+            encryptAndStorePassword(userVm, password);
         } else {
             throw new CloudRuntimeException(
                     "Failed to reset password for the virtual machine ");
@@ -643,13 +632,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
             if (template != null && template.getEnablePassword()) {
                 userVm.setPassword(password);
                 //update the encrypted password in vm_details table too
-                if (sshPublicKey != null && !sshPublicKey.equals("") && password != null && !password.equals("saved_password")) {
-                    String encryptedPasswd = RSAHelper.encryptWithSSHPublicKey(sshPublicKey, password);
-                    if (encryptedPasswd == null) {
-                        throw new CloudRuntimeException("Error encrypting password");
-                    }
-                    userVm.setDetail("Encrypted.Password", encryptedPasswd);
-                }
+                encryptAndStorePassword(userVm, password);
             }
             _vmDao.saveDetails(userVm);
         } else {
@@ -3304,18 +3287,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
 
             // Check if an SSH key pair was selected for the instance and if so
             // use it to encrypt & save the vm password
-            String sshPublicKey = vm.getDetail("SSH.PublicKey");
-            if (sshPublicKey != null && !sshPublicKey.equals("")
-                    && password != null && !password.equals("saved_password")) {
-                String encryptedPasswd = RSAHelper.encryptWithSSHPublicKey(
-                        sshPublicKey, password);
-                if (encryptedPasswd == null) {
-                    throw new CloudRuntimeException("Error encrypting password");
-                }
-
-                vm.setDetail("Encrypted.Password", encryptedPasswd);
-                _vmDao.saveDetails(vm);
-            }
+            encryptAndStorePassword(vm, password);
 
             params = new HashMap<VirtualMachineProfile.Param, Object>();
             if (additionalParams != null) {
@@ -4621,15 +4593,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
                 // update the password in vm_details table too
                 // Check if an SSH key pair was selected for the instance and if so
                 // use it to encrypt & save the vm password
-                String sshPublicKey = vm.getDetail("SSH.PublicKey");
-                if (sshPublicKey != null && !sshPublicKey.equals("") && password != null && !password.equals("saved_password")) {
-                    String encryptedPasswd = RSAHelper.encryptWithSSHPublicKey(sshPublicKey, password);
-                    if (encryptedPasswd == null) {
-                        throw new CloudRuntimeException("VM reset is completed but error occurred when encrypting newly created password");
-                    }
-                    vm.setDetail("Encrypted.Password", encryptedPasswd);
-                    _vmDao.saveDetails(vm);
-                }
+                encryptAndStorePassword(vm, password);
             } else {
                 throw new CloudRuntimeException("VM reset is completed but failed to reset password for the virtual machine ");
             }
@@ -4717,5 +4681,24 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
         if (vm.getState() == State.Running)
             collectVmDiskStatistics(vm);
     }
+    
+    private void encryptAndStorePassword(UserVmVO vm, String password) {
+        String sshPublicKey = vm.getDetail("SSH.PublicKey");
+        if (sshPublicKey != null && !sshPublicKey.equals("")
+                && password != null && !password.equals("saved_password")) {
+            if (!sshPublicKey.startsWith("ssh-rsa")) {
+                s_logger.warn("Only RSA public keys can be used to encrypt a vm password.");
+                return;
+            }
+            String encryptedPasswd = RSAHelper.encryptWithSSHPublicKey(
+                    sshPublicKey, password);
+            if (encryptedPasswd == null) {
+                throw new CloudRuntimeException("Error encrypting password");
+            }
+
+            vm.setDetail("Encrypted.Password", encryptedPasswd);
+            _vmDao.saveDetails(vm);
+        }
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b0ea02e6/utils/src/com/cloud/utils/ssh/SSHKeysHelper.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/ssh/SSHKeysHelper.java b/utils/src/com/cloud/utils/ssh/SSHKeysHelper.java
index 2755c54..a14e5a4 100644
--- a/utils/src/com/cloud/utils/ssh/SSHKeysHelper.java
+++ b/utils/src/com/cloud/utils/ssh/SSHKeysHelper.java
@@ -82,7 +82,7 @@ public class SSHKeysHelper {
 		if (!keyMaterial.contains(" ")) 
 			keyMaterial = new String(Base64.decodeBase64(keyMaterial.getBytes()));
 		
-		if (!keyMaterial.startsWith("ssh-rsa") || !keyMaterial.contains(" "))
+		if ((!keyMaterial.startsWith("ssh-rsa") && !keyMaterial.startsWith("ssh-dss")) || !keyMaterial.contains(" "))
 			return null;
 		
 		String[] key = keyMaterial.split(" ");

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b0ea02e6/utils/test/com/cloud/utils/crypto/RSAHelperTest.java
----------------------------------------------------------------------
diff --git a/utils/test/com/cloud/utils/crypto/RSAHelperTest.java b/utils/test/com/cloud/utils/crypto/RSAHelperTest.java
new file mode 100644
index 0000000..d1f496e
--- /dev/null
+++ b/utils/test/com/cloud/utils/crypto/RSAHelperTest.java
@@ -0,0 +1,50 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.utils.crypto;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+import com.cloud.utils.crypt.RSAHelper;
+
+public class RSAHelperTest {
+    @Test
+    public void testEncryptWithRSA() {
+        String rsaKey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC2D2Cs0XAEqm+ajJpumIPrMpKp0CWtIW+8ZY2/MJCW" + 
+                "hge1eY18u9I3PPnkMVJsTOaN0wQojjw4AkKgKjNZXA9wyUq56UyN/stmipu8zifWPgxQGDRkuzzZ6buk" +
+                "ef8q2Awjpo8hv5/0SRPJxQLEafESnUP+Uu/LUwk5VVC7PHzywJRUGFuzDl/uT72+6hqpL2YpC6aTl4/P" + 
+                "2eDvUQhCdL9dBmUSFX8ftT53W1jhsaQl7mPElVgSCtWz3IyRkogobMPrpJW/IPKEiojKIuvNoNv4CDR6" +
+                "ybeVjHOJMb9wi62rXo+CzUsW0Y4jPOX/OykAm5vrNOhQhw0aaBcv5XVv8BRX";
+        String encryptedString = RSAHelper.encryptWithSSHPublicKey(rsaKey, "content");
+        assertNotNull(encryptedString);
+    }
+    
+    @Test
+    public void testEncryptWithDSA() {
+        String dssKey = "ssh-dss AAAAB3NzaC1kc3MAAACBALbaewDnzZ5AcGbZno7VW1m7Si3Q+yEANXZioVupfSwOP0q9aP2iV"+
+                "tyqq575JnUVZXMDR2Gr254F/qCJ0TKAvucN0gcd2XslX4jBcu1Z7s7YZf6d7fC58k0NE6/keokJNKhQO" +
+                "i56iirRzSA/YFrD64mzfq6rEmai0q7GjGGP0RT1AAAAFQDO5++6JonyqnoRkV9Yl1OaEOPjVwAAAIAYA" +
+                "tqtKtU/INlTIuL3wt3nyKzwPUnz3fqxP5Ger3OlRZsOahalTFt2OF5jGGmCunyBTRteOetZObr0QhUIF" +
+                "4bSDr6UiYYYbH1ES0ws/t1mDIeTh3UUHV1QYACN6c07FKyKLMtB9AthiG2FMLKCEedG3NeXItuNzsuQD" +
+                "+n/K1rzMAAAAIBi5SM4pFPiB7BvTZvARV56vrG5QNgWVazSwbwgl/EACiWYbRauHDUQA9f+Rq+ayWcsR" +
+                "os1CD+Q81y9SmlQaZVKkSPZLxXfu5bi3s4o431xjilhZdt4vKbj2pK364IjghJPNBBfmRXzlj9awKxr/" +
+                "UebZcBgNRyeky7VZSbbF2jQSQ==";
+        String encryptedString = RSAHelper.encryptWithSSHPublicKey(dssKey, "content");
+        assertNull(encryptedString);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b0ea02e6/utils/test/com/cloud/utils/ssh/SSHKeysHelperTest.java
----------------------------------------------------------------------
diff --git a/utils/test/com/cloud/utils/ssh/SSHKeysHelperTest.java b/utils/test/com/cloud/utils/ssh/SSHKeysHelperTest.java
new file mode 100644
index 0000000..6402e3e
--- /dev/null
+++ b/utils/test/com/cloud/utils/ssh/SSHKeysHelperTest.java
@@ -0,0 +1,69 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.utils.ssh;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class SSHKeysHelperTest {
+    @Test
+    public void rsaKeyTest() {
+        String rsaKey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC2D2Cs0XAEqm+ajJpumIPrMpKp0CWtIW+8ZY2/MJCW" + 
+                "hge1eY18u9I3PPnkMVJsTOaN0wQojjw4AkKgKjNZXA9wyUq56UyN/stmipu8zifWPgxQGDRkuzzZ6buk" +
+                "ef8q2Awjpo8hv5/0SRPJxQLEafESnUP+Uu/LUwk5VVC7PHzywJRUGFuzDl/uT72+6hqpL2YpC6aTl4/P" + 
+                "2eDvUQhCdL9dBmUSFX8ftT53W1jhsaQl7mPElVgSCtWz3IyRkogobMPrpJW/IPKEiojKIuvNoNv4CDR6" +
+                "ybeVjHOJMb9wi62rXo+CzUsW0Y4jPOX/OykAm5vrNOhQhw0aaBcv5XVv8BRX test@testkey";
+        String storedRsaKey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC2D2Cs0XAEqm+ajJpumIPrMpKp0CWtIW+8ZY2/MJCW" + 
+                "hge1eY18u9I3PPnkMVJsTOaN0wQojjw4AkKgKjNZXA9wyUq56UyN/stmipu8zifWPgxQGDRkuzzZ6buk" +
+                "ef8q2Awjpo8hv5/0SRPJxQLEafESnUP+Uu/LUwk5VVC7PHzywJRUGFuzDl/uT72+6hqpL2YpC6aTl4/P" + 
+                "2eDvUQhCdL9dBmUSFX8ftT53W1jhsaQl7mPElVgSCtWz3IyRkogobMPrpJW/IPKEiojKIuvNoNv4CDR6" +
+                "ybeVjHOJMb9wi62rXo+CzUsW0Y4jPOX/OykAm5vrNOhQhw0aaBcv5XVv8BRX";
+        String parsedKey = SSHKeysHelper.getPublicKeyFromKeyMaterial(rsaKey);
+        String fingerprint = SSHKeysHelper.getPublicKeyFingerprint(parsedKey);
+        
+        assertTrue(storedRsaKey.equals(parsedKey));
+        assertTrue("f6:96:3f:f4:78:f7:80:11:6c:f8:e3:2b:40:20:f1:14".equals(fingerprint));
+        
+    }
+
+    @Test
+    public void dsaKeyTest() {
+        String dssKey = "ssh-dss AAAAB3NzaC1kc3MAAACBALbaewDnzZ5AcGbZno7VW1m7Si3Q+yEANXZioVupfSwOP0q9aP2iV"+
+                "tyqq575JnUVZXMDR2Gr254F/qCJ0TKAvucN0gcd2XslX4jBcu1Z7s7YZf6d7fC58k0NE6/keokJNKhQO" +
+                "i56iirRzSA/YFrD64mzfq6rEmai0q7GjGGP0RT1AAAAFQDO5++6JonyqnoRkV9Yl1OaEOPjVwAAAIAYA" +
+                "tqtKtU/INlTIuL3wt3nyKzwPUnz3fqxP5Ger3OlRZsOahalTFt2OF5jGGmCunyBTRteOetZObr0QhUIF" +
+                "4bSDr6UiYYYbH1ES0ws/t1mDIeTh3UUHV1QYACN6c07FKyKLMtB9AthiG2FMLKCEedG3NeXItuNzsuQD" +
+                "+n/K1rzMAAAAIBi5SM4pFPiB7BvTZvARV56vrG5QNgWVazSwbwgl/EACiWYbRauHDUQA9f+Rq+ayWcsR" +
+                "os1CD+Q81y9SmlQaZVKkSPZLxXfu5bi3s4o431xjilhZdt4vKbj2pK364IjghJPNBBfmRXzlj9awKxr/" +
+                "UebZcBgNRyeky7VZSbbF2jQSQ== test key";
+        String storedDssKey = "ssh-dss AAAAB3NzaC1kc3MAAACBALbaewDnzZ5AcGbZno7VW1m7Si3Q+yEANXZioVupfSwOP0q9aP2iV"+
+                "tyqq575JnUVZXMDR2Gr254F/qCJ0TKAvucN0gcd2XslX4jBcu1Z7s7YZf6d7fC58k0NE6/keokJNKhQO" +
+                "i56iirRzSA/YFrD64mzfq6rEmai0q7GjGGP0RT1AAAAFQDO5++6JonyqnoRkV9Yl1OaEOPjVwAAAIAYA" +
+                "tqtKtU/INlTIuL3wt3nyKzwPUnz3fqxP5Ger3OlRZsOahalTFt2OF5jGGmCunyBTRteOetZObr0QhUIF" +
+                "4bSDr6UiYYYbH1ES0ws/t1mDIeTh3UUHV1QYACN6c07FKyKLMtB9AthiG2FMLKCEedG3NeXItuNzsuQD" +
+                "+n/K1rzMAAAAIBi5SM4pFPiB7BvTZvARV56vrG5QNgWVazSwbwgl/EACiWYbRauHDUQA9f+Rq+ayWcsR" +
+                "os1CD+Q81y9SmlQaZVKkSPZLxXfu5bi3s4o431xjilhZdt4vKbj2pK364IjghJPNBBfmRXzlj9awKxr/" +
+                "UebZcBgNRyeky7VZSbbF2jQSQ==";
+        String parsedKey = SSHKeysHelper.getPublicKeyFromKeyMaterial(dssKey);
+        String fingerprint = SSHKeysHelper.getPublicKeyFingerprint(parsedKey);
+        
+        assertTrue(storedDssKey.equals(parsedKey));
+        assertTrue("fc:6e:ef:31:93:f8:92:2b:a9:03:c7:06:90:f5:ec:bb".equals(fingerprint));
+        
+    }
+}


[07/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1

Posted by ah...@apache.org.
CLOUDSTACK-3024: Invalid reference to testclient close

Testclient does not expose a close() method anymore for closing the
connection to cloudstack

Signed-off-by: Prasanna Santhanam <ts...@apache.org>


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

Branch: refs/heads/vmsync
Commit: e405703d5c38fd42b4c91533cf50e07190fbe760
Parents: bf0265d
Author: Prasanna Santhanam <ts...@apache.org>
Authored: Mon Jun 17 10:04:26 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Mon Jun 17 10:05:02 2013 +0530

----------------------------------------------------------------------
 test/integration/component/test_host_high_availability.py | 1 -
 1 file changed, 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e405703d/test/integration/component/test_host_high_availability.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_host_high_availability.py b/test/integration/component/test_host_high_availability.py
index 57eb5ed..2fe07b1 100644
--- a/test/integration/component/test_host_high_availability.py
+++ b/test/integration/component/test_host_high_availability.py
@@ -142,7 +142,6 @@ class TestHostHighAvailability(cloudstackTestCase):
         try:
             #Clean up, terminate the created accounts, domains etc
             cleanup_resources(self.apiclient, self.cleanup)
-            self.testClient.close()
         except Exception as e:
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return


[27/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1

Posted by ah...@apache.org.
CLOUDSTACK-2914: default lb scheme to Public when the service LB is enabled, and scheme is not specified explicitly


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

Branch: refs/heads/vmsync
Commit: fc16e29f992d81156a4e08a77da215f8276f4efe
Parents: b0ea02e
Author: Alena Prokharchyk <al...@citrix.com>
Authored: Mon Jun 17 10:09:52 2013 -0700
Committer: Alena Prokharchyk <al...@citrix.com>
Committed: Mon Jun 17 10:10:43 2013 -0700

----------------------------------------------------------------------
 .../api/command/admin/network/CreateNetworkOfferingCmd.java  | 2 +-
 .../com/cloud/configuration/ConfigurationManagerImpl.java    | 8 +++++---
 2 files changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fc16e29f/api/src/org/apache/cloudstack/api/command/admin/network/CreateNetworkOfferingCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/CreateNetworkOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/CreateNetworkOfferingCmd.java
index 6410715..febb0c3 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/network/CreateNetworkOfferingCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/network/CreateNetworkOfferingCmd.java
@@ -95,7 +95,7 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
     @Parameter(name=ApiConstants.IS_PERSISTENT, type=CommandType.BOOLEAN, description="true if network offering supports persistent networks; defaulted to false if not specified")
     private Boolean isPersistent;
     
-    @Parameter(name=ApiConstants.DETAILS, type=CommandType.MAP, since="4.2.0", description="Template details in key/value pairs." +
+    @Parameter(name=ApiConstants.DETAILS, type=CommandType.MAP, since="4.2.0", description="Network offering details in key/value pairs." +
     		" Supported keys are internallbprovider/publiclbprovider with service provider as a value")
     protected Map details;
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fc16e29f/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
index 131d340..68745bf 100755
--- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
@@ -3968,9 +3968,6 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
                         _networkModel.checkCapabilityForProvider(serviceProviderMap.get(Service.Lb), Service.Lb, Capability.LbSchemes, publicLbStr);
                         internalLb = publicLbStr.contains("internal");
                         publicLb = publicLbStr.contains("public");
-                    } else {
-                        //if not specified, default public lb to true
-                        publicLb = true;
                     }
                 }
             }
@@ -4009,6 +4006,11 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
                 }
             }
         }
+        
+        if (serviceProviderMap.containsKey(Service.Lb) && !internalLb && !publicLb) {
+            //if not specified, default public lb to true
+            publicLb = true;
+        }
 
         NetworkOfferingVO offering = new NetworkOfferingVO(name, displayText, trafficType, systemOnly, specifyVlan,
                 networkRate, multicastRate, isDefault, availability, tags, type, conserveMode, dedicatedLb,


[12/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1

Posted by ah...@apache.org.
Add proposal to CloudStack_GSoC_Guide.xml


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

Branch: refs/heads/vmsync
Commit: ac48e5dc67e6ae93545ab188500070b3ef3da290
Parents: fcafe28
Author: Shiva Teja <sh...@gmail.com>
Authored: Thu Jun 13 23:02:12 2013 +0530
Committer: Sebastien Goasguen <ru...@gmail.com>
Committed: Mon Jun 17 02:20:36 2013 -0400

----------------------------------------------------------------------
 docs/en-US/CloudStack_GSoC_Guide.xml | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ac48e5dc/docs/en-US/CloudStack_GSoC_Guide.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/CloudStack_GSoC_Guide.xml b/docs/en-US/CloudStack_GSoC_Guide.xml
index 1f43593..cd8205d 100644
--- a/docs/en-US/CloudStack_GSoC_Guide.xml
+++ b/docs/en-US/CloudStack_GSoC_Guide.xml
@@ -50,5 +50,6 @@
     <xi:include href="gsoc-imduffy15.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
     <xi:include href="gsoc-dharmesh.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
     <xi:include href="gsoc-meng.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+    <xi:include href="gsoc-shiva.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
 </book>
 


[50/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1

Posted by ah...@apache.org.
Merge from master


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

Branch: refs/heads/vmsync
Commit: e2edae1711f1740639a81c1d64b25d75213949af
Parents: 309f8da fb31a39
Author: Alex Huang <al...@gmail.com>
Authored: Mon Jun 17 19:00:44 2013 -0700
Committer: Alex Huang <al...@gmail.com>
Committed: Mon Jun 17 19:00:44 2013 -0700

----------------------------------------------------------------------
 api/src/com/cloud/network/NetworkModel.java     |    2 +
 api/src/com/cloud/offering/NetworkOffering.java |    2 +
 .../command/admin/cluster/ListClustersCmd.java  |    6 -
 .../api/command/admin/host/ListHostsCmd.java    |    7 -
 .../api/command/admin/ldap/LDAPConfigCmd.java   |   16 +-
 .../admin/network/CreateNetworkOfferingCmd.java |    2 +-
 .../api/command/admin/pod/ListPodsByCmd.java    |    7 -
 .../admin/storage/ListStoragePoolsCmd.java      |    7 -
 .../admin/systemvm/ListSystemVMsCmd.java        |    7 -
 .../api/command/user/iso/ListIsosCmd.java       |    7 -
 .../command/user/network/ListNetworksCmd.java   |    7 -
 .../command/user/snapshot/ListSnapshotsCmd.java |   13 +-
 .../command/user/template/ListTemplatesCmd.java |    8 -
 .../api/command/user/vm/ListVMsCmd.java         |    7 -
 .../api/command/user/volume/ListVolumesCmd.java |    5 -
 .../api/response/FirewallResponse.java          |    8 +-
 .../api/response/SnapshotResponse.java          |    7 +
 .../service/controller/s3/ServiceProvider.java  |    6 +-
 awsapi/web/web.xml                              |   11 +-
 client/tomcatconf/nonossComponentContext.xml.in |    1 +
 .../src/com/cloud/agent/api/ScaleVmCommand.java |   26 +-
 .../virtualnetwork/VirtualRoutingResource.java  |   50 +-
 .../com/cloud/network/HAProxyConfigurator.java  |   22 +-
 docs/en-US/CloudStack_GSoC_Guide.xml            |    3 +-
 docs/en-US/Release_Notes.xml                    |    2 +-
 docs/en-US/add-loadbalancer-rule-vpc.xml        |    8 +-
 docs/en-US/add-remove-nic-ui.xml                |  147 +++
 docs/en-US/configure-package-repository.xml     |    4 +-
 docs/en-US/create-vpn-connection-vpc.xml        |   31 +-
 docs/en-US/create-vpn-gateway-for-vpc.xml       |   30 +-
 docs/en-US/delete-reset-vpn.xml                 |   28 +-
 docs/en-US/gsoc-meng.xml                        |  235 ++++
 docs/en-US/gsoc-shiva.xml                       |   70 ++
 docs/en-US/images/remove-nic.png                |  Bin 0 -> 735 bytes
 docs/en-US/images/set-default-nic.png           |  Bin 0 -> 1012 bytes
 .../management-server-install-db-local.xml      |    8 +
 docs/en-US/networks.xml                         |    1 +
 docs/en-US/pvlan.xml                            |  202 ++-
 docs/en-US/using-multiple-guest-networks.xml    |    1 +
 docs/pot/configure-package-repository.pot       |    4 +-
 .../src/com/cloud/storage/VolumeManager.java    |    2 +
 .../orchestration/CloudOrchestrator.java        |    6 +
 .../cloud/vm/VirtualMachineManagerImplTest.java |   12 +-
 .../com/cloud/capacity/dao/CapacityDaoImpl.java |   24 +-
 .../src/com/cloud/dc/dao/DataCenterDao.java     |    2 +-
 .../src/com/cloud/dc/dao/DataCenterDaoImpl.java |   15 +-
 .../com/cloud/network/dao/IPAddressDaoImpl.java |    1 +
 .../rules/dao/PortForwardingRulesDao.java       |    2 +-
 .../rules/dao/PortForwardingRulesDaoImpl.java   |    9 +-
 .../com/cloud/offerings/NetworkOfferingVO.java  |    4 +
 .../storage/dao/SnapshotPolicyDaoImpl.java      |    1 -
 .../com/cloud/storage/dao/VMTemplateDao.java    |    2 +-
 .../cloud/storage/dao/VMTemplateDaoImpl.java    |   21 +-
 .../com/cloud/upgrade/dao/Upgrade410to420.java  |    1 +
 .../src/com/cloud/usage/dao/UsageDao.java       |    5 +-
 .../src/com/cloud/usage/dao/UsageDaoImpl.java   |   64 +
 .../strategy/AncientSnapshotStrategy.java       |    5 +
 .../HypervisorHostEndPointRpcServer.java        |    2 +-
 .../kvm/resource/LibvirtComputingResource.java  |    4 +-
 .../kvm/resource/LibvirtStorageVolumeDef.java   |    2 +-
 .../hypervisor/kvm/resource/LibvirtVMDef.java   |    2 +-
 .../resource/LibvirtComputingResourceTest.java  |    4 +-
 .../vmware/resource/VmwareResource.java         |   57 +-
 .../vmware/resource/VmwareResourceTest.java     |    7 +-
 .../xen/discoverer/XcpServerDiscoverer.java     |   12 +-
 .../xen/resource/CitrixResourceBase.java        |    8 +-
 .../xen/resource/CitrixResourceBaseTest.java    |   12 +-
 .../guru/BigSwitchVnsGuestNetworkGuru.java      |    2 +-
 .../cloud/network/guru/OvsGuestNetworkGuru.java |    3 +-
 scripts/network/domr/call_dnsmasq.sh            |   29 +
 scripts/network/domr/createipAlias.sh           |   26 +
 scripts/network/domr/deleteipAlias.sh           |   25 +
 server/src/com/cloud/api/ApiResponseHelper.java |   10 +-
 .../com/cloud/api/query/QueryManagerImpl.java   |   73 +-
 .../api/query/dao/StoragePoolJoinDaoImpl.java   |   17 +-
 server/src/com/cloud/configuration/Config.java  |    9 +-
 .../configuration/ConfigurationManagerImpl.java |  127 +-
 .../consoleproxy/ConsoleProxyManagerImpl.java   |    7 +
 .../com/cloud/network/NetworkManagerImpl.java   |   68 +-
 .../src/com/cloud/network/NetworkModelImpl.java |    5 +-
 .../com/cloud/network/NetworkServiceImpl.java   |   55 +-
 .../network/guru/ExternalGuestNetworkGuru.java  |    3 +-
 .../cloud/network/guru/GuestNetworkGuru.java    |   11 +-
 .../VirtualNetworkApplianceManagerImpl.java     |   28 +-
 .../cloud/network/rules/RulesManagerImpl.java   |    2 +-
 .../network/vpc/NetworkACLServiceImpl.java      |    4 +
 .../cloud/server/ConfigurationServerImpl.java   |   25 +
 .../com/cloud/server/ManagementServerImpl.java  |   98 +-
 .../com/cloud/storage/StorageManagerImpl.java   |    3 +
 .../com/cloud/storage/VolumeManagerImpl.java    |    3 +-
 .../storage/download/DownloadMonitorImpl.java   |   20 +-
 .../src/com/cloud/storage/s3/S3ManagerImpl.java |   10 +-
 .../storage/snapshot/SnapshotManagerImpl.java   |   14 +-
 .../storage/snapshot/SnapshotSchedulerImpl.java |    5 +-
 .../cloud/storage/upload/UploadMonitorImpl.java |   14 +-
 server/src/com/cloud/vm/UserVmManagerImpl.java  |   74 +-
 .../configuration/ValidateIpRangeTest.java      |   11 +-
 .../com/cloud/network/MockNetworkModelImpl.java |    5 +
 .../com/cloud/vpc/MockNetworkModelImpl.java     |    5 +
 services/console-proxy/server/js/ajaxkeys.js    |   42 +-
 .../console-proxy/server/scripts/ssvm-check.sh  |  136 --
 .../consoleproxy/ConsoleProxyClientBase.java    |    4 +-
 .../consoleproxy/ConsoleProxyGCThread.java      |    5 +-
 .../consoleproxy/ConsoleProxyVncClient.java     |    5 +-
 .../consoleproxy/vnc/VncClientPacketSender.java |    4 +-
 .../vnc/VncServerPacketReceiver.java            |    4 +-
 .../server/systemvm-descriptor.xml              |    9 +
 .../resource/NfsSecondaryStorageResource.java   |   19 +-
 setup/db/db/schema-2214to30.sql                 |    1 +
 setup/db/db/schema-410to420.sql                 |    3 +
 setup/dev/advanced.cfg                          |   21 +-
 test/integration/component/maint/__init__.py    |   21 +
 .../component/maint/test_high_availability.py   | 1079 ++++++++++++++++
 .../maint/test_host_high_availability.py        |  810 ++++++++++++
 .../maint/test_vpc_host_maintenance.py          |  561 +++++++++
 .../maint/test_vpc_on_host_maintenance.py       |  323 +++++
 test/integration/component/test_accounts.py     |    5 +-
 .../component/test_advancedsg_networks.py       |   20 +-
 .../component/test_custom_hostname.py           |   22 +-
 test/integration/component/test_egress_rules.py |    1 -
 test/integration/component/test_eip_elb.py      |    6 -
 .../component/test_high_availability.py         | 1079 ----------------
 .../component/test_host_high_availability.py    |  811 ------------
 .../component/test_netscaler_configs.py         |   20 +-
 test/integration/component/test_netscaler_lb.py |   81 +-
 .../component/test_netscaler_lb_algo.py         |   56 +-
 .../component/test_netscaler_lb_sticky.py       |    6 +-
 .../component/test_network_offering.py          |    1 -
 .../component/test_project_configs.py           |    2 -
 .../component/test_project_limits.py            |    1 -
 test/integration/component/test_projects.py     |    1 -
 .../component/test_shared_networks.py           |   94 +-
 test/integration/component/test_tags.py         |    2 -
 test/integration/component/test_templates.py    |    1 -
 .../component/test_vm_passwdenabled.py          |    1 -
 test/integration/component/test_vpc.py          |  423 +------
 .../component/test_vpc_host_maintenance.py      |  889 -------------
 test/integration/component/test_vpc_network.py  |  275 ++--
 .../component/test_vpc_network_lbrules.py       |    2 +-
 .../component/test_vpc_network_pfrules.py       |  489 ++++----
 .../integration/component/test_vpc_offerings.py |    2 -
 test/integration/component/test_vpc_routers.py  |    4 -
 .../component/test_vpc_vm_life_cycle.py         | 1181 +++---------------
 .../component/test_vpc_vms_deployment.py        |    1 -
 ...deploy_vms_with_varied_deploymentplanners.py |   25 +-
 test/integration/smoke/test_network.py          |  376 +++---
 .../integration/smoke/test_portable_publicip.py |    1 -
 test/integration/smoke/test_vm_life_cycle.py    |    4 +-
 tools/apidoc/generateadmincommands.xsl          |    6 +-
 tools/apidoc/generatecommand.xsl                |    4 +-
 tools/apidoc/generatedomainadmincommands.xsl    |    4 +-
 tools/apidoc/generatetoc_footer.xsl             |    4 +-
 tools/apidoc/generateusercommands.xsl           |    4 +-
 tools/apidoc/images/cloudstack.png              |  Bin 3893 -> 8575 bytes
 tools/apidoc/images/ins_buttonshadow.gif        |  Bin 1683 -> 0 bytes
 tools/apidoc/images/insdownload_button.gif      |  Bin 2531 -> 0 bytes
 .../apidoc/images/insdownload_button_hover.gif  |  Bin 2569 -> 0 bytes
 tools/apidoc/images/insjoincomm_button.gif      |  Bin 2627 -> 0 bytes
 .../apidoc/images/insjoincomm_button_hover.gif  |  Bin 2620 -> 0 bytes
 tools/apidoc/includes/main.css                  |    2 +-
 tools/appliance/build.sh                        |    6 +-
 tools/cli/cloudmonkey/config.py                 |    2 +-
 tools/cli/cloudmonkey/requester.py              |   47 +-
 tools/marvin/marvin/cloudstackTestClient.py     |    1 +
 ui/index.jsp                                    |    1 -
 ui/scripts/configuration.js                     |    7 +-
 ui/scripts/instances.js                         |   12 +-
 ui/scripts/network.js                           |  135 +-
 ui/scripts/system.js                            |   10 +-
 ui/scripts/ui-custom/projectSelect.js           |    4 +-
 ui/scripts/ui-custom/projects.js                |    4 +-
 ui/scripts/ui/utils.js                          |    2 +-
 ui/scripts/ui/widgets/listView.js               |   26 +-
 ui/scripts/vpc.js                               |   17 +-
 ui/scripts/zoneWizard.js                        |    2 +
 .../cloud/usage/parser/NetworkUsageParser.java  |   11 +-
 .../cloud/usage/parser/VmDiskUsageParser.java   |   59 +-
 utils/src/com/cloud/utils/S3Utils.java          |    4 +-
 utils/src/com/cloud/utils/StringUtils.java      |    6 +-
 utils/src/com/cloud/utils/Ternary.java          |    2 +-
 utils/src/com/cloud/utils/net/NetUtils.java     |   42 +-
 .../src/com/cloud/utils/ssh/SSHKeysHelper.java  |    2 +-
 utils/test/com/cloud/utils/StringUtilsTest.java |    5 +
 utils/test/com/cloud/utils/TernaryTest.java     |   35 +
 .../com/cloud/utils/crypto/RSAHelperTest.java   |   50 +
 .../test/com/cloud/utils/net/NetUtilsTest.java  |   18 +
 .../com/cloud/utils/ssh/SSHKeysHelperTest.java  |   69 +
 187 files changed, 5783 insertions(+), 5834 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java
index 1283f2c,0417b18..ac48f75
--- a/api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java
@@@ -118,10 -114,7 +115,7 @@@ public class ListClustersCmd extends Ba
          this.managedState = managedstate;
      }
  
-     public String getZoneType() {
-         return zoneType;
-     }
 -
 +    
      public Boolean getShowCapacities() {
          return showCapacities;
      }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/api/src/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java
index 18a153c,eaaec30..cf1f5be
--- a/api/src/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java
@@@ -75,10 -74,7 +75,7 @@@ public class ListHostsCmd extends BaseL
      @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType = ZoneResponse.class,
              description="the Zone ID for the host")
      private Long zoneId;
 -    
 +
-     @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.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType = UserVmResponse.class,
              required=false, description="lists hosts in the same cluster as this VM and flag hosts with enough CPU/RAm to host this VM")
      private Long virtualMachineId;
@@@ -127,11 -123,7 +124,7 @@@
      public Long getZoneId() {
          return zoneId;
      }
 -    
 +
-     public String getZoneType() {
-         return zoneType;
-     }
-     
      public Long getVirtualMachineId() {
          return virtualMachineId;
      }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/api/src/org/apache/cloudstack/api/command/admin/ldap/LDAPConfigCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/admin/ldap/LDAPConfigCmd.java
index 9eaecca,2726f84..7f31800
--- a/api/src/org/apache/cloudstack/api/command/admin/ldap/LDAPConfigCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/ldap/LDAPConfigCmd.java
@@@ -44,10 -43,9 +44,9 @@@ public class LDAPConfigCmd extends Base
      /////////////////////////////////////////////////////
      //////////////// API parameters /////////////////////
      /////////////////////////////////////////////////////
- 
-     @Parameter(name=ApiConstants.LIST_ALL, type=CommandType.STRING,  description="Hostname or ip address of the ldap server eg: my.ldap.com")
-     private String listall;
+     @Parameter(name=ApiConstants.LIST_ALL, type=CommandType.BOOLEAN,  description="If true return current LDAP configuration")
+     private Boolean listAll;
 -    
 +
      @Parameter(name=ApiConstants.HOST_NAME, type=CommandType.STRING,  description="Hostname or ip address of the ldap server eg: my.ldap.com")
      private String hostname;
  
@@@ -79,10 -77,10 +78,10 @@@
      /////////////////// Accessors ///////////////////////
      /////////////////////////////////////////////////////
  
-     public String getListAll() {
-         return listall == null ? "false" : listall;
+     public Boolean getListAll() {
+     	return listAll == null ? Boolean.FALSE : listAll;
      }
 -    
 +
      public String getBindPassword() {
          return bindPassword;
      }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/api/src/org/apache/cloudstack/api/command/admin/network/CreateNetworkOfferingCmd.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/api/src/org/apache/cloudstack/api/command/admin/pod/ListPodsByCmd.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/api/src/org/apache/cloudstack/api/command/admin/storage/ListStoragePoolsCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/admin/storage/ListStoragePoolsCmd.java
index 12bb6d0,85a3c22..367d1e6
--- a/api/src/org/apache/cloudstack/api/command/admin/storage/ListStoragePoolsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/storage/ListStoragePoolsCmd.java
@@@ -60,10 -59,7 +60,7 @@@ public class ListStoragePoolsCmd extend
      @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType = ZoneResponse.class,
              description="the Zone ID for the storage pool")
      private Long zoneId;
 -    
 +
-     @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.ID, type=CommandType.UUID, entityType = StoragePoolResponse.class,
              description="the ID of the storage pool")
      private Long id;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/api/src/org/apache/cloudstack/api/command/admin/systemvm/ListSystemVMsCmd.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java
index 53e4d14,3219601..a12b8f6
--- a/api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java
@@@ -119,12 -115,8 +116,8 @@@ public class ListIsosCmd extends BaseLi
          return zoneId;
      }
  
-     public String getZoneType() {
-         return zoneType;
-     }
-     
      public boolean listInReadyState() {
 -        Account account = UserContext.current().getCaller();
 +        Account account = CallContext.current().getCallingAccount();
          // It is account specific if account is admin type and domainId and accountName are not null
          boolean isAccountSpecific = (account == null || isAdmin(account.getType())) && (getAccountName() != null) && (getDomainId() != null);
          // Show only those that are downloaded.

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/api/src/org/apache/cloudstack/api/command/user/network/ListNetworksCmd.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java
index ca169b7,8859ba5..aafe9d8
--- a/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java
@@@ -29,7 -26,10 +29,8 @@@ import org.apache.cloudstack.api.Parame
  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;
  import com.cloud.storage.Snapshot;
  import com.cloud.utils.Pair;
  
@@@ -60,9 -60,10 +61,10 @@@ public class ListSnapshotsCmd extends B
              description="the ID of the disk volume")
      private Long volumeId;
  
-     @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 ///////////////////////
      /////////////////////////////////////////////////////
@@@ -87,10 -88,10 +89,10 @@@
          return volumeId;
      }
  
-     public String getZoneType() {
-         return zoneType;
+     public Long getZoneId() {
+         return zoneId;
 -    }    
 -
 +    }
 +    
      /////////////////////////////////////////////////////
      /////////////// API Implementation///////////////////
      /////////////////////////////////////////////////////
@@@ -100,8 -101,8 +102,9 @@@
          return s_name;
      }
  
 -    public AsyncJob.Type getInstanceType() {
 -        return AsyncJob.Type.Snapshot;
++    @Override
 +    public ApiCommandJobType getInstanceType() {
 +        return ApiCommandJobType.Snapshot;
      }
  
      @Override
@@@ -117,6 -118,6 +120,6 @@@
          response.setResponses(snapshotResponses, result.second());
          response.setResponseName(getCommandName());
  
--        this.setResponseObject(response);
++        setResponseObject(response);
      }
  }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
index 29d0356,aeb76f5..b764b6d
--- a/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
@@@ -97,13 -92,9 +93,9 @@@ public class ListTemplatesCmd extends B
          return zoneId;
      }
  
-     public String getZoneType() {
-         return zoneType;
-     }
-     
      public boolean listInReadyState() {
  
 -        Account account = UserContext.current().getCaller();
 +        Account account = CallContext.current().getCallingAccount();
          // It is account specific if account is admin type and domainId and accountName are not null
          boolean isAccountSpecific = (account == null || isAdmin(account.getType())) && (getAccountName() != null) && (getDomainId() != null);
          // Show only those that are downloaded.

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/api/src/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/api/src/org/apache/cloudstack/api/command/user/volume/ListVolumesCmd.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/api/src/org/apache/cloudstack/api/response/FirewallResponse.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/api/src/org/apache/cloudstack/api/response/SnapshotResponse.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/engine/components-api/src/com/cloud/storage/VolumeManager.java
----------------------------------------------------------------------
diff --cc engine/components-api/src/com/cloud/storage/VolumeManager.java
index 36fd75b,0000000..5345aa7
mode 100644,000000..100644
--- a/engine/components-api/src/com/cloud/storage/VolumeManager.java
+++ b/engine/components-api/src/com/cloud/storage/VolumeManager.java
@@@ -1,119 -1,0 +1,121 @@@
 +/*
 + * Licensed to the Apache Software Foundation (ASF) under one
 + * or more contributor license agreements.  See the NOTICE file
 + * distributed with this work for additional information
 + * regarding copyright ownership.  The ASF licenses this file
 + * to you under the Apache License, Version 2.0 (the
 + * "License"); you may not use this file except in compliance
 + * with the License.  You may obtain a copy of the License at
 + *
 + *   http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * Unless required by applicable law or agreed to in writing,
 + * software distributed under the License is distributed on an
 + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 + * KIND, either express or implied.  See the License for the
 + * specific language governing permissions and limitations
 + * under the License.
 + */
 +package com.cloud.storage;
 +
 +import java.util.Map;
 +
 +import org.apache.cloudstack.api.command.user.volume.AttachVolumeCmd;
 +import org.apache.cloudstack.api.command.user.volume.CreateVolumeCmd;
 +import org.apache.cloudstack.api.command.user.volume.DetachVolumeCmd;
 +import org.apache.cloudstack.api.command.user.volume.MigrateVolumeCmd;
 +import org.apache.cloudstack.api.command.user.volume.ResizeVolumeCmd;
 +import org.apache.cloudstack.api.command.user.volume.UploadVolumeCmd;
 +import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
 +
 +import com.cloud.agent.api.to.VirtualMachineTO;
 +import com.cloud.deploy.DeployDestination;
 +import com.cloud.exception.ConcurrentOperationException;
 +import com.cloud.exception.InsufficientStorageCapacityException;
 +import com.cloud.exception.ResourceAllocationException;
 +import com.cloud.exception.StorageUnavailableException;
 +import com.cloud.host.Host;
 +import com.cloud.hypervisor.Hypervisor.HypervisorType;
 +import com.cloud.storage.Volume.Type;
 +import com.cloud.user.Account;
 +import com.cloud.vm.DiskProfile;
 +import com.cloud.vm.VMInstanceVO;
 +import com.cloud.vm.VirtualMachine;
 +import com.cloud.vm.VirtualMachineProfile;
 +
 +public interface VolumeManager extends VolumeApiService {
 +
 +    VolumeInfo moveVolume(VolumeInfo volume, long destPoolDcId, Long destPoolPodId,
 +            Long destPoolClusterId, HypervisorType dataDiskHyperType)
 +            throws ConcurrentOperationException;
 +
 +    @Override
 +    VolumeVO uploadVolume(UploadVolumeCmd cmd)
 +            throws ResourceAllocationException;
 +
 +    VolumeVO allocateDuplicateVolume(VolumeVO oldVol, Long templateId);
 +
 +    boolean volumeOnSharedStoragePool(VolumeVO volume);
 +
 +    boolean volumeInactive(Volume volume);
 +
 +    String getVmNameOnVolume(Volume volume);
 +
 +    @Override
 +    VolumeVO allocVolume(CreateVolumeCmd cmd)
 +            throws ResourceAllocationException;
 +
 +    @Override
 +    VolumeVO createVolume(CreateVolumeCmd cmd);
 +
 +    @Override
 +    VolumeVO resizeVolume(ResizeVolumeCmd cmd)
 +            throws ResourceAllocationException;
 +
 +    @Override
 +    boolean deleteVolume(long volumeId, Account caller)
 +            throws ConcurrentOperationException;
 +    
 +    void destroyVolume(VolumeVO volume);
 +
 +    DiskProfile allocateRawVolume(Type type, String name, DiskOfferingVO offering, Long size, VMInstanceVO vm, Account owner);
 +    @Override
 +    Volume attachVolumeToVM(AttachVolumeCmd command);
 +
 +    @Override
 +    Volume detachVolumeFromVM(DetachVolumeCmd cmmd);
 +
 +    void release(VirtualMachineProfile profile);
 +
 +    void cleanupVolumes(long vmId) throws ConcurrentOperationException;
 +
 +    @Override
 +    Volume migrateVolume(MigrateVolumeCmd cmd);
 +
 +    void migrateVolumes(VirtualMachine vm, VirtualMachineTO vmTo, Host srcHost, Host destHost,
 +            Map<Volume, StoragePool> volumeToPool);
 +
 +    boolean storageMigration(
 +            VirtualMachineProfile vm,
 +            StoragePool destPool);
 +
 +    void prepareForMigration(
 +            VirtualMachineProfile vm,
 +            DeployDestination dest);
 +
 +    void prepare(VirtualMachineProfile vm,
 +            DeployDestination dest) throws StorageUnavailableException,
 +            InsufficientStorageCapacityException, ConcurrentOperationException;
 +
 +    boolean canVmRestartOnAnotherServer(long vmId);
 +
 +    DiskProfile allocateTemplatedVolume(Type type, String name,
 +            DiskOfferingVO offering, VMTemplateVO template, VMInstanceVO vm,
 +            Account owner);
 +
 +    String getVmNameFromVolumeId(long volumeId);
 +
 +    String getStoragePoolOfVolume(long volumeId);
++
++    boolean validateVolumeSizeRange(long size);
 +}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/engine/orchestration/src/org/apache/cloudstack/platform/orchestration/CloudOrchestrator.java
----------------------------------------------------------------------
diff --cc engine/orchestration/src/org/apache/cloudstack/platform/orchestration/CloudOrchestrator.java
index d343df3,96fb1d9..a60ad38
--- a/engine/orchestration/src/org/apache/cloudstack/platform/orchestration/CloudOrchestrator.java
+++ b/engine/orchestration/src/org/apache/cloudstack/platform/orchestration/CloudOrchestrator.java
@@@ -45,6 -46,6 +45,7 @@@ import com.cloud.network.dao.NetworkVO
  import com.cloud.service.ServiceOfferingVO;
  import com.cloud.service.dao.ServiceOfferingDao;
  import com.cloud.storage.DiskOfferingVO;
++import com.cloud.storage.VolumeManager;
  import com.cloud.storage.dao.DiskOfferingDao;
  import com.cloud.storage.dao.VMTemplateDao;
  import com.cloud.user.dao.AccountDao;
@@@ -88,9 -88,12 +89,12 @@@ public class CloudOrchestrator implemen
  	@Inject
  	protected AccountDao _accountDao = null;
  
+     @Inject
+     VolumeManager _volumeMgr;
+ 
  	public CloudOrchestrator() {
  	}
 -
 +	
      public VirtualMachineEntity createFromScratch(String uuid, String iso, String os, String hypervisor, String hostName, int cpu, int speed, long memory, List<String> networks, List<String> computeTags,
              Map<String, String> details, String owner) {
          return null;
@@@ -250,7 -251,8 +255,8 @@@
  				throw new InvalidParameterValueException("Disk offering "
  						+ diskOffering + " requires size parameter.");
  			}
+             _volumeMgr.validateVolumeSizeRange(size * 1024 * 1024 * 1024);
 -        }
 +		}
  		rootDiskOffering.first(diskOffering);
  		rootDiskOffering.second(size);
  

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/engine/orchestration/test/com/cloud/vm/VirtualMachineManagerImplTest.java
----------------------------------------------------------------------
diff --cc engine/orchestration/test/com/cloud/vm/VirtualMachineManagerImplTest.java
index 607c1e2,0000000..192f99a
mode 100644,000000..100644
--- a/engine/orchestration/test/com/cloud/vm/VirtualMachineManagerImplTest.java
+++ b/engine/orchestration/test/com/cloud/vm/VirtualMachineManagerImplTest.java
@@@ -1,420 -1,0 +1,430 @@@
 +// Licensed to the Apache Software Foundation (ASF) under one
 +// or more contributor license agreements.  See the NOTICE file
 +// distributed with this work for additional information
 +// regarding copyright ownership.  The ASF licenses this file
 +// to you under the Apache License, Version 2.0 (the
 +// "License"); you may not use this file except in compliance
 +// with the License.  You may obtain a copy of the License at
 +//
 +//   http://www.apache.org/licenses/LICENSE-2.0
 +//
 +// Unless required by applicable law or agreed to in writing,
 +// software distributed under the License is distributed on an
 +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 +// KIND, either express or implied.  See the License for the
 +// specific language governing permissions and limitations
 +// under the License.
 +
 +package com.cloud.vm;
 +
 +import static org.mockito.Matchers.any;
 +import static org.mockito.Matchers.anyLong;
 +import static org.mockito.Matchers.isA;
 +import static org.mockito.Mockito.doNothing;
 +import static org.mockito.Mockito.mock;
 +import static org.mockito.Mockito.when;
 +
 +import java.util.HashMap;
 +import java.util.Iterator;
 +import java.util.List;
 +import java.util.Map;
 +
 +import org.junit.Before;
 +import org.junit.Test;
 +import org.mockito.Mock;
 +import org.mockito.MockitoAnnotations;
 +import org.mockito.Spy;
 +
 +import org.apache.cloudstack.api.command.user.vm.RestoreVMCmd;
++import org.apache.cloudstack.config.ConfigDepot;
 +import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
 +import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
 +
 +import com.cloud.agent.AgentManager;
 +import com.cloud.agent.api.Answer;
 +import com.cloud.agent.api.CheckVirtualMachineAnswer;
 +import com.cloud.agent.api.CheckVirtualMachineCommand;
 +import com.cloud.agent.api.MigrateWithStorageAnswer;
 +import com.cloud.agent.api.MigrateWithStorageCommand;
 +import com.cloud.agent.api.MigrateWithStorageCompleteAnswer;
 +import com.cloud.agent.api.MigrateWithStorageCompleteCommand;
 +import com.cloud.agent.api.MigrateWithStorageReceiveAnswer;
 +import com.cloud.agent.api.MigrateWithStorageReceiveCommand;
 +import com.cloud.agent.api.MigrateWithStorageSendAnswer;
 +import com.cloud.agent.api.MigrateWithStorageSendCommand;
 +import com.cloud.agent.api.PrepareForMigrationAnswer;
 +import com.cloud.agent.api.PrepareForMigrationCommand;
 +import com.cloud.agent.api.ScaleVmAnswer;
 +import com.cloud.agent.api.ScaleVmCommand;
 +import com.cloud.configuration.dao.ConfigurationDao;
 +import com.cloud.dc.dao.ClusterDao;
 +import com.cloud.dc.dao.DataCenterDao;
 +import com.cloud.dc.dao.HostPodDao;
 +import com.cloud.deploy.DeployDestination;
 +import com.cloud.exception.ConcurrentOperationException;
 +import com.cloud.exception.ManagementServerException;
 +import com.cloud.exception.OperationTimedoutException;
 +import com.cloud.exception.ResourceUnavailableException;
 +import com.cloud.exception.VirtualMachineMigrationException;
 +import com.cloud.host.HostVO;
 +import com.cloud.host.dao.HostDao;
 +import com.cloud.hypervisor.Hypervisor.HypervisorType;
 +import com.cloud.hypervisor.HypervisorGuru;
 +import com.cloud.hypervisor.HypervisorGuruManager;
 +import com.cloud.network.NetworkManager;
 +import com.cloud.offering.ServiceOffering;
 +import com.cloud.service.ServiceOfferingVO;
 +import com.cloud.storage.DiskOfferingVO;
 +import com.cloud.storage.StoragePool;
 +import com.cloud.storage.StoragePoolHostVO;
 +import com.cloud.storage.VMTemplateVO;
 +import com.cloud.storage.Volume;
 +import com.cloud.storage.VolumeManager;
 +import com.cloud.storage.VolumeVO;
 +import com.cloud.storage.dao.DiskOfferingDao;
 +import com.cloud.storage.dao.StoragePoolHostDao;
 +import com.cloud.storage.dao.VMTemplateDao;
 +import com.cloud.storage.dao.VolumeDao;
 +import com.cloud.user.Account;
 +import com.cloud.user.AccountVO;
 +import com.cloud.user.UserVO;
 +import com.cloud.user.dao.AccountDao;
 +import com.cloud.user.dao.UserDao;
 +import com.cloud.utils.Pair;
 +import com.cloud.utils.db.EntityManager;
 +import com.cloud.utils.exception.CloudRuntimeException;
 +import com.cloud.vm.VirtualMachine.Event;
 +import com.cloud.vm.VirtualMachine.PowerState;
 +import com.cloud.vm.VirtualMachine.State;
 +import com.cloud.vm.dao.UserVmDao;
 +import com.cloud.vm.dao.VMInstanceDao;
 +import com.cloud.vm.snapshot.VMSnapshotManager;
 +
 +public class VirtualMachineManagerImplTest {
 +
 +        @Spy VirtualMachineManagerImpl _vmMgr = new VirtualMachineManagerImpl();
 +        @Mock
 +        VolumeManager _storageMgr;
 +        @Mock
 +        Account _account;
 +        @Mock
 +        AgentManager _agentMgr;
 +        @Mock
 +        AccountDao _accountDao;
 +        @Mock
 +        ConfigurationDao _configDao;
 +        @Mock
 +        HostDao _hostDao;
 +        @Mock
 +        UserDao _userDao;
 +        @Mock
 +        UserVmDao _vmDao;
 +        @Mock
 +        ItWorkDao _workDao;
 +        @Mock
 +        VMInstanceDao _vmInstanceDao;
 +        @Mock
 +        VMTemplateDao _templateDao;
 +        @Mock
 +        VolumeDao _volsDao;
 +        @Mock
 +        RestoreVMCmd _restoreVMCmd;
 +        @Mock
 +        AccountVO _accountMock;
 +        @Mock
 +        UserVO _userMock;
 +        @Mock
 +        UserVmVO _vmMock;
 +        @Mock
 +        VMInstanceVO _vmInstance;
 +        @Mock
 +        HostVO _host;
 +        @Mock
 +        VMTemplateVO _templateMock;
 +        @Mock
 +        VolumeVO _volumeMock;
 +        @Mock
 +        List<VolumeVO> _rootVols;
 +        @Mock
 +        ItWorkVO _work;
++        @Mock
++    ConfigDepot _configDepot;
++        @Mock
++        HostVO hostVO;
 +
 +    @Mock
 +    EntityManager _entityMgr;
 +
 +        @Mock ClusterDao _clusterDao;
 +        @Mock HostPodDao _podDao;
 +        @Mock DataCenterDao _dcDao;
 +        @Mock DiskOfferingDao _diskOfferingDao;
 +        @Mock PrimaryDataStoreDao _storagePoolDao;
 +        @Mock StoragePoolHostDao _poolHostDao;
 +        @Mock NetworkManager _networkMgr;
 +        @Mock HypervisorGuruManager _hvGuruMgr;
 +        @Mock VMSnapshotManager _vmSnapshotMgr;
 +
 +        // Mock objects for vm migration with storage test.
 +        @Mock DiskOfferingVO _diskOfferingMock;
 +        @Mock StoragePoolVO _srcStoragePoolMock;
 +        @Mock StoragePoolVO _destStoragePoolMock;
 +        @Mock HostVO _srcHostMock;
 +        @Mock HostVO _destHostMock;
 +    @Mock
 +    Map<Volume, StoragePool> _volumeToPoolMock;
 +
 +        @Before
 +        public void setup(){
 +            MockitoAnnotations.initMocks(this);
 +
 +        _vmMgr._entityMgr = _entityMgr;
 +            _vmMgr._volsDao = _volsDao;
 +            _vmMgr._volumeMgr = _storageMgr;
 +            _vmMgr._hostDao = _hostDao;
 +            _vmMgr._nodeId = 1L;
 +/*
 +            _vmMgr._workDao = _workDao;
 +*/
 +            _vmMgr._agentMgr = _agentMgr;
 +            _vmMgr._poolHostDao= _poolHostDao;
 +            _vmMgr._networkMgr = _networkMgr;
 +            _vmMgr._hvGuruMgr = _hvGuruMgr;
 +            _vmMgr._vmSnapshotMgr = _vmSnapshotMgr;
 +            _vmMgr._vmDao = _vmInstanceDao;
++        _vmMgr._configDepot = _configDepot;
 +
 +            when(_vmMock.getId()).thenReturn(314l);
 +            when(_vmInstance.getId()).thenReturn(1L);
 +            when(_vmInstance.getServiceOfferingId()).thenReturn(2L);
 +            when(_vmInstance.getInstanceName()).thenReturn("myVm");
 +            when(_vmInstance.getHostId()).thenReturn(2L);
 +            when(_vmInstance.getType()).thenReturn(VirtualMachine.Type.User);
 +            when(_host.getId()).thenReturn(1L);
 +            when(_hostDao.findById(anyLong())).thenReturn(null);
 +        when(_entityMgr.findById(ServiceOffering.class, anyLong())).thenReturn(getSvcoffering(512));
 +            when(_workDao.persist(_work)).thenReturn(_work);
 +            when(_workDao.update("1", _work)).thenReturn(true);
 +            when(_work.getId()).thenReturn("1");
 +            doNothing().when(_work).setStep(ItWorkVO.Step.Done);
 +            //doNothing().when(_volsDao).detachVolume(anyLong());
 +            //when(_work.setStep(ItWorkVO.Step.Done)).thenReturn("1");
 +
 +        }
 +
 +
 +    @Test(expected=CloudRuntimeException.class)
 +    public void testScaleVM1()  throws Exception {
 +
 +
 +        DeployDestination dest = new DeployDestination(null, null, null, _host);
 +        long l = 1L;
 +
 +        when(_vmInstanceDao.findById(anyLong())).thenReturn(_vmInstance);
 +        _vmMgr.migrateForScale(_vmInstance.getUuid(), l, dest, l);
 +
 +    }
 +
 +    @Test (expected=CloudRuntimeException.class)
 +    public void testScaleVM2()  throws Exception {
 +
 +        DeployDestination dest = new DeployDestination(null, null, null, _host);
 +        long l = 1L;
 +
 +        when(_vmInstanceDao.findById(anyLong())).thenReturn(_vmInstance);
 +        ServiceOfferingVO newServiceOffering = getSvcoffering(512);
++        when(_hostDao.findById(_vmInstance.hostId)).thenReturn(hostVO);
++        when(hostVO.getClusterId()).thenReturn(1L);
++//        when(_configDepot.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);
 +
 +    }
 +
 +    @Test (expected=CloudRuntimeException.class)
 +    public void testScaleVM3()  throws Exception {
 +
 +        /*VirtualMachineProfile<VMInstanceVO> profile = new VirtualMachineProfileImpl<VMInstanceVO>(vm);
 +
 +        Long srcHostId = vm.getHostId();
 +        Long oldSvcOfferingId = vm.getServiceOfferingId();
 +        if (srcHostId == null) {
 +            throw new CloudRuntimeException("Unable to scale the vm because it doesn't have a host id");
 +        }*/
 +
 +        when(_vmInstance.getHostId()).thenReturn(null);
 +        when(_vmInstanceDao.findById(anyLong())).thenReturn(_vmInstance);
 +        _vmMgr.findHostAndMigrate(_vmInstance.getUuid(), 2l);
 +
 +    }
 +
 +
 +    private ServiceOfferingVO getSvcoffering(int ramSize){
 +
 +        long id  = 4L;
 +        String name = "name";
 +        String displayText = "displayText";
 +        int cpu = 1;
 +        //int ramSize = 256;
 +        int speed = 128;
 +
 +        boolean ha = false;
 +        boolean useLocalStorage = false;
 +
 +        ServiceOfferingVO serviceOffering = new ServiceOfferingVO(name, cpu, ramSize, speed, null, null, ha, displayText, useLocalStorage, false, null, false, null, false);
 +        return serviceOffering;
 +    }
 +
 +    private void initializeMockConfigForMigratingVmWithVolumes() throws OperationTimedoutException,
 +        ResourceUnavailableException {
 +
 +        // Mock the source and destination hosts.
 +        when(_srcHostMock.getId()).thenReturn(5L);
 +        when(_destHostMock.getId()).thenReturn(6L);
 +        when(_hostDao.findById(5L)).thenReturn(_srcHostMock);
 +        when(_hostDao.findById(6L)).thenReturn(_destHostMock);
 +
 +        // Mock the vm being migrated.
 +        when(_vmMock.getId()).thenReturn(1L);
 +        when(_vmMock.getHypervisorType()).thenReturn(HypervisorType.XenServer);
 +        when(_vmMock.getState()).thenReturn(State.Running).thenReturn(State.Running).thenReturn(State.Migrating)
 +            .thenReturn(State.Migrating);
 +        when(_vmMock.getHostId()).thenReturn(5L);
 +        when(_vmInstance.getId()).thenReturn(1L);
 +        when(_vmInstance.getServiceOfferingId()).thenReturn(2L);
 +        when(_vmInstance.getInstanceName()).thenReturn("myVm");
 +        when(_vmInstance.getHostId()).thenReturn(5L);
 +        when(_vmInstance.getType()).thenReturn(VirtualMachine.Type.User);
 +        when(_vmInstance.getState()).thenReturn(State.Running).thenReturn(State.Running).thenReturn(State.Migrating)
 +            .thenReturn(State.Migrating);
 +
 +        // Mock the work item.
 +        when(_workDao.persist(any(ItWorkVO.class))).thenReturn(_work);
 +        when(_workDao.update("1", _work)).thenReturn(true);
 +        when(_work.getId()).thenReturn("1");
 +        doNothing().when(_work).setStep(ItWorkVO.Step.Done);
 +
 +        // Mock the vm guru and the user vm object that gets returned.
 +        _vmMgr._vmGurus = new HashMap<VirtualMachine.Type, VirtualMachineGuru>();
 +
 +        // Mock the iteration over all the volumes of an instance.
 +        Iterator<VolumeVO> volumeIterator = mock(Iterator.class);
 +        when(_volsDao.findUsableVolumesForInstance(anyLong())).thenReturn(_rootVols);
 +        when(_rootVols.iterator()).thenReturn(volumeIterator);
 +        when(volumeIterator.hasNext()).thenReturn(true, false);
 +        when(volumeIterator.next()).thenReturn(_volumeMock);
 +
 +        // Mock the disk offering and pool objects for a volume.
 +        when(_volumeMock.getDiskOfferingId()).thenReturn(5L);
 +        when(_volumeMock.getPoolId()).thenReturn(200L);
 +        when(_diskOfferingDao.findById(anyLong())).thenReturn(_diskOfferingMock);
 +        when(_storagePoolDao.findById(anyLong())).thenReturn(_srcStoragePoolMock);
 +
 +        // Mock the volume to pool mapping.
 +        when(_volumeToPoolMock.get(_volumeMock)).thenReturn(_destStoragePoolMock);
 +        when(_destStoragePoolMock.getId()).thenReturn(201L);
 +        when(_srcStoragePoolMock.getId()).thenReturn(200L);
 +        when(_destStoragePoolMock.isLocal()).thenReturn(false);
 +        when(_diskOfferingMock.getUseLocalStorage()).thenReturn(false);
 +        when(_poolHostDao.findByPoolHost(anyLong(), anyLong())).thenReturn(mock(StoragePoolHostVO.class));
 +
 +        // Mock hypervisor guru.
 +        HypervisorGuru guruMock = mock(HypervisorGuru.class);
 +        when(_hvGuruMgr.getGuru(HypervisorType.XenServer)).thenReturn(guruMock);
 +
 +        when(_srcHostMock.getClusterId()).thenReturn(3L);
 +        when(_destHostMock.getClusterId()).thenReturn(3L);
 +
 +        // Mock the commands and answers to the agent.
 +        PrepareForMigrationAnswer prepAnswerMock = mock(PrepareForMigrationAnswer.class);
 +        when(prepAnswerMock.getResult()).thenReturn(true);
 +        when(_agentMgr.send(anyLong(), isA(PrepareForMigrationCommand.class))).thenReturn(prepAnswerMock);
 +
 +        MigrateWithStorageAnswer migAnswerMock = mock(MigrateWithStorageAnswer.class);
 +        when(migAnswerMock.getResult()).thenReturn(true);
 +        when(_agentMgr.send(anyLong(), isA(MigrateWithStorageCommand.class))).thenReturn(migAnswerMock);
 +
 +        MigrateWithStorageReceiveAnswer migRecAnswerMock = mock(MigrateWithStorageReceiveAnswer.class);
 +        when(migRecAnswerMock.getResult()).thenReturn(true);
 +        when(_agentMgr.send(anyLong(), isA(MigrateWithStorageReceiveCommand.class))).thenReturn(migRecAnswerMock);
 +
 +        MigrateWithStorageSendAnswer migSendAnswerMock = mock(MigrateWithStorageSendAnswer.class);
 +        when(migSendAnswerMock.getResult()).thenReturn(true);
 +        when(_agentMgr.send(anyLong(), isA(MigrateWithStorageSendCommand.class))).thenReturn(migSendAnswerMock);
 +
 +        MigrateWithStorageCompleteAnswer migCompleteAnswerMock = mock(MigrateWithStorageCompleteAnswer.class);
 +        when(migCompleteAnswerMock.getResult()).thenReturn(true);
 +        when(_agentMgr.send(anyLong(), isA(MigrateWithStorageCompleteCommand.class))).thenReturn(migCompleteAnswerMock);
 +
 +        CheckVirtualMachineAnswer checkVmAnswerMock = mock(CheckVirtualMachineAnswer.class);
 +        when(checkVmAnswerMock.getResult()).thenReturn(true);
 +        when(checkVmAnswerMock.getState()).thenReturn(PowerState.PowerOn);
 +        when(_agentMgr.send(anyLong(), isA(CheckVirtualMachineCommand.class))).thenReturn(checkVmAnswerMock);
 +
 +        // Mock the state transitions of vm.
 +        Pair<Long, Long> opaqueMock = new Pair<Long, Long> (_vmMock.getHostId(), _destHostMock.getId());
 +        when(_vmSnapshotMgr.hasActiveVMSnapshotTasks(anyLong())).thenReturn(false);
 +        when(_vmInstanceDao.updateState(State.Running, Event.MigrationRequested, State.Migrating, _vmMock, opaqueMock))
 +            .thenReturn(true);
 +        when(_vmInstanceDao.updateState(State.Migrating, Event.OperationSucceeded, State.Running, _vmMock, opaqueMock))
 +            .thenReturn(true);
 +    }
 +
 +    // Check migration of a vm with its volumes within a cluster.
 +    @Test
 +    public void testMigrateWithVolumeWithinCluster() throws ResourceUnavailableException, ConcurrentOperationException,
 +        ManagementServerException, VirtualMachineMigrationException, OperationTimedoutException {
 +
 +        initializeMockConfigForMigratingVmWithVolumes();
 +        when(_srcHostMock.getClusterId()).thenReturn(3L);
 +        when(_destHostMock.getClusterId()).thenReturn(3L);
 +
 +        _vmMgr.migrateWithStorage(_vmInstance.getUuid(), _srcHostMock.getId(), _destHostMock.getId(), _volumeToPoolMock);
 +    }
 +
 +    // Check migration of a vm with its volumes across a cluster.
 +    @Test
 +    public void testMigrateWithVolumeAcrossCluster() throws ResourceUnavailableException, ConcurrentOperationException,
 +        ManagementServerException, VirtualMachineMigrationException, OperationTimedoutException {
 +
 +        initializeMockConfigForMigratingVmWithVolumes();
 +        when(_srcHostMock.getClusterId()).thenReturn(3L);
 +        when(_destHostMock.getClusterId()).thenReturn(4L);
 +
 +        _vmMgr.migrateWithStorage(_vmInstance.getUuid(), _srcHostMock.getId(), _destHostMock.getId(), _volumeToPoolMock);
 +    }
 +
 +    // Check migration of a vm fails when src and destination pool are not of same type; that is, one is shared and
 +    // other is local.
 +    @Test(expected=CloudRuntimeException.class)
 +    public void testMigrateWithVolumeFail1() throws ResourceUnavailableException, ConcurrentOperationException,
 +        ManagementServerException, VirtualMachineMigrationException, OperationTimedoutException {
 +
 +        initializeMockConfigForMigratingVmWithVolumes();
 +        when(_srcHostMock.getClusterId()).thenReturn(3L);
 +        when(_destHostMock.getClusterId()).thenReturn(3L);
 +
 +        when(_destStoragePoolMock.isLocal()).thenReturn(true);
 +        when(_diskOfferingMock.getUseLocalStorage()).thenReturn(false);
 +
 +        _vmMgr.migrateWithStorage(_vmInstance.getUuid(), _srcHostMock.getId(), _destHostMock.getId(), _volumeToPoolMock);
 +    }
 +
 +    // Check migration of a vm fails when vm is not in Running state.
 +    @Test(expected=ConcurrentOperationException.class)
 +    public void testMigrateWithVolumeFail2() throws ResourceUnavailableException, ConcurrentOperationException,
 +        ManagementServerException, VirtualMachineMigrationException, OperationTimedoutException {
 +
 +        initializeMockConfigForMigratingVmWithVolumes();
 +        when(_srcHostMock.getClusterId()).thenReturn(3L);
 +        when(_destHostMock.getClusterId()).thenReturn(3L);
 +
 +        when(_vmMock.getState()).thenReturn(State.Stopped);
 +
 +        _vmMgr.migrateWithStorage(_vmInstance.getUuid(), _srcHostMock.getId(), _destHostMock.getId(), _volumeToPoolMock);
 +    }
 +}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
----------------------------------------------------------------------
diff --cc plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
index 072fd60,1af4239..87b3df3
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
@@@ -1216,25 -1261,24 +1262,24 @@@ public class VmwareResource implements 
                  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;
 -                args += " -i " + nic.getIp();
 -                args += " -m " + Long.toString(NetUtils.getCidrSize(nic.getNetmask()));
 -                args += " -a " + sb.toString();
 +            args += " -d " + "eth" + ethDeviceNum;
 +            args += " -i " + nic.getIp();
 +            args += " -m " + Long.toString(NetUtils.getCidrSize(nic.getNetmask()));
 +            args += " -a " + sb.toString();
  
                  result = SshHelper.sshExecute(routerIp, DEFAULT_DOMR_SSHPORT, "root", mgr.getSystemVMKeyFile(), null,
 -                        "/opt/cloud/bin/vpc_acl.sh " + args);
 +                    "/opt/cloud/bin/vpc_acl.sh " + args);
  
 -                if (!result.first()) {
 -                    String msg = "SetNetworkACLAnswer on domain router " + routerIp + " failed. message: " + result.second();
 -                    s_logger.error(msg);
 +            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);
 +            }
              }
  
              return new SetNetworkACLAnswer(cmd, true, results);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/plugins/network-elements/bigswitch-vns/src/com/cloud/network/guru/BigSwitchVnsGuestNetworkGuru.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/plugins/network-elements/ovs/src/com/cloud/network/guru/OvsGuestNetworkGuru.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/server/src/com/cloud/api/ApiResponseHelper.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/server/src/com/cloud/api/query/QueryManagerImpl.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/api/query/QueryManagerImpl.java
index 6280cbf,f70f5ae..de39793
--- a/server/src/com/cloud/api/query/QueryManagerImpl.java
+++ b/server/src/com/cloud/api/query/QueryManagerImpl.java
@@@ -16,23 -16,23 +16,23 @@@
  // under the License.
  package com.cloud.api.query;
  
--import java.util.*;
++import java.util.ArrayList;
++import java.util.Date;
++import java.util.HashSet;
++import java.util.LinkedList;
++import java.util.List;
++import java.util.Map;
++import java.util.Set;
  
  import javax.ejb.Local;
  import javax.inject.Inject;
  
--import com.cloud.api.ApiDBUtils;
--import com.cloud.server.ResourceMetaDataService;
--import com.cloud.server.ResourceTag;
--import com.cloud.server.TaggedResourceService;
--import com.cloud.vm.NicDetailVO;
--import com.cloud.vm.dao.NicDetailDao;
++import org.apache.log4j.Logger;
++import org.springframework.stereotype.Component;
++
  import org.apache.cloudstack.affinity.AffinityGroupResponse;
  import org.apache.cloudstack.affinity.AffinityGroupVMMapVO;
  import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao;
--import com.cloud.storage.VolumeDetailVO;
--import com.cloud.storage.dao.VolumeDetailsDao;
--
  import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd;
  import org.apache.cloudstack.api.command.admin.host.ListHostsCmd;
  import org.apache.cloudstack.api.command.admin.internallb.ListInternalLBVMsCmd;
@@@ -54,11 -54,10 +54,28 @@@ import org.apache.cloudstack.api.comman
  import org.apache.cloudstack.api.command.user.volume.ListResourceDetailsCmd;
  import org.apache.cloudstack.api.command.user.volume.ListVolumesCmd;
  import org.apache.cloudstack.api.command.user.zone.ListZonesByCmd;
--import org.apache.cloudstack.api.response.*;
++import org.apache.cloudstack.api.response.AccountResponse;
++import org.apache.cloudstack.api.response.AsyncJobResponse;
++import org.apache.cloudstack.api.response.DiskOfferingResponse;
++import org.apache.cloudstack.api.response.DomainRouterResponse;
++import org.apache.cloudstack.api.response.EventResponse;
++import org.apache.cloudstack.api.response.HostResponse;
++import org.apache.cloudstack.api.response.InstanceGroupResponse;
++import org.apache.cloudstack.api.response.ListResponse;
++import org.apache.cloudstack.api.response.ProjectAccountResponse;
++import org.apache.cloudstack.api.response.ProjectInvitationResponse;
++import org.apache.cloudstack.api.response.ProjectResponse;
++import org.apache.cloudstack.api.response.ResourceDetailResponse;
++import org.apache.cloudstack.api.response.ResourceTagResponse;
++import org.apache.cloudstack.api.response.SecurityGroupResponse;
++import org.apache.cloudstack.api.response.ServiceOfferingResponse;
++import org.apache.cloudstack.api.response.StoragePoolResponse;
++import org.apache.cloudstack.api.response.UserResponse;
++import org.apache.cloudstack.api.response.UserVmResponse;
++import org.apache.cloudstack.api.response.VolumeResponse;
++import org.apache.cloudstack.api.response.ZoneResponse;
 +import org.apache.cloudstack.context.CallContext;
  import org.apache.cloudstack.query.QueryService;
--import org.apache.log4j.Logger;
--import org.springframework.stereotype.Component;
  
  import com.cloud.api.query.dao.AccountJoinDao;
  import com.cloud.api.query.dao.AffinityGroupJoinDao;
@@@ -119,9 -118,9 +136,14 @@@ import com.cloud.projects.ProjectManage
  import com.cloud.projects.dao.ProjectAccountDao;
  import com.cloud.projects.dao.ProjectDao;
  import com.cloud.server.Criteria;
++import com.cloud.server.ResourceMetaDataService;
++import com.cloud.server.ResourceTag;
++import com.cloud.server.TaggedResourceService;
  import com.cloud.service.ServiceOfferingVO;
  import com.cloud.service.dao.ServiceOfferingDao;
  import com.cloud.storage.Volume;
++import com.cloud.storage.VolumeDetailVO;
++import com.cloud.storage.dao.VolumeDetailsDao;
  import com.cloud.user.Account;
  import com.cloud.user.AccountManager;
  import com.cloud.user.AccountVO;
@@@ -136,9 -136,9 +158,11 @@@ import com.cloud.utils.db.SearchCriteri
  import com.cloud.utils.db.SearchCriteria.Func;
  import com.cloud.utils.db.SearchCriteria.Op;
  import com.cloud.vm.DomainRouterVO;
++import com.cloud.vm.NicDetailVO;
  import com.cloud.vm.UserVmVO;
  import com.cloud.vm.VirtualMachine;
  import com.cloud.vm.dao.DomainRouterDao;
++import com.cloud.vm.dao.NicDetailDao;
  import com.cloud.vm.dao.UserVmDao;
  
  @Component
@@@ -636,8 -636,7 +660,7 @@@ public class QueryManagerImpl extends M
          c.addCriteria(Criteria.ID, cmd.getId());
          c.addCriteria(Criteria.NAME, cmd.getInstanceName());
          c.addCriteria(Criteria.STATE, cmd.getState());
 -        c.addCriteria(Criteria.DATACENTERID, cmd.getZoneId());        
 +        c.addCriteria(Criteria.DATACENTERID, cmd.getZoneId());
-         c.addCriteria(Criteria.DATACENTERTYPE, cmd.getZoneType());
          c.addCriteria(Criteria.GROUPID, cmd.getGroupId());
          c.addCriteria(Criteria.FOR_VIRTUAL_NETWORK, cmd.getForVirtualNetwork());
          c.addCriteria(Criteria.NETWORKID, cmd.getNetworkId());
@@@ -686,8 -685,7 +709,7 @@@
          Object name = c.getCriteria(Criteria.NAME);
          Object state = c.getCriteria(Criteria.STATE);
          Object notState = c.getCriteria(Criteria.NOTSTATE);
 -        Object zoneId = c.getCriteria(Criteria.DATACENTERID);        
 +        Object zoneId = c.getCriteria(Criteria.DATACENTERID);
-         Object zoneType = c.getCriteria(Criteria.DATACENTERTYPE);
          Object pod = c.getCriteria(Criteria.PODID);
          Object hostId = c.getCriteria(Criteria.HOSTID);
          Object hostName = c.getCriteria(Criteria.HOSTNAME);
@@@ -709,8 -707,7 +731,7 @@@
          sb.and("stateEQ", sb.entity().getState(), SearchCriteria.Op.EQ);
          sb.and("stateNEQ", sb.entity().getState(), SearchCriteria.Op.NEQ);
          sb.and("stateNIN", sb.entity().getState(), SearchCriteria.Op.NIN);
 -        sb.and("dataCenterId", sb.entity().getDataCenterId(), SearchCriteria.Op.EQ);       
 +        sb.and("dataCenterId", sb.entity().getDataCenterId(), SearchCriteria.Op.EQ);
-         sb.and("dataCenterType", sb.entity().getDataCenterType(), SearchCriteria.Op.EQ);
          sb.and("podId", sb.entity().getPodId(), SearchCriteria.Op.EQ);
          sb.and("hypervisorType", sb.entity().getHypervisorType(), SearchCriteria.Op.EQ);
          sb.and("hostIdEQ", sb.entity().getHostId(), SearchCriteria.Op.EQ);
@@@ -824,11 -821,7 +845,7 @@@
                  sc.setParameters("stateNEQ", "Destroyed");
              }
          }
 -               
 +        
-         if (zoneType != null) {
-         	sc.setParameters("dataCenterType", zoneType);
-         }
-         
          if (pod != null) {
              sc.setParameters("podId", pod);
  
@@@ -1422,8 -1415,7 +1439,7 @@@
  
      public Pair<List<HostJoinVO>, Integer> searchForServersInternal(ListHostsCmd cmd) {
  
 -        Long zoneId = _accountMgr.checkAccessAndSpecifyAuthority(UserContext.current().getCaller(), cmd.getZoneId());        
 +        Long zoneId = _accountMgr.checkAccessAndSpecifyAuthority(CallContext.current().getCallingAccount(), cmd.getZoneId());
-         String zoneType = cmd.getZoneType();
          Object name = cmd.getHostName();
          Object type = cmd.getType();
          Object state = cmd.getState();
@@@ -1444,8 -1436,7 +1460,7 @@@
          sb.and("name", sb.entity().getName(), SearchCriteria.Op.LIKE);
          sb.and("type", sb.entity().getType(), SearchCriteria.Op.LIKE);
          sb.and("status", sb.entity().getStatus(), SearchCriteria.Op.EQ);
 -        sb.and("dataCenterId", sb.entity().getZoneId(), SearchCriteria.Op.EQ);        
 +        sb.and("dataCenterId", sb.entity().getZoneId(), SearchCriteria.Op.EQ);
-         sb.and("dataCenterType", sb.entity().getZoneType(), SearchCriteria.Op.EQ);
          sb.and("podId", sb.entity().getPodId(), SearchCriteria.Op.EQ);
          sb.and("clusterId", sb.entity().getClusterId(), SearchCriteria.Op.EQ);
          sb.and("resourceState", sb.entity().getResourceState(), SearchCriteria.Op.EQ);
@@@ -1489,10 -1480,7 +1504,7 @@@
          }
          if (zoneId != null) {
              sc.setParameters("dataCenterId", zoneId);
 -        }      
 +        }
-         if (zoneType != null) {
-         	sc.setParameters("dataCenterType", zoneType);
-         }
          if (pod != null) {
              sc.setParameters("podId", pod);
          }
@@@ -1549,8 -1537,7 +1561,7 @@@
          String type = cmd.getType();
          Map<String, String> tags = cmd.getTags();
  
 -        Long zoneId = cmd.getZoneId();        
 +        Long zoneId = cmd.getZoneId();
-         String zoneType = cmd.getZoneType();
          Long podId = null;
          if (_accountMgr.isAdmin(caller.getType())) {
              podId = cmd.getPodId();
@@@ -1577,8 -1564,7 +1588,7 @@@
          sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ);
          sb.and("volumeType", sb.entity().getVolumeType(), SearchCriteria.Op.LIKE);
          sb.and("instanceId", sb.entity().getVmId(), SearchCriteria.Op.EQ);
 -        sb.and("dataCenterId", sb.entity().getDataCenterId(), SearchCriteria.Op.EQ);       
 +        sb.and("dataCenterId", sb.entity().getDataCenterId(), SearchCriteria.Op.EQ);
-         sb.and("dataCenterType", sb.entity().getDataCenterType(), SearchCriteria.Op.EQ);
          sb.and("podId", sb.entity().getPodId(), SearchCriteria.Op.EQ);
          // Only return volumes that are not destroyed
          sb.and("state", sb.entity().getState(), SearchCriteria.Op.NEQ);
@@@ -1637,10 -1623,7 +1647,7 @@@
          }
          if (zoneId != null) {
              sc.setParameters("dataCenterId", zoneId);
 -        }        
 +        }
-         if (zoneType != null) {
-         	sc.setParameters("dataCenterType", zoneType);
-         }
          if (podId != null) {
              sc.setParameters("podId", podId);
          }
@@@ -1886,8 -1869,7 +1893,7 @@@
  
      private Pair<List<StoragePoolJoinVO>, Integer> searchForStoragePoolsInternal(ListStoragePoolsCmd cmd) {
  
 -        Long zoneId = _accountMgr.checkAccessAndSpecifyAuthority(UserContext.current().getCaller(), cmd.getZoneId());       
 +        Long zoneId = _accountMgr.checkAccessAndSpecifyAuthority(CallContext.current().getCallingAccount(), cmd.getZoneId());
-         String zoneType = cmd.getZoneType();
          Object id = cmd.getId();
          Object name = cmd.getStoragePoolName();
          Object path = cmd.getPath();
@@@ -1906,8 -1888,7 +1912,7 @@@
          sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ);
          sb.and("name", sb.entity().getName(), SearchCriteria.Op.LIKE);
          sb.and("path", sb.entity().getPath(), SearchCriteria.Op.EQ);
 -        sb.and("dataCenterId", sb.entity().getZoneId(), SearchCriteria.Op.EQ);        
 +        sb.and("dataCenterId", sb.entity().getZoneId(), SearchCriteria.Op.EQ);
-         sb.and("dataCenterType", sb.entity().getZoneType(), SearchCriteria.Op.EQ);
          sb.and("podId", sb.entity().getPodId(), SearchCriteria.Op.EQ);
          sb.and("clusterId", sb.entity().getClusterId(), SearchCriteria.Op.EQ);
          sb.and("hostAddress", sb.entity().getHostAddress(), SearchCriteria.Op.EQ);
@@@ -1937,10 -1918,7 +1942,7 @@@
          }
          if (zoneId != null) {
              sc.setParameters("dataCenterId", zoneId);
 -        }        
 +        }
-         if (zoneType != null) {
-         	sc.setParameters("dataCenterType", zoneType);
-         }
          if (pod != null) {
              sc.setParameters("podId", pod);
          }
@@@ -2500,6 -2478,6 +2502,7 @@@
      }
  
  
++    @Override
      public List<ResourceDetailResponse> listResource(ListResourceDetailsCmd cmd){
  
          String key = cmd.getKey();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/server/src/com/cloud/configuration/Config.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/configuration/ConfigurationManagerImpl.java
index c7947c3,6dac26c..ac80383
--- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
@@@ -195,8 -188,10 +194,9 @@@ import com.cloud.user.AccountManager
  import com.cloud.user.AccountVO;
  import com.cloud.user.ResourceLimitService;
  import com.cloud.user.User;
 -import com.cloud.user.UserContext;
  import com.cloud.user.dao.AccountDao;
  import com.cloud.utils.NumbersUtil;
+ import com.cloud.utils.Pair;
  import com.cloud.utils.StringUtils;
  import com.cloud.utils.component.ManagerBase;
  import com.cloud.utils.crypt.DBEncryptionUtil;
@@@ -2537,13 -2527,19 +2537,19 @@@ public class ConfigurationManagerImpl e
          }
          Transaction txn = Transaction.currentTxn();
          txn.start();
- 
+         if (sameSubnet == null || 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, 
 +        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();
  
@@@ -2560,31 -2584,23 +2594,23 @@@
                  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.");
+                     //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 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;
 -                    }
 +                        }
-                         break;
+                     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 {
-                         throw new InvalidParameterValueException("Start ip and End ip is not in vlan range!");
+                     else if (val == 3) {
+                         sameSubnet =true;
                      }
                  }
                  if (ipv6) {
@@@ -2599,13 -2615,25 +2625,25 @@@
                      _networkModel.checkIp6Parameters(startIPv6, endIPv6, ip6Gateway, ip6Cidr);
                  }
              }
-             if (sameSubnet == false) {
-                 if (newVlanGateway ==null)  {
-                     throw  new MissingParameterValueException("The gateway for the new subnet is not specified.");
 -        }
 +                }
+         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<String,String> vlanDetails=null;
+ 
+         if (sameSubnet){
+              vlanDetails = new Pair<String, String>(vlanGateway, vlanNetmask);
+         }
+         else {
+              vlanDetails = new Pair<String, String>(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.");
          }
-         return  sameSubnet;
+ 
+         Pair<Boolean,Pair<String,String>> result = new Pair<Boolean,Pair<String,String>>(sameSubnet, vlanDetails);
+         return  result;
      }
  
      @Override
@@@ -3951,7 -4005,12 +3986,12 @@@
                  }
              }
          }
 -        
 +
+         if (serviceProviderMap != null && serviceProviderMap.containsKey(Service.Lb) && !internalLb && !publicLb) {
+             //if not specified, default public lb to true
+             publicLb = true;
+         }
+ 
          NetworkOfferingVO offering = new NetworkOfferingVO(name, displayText, trafficType, systemOnly, specifyVlan,
                  networkRate, multicastRate, isDefault, availability, tags, type, conserveMode, dedicatedLb,
                  sharedSourceNat, redundantRouter, elasticIp, elasticLb, specifyIpRanges, inline, isPersistent, associatePublicIp, publicLb, internalLb);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
index 59e3901,7362cf1..07c3952
--- a/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
+++ b/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
@@@ -939,9 -943,16 +939,16 @@@ public class ConsoleProxyManagerImpl ex
          ZoneHostInfo zoneHostInfo = zoneHostInfoMap.get(dataCenterId);
          if (zoneHostInfo != null && isZoneHostReady(zoneHostInfo)) {
              VMTemplateVO template = _templateDao.findSystemVMTemplate(dataCenterId);
 -            HostVO secondaryStorageHost = this.templateMgr.getSecondaryStorageHost(dataCenterId);
 +            HostVO secondaryStorageHost = templateMgr.getSecondaryStorageHost(dataCenterId);
              boolean templateReady = false;
 -            
 +
+             if (secondaryStorageHost == null) {
+                 if (s_logger.isDebugEnabled()) {
+                     s_logger.debug("No secondary storage available in zone " + dataCenterId + ", wait until it is ready to launch secondary storage vm");
+                 }
+                 return false;
+             }
+ 
              if (template != null && secondaryStorageHost != null) {
                  VMTemplateHostVO templateHostRef = _vmTemplateHostDao.findByHostTemplate(secondaryStorageHost.getId(), template.getId());
                  templateReady = (templateHostRef != null) && (templateHostRef.getDownloadState() == Status.DOWNLOADED);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/server/src/com/cloud/network/NetworkManagerImpl.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/network/NetworkManagerImpl.java
index d197eba,274e794..dc26380
--- a/server/src/com/cloud/network/NetworkManagerImpl.java
+++ b/server/src/com/cloud/network/NetworkManagerImpl.java
@@@ -1320,21 -1331,9 +1332,9 @@@ public class NetworkManagerImpl extend
              offering.setState(NetworkOffering.State.Enabled);
              _networkOfferingDao.update(offering.getId(), offering);
          }
 -        
 +
-         Map<Network.Service, Set<Network.Provider>> defaultINetworkOfferingProvidersForVpcNetwork = new HashMap<Network.Service, Set<Network.Provider>>();
-         defaultProviders.clear();
-         defaultProviders.add(Network.Provider.VPCVirtualRouter);
-         defaultINetworkOfferingProvidersForVpcNetwork.put(Service.Dhcp, defaultProviders);
-         defaultINetworkOfferingProvidersForVpcNetwork.put(Service.Dns, defaultProviders);
-         defaultINetworkOfferingProvidersForVpcNetwork.put(Service.UserData, defaultProviders);
-         defaultINetworkOfferingProvidersForVpcNetwork.put(Service.Firewall, defaultProviders);
-         defaultINetworkOfferingProvidersForVpcNetwork.put(Service.Gateway, defaultProviders);
-         defaultINetworkOfferingProvidersForVpcNetwork.put(Service.Lb, defaultProviders);
-         defaultINetworkOfferingProvidersForVpcNetwork.put(Service.SourceNat, defaultProviders);
-         defaultINetworkOfferingProvidersForVpcNetwork.put(Service.StaticNat, defaultProviders);
-         defaultINetworkOfferingProvidersForVpcNetwork.put(Service.PortForwarding, defaultProviders);
-         defaultINetworkOfferingProvidersForVpcNetwork.put(Service.Vpn, defaultProviders);
  
+         //#4 - default isolated offering with Source nat service
          if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOfferingWithSourceNatService) == null) {
              offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingWithSourceNatService,
                      "Offering for Isolated networks with Source Nat service enabled", TrafficType.Guest,
@@@ -1372,7 -1374,34 +1375,34 @@@
              offering.setState(NetworkOffering.State.Enabled);
              _networkOfferingDao.update(offering.getId(), offering);
          }
 -        
 +
+         //#8 - network offering with internal lb service
+         Map<Network.Service, Set<Network.Provider>> internalLbOffProviders =
+                 new HashMap<Network.Service, Set<Network.Provider>>();
+         Set<Network.Provider> defaultVpcProvider = new HashSet<Network.Provider>();
+         defaultVpcProvider.add(Network.Provider.VPCVirtualRouter);
+         
+         Set<Network.Provider> defaultInternalLbProvider = new HashSet<Network.Provider>();
+         defaultInternalLbProvider.add(Network.Provider.InternalLbVm);
+ 
+         internalLbOffProviders.put(Service.Dhcp, defaultVpcProvider);
+         internalLbOffProviders.put(Service.Dns, defaultVpcProvider);
+         internalLbOffProviders.put(Service.UserData, defaultVpcProvider);
+         internalLbOffProviders.put(Service.NetworkACL, defaultVpcProvider);
+         internalLbOffProviders.put(Service.Gateway, defaultVpcProvider);
+         internalLbOffProviders.put(Service.Lb, defaultInternalLbProvider);
+         internalLbOffProviders.put(Service.SourceNat, defaultVpcProvider);
+         
+         if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworksWithInternalLB) == null) {
+             offering = _configMgr.createNetworkOffering(NetworkOffering.DefaultIsolatedNetworkOfferingForVpcNetworksWithInternalLB,
+                     "Offering for Isolated VPC networks with Internal Lb support", TrafficType.Guest,
+                     null, false, Availability.Optional, null, internalLbOffProviders,
+                     true, Network.GuestType.Isolated, false, null, false, null, false, false, null);
+             offering.setState(NetworkOffering.State.Enabled);
+             offering.setInternalLb(true);
+             _networkOfferingDao.update(offering.getId(), offering);
+         }
+ 
          Map<Network.Service, Set<Network.Provider>> netscalerServiceProviders = new HashMap<Network.Service, Set<Network.Provider>>();
          Set<Network.Provider> vrProvider = new HashSet<Network.Provider>();
          vrProvider.add(Provider.VirtualRouter);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/server/src/com/cloud/network/NetworkServiceImpl.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/network/NetworkServiceImpl.java
index 44c2873,aace68d..1897ef6
--- a/server/src/com/cloud/network/NetworkServiceImpl.java
+++ b/server/src/com/cloud/network/NetworkServiceImpl.java
@@@ -118,10 -131,9 +118,9 @@@ import com.cloud.network.element.VpcVir
  import com.cloud.network.guru.NetworkGuru;
  import com.cloud.network.rules.FirewallRule.Purpose;
  import com.cloud.network.rules.FirewallRuleVO;
--import com.cloud.network.rules.PortForwardingRuleVO;
  import com.cloud.network.rules.RulesManager;
  import com.cloud.network.rules.dao.PortForwardingRulesDao;
 +import com.cloud.network.vpc.NetworkACL;
  import com.cloud.network.vpc.PrivateIpVO;
  import com.cloud.network.vpc.Vpc;
  import com.cloud.network.vpc.VpcManager;
@@@ -777,11 -789,16 +776,16 @@@ public class NetworkServiceImpl extend
          if (dc.getNetworkType() == NetworkType.Advanced && network.getGuestType() == Network.GuestType.Isolated) {
              //check PF or static NAT is configured on this ip address
              String secondaryIp = secIpVO.getIp4Address();
-             List<PortForwardingRuleVO> pfRuleList = _portForwardingDao.listByDestIpAddr(secondaryIp);
-             if (pfRuleList.size() != 0) {
+             List<FirewallRuleVO> fwRulesList =  _firewallDao.listByNetworkAndPurpose(network.getId(), Purpose.PortForwarding);
+ 
+             if (fwRulesList.size() != 0) {
+                 for (FirewallRuleVO rule: fwRulesList) {
+                     if (_portForwardingDao.findByIdAndIp(rule.getId(), secondaryIp) != null) {
 -                        s_logger.debug("VM nic IP " + secondaryIp + " is associated with the port forwarding rule");
 -                        throw new InvalidParameterValueException("Can't remove the secondary ip " + secondaryIp + " is associate with the port forwarding rule");
 -                    }
 +                s_logger.debug("VM nic IP " + secondaryIp + " is associated with the port forwarding rule");
 +                throw new InvalidParameterValueException("Can't remove the secondary ip " + secondaryIp + " is associate with the port forwarding rule");
 +            }
+                 }
+             }
              //check if the secondary ip associated with any static nat rule
              IPAddressVO publicIpVO = _ipAddressDao.findByVmIp(secondaryIp);
              if (publicIpVO != null) {
@@@ -1336,8 -1355,7 +1340,7 @@@
          Long id = cmd.getId();
          String keyword = cmd.getKeyword();
          Long zoneId = cmd.getZoneId();
-         String zoneType = cmd.getZoneType();
 -        Account caller = UserContext.current().getCaller();
 +        Account caller = CallContext.current().getCallingAccount();
          Long domainId = cmd.getDomainId();
          String accountName = cmd.getAccountName();
          String guestIpType = cmd.getGuestIpType();
@@@ -1484,8 -1502,8 +1487,8 @@@
              if (!permittedAccounts.isEmpty()) {
                  //get account level networks
                  networksToReturn.addAll(listAccountSpecificNetworks(
 -                        buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType, 
 +                        buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType,
-                                 physicalNetworkId, aclType, skipProjectNetworks, restartRequired, specifyIpRanges, vpcId, tags, zoneType), searchFilter,
+                                 physicalNetworkId, aclType, skipProjectNetworks, restartRequired, specifyIpRanges, vpcId, tags), searchFilter,
                          permittedAccounts));
                  //get domain level networks
                  if (domainId != null) {
@@@ -1498,13 -1516,13 +1501,13 @@@
              } else {
                  //add account specific networks
                  networksToReturn.addAll(listAccountSpecificNetworksByDomainPath(
 -                        buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType, 
 +                        buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType,
-                                 physicalNetworkId, aclType, skipProjectNetworks, restartRequired, specifyIpRanges, vpcId, tags, zoneType), searchFilter, path,
+                                 physicalNetworkId, aclType, skipProjectNetworks, restartRequired, specifyIpRanges, vpcId, tags), searchFilter, path,
                          isRecursive));
                  //add domain specific networks of domain + parent domains
                  networksToReturn.addAll(listDomainSpecificNetworksByDomainPath(
 -                        buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType, 
 +                        buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType,
-                                 physicalNetworkId, aclType, skipProjectNetworks, restartRequired, specifyIpRanges, vpcId, tags, zoneType), searchFilter, path,
+                                 physicalNetworkId, aclType, skipProjectNetworks, restartRequired, specifyIpRanges, vpcId, tags), searchFilter, path,
                                  isRecursive));
                  //add networks of subdomains
                  if (domainId == null) {
@@@ -2666,9 -2680,10 +2665,10 @@@
                          vnetString = vnetString+vnetRange.first().toString()+"-"+value.toString()+";";
                      }
                 }
-                 vnetString = vnetString+"*";
-                 vnetString = vnetString.replace(";*","");
+                if (vnetString.length() > 0 && vnetString.charAt(vnetString.length()-1)==';') {
+                    vnetString = vnetString.substring(0, vnetString.length()-1);
+                }
 -               network.setVnet(vnetString);
 +                network.setVnet(vnetString);
              }
  
              for (Pair<Integer, Integer> vnetToAdd : vnetsToAdd) {
@@@ -2774,12 -2789,15 +2774,15 @@@
          _datacneter_vnet.deleteRange(txn, network.getDataCenterId(), network.getId(), start, end);
  
          String vnetString="";
-         for (Pair<Integer,Integer> vnetRange : existingRanges ){
+         if (existingRanges.isEmpty()) {
+             network.setVnet(null);
+         } else {
+             for (Pair<Integer,Integer> vnetRange : existingRanges ) {
 -                vnetString=vnetString+vnetRange.first().toString()+"-"+vnetRange.second().toString()+";";
 -            }
 +            vnetString=vnetString+vnetRange.first().toString()+"-"+vnetRange.second().toString()+";";
 +        }
-         vnetString = vnetString+"*";
-         vnetString = vnetString.replace(";*","");
+             vnetString = vnetString.substring(0, vnetString.length()-1);
 -            network.setVnet(vnetString);
 +        network.setVnet(vnetString);
+         }
          _physicalNetworkDao.update(network.getId(), network);
          txn.commit();
          _physicalNetworkDao.releaseFromLockTable(network.getId());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/server/src/com/cloud/network/guru/ExternalGuestNetworkGuru.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/server/src/com/cloud/network/guru/GuestNetworkGuru.java
----------------------------------------------------------------------


[21/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1

Posted by ah...@apache.org.
set rpcProvider field correctly

Signed-off-by: Dave Brosius <db...@mebigfatguy.com>
Signed-off-by: Prasanna Santhanam <ts...@apache.org>


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

Branch: refs/heads/vmsync
Commit: 3a0294212372b9ed1ecc7522d732e640c070d013
Parents: 770cf02
Author: Dave Brosius <db...@mebigfatguy.com>
Authored: Wed May 22 02:23:27 2013 -0400
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Mon Jun 17 19:12:02 2013 +0530

----------------------------------------------------------------------
 .../apache/cloudstack/storage/HypervisorHostEndPointRpcServer.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3a029421/engine/storage/src/org/apache/cloudstack/storage/HypervisorHostEndPointRpcServer.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/HypervisorHostEndPointRpcServer.java b/engine/storage/src/org/apache/cloudstack/storage/HypervisorHostEndPointRpcServer.java
index bc21776..060b490 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/HypervisorHostEndPointRpcServer.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/HypervisorHostEndPointRpcServer.java
@@ -46,7 +46,7 @@ public class HypervisorHostEndPointRpcServer implements HostEndpointRpcServer {
     }
     
     public HypervisorHostEndPointRpcServer(RpcProvider rpcProvider) {
-        rpcProvider = rpcProvider;
+        this.rpcProvider = rpcProvider;
         rpcProvider.registerRpcServiceEndpoint(RpcServiceDispatcher.getDispatcher(this));
     }
     


[38/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1

Posted by ah...@apache.org.
CLOUDSTACK-1623: Update documentation to check hosts entry for correct loopback interface setup to fix cloud-setup-databases issues during setup


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

Branch: refs/heads/vmsync
Commit: d4477ba8da60290d21afd58ce0901d12c85de3a9
Parents: 84b92f8
Author: Shanker Balan <ma...@shankerbalan.net>
Authored: Mon Mar 11 18:46:33 2013 +0530
Committer: Chip Childers <ch...@gmail.com>
Committed: Mon Jun 17 19:42:20 2013 +0100

----------------------------------------------------------------------
 docs/en-US/management-server-install-db-local.xml | 8 ++++++++
 1 file changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d4477ba8/docs/en-US/management-server-install-db-local.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/management-server-install-db-local.xml b/docs/en-US/management-server-install-db-local.xml
index 918cdc0..310327f 100644
--- a/docs/en-US/management-server-install-db-local.xml
+++ b/docs/en-US/management-server-install-db-local.xml
@@ -143,6 +143,14 @@ binlog-format = 'ROW'</programlisting>
 -i &lt;management_server_ip&gt;</programlisting>
       <para>When this script is finished, you should see a message like “Successfully initialized
         the database.”</para>
+      <note>
+	<para>If the script is unable to connect to the MySQL database, check
+          the "localhost" loopback address in <filename>/etc/hosts</filename>. It should
+          be pointing to the IPv4 loopback address "127.0.0.1" and not the IPv6 loopback
+          address ::1. Alternatively, reconfigure MySQL to bind to the IPv6 loopback
+          interface.
+        </para>
+      </note>
     </listitem>
     <listitem>
       <para>If you are running the KVM hypervisor on the same machine with the Management Server,


[33/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1

Posted by ah...@apache.org.
Removed String instantiation

String instantiation and redundant method call replaced with a constant.

Signed-off-by: Laszlo Hornyak <la...@gmail.com>


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

Branch: refs/heads/vmsync
Commit: ce8ada030d3150087357d7135c3877c25a4702c2
Parents: a2c7d3a
Author: Laszlo Hornyak <la...@gmail.com>
Authored: Sat Jun 8 21:46:40 2013 +0200
Committer: Chip Childers <ch...@gmail.com>
Committed: Mon Jun 17 19:15:37 2013 +0100

----------------------------------------------------------------------
 .../com/cloud/network/HAProxyConfigurator.java  | 22 ++++++++------------
 1 file changed, 9 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ce8ada03/core/src/com/cloud/network/HAProxyConfigurator.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/network/HAProxyConfigurator.java b/core/src/com/cloud/network/HAProxyConfigurator.java
index 29fdf4a..162571f 100644
--- a/core/src/com/cloud/network/HAProxyConfigurator.java
+++ b/core/src/com/cloud/network/HAProxyConfigurator.java
@@ -33,7 +33,6 @@ import com.cloud.agent.api.to.LoadBalancerTO;
 import com.cloud.agent.api.to.PortForwardingRuleTO;
 import com.cloud.agent.api.to.LoadBalancerTO.DestinationTO;
 import com.cloud.agent.api.to.LoadBalancerTO.StickinessPolicyTO;
-import com.cloud.agent.resource.virtualnetwork.VirtualRoutingResource;
 import com.cloud.network.rules.LbStickinessMethod.StickinessMethodType;
 import com.cloud.utils.net.NetUtils;
 
@@ -41,6 +40,7 @@ import com.cloud.utils.net.NetUtils;
 public class HAProxyConfigurator implements LoadBalancerConfigurator {
 
     private static final Logger s_logger = Logger.getLogger(HAProxyConfigurator.class);
+    private static final String blankLine = "\t ";
     private static String[] globalSection = { "global",
             "\tlog 127.0.0.1:3914   local0 warning", 
             "\tmaxconn 4096",
@@ -86,9 +86,9 @@ public class HAProxyConfigurator implements LoadBalancerConfigurator {
         List<String> result = new ArrayList<String>();
 
         result.addAll(Arrays.asList(globalSection));
-        result.add(getBlankLine());
+        result.add(blankLine);
         result.addAll(Arrays.asList(defaultsSection));
-        result.add(getBlankLine());
+        result.add(blankLine);
 
         if (pools.isEmpty()) {
             // haproxy cannot handle empty listen / frontend or backend, so add
@@ -96,7 +96,7 @@ public class HAProxyConfigurator implements LoadBalancerConfigurator {
             // on port 9
             result.addAll(Arrays.asList(defaultListen));
         }
-        result.add(getBlankLine());
+        result.add(blankLine);
 
         for (Map.Entry<String, List<PortForwardingRuleTO>> e : pools.entrySet()) {
             List<String> poolRules = getRulesForPool(e.getKey(), e.getValue());
@@ -143,7 +143,7 @@ public class HAProxyConfigurator implements LoadBalancerConfigurator {
                     .append(rule.getDstPortRange()[0]).append(" check");
             result.add(sb.toString());
         }
-        result.add(getBlankLine());
+        result.add(blankLine);
         return result;
     }
  
@@ -507,14 +507,10 @@ public class HAProxyConfigurator implements LoadBalancerConfigurator {
             result.add(sb.toString());
         }
         
-        result.add(getBlankLine());
+        result.add(blankLine);
         return result;
     }
 
-    private String getBlankLine() {
-        return new String("\t ");
-    }
-
     private String generateStatsRule(LoadBalancerConfigCommand lbCmd,
             String ruleName, String statsIp) {
         StringBuilder rule = new StringBuilder("\nlisten ").append(ruleName)
@@ -534,7 +530,7 @@ public class HAProxyConfigurator implements LoadBalancerConfigurator {
         List<String> result = new ArrayList<String>();
 
         result.addAll(Arrays.asList(globalSection));
-        result.add(getBlankLine());
+        result.add(blankLine);
         result.addAll(Arrays.asList(defaultsSection));
         if (!lbCmd.lbStatsVisibility.equals("disabled")) {
             /* new rule : listen admin_page guestip/link-local:8081 */
@@ -568,7 +564,7 @@ public class HAProxyConfigurator implements LoadBalancerConfigurator {
             }
 
         }
-        result.add(getBlankLine());
+        result.add(blankLine);
         boolean has_listener = false;
         for (LoadBalancerTO lbTO : lbCmd.getLoadBalancers()) {
             if ( lbTO.isRevoked() ) {
@@ -578,7 +574,7 @@ public class HAProxyConfigurator implements LoadBalancerConfigurator {
             result.addAll(poolRules);
             has_listener = true;
         }
-        result.add(getBlankLine());
+        result.add(blankLine);
         if ( !has_listener) {
             // haproxy cannot handle empty listen / frontend or backend, so add
             // a dummy listener


[16/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1

Posted by ah...@apache.org.
Moving maintenance mode into component/maint

All tests that could possible disrupt the runs of other tests because of
putting resources into maintenace will be put under maint/. This should
allow us to run the tests sequentially when other tests are not running
on a deployment.

Signed-off-by: Prasanna Santhanam <ts...@apache.org>


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

Branch: refs/heads/vmsync
Commit: 0587d3a496b4c5d29a6b14774f5e7fdc42a5bb33
Parents: a3d585e
Author: Prasanna Santhanam <ts...@apache.org>
Authored: Mon Jun 17 12:32:50 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Mon Jun 17 12:33:57 2013 +0530

----------------------------------------------------------------------
 test/integration/component/maint/__init__.py    |   21 +
 .../component/maint/test_high_availability.py   | 1079 ++++++++++++++++++
 .../maint/test_host_high_availability.py        |  810 +++++++++++++
 .../maint/test_vpc_host_maintenance.py          |  561 +++++++++
 .../maint/test_vpc_on_host_maintenance.py       |  323 ++++++
 .../component/test_high_availability.py         | 1079 ------------------
 .../component/test_host_high_availability.py    |  810 -------------
 test/integration/component/test_vpc.py          |  252 +---
 .../component/test_vpc_host_maintenance.py      |  889 ---------------
 9 files changed, 2795 insertions(+), 3029 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0587d3a4/test/integration/component/maint/__init__.py
----------------------------------------------------------------------
diff --git a/test/integration/component/maint/__init__.py b/test/integration/component/maint/__init__.py
new file mode 100644
index 0000000..f044f8b
--- /dev/null
+++ b/test/integration/component/maint/__init__.py
@@ -0,0 +1,21 @@
+# 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.
+
+"""
+Tests that put hosts, zones, resources in to maintenance mode are here.
+These will have to be run sequentiall when resources are available so as not disrupt other tests
+"""
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0587d3a4/test/integration/component/maint/test_high_availability.py
----------------------------------------------------------------------
diff --git a/test/integration/component/maint/test_high_availability.py b/test/integration/component/maint/test_high_availability.py
new file mode 100644
index 0000000..7b0f78e
--- /dev/null
+++ b/test/integration/component/maint/test_high_availability.py
@@ -0,0 +1,1079 @@
+#!/usr/bin/env python
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+""" P1 tests for high availability
+"""
+#Import Local Modules
+import marvin
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from marvin.integration.lib.utils import *
+from marvin.integration.lib.base import *
+from marvin.integration.lib.common import *
+from marvin import remoteSSHClient
+import datetime
+
+
+class Services:
+    """Test network offering Services
+    """
+
+    def __init__(self):
+        self.services = {
+                         "account": {
+                                    "email": "test@test.com",
+                                    "firstname": "HA",
+                                    "lastname": "HA",
+                                    "username": "HA",
+                                    # Random characters are appended for unique
+                                    # username
+                                    "password": "password",
+                                    },
+                         "service_offering": {
+                                    "name": "Tiny Instance",
+                                    "displaytext": "Tiny Instance",
+                                    "cpunumber": 1,
+                                    "cpuspeed": 100,    # in MHz
+                                    "memory": 128,       # In MBs
+                                    },
+                         "lbrule": {
+                                    "name": "SSH",
+                                    "alg": "roundrobin",
+                                    # Algorithm used for load balancing
+                                    "privateport": 22,
+                                    "publicport": 2222,
+                                },
+                         "natrule": {
+                                    "privateport": 22,
+                                    "publicport": 22,
+                                    "protocol": "TCP"
+                                },
+                         "fw_rule": {
+                                    "startport": 1,
+                                    "endport": 6000,
+                                    "cidr": '55.55.0.0/11',
+                                    # Any network (For creating FW rule)
+                                },
+                         "virtual_machine": {
+                                    "displayname": "VM",
+                                    "username": "root",
+                                    "password": "password",
+                                    "ssh_port": 22,
+                                    "hypervisor": 'XenServer',
+                                    # Hypervisor type should be same as
+                                    # hypervisor type of cluster
+                                    "privateport": 22,
+                                    "publicport": 22,
+                                    "protocol": 'TCP',
+                                },
+                         "templates": {
+                                "displaytext": "Public Template",
+                                "name": "Public template",
+                                "ostype": 'CentOS 5.3 (64-bit)',
+                                "url": "http://download.cloud.com/releases/2.0.0/UbuntuServer-10-04-64bit.vhd.bz2",
+                                "hypervisor": 'XenServer',
+                                "format": 'VHD',
+                                "isfeatured": True,
+                                "ispublic": True,
+                                "isextractable": True,
+                                "templatefilter": 'self',
+                         },
+                         "ostype": 'CentOS 5.3 (64-bit)',
+                         # Cent OS 5.3 (64 bit)
+                         "sleep": 60,
+                         "timeout": 100,
+                         "mode": 'advanced'
+                    }
+
+
+class TestHighAvailability(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+
+        cls.api_client = super(
+                               TestHighAvailability,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(
+                                cls.api_client,
+                                cls.services
+                            )
+        cls.zone = get_zone(
+                            cls.api_client,
+                            cls.services
+                            )
+        cls.pod = get_pod(
+                          cls.api_client,
+                          zoneid=cls.zone.id,
+                          services=cls.services
+                          )
+        cls.template = get_template(
+                                    cls.api_client,
+                                    cls.zone.id,
+                                    cls.services["ostype"]
+                            )
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering"],
+                                            offerha=True
+                                            )
+        cls._cleanup = [
+                        cls.service_offering,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.account = Account.create(
+                                     self.apiclient,
+                                     self.services["account"],
+                                     admin=True,
+                                     domainid=self.domain.id
+                                     )
+        self.cleanup = [self.account]
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created accounts, domains etc
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(tags = ["advanced", "advancedns", "multihost"])
+    def test_01_host_maintenance_mode(self):
+        """Test host maintenance mode
+        """
+
+
+        # Validate the following
+        # 1. Create Vms. Acquire IP. Create port forwarding & load balancing
+        #    rules for Vms.
+        # 2. Host 1: put to maintenance mode. All Vms should failover to Host
+        #    2 in cluster. Vms should be in running state. All port forwarding
+        #    rules and load balancing Rules should work.
+        # 3. After failover to Host 2 succeeds, deploy Vms. Deploy Vms on host
+        #    2 should succeed.
+        # 4. Host 1: cancel maintenance mode.
+        # 5. Host 2 : put to maintenance mode. All Vms should failover to
+        #    Host 1 in cluster.
+        # 6. After failover to Host 1 succeeds, deploy VMs. Deploy Vms on
+        #    host 1 should succeed.
+
+        hosts = Host.list(
+                          self.apiclient,
+                          zoneid=self.zone.id,
+                          resourcestate='Enabled',
+                          type='Routing'
+                          )
+        self.assertEqual(
+                         isinstance(hosts, list),
+                         True,
+                         "List hosts should return valid host response"
+                         )
+        self.assertGreaterEqual(
+                         len(hosts),
+                         2,
+                         "There must be two hosts present in a cluster"
+                        )
+        self.debug("Checking HA with hosts: %s, %s" % (
+                                                       hosts[0].name,
+                                                       hosts[1].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.name,
+                                  domainid=self.account.domainid,
+                                  serviceofferingid=self.service_offering.id
+                                  )
+        vms = VirtualMachine.list(
+                                  self.apiclient,
+                                  id=virtual_machine.id,
+                                  listall=True
+                                  )
+        self.assertEqual(
+                    isinstance(vms, list),
+                    True,
+                    "List VMs should return valid response for deployed VM"
+                    )
+        self.assertNotEqual(
+                    len(vms),
+                    0,
+                    "List VMs should return valid response for deployed VM"
+                    )
+        vm = vms[0]
+        self.debug("Deployed VM on host: %s" % vm.hostid)
+        self.assertEqual(
+                         vm.state,
+                         "Running",
+                         "Deployed VM should be in RUnning state"
+                         )
+        networks = Network.list(
+                                self.apiclient,
+                                account=self.account.name,
+                                domainid=self.account.domainid,
+                                listall=True
+                                )
+        self.assertEqual(
+                    isinstance(networks, list),
+                    True,
+                    "List networks should return valid list for the account"
+                    )
+        network = networks[0]
+
+        self.debug("Associating public IP for account: %s" %
+                                            self.account.name)
+        public_ip = PublicIPAddress.create(
+                                    self.apiclient,
+                                    accountid=self.account.name,
+                                    zoneid=self.zone.id,
+                                    domainid=self.account.domainid,
+                                    networkid=network.id
+                                    )
+
+        self.debug("Associated %s with network %s" % (
+                                        public_ip.ipaddress.ipaddress,
+                                        network.id
+                                        ))
+        self.debug("Creating PF rule for IP address: %s" %
+                                        public_ip.ipaddress.ipaddress)
+        nat_rule = NATRule.create(
+                                 self.apiclient,
+                                 virtual_machine,
+                                 self.services["natrule"],
+                                 ipaddressid=public_ip.ipaddress.id
+                                 )
+
+        self.debug("Creating LB rule on IP with NAT: %s" %
+                                    public_ip.ipaddress.ipaddress)
+
+        # Create Load Balancer rule on IP already having NAT rule
+        lb_rule = LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=public_ip.ipaddress.id,
+                                    accountid=self.account.name
+                                    )
+        self.debug("Created LB rule with ID: %s" % lb_rule.id)
+
+        # Should be able to SSH VM
+        try:
+            self.debug("SSH into VM: %s" % virtual_machine.id)
+            ssh = virtual_machine.get_ssh_client(
+                                    ipaddress=public_ip.ipaddress.ipaddress)
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (virtual_machine.ipaddress, e)
+                      )
+
+        first_host = vm.hostid
+        self.debug("Enabling maintenance mode for host %s" % vm.hostid)
+        cmd = prepareHostForMaintenance.prepareHostForMaintenanceCmd()
+        cmd.id = first_host
+        self.apiclient.prepareHostForMaintenance(cmd)
+
+        self.debug("Waiting for SSVMs to come up")
+        wait_for_ssvms(
+                       self.apiclient,
+                       zoneid=self.zone.id,
+                       podid=self.pod.id,
+                      )
+
+        timeout = self.services["timeout"]
+        # Poll and check state of VM while it migrates from one host to another
+        while True:
+            vms = VirtualMachine.list(
+                                  self.apiclient,
+                                  id=virtual_machine.id,
+                                  listall=True
+                                  )
+            self.assertEqual(
+                    isinstance(vms, list),
+                    True,
+                    "List VMs should return valid response for deployed VM"
+                    )
+            self.assertNotEqual(
+                    len(vms),
+                    0,
+                    "List VMs should return valid response for deployed VM"
+                    )
+            vm = vms[0]
+
+            self.debug("VM 1 state: %s" % vm.state)
+            if vm.state in ["Stopping",
+                            "Stopped",
+                            "Running",
+                            "Starting",
+                            "Migrating"]:
+                if vm.state == "Running":
+                    break
+                else:
+                    time.sleep(self.services["sleep"])
+                    timeout = timeout - 1
+            else:
+                self.fail(
+                    "VM migration from one-host-to-other failed while enabling maintenance"
+                    )
+        second_host = vm.hostid
+        self.assertEqual(
+                vm.state,
+                "Running",
+                "VM should be in Running state after enabling host maintenance"
+                )
+        # Should be able to SSH VM
+        try:
+            self.debug("SSH into VM: %s" % virtual_machine.id)
+            ssh = virtual_machine.get_ssh_client(
+                                    ipaddress=public_ip.ipaddress.ipaddress)
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (virtual_machine.ipaddress, e)
+                      )
+        self.debug("Deploying VM in account: %s" % self.account.name)
+        # Spawn an instance on other host
+        virtual_machine_2 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account.name,
+                                  domainid=self.account.domainid,
+                                  serviceofferingid=self.service_offering.id
+                                  )
+        vms = VirtualMachine.list(
+                                  self.apiclient,
+                                  id=virtual_machine_2.id,
+                                  listall=True
+                                  )
+        self.assertEqual(
+                    isinstance(vms, list),
+                    True,
+                    "List VMs should return valid response for deployed VM"
+                    )
+        self.assertNotEqual(
+                    len(vms),
+                    0,
+                    "List VMs should return valid response for deployed VM"
+                    )
+        vm = vms[0]
+        self.debug("Deployed VM on host: %s" % vm.hostid)
+        self.debug("VM 2 state: %s" % vm.state)
+        self.assertEqual(
+                         vm.state,
+                         "Running",
+                         "Deployed VM should be in Running state"
+                         )
+
+        self.debug("Canceling host maintenance for ID: %s" % first_host)
+        cmd = cancelHostMaintenance.cancelHostMaintenanceCmd()
+        cmd.id = first_host
+        self.apiclient.cancelHostMaintenance(cmd)
+        self.debug("Maintenance mode canceled for host: %s" % first_host)
+
+        self.debug("Enabling maintenance mode for host %s" % second_host)
+        cmd = prepareHostForMaintenance.prepareHostForMaintenanceCmd()
+        cmd.id = second_host
+        self.apiclient.prepareHostForMaintenance(cmd)
+        self.debug("Maintenance mode enabled for host: %s" % second_host)
+
+        self.debug("Waiting for SSVMs to come up")
+        wait_for_ssvms(
+                       self.apiclient,
+                       zoneid=self.zone.id,
+                       podid=self.pod.id,
+                      )
+
+        # Poll and check the status of VMs
+        timeout = self.services["timeout"]
+        while True:
+            vms = VirtualMachine.list(
+                                  self.apiclient,
+                                  account=self.account.name,
+                                  domainid=self.account.domainid,
+                                  listall=True
+                                  )
+            self.assertEqual(
+                    isinstance(vms, list),
+                    True,
+                    "List VMs should return valid response for deployed VM"
+                    )
+            self.assertNotEqual(
+                    len(vms),
+                    0,
+                    "List VMs should return valid response for deployed VM"
+                    )
+            vm = vms[0]
+            self.debug(
+                "VM state after enabling maintenance on first host: %s" %
+                                                                    vm.state)
+            if vm.state in [
+                            "Stopping",
+                            "Stopped",
+                            "Running",
+                            "Starting",
+                            "Migrating"
+                            ]:
+                if vm.state == "Running":
+                    break
+                else:
+                    time.sleep(self.services["sleep"])
+                    timeout = timeout - 1
+            else:
+                self.fail(
+                    "VM migration from one-host-to-other failed while enabling maintenance"
+                    )
+
+                # Poll and check the status of VMs
+        timeout = self.services["timeout"]
+        while True:
+            vms = VirtualMachine.list(
+                                  self.apiclient,
+                                  account=self.account.name,
+                                  domainid=self.account.domainid,
+                                  listall=True
+                                  )
+            self.assertEqual(
+                    isinstance(vms, list),
+                    True,
+                    "List VMs should return valid response for deployed VM"
+                    )
+            self.assertNotEqual(
+                    len(vms),
+                    0,
+                    "List VMs should return valid response for deployed VM"
+                    )
+            vm = vms[1]
+            self.debug(
+                "VM state after enabling maintenance on first host: %s" %
+                                                                    vm.state)
+            if vm.state in [
+                            "Stopping",
+                            "Stopped",
+                            "Running",
+                            "Starting",
+                            "Migrating"
+                            ]:
+                if vm.state == "Running":
+                    break
+                else:
+                    time.sleep(self.services["sleep"])
+                    timeout = timeout - 1
+            else:
+                self.fail(
+                    "VM migration from one-host-to-other failed while enabling maintenance"
+                    )
+
+        for vm in vms:
+            self.debug(
+                "VM states after enabling maintenance mode on host: %s - %s" %
+                                                    (first_host, vm.state))
+            self.assertEqual(
+                         vm.state,
+                         "Running",
+                         "Deployed VM should be in Running state"
+                         )
+
+        # Spawn an instance on other host
+        virtual_machine_3 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account.name,
+                                  domainid=self.account.domainid,
+                                  serviceofferingid=self.service_offering.id
+                                  )
+        vms = VirtualMachine.list(
+                                  self.apiclient,
+                                  id=virtual_machine_3.id,
+                                  listall=True
+                                  )
+        self.assertEqual(
+                    isinstance(vms, list),
+                    True,
+                    "List VMs should return valid response for deployed VM"
+                    )
+        self.assertNotEqual(
+                    len(vms),
+                    0,
+                    "List VMs should return valid response for deployed VM"
+                    )
+        vm = vms[0]
+
+        self.debug("Deployed VM on host: %s" % vm.hostid)
+        self.debug("VM 3 state: %s" % vm.state)
+        self.assertEqual(
+                         vm.state,
+                         "Running",
+                         "Deployed VM should be in Running state"
+                         )
+
+        # Should be able to SSH VM
+        try:
+            self.debug("SSH into VM: %s" % virtual_machine.id)
+            ssh = virtual_machine.get_ssh_client(
+                                    ipaddress=public_ip.ipaddress.ipaddress)
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (virtual_machine.ipaddress, e)
+                      )
+
+        self.debug("Canceling host maintenance for ID: %s" % second_host)
+        cmd = cancelHostMaintenance.cancelHostMaintenanceCmd()
+        cmd.id = second_host
+        self.apiclient.cancelHostMaintenance(cmd)
+        self.debug("Maintenance mode canceled for host: %s" % second_host)
+
+        self.debug("Waiting for SSVMs to come up")
+        wait_for_ssvms(
+                       self.apiclient,
+                       zoneid=self.zone.id,
+                       podid=self.pod.id,
+                      )
+        return
+
+    @attr(tags = ["advanced", "advancedns", "multihost"])
+    def test_02_host_maintenance_mode_with_activities(self):
+        """Test host maintenance mode with activities
+        """
+
+
+        # Validate the following
+        # 1. Create Vms. Acquire IP. Create port forwarding & load balancing
+        #    rules for Vms.
+        # 2. While activities are ongoing: Create snapshots, recurring
+        #    snapshots, create templates, download volumes, Host 1: put to
+        #    maintenance mode. All Vms should failover to Host 2 in cluster
+        #    Vms should be in running state. All port forwarding rules and
+        #    load balancing Rules should work.
+        # 3. After failover to Host 2 succeeds, deploy Vms. Deploy Vms on host
+        #    2 should succeed. All ongoing activities in step 3 should succeed
+        # 4. Host 1: cancel maintenance mode.
+        # 5. While activities are ongoing: Create snapshots, recurring
+        #    snapshots, create templates, download volumes, Host 2: put to
+        #    maintenance mode. All Vms should failover to Host 1 in cluster.
+        # 6. After failover to Host 1 succeeds, deploy VMs. Deploy Vms on
+        #    host 1 should succeed. All ongoing activities in step 6 should
+        #    succeed.
+
+        hosts = Host.list(
+                          self.apiclient,
+                          zoneid=self.zone.id,
+                          resourcestate='Enabled',
+                          type='Routing'
+                          )
+        self.assertEqual(
+                         isinstance(hosts, list),
+                         True,
+                         "List hosts should return valid host response"
+                         )
+        self.assertGreaterEqual(
+                         len(hosts),
+                         2,
+                         "There must be two hosts present in a cluster"
+                        )
+        self.debug("Checking HA with hosts: %s, %s" % (
+                                                       hosts[0].name,
+                                                       hosts[1].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.name,
+                                  domainid=self.account.domainid,
+                                  serviceofferingid=self.service_offering.id
+                                  )
+        vms = VirtualMachine.list(
+                                  self.apiclient,
+                                  id=virtual_machine.id,
+                                  listall=True
+                                  )
+        self.assertEqual(
+                    isinstance(vms, list),
+                    True,
+                    "List VMs should return valid response for deployed VM"
+                    )
+        self.assertNotEqual(
+                    len(vms),
+                    0,
+                    "List VMs should return valid response for deployed VM"
+                    )
+        vm = vms[0]
+        self.debug("Deployed VM on host: %s" % vm.hostid)
+        self.assertEqual(
+                         vm.state,
+                         "Running",
+                         "Deployed VM should be in RUnning state"
+                         )
+        networks = Network.list(
+                                self.apiclient,
+                                account=self.account.name,
+                                domainid=self.account.domainid,
+                                listall=True
+                                )
+        self.assertEqual(
+                    isinstance(networks, list),
+                    True,
+                    "List networks should return valid list for the account"
+                    )
+        network = networks[0]
+
+        self.debug("Associating public IP for account: %s" %
+                                            self.account.name)
+        public_ip = PublicIPAddress.create(
+                                    self.apiclient,
+                                    accountid=self.account.name,
+                                    zoneid=self.zone.id,
+                                    domainid=self.account.domainid,
+                                    networkid=network.id
+                                    )
+
+        self.debug("Associated %s with network %s" % (
+                                        public_ip.ipaddress.ipaddress,
+                                        network.id
+                                        ))
+        self.debug("Creating PF rule for IP address: %s" %
+                                        public_ip.ipaddress.ipaddress)
+        nat_rule = NATRule.create(
+                                 self.apiclient,
+                                 virtual_machine,
+                                 self.services["natrule"],
+                                 ipaddressid=public_ip.ipaddress.id
+                                 )
+
+        self.debug("Creating LB rule on IP with NAT: %s" %
+                                    public_ip.ipaddress.ipaddress)
+
+        # Create Load Balancer rule on IP already having NAT rule
+        lb_rule = LoadBalancerRule.create(
+                                    self.apiclient,
+                                    self.services["lbrule"],
+                                    ipaddressid=public_ip.ipaddress.id,
+                                    accountid=self.account.name
+                                    )
+        self.debug("Created LB rule with ID: %s" % lb_rule.id)
+
+        # Should be able to SSH VM
+        try:
+            self.debug("SSH into VM: %s" % virtual_machine.id)
+            ssh = virtual_machine.get_ssh_client(
+                                    ipaddress=public_ip.ipaddress.ipaddress)
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (virtual_machine.ipaddress, e)
+                      )
+        # Get the Root disk of VM
+        volumes = list_volumes(
+                            self.apiclient,
+                            virtualmachineid=virtual_machine.id,
+                            type='ROOT',
+                            listall=True
+                            )
+        volume = volumes[0]
+        self.debug(
+            "Root volume of VM(%s): %s" % (
+                                            virtual_machine.name,
+                                            volume.name
+                                            ))
+        # Create a snapshot from the ROOTDISK
+        self.debug("Creating snapshot on ROOT volume: %s" % volume.name)
+        snapshot = Snapshot.create(self.apiclient, volumes[0].id)
+        self.debug("Snapshot created: ID - %s" % snapshot.id)
+
+        snapshots = list_snapshots(
+                                   self.apiclient,
+                                   id=snapshot.id,
+                                   listall=True
+                                   )
+        self.assertEqual(
+                            isinstance(snapshots, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        self.assertNotEqual(
+                            snapshots,
+                            None,
+                            "Check if result exists in list snapshots call"
+                            )
+        self.assertEqual(
+                            snapshots[0].id,
+                            snapshot.id,
+                            "Check snapshot id in list resources call"
+                        )
+
+        # Generate template from the snapshot
+        self.debug("Generating template from snapshot: %s" % snapshot.name)
+        template = Template.create_from_snapshot(
+                                                 self.apiclient,
+                                                 snapshot,
+                                                 self.services["templates"]
+                                                 )
+        self.debug("Created template from snapshot: %s" % template.id)
+
+        templates = list_templates(
+                                self.apiclient,
+                                templatefilter=\
+                                self.services["templates"]["templatefilter"],
+                                id=template.id
+                                )
+
+        self.assertEqual(
+                isinstance(templates, list),
+                True,
+                "List template call should return the newly created template"
+                )
+
+        self.assertEqual(
+                    templates[0].isready,
+                    True,
+                    "The newly created template should be in ready state"
+                    )
+
+        first_host = vm.hostid
+        self.debug("Enabling maintenance mode for host %s" % vm.hostid)
+        cmd = prepareHostForMaintenance.prepareHostForMaintenanceCmd()
+        cmd.id = first_host
+        self.apiclient.prepareHostForMaintenance(cmd)
+
+        self.debug("Waiting for SSVMs to come up")
+        wait_for_ssvms(
+                       self.apiclient,
+                       zoneid=self.zone.id,
+                       podid=self.pod.id,
+                      )
+
+        timeout = self.services["timeout"]
+        # Poll and check state of VM while it migrates from one host to another
+        while True:
+            vms = VirtualMachine.list(
+                                  self.apiclient,
+                                  id=virtual_machine.id,
+                                  listall=True
+                                  )
+            self.assertEqual(
+                    isinstance(vms, list),
+                    True,
+                    "List VMs should return valid response for deployed VM"
+                    )
+            self.assertNotEqual(
+                    len(vms),
+                    0,
+                    "List VMs should return valid response for deployed VM"
+                    )
+            vm = vms[0]
+
+            self.debug("VM 1 state: %s" % vm.state)
+            if vm.state in ["Stopping",
+                            "Stopped",
+                            "Running",
+                            "Starting",
+                            "Migrating"]:
+                if vm.state == "Running":
+                    break
+                else:
+                    time.sleep(self.services["sleep"])
+                    timeout = timeout - 1
+            else:
+                self.fail(
+                    "VM migration from one-host-to-other failed while enabling maintenance"
+                    )
+        second_host = vm.hostid
+        self.assertEqual(
+                vm.state,
+                "Running",
+                "VM should be in Running state after enabling host maintenance"
+                )
+        # Should be able to SSH VM
+        try:
+            self.debug("SSH into VM: %s" % virtual_machine.id)
+            ssh = virtual_machine.get_ssh_client(
+                                    ipaddress=public_ip.ipaddress.ipaddress)
+        except Exception as e:
+            self.fail("SSH Access failed for %s: %s" % \
+                      (virtual_machine.ipaddress, e)
+                      )
+        self.debug("Deploying VM in account: %s" % self.account.name)
+        # Spawn an instance on other host
+        virtual_machine_2 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account.name,
+                                  domainid=self.account.domainid,
+                                  serviceofferingid=self.service_offering.id
+                                  )
+        vms = VirtualMachine.list(
+                                  self.apiclient,
+                                  id=virtual_machine_2.id,
+                                  listall=True
+                                  )
+        self.assertEqual(
+                    isinstance(vms, list),
+                    True,
+                    "List VMs should return valid response for deployed VM"
+                    )
+        self.assertNotEqual(
+                    len(vms),
+                    0,
+                    "List VMs should return valid response for deployed VM"
+                    )
+        vm = vms[0]
+        self.debug("Deployed VM on host: %s" % vm.hostid)
+        self.debug("VM 2 state: %s" % vm.state)
+        self.assertEqual(
+                         vm.state,
+                         "Running",
+                         "Deployed VM should be in Running state"
+                         )
+
+        self.debug("Canceling host maintenance for ID: %s" % first_host)
+        cmd = cancelHostMaintenance.cancelHostMaintenanceCmd()
+        cmd.id = first_host
+        self.apiclient.cancelHostMaintenance(cmd)
+        self.debug("Maintenance mode canceled for host: %s" % first_host)
+
+        # Get the Root disk of VM
+        volumes = list_volumes(
+                            self.apiclient,
+                            virtualmachineid=virtual_machine_2.id,
+                            type='ROOT',
+                            listall=True
+                            )
+        volume = volumes[0]
+        self.debug(
+            "Root volume of VM(%s): %s" % (
+                                            virtual_machine_2.name,
+                                            volume.name
+                                            ))
+        # Create a snapshot from the ROOTDISK
+        self.debug("Creating snapshot on ROOT volume: %s" % volume.name)
+        snapshot = Snapshot.create(self.apiclient, volumes[0].id)
+        self.debug("Snapshot created: ID - %s" % snapshot.id)
+
+        snapshots = list_snapshots(
+                                   self.apiclient,
+                                   id=snapshot.id,
+                                   listall=True
+                                   )
+        self.assertEqual(
+                            isinstance(snapshots, list),
+                            True,
+                            "Check list response returns a valid list"
+                        )
+        self.assertNotEqual(
+                            snapshots,
+                            None,
+                            "Check if result exists in list snapshots call"
+                            )
+        self.assertEqual(
+                            snapshots[0].id,
+                            snapshot.id,
+                            "Check snapshot id in list resources call"
+                        )
+
+        # Generate template from the snapshot
+        self.debug("Generating template from snapshot: %s" % snapshot.name)
+        template = Template.create_from_snapshot(
+                                                 self.apiclient,
+                                                 snapshot,
+                                                 self.services["templates"]
+                                                 )
+        self.debug("Created template from snapshot: %s" % template.id)
+
+        templates = list_templates(
+                                self.apiclient,
+                                templatefilter=\
+                                self.services["templates"]["templatefilter"],
+                                id=template.id
+                                )
+
+        self.assertEqual(
+                isinstance(templates, list),
+                True,
+                "List template call should return the newly created template"
+                )
+
+        self.assertEqual(
+                    templates[0].isready,
+                    True,
+                    "The newly created template should be in ready state"
+                    )
+
+        self.debug("Enabling maintenance mode for host %s" % second_host)
+        cmd = prepareHostForMaintenance.prepareHostForMaintenanceCmd()
+        cmd.id = second_host
+        self.apiclient.prepareHostForMaintenance(cmd)
+        self.debug("Maintenance mode enabled for host: %s" % second_host)
+
+        self.debug("Waiting for SSVMs to come up")
+        wait_for_ssvms(
+                       self.apiclient,
+                       zoneid=self.zone.id,
+                       podid=self.pod.id,
+                      )
+
+        # Poll and check the status of VMs
+        timeout = self.services["timeout"]
+        while True:
+            vms = VirtualMachine.list(
+                                  self.apiclient,
+                                  account=self.account.name,
+                                  domainid=self.account.domainid,
+                                  listall=True
+                                  )
+            self.assertEqual(
+                    isinstance(vms, list),
+                    True,
+                    "List VMs should return valid response for deployed VM"
+                    )
+            self.assertNotEqual(
+                    len(vms),
+                    0,
+                    "List VMs should return valid response for deployed VM"
+                    )
+            vm = vms[0]
+            self.debug(
+                "VM state after enabling maintenance on first host: %s" %
+                                                                    vm.state)
+            if vm.state in ["Stopping",
+                            "Stopped",
+                            "Running",
+                            "Starting",
+                            "Migrating"]:
+                if vm.state == "Running":
+                    break
+                else:
+                    time.sleep(self.services["sleep"])
+                    timeout = timeout - 1
+            else:
+                self.fail(
+                    "VM migration from one-host-to-other failed while enabling maintenance"
+                    )
+
+        # Poll and check the status of VMs
+        timeout = self.services["timeout"]
+        while True:
+            vms = VirtualMachine.list(
+                                  self.apiclient,
+                                  account=self.account.name,
+                                  domainid=self.account.domainid,
+                                  listall=True
+                                  )
+            self.assertEqual(
+                    isinstance(vms, list),
+                    True,
+                    "List VMs should return valid response for deployed VM"
+                    )
+            self.assertNotEqual(
+                    len(vms),
+                    0,
+                    "List VMs should return valid response for deployed VM"
+                    )
+            vm = vms[1]
+            self.debug(
+                "VM state after enabling maintenance on first host: %s" %
+                                                                    vm.state)
+            if vm.state in ["Stopping",
+                            "Stopped",
+                            "Running",
+                            "Starting",
+                            "Migrating"]:
+                if vm.state == "Running":
+                    break
+                else:
+                    time.sleep(self.services["sleep"])
+                    timeout = timeout - 1
+            else:
+                self.fail(
+                    "VM migration from one-host-to-other failed while enabling maintenance"
+                    )
+
+        for vm in vms:
+            self.debug(
+                "VM states after enabling maintenance mode on host: %s - %s" %
+                                                    (first_host, vm.state))
+            self.assertEqual(
+                         vm.state,
+                         "Running",
+                         "Deployed VM should be in Running state"
+                         )
+
+        # Spawn an instance on other host
+        virtual_machine_3 = VirtualMachine.create(
+                                  self.apiclient,
+                                  self.services["virtual_machine"],
+                                  accountid=self.account.name,
+                                  domainid=self.account.domainid,
+                                  serviceofferingid=self.service_offering.id
+                                  )
+        vms = VirtualMachine.list(
+                                  self.apiclient,
+                                  id=virtual_machine_3.id,
+                                  listall=True
+                                  )
+        self.assertEqual(
+                    isinstance(vms, list),
+                    True,
+                    "List VMs should return valid response for deployed VM"
+                    )
+        self.assertNotEqual(
+                    len(vms),
+                    0,
+                    "List VMs should return valid response for deployed VM"
+                    )
+        vm = vms[0]
+
+        self.debug("Deployed VM on host: %s" % vm.hostid)
+        self.debug("VM 3 state: %s" % vm.state)
+        self.assertEqual(
+                         vm.state,
+                         "Running",
+                         "Deployed VM should be in Running state"
+                         )
+
+        self.debug("Canceling host maintenance for ID: %s" % second_host)
+        cmd = cancelHostMaintenance.cancelHostMaintenanceCmd()
+        cmd.id = second_host
+        self.apiclient.cancelHostMaintenance(cmd)
+        self.debug("Maintenance mode canceled for host: %s" % second_host)
+
+        self.debug("Waiting for SSVMs to come up")
+        wait_for_ssvms(
+                       self.apiclient,
+                       zoneid=self.zone.id,
+                       podid=self.pod.id,
+                      )
+        return

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0587d3a4/test/integration/component/maint/test_host_high_availability.py
----------------------------------------------------------------------
diff --git a/test/integration/component/maint/test_host_high_availability.py b/test/integration/component/maint/test_host_high_availability.py
new file mode 100644
index 0000000..5fb047b
--- /dev/null
+++ b/test/integration/component/maint/test_host_high_availability.py
@@ -0,0 +1,810 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+""" P1 tests for dedicated Host high availability
+"""
+#Import Local Modules
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from marvin.integration.lib.utils import *
+from marvin.integration.lib.base import *
+from marvin.integration.lib.common import *
+
+
+class Services:
+    """ Dedicated host HA test cases """
+
+    def __init__(self):
+        self.services = {
+            "account": {
+                "email": "test@test.com",
+                "firstname": "HA",
+                "lastname": "HA",
+                "username": "HA",
+                # Random characters are appended for unique
+                # username
+                "password": "password",
+            },
+            "service_offering_with_ha": {
+                "name": "Tiny Instance With HA Enabled",
+                "displaytext": "Tiny Instance",
+                "cpunumber": 1,
+                "cpuspeed": 100, # in MHz
+                "memory": 128, # In MBs
+            },
+            "service_offering_without_ha": {
+                "name": "Tiny Instance Without HA",
+                "displaytext": "Tiny Instance",
+                "cpunumber": 1,
+                "cpuspeed": 100, # in MHz
+                "memory": 128, # In MBs
+            },
+            "virtual_machine": {
+                "displayname": "VM",
+                "username": "root",
+                "password": "password",
+                "ssh_port": 22,
+                "hypervisor": 'XenServer',
+                # Hypervisor type should be same as
+                # hypervisor type of cluster
+                "privateport": 22,
+                "publicport": 22,
+                "protocol": 'TCP',
+            },
+            "ostype": 'CentOS 5.3 (64-bit)',
+            "timeout": 100,
+        }
+
+
+class TestHostHighAvailability(cloudstackTestCase):
+    """ Dedicated host HA test cases """
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+            TestHostHighAvailability,
+            cls
+        ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(
+            cls.api_client,
+            cls.services
+        )
+        cls.zone = get_zone(
+            cls.api_client,
+            cls.services
+        )
+
+        cls.template = get_template(
+            cls.api_client,
+            cls.zone.id,
+            cls.services["ostype"]
+        )
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering_with_ha = ServiceOffering.create(
+            cls.api_client,
+            cls.services["service_offering_with_ha"],
+            offerha=True
+        )
+
+        cls.service_offering_without_ha = ServiceOffering.create(
+            cls.api_client,
+            cls.services["service_offering_without_ha"],
+            offerha=False
+        )
+
+        cls._cleanup = [
+            cls.service_offering_with_ha,
+            cls.service_offering_without_ha,
+        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.account = Account.create(
+            self.apiclient,
+            self.services["account"],
+            admin=True,
+            domainid=self.domain.id
+        )
+        self.cleanup = [self.account]
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created accounts, domains etc
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    @attr(configuration="ha.tag")
+    @attr(tags=["advanced", "advancedns", "sg", "basic", "eip", "simulator"])
+    def test_01_vm_deployment_with_compute_offering_with_ha_enabled(self):
+        """ Test VM deployments (Create HA enabled Compute Service Offering and VM) """
+
+        # Steps,
+        #1. Create a Compute service offering with the 'Offer HA' option selected.
+        #2. Create a Guest VM with the compute service offering created above.
+        # Validations,
+        #1. Ensure that the offering is created and that in the UI the 'Offer HA' field is enabled (Yes)
+        #The listServiceOffering API should list 'offerha' as true.
+        #2. Select the newly created VM and ensure that the Compute offering field value lists the compute service offering that was selected.
+        #    Also, check that the HA Enabled field is enabled 'Yes'.
+
+        #list and validate above created service offering with Ha enabled
+        list_service_response = list_service_offering(
+            self.apiclient,
+            id=self.service_offering_with_ha.id
+        )
+        self.assertEqual(
+            isinstance(list_service_response, list),
+            True,
+            "listServiceOfferings returned invalid object in response."
+        )
+        self.assertNotEqual(
+            len(list_service_response),
+            0,
+            "listServiceOfferings returned empty list."
+        )
+        self.assertEqual(
+            list_service_response[0].offerha,
+            True,
+            "The service offering is not HA enabled"
+        )
+
+        #create virtual machine with the service offering with Ha enabled
+        virtual_machine = VirtualMachine.create(
+            self.apiclient,
+            self.services["virtual_machine"],
+            accountid=self.account.name,
+            domainid=self.account.domainid,
+            serviceofferingid=self.service_offering_with_ha.id
+        )
+        vms = VirtualMachine.list(
+            self.apiclient,
+            id=virtual_machine.id,
+            listall=True
+        )
+        self.assertEqual(
+            isinstance(vms, list),
+            True,
+            "listVirtualMachines returned invalid object in response."
+        )
+        self.assertNotEqual(
+            len(vms),
+            0,
+            "listVirtualMachines returned empty list."
+        )
+        self.debug("Deployed VM on host: %s" % vms[0].hostid)
+        self.assertEqual(
+            vms[0].haenable,
+            True,
+            "VM not created with HA enable tag"
+        )
+
+    @attr(configuration="ha.tag")
+    @attr(tags=["advanced", "advancedns", "sg", "basic", "eip", "simulator", "multihost"])
+    def test_02_no_vm_creation_on_host_with_haenabled(self):
+        """ Verify you can not create new VMs on hosts with an ha.tag """
+
+        # Steps,
+        #1. Fresh install CS (Bonita) that supports this feature
+        #2. Create Basic zone, pod, cluster, add 3 hosts to cluster (host1, host2, host3), secondary & primary Storage
+        #3. When adding host3, assign the HA host tag.
+        #4. You should already have a compute service offering with HA already create from above. If not, create one for HA.
+        #5. Create VMs with the service offering with and without the HA tag
+        # Validations,
+        #Check to make sure the newly created VM is not on any HA enabled hosts
+        #The  VM should be created only on host1 or host2 and never host3 (HA enabled)
+
+        #create and verify virtual machine with HA enabled service offering
+        virtual_machine_with_ha = VirtualMachine.create(
+            self.apiclient,
+            self.services["virtual_machine"],
+            accountid=self.account.name,
+            domainid=self.account.domainid,
+            serviceofferingid=self.service_offering_with_ha.id
+        )
+
+        vms = VirtualMachine.list(
+            self.apiclient,
+            id=virtual_machine_with_ha.id,
+            listall=True
+        )
+
+        self.assertEqual(
+            isinstance(vms, list),
+            True,
+            "listVirtualMachines returned invalid object in response."
+        )
+
+        self.assertNotEqual(
+            len(vms),
+            0,
+            "listVirtualMachines returned empty list."
+        )
+
+        vm = vms[0]
+
+        self.debug("Deployed VM on host: %s" % vm.hostid)
+
+        #validate the virtual machine created is host Ha enabled
+        list_hosts_response = list_hosts(
+            self.apiclient,
+            id=vm.hostid
+        )
+        self.assertEqual(
+            isinstance(list_hosts_response, list),
+            True,
+            "listHosts returned invalid object in response."
+        )
+
+        self.assertNotEqual(
+            len(list_hosts_response),
+            0,
+            "listHosts retuned empty list in response."
+        )
+
+        self.assertEqual(
+            list_hosts_response[0].hahost,
+            False,
+            "VM created on HA enabled host."
+        )
+
+        #create and verify virtual machine with Ha disabled service offering
+        virtual_machine_without_ha = VirtualMachine.create(
+            self.apiclient,
+            self.services["virtual_machine"],
+            accountid=self.account.name,
+            domainid=self.account.domainid,
+            serviceofferingid=self.service_offering_without_ha.id
+        )
+
+        vms = VirtualMachine.list(
+            self.apiclient,
+            id=virtual_machine_without_ha.id,
+            listall=True
+        )
+
+        self.assertEqual(
+            isinstance(vms, list),
+            True,
+            "listVirtualMachines returned invalid object in response."
+        )
+
+        self.assertNotEqual(
+            len(vms),
+            0,
+            "listVirtualMachines returned empty list."
+        )
+
+        vm = vms[0]
+
+        self.debug("Deployed VM on host: %s" % vm.hostid)
+
+        #verify that the virtual machine created on the host is Ha disabled
+        list_hosts_response = list_hosts(
+            self.apiclient,
+            id=vm.hostid
+        )
+        self.assertEqual(
+            isinstance(list_hosts_response, list),
+            True,
+            "listHosts returned invalid object in response."
+        )
+
+        self.assertNotEqual(
+            len(list_hosts_response),
+            0,
+            "listHosts returned empty list."
+        )
+
+        host = list_hosts_response[0]
+
+        self.assertEqual(
+            host.hahost,
+            False,
+            "VM migrated to HA enabled host."
+        )
+
+    @attr(configuration="ha.tag")
+    @attr(tags=["advanced", "advancedns", "sg", "basic", "eip", "simulator", "multihost"])
+    def test_03_cant_migrate_vm_to_host_with_ha_positive(self):
+        """ Verify you can not migrate VMs to hosts with an ha.tag (positive) """
+
+        # Steps,
+        #1. Create a Compute service offering with the 'Offer HA' option selected.
+        #2. Create a Guest VM with the compute service offering created above.
+        #3. Select the VM and migrate VM to another host. Choose a 'Suitable' host (i.e. host2)
+        # Validations
+        #The option from the 'Migrate instance to another host' dialog box' should list host3 as 'Not Suitable' for migration.
+        #Confirm that the VM is migrated to the 'Suitable' host you selected (i.e. host2)
+
+        #create and verify the virtual machine with HA enabled service offering
+        virtual_machine_with_ha = VirtualMachine.create(
+            self.apiclient,
+            self.services["virtual_machine"],
+            accountid=self.account.name,
+            domainid=self.account.domainid,
+            serviceofferingid=self.service_offering_with_ha.id
+        )
+
+        vms = VirtualMachine.list(
+            self.apiclient,
+            id=virtual_machine_with_ha.id,
+            listall=True,
+        )
+
+        self.assertEqual(
+            isinstance(vms, list),
+            True,
+            "List VMs should return valid response for deployed VM"
+        )
+
+        self.assertNotEqual(
+            len(vms),
+            0,
+            "List VMs should return valid response for deployed VM"
+        )
+
+        vm = vms[0]
+
+        self.debug("Deployed VM on host: %s" % vm.hostid)
+
+        #Find out a Suitable host for VM migration
+        list_hosts_response = list_hosts(
+            self.apiclient,
+        )
+        self.assertEqual(
+            isinstance(list_hosts_response, list),
+            True,
+            "The listHosts API returned the invalid list"
+        )
+
+        self.assertNotEqual(
+            len(list_hosts_response),
+            0,
+            "The listHosts returned nothing."
+        )
+        suitableHost = None
+        for host in list_hosts_response:
+            if host.suitableformigration == True and host.hostid != vm.hostid:
+                suitableHost = host
+                break
+
+        self.assertTrue(suitableHost is not None, "suitablehost should not be None")
+
+        #Migration of the VM to a suitable host
+        self.debug("Migrating VM-ID: %s to Host: %s" % (self.vm.id, suitableHost.id))
+
+        cmd = migrateVirtualMachine.migrateVirtualMachineCmd()
+        cmd.hostid = suitableHost.id
+        cmd.virtualmachineid = self.vm.id
+        self.apiclient.migrateVirtualMachine(cmd)
+
+        #Verify that the VM migrated to a targeted Suitable host
+        list_vm_response = list_virtual_machines(
+            self.apiclient,
+            id=vm.id
+        )
+        self.assertEqual(
+            isinstance(list_vm_response, list),
+            True,
+            "The listVirtualMachines returned the invalid list."
+        )
+
+        self.assertNotEqual(
+            list_vm_response,
+            None,
+            "The listVirtualMachines API returned nothing."
+        )
+
+        vm_response = list_vm_response[0]
+
+        self.assertEqual(
+            vm_response.id,
+            vm.id,
+            "The virtual machine id and the the virtual machine from listVirtualMachines is not matching."
+        )
+
+        self.assertEqual(
+            vm_response.hostid,
+            suitableHost.id,
+            "The VM is not migrated to targeted suitable host."
+        )
+
+    @attr(configuration="ha.tag")
+    @attr(tags=["advanced", "advancedns", "sg", "basic", "eip", "simulator", "multihost"])
+    def test_04_cant_migrate_vm_to_host_with_ha_negative(self):
+        """ Verify you can not migrate VMs to hosts with an ha.tag (negative) """
+
+        # Steps,
+        #1. Create a Compute service offering with the 'Offer HA' option selected.
+        #2. Create a Guest VM with the compute service offering created above.
+        #3. Select the VM and migrate VM to another host. Choose a 'Not Suitable' host.
+        # Validations,
+        #The option from the 'Migrate instance to another host' dialog box should list host3 as 'Not Suitable' for migration.
+        #By design, The Guest VM can STILL can be migrated to host3 if the admin chooses to do so.
+
+        #create and verify virtual machine with HA enabled service offering
+        virtual_machine_with_ha = VirtualMachine.create(
+            self.apiclient,
+            self.services["virtual_machine"],
+            accountid=self.account.name,
+            domainid=self.account.domainid,
+            serviceofferingid=self.service_offering_with_ha.id
+        )
+
+        vms = VirtualMachine.list(
+            self.apiclient,
+            id=virtual_machine_with_ha.id,
+            listall=True
+        )
+
+        self.assertEqual(
+            isinstance(vms, list),
+            True,
+            "The listVirtualMachines returned invalid object in response."
+        )
+
+        self.assertNotEqual(
+            len(vms),
+            0,
+            "The listVirtualMachines returned empty response."
+        )
+
+        vm = vms[0]
+
+        self.debug("Deployed VM on host: %s" % vm.hostid)
+
+        #Find out Non-Suitable host for VM migration
+        list_hosts_response = list_hosts(
+            self.apiclient,
+        )
+        self.assertEqual(
+            isinstance(list_hosts_response, list),
+            True,
+            "listHosts returned invalid object in response."
+        )
+
+        self.assertNotEqual(
+            len(list_hosts_response),
+            0,
+            "listHosts returned empty response."
+        )
+
+        notSuitableHost = None
+        for host in list_hosts_response:
+            if not host.suitableformigration and host.hostid != vm.hostid:
+                notSuitableHost = host
+                break
+
+        self.assertTrue(notSuitableHost is not None, "notsuitablehost should not be None")
+
+        #Migrate VM to Non-Suitable host
+        self.debug("Migrating VM-ID: %s to Host: %s" % (vm.id, notSuitableHost.id))
+
+        cmd = migrateVirtualMachine.migrateVirtualMachineCmd()
+        cmd.hostid = notSuitableHost.id
+        cmd.virtualmachineid = vm.id
+        self.apiclient.migrateVirtualMachine(cmd)
+
+        #Verify that the virtual machine got migrated to targeted Non-Suitable host
+        list_vm_response = list_virtual_machines(
+            self.apiclient,
+            id=vm.id
+        )
+        self.assertEqual(
+            isinstance(list_vm_response, list),
+            True,
+            "listVirtualMachine returned invalid object in response."
+        )
+
+        self.assertNotEqual(
+            len(list_vm_response),
+            0,
+            "listVirtualMachines returned empty response."
+        )
+
+        self.assertEqual(
+            list_vm_response[0].id,
+            vm.id,
+            "Virtual machine id with the virtual machine from listVirtualMachine is not matching."
+        )
+
+        self.assertEqual(
+            list_vm_response[0].hostid,
+            notSuitableHost.id,
+            "The detination host id of migrated VM is not matching."
+        )
+
+    @attr(configuration="ha.tag")
+    @attr(speed="slow")
+    @attr(tags=["advanced", "advancedns", "sg", "basic", "eip", "simulator", "multihost"])
+    def test_05_no_vm_with_ha_gets_migrated_to_ha_host_in_live_migration(self):
+        """ Verify that none of the VMs with HA enabled migrate to an ha tagged host during live migration """
+
+        # Steps,
+        #1. Fresh install CS that supports this feature
+        #2. Create Basic zone, pod, cluster, add 3 hosts to cluster (host1, host2, host3), secondary & primary Storage
+        #3. When adding host3, assign the HA host tag.
+        #4. Create VMs with and without the Compute Service Offering with the HA tag.
+        #5. Note the VMs on host1 and whether any of the VMs have their 'HA enabled' flags enabled.
+        #6. Put host1 into maintenance mode.
+        # Validations,
+        #1. Make sure the VMs are created on either host1 or host2 and not on host3
+        #2. Putting host1 into maintenance mode should trigger a live migration. Make sure the VMs are not migrated to HA enabled host3.
+
+        # create and verify virtual machine with HA disabled service offering
+        virtual_machine_with_ha = VirtualMachine.create(
+            self.apiclient,
+            self.services["virtual_machine"],
+            accountid=self.account.name,
+            domainid=self.account.domainid,
+            serviceofferingid=self.service_offering_with_ha.id
+        )
+
+        vms = VirtualMachine.list(
+            self.apiclient,
+            id=virtual_machine_with_ha.id,
+            listall=True
+        )
+
+        self.assertEqual(
+            isinstance(vms, list),
+            True,
+            "List VMs should return valid response for deployed VM"
+        )
+
+        self.assertNotEqual(
+            len(vms),
+            0,
+            "List VMs should return valid response for deployed VM"
+        )
+
+        vm_with_ha_enabled = vms[0]
+
+        #Verify the virtual machine got created on non HA host
+        list_hosts_response = list_hosts(
+            self.apiclient,
+            id=vm_with_ha_enabled.hostid
+        )
+        self.assertEqual(
+            isinstance(list_hosts_response, list),
+            True,
+            "Check list response returns a valid list"
+        )
+
+        self.assertNotEqual(
+            len(list_hosts_response),
+            0,
+            "Check Host is available"
+        )
+
+        self.assertEqual(
+            list_hosts_response[0].hahost,
+            False,
+            "The virtual machine is not ha enabled so check if VM is created on host which is also not ha enabled"
+        )
+
+        #put the Host in maintainance mode
+        self.debug("Enabling maintenance mode for host %s" % vm_with_ha_enabled.hostid)
+        cmd = prepareHostForMaintenance.prepareHostForMaintenanceCmd()
+        cmd.id = vm_with_ha_enabled.hostid
+        self.apiclient.prepareHostForMaintenance(cmd)
+
+        timeout = self.services["timeout"]
+
+        #verify the VM live migration happened to another running host
+        self.debug("Waiting for VM to come up")
+        wait_for_vm(
+            self.apiclient,
+            virtualmachineid=vm_with_ha_enabled.id,
+            interval=timeout
+        )
+
+        vms = VirtualMachine.list(
+            self.apiclient,
+            id=vm_with_ha_enabled.id,
+            listall=True,
+        )
+
+        self.assertEqual(
+            isinstance(vms, list),
+            True,
+            "List VMs should return valid response for deployed VM"
+        )
+
+        self.assertNotEqual(
+            len(vms),
+            0,
+            "List VMs should return valid response for deployed VM"
+        )
+
+        vm_with_ha_enabled1 = vms[0]
+
+        list_hosts_response = list_hosts(
+            self.apiclient,
+            id=vm_with_ha_enabled1.hostid
+        )
+        self.assertEqual(
+            isinstance(list_hosts_response, list),
+            True,
+            "Check list response returns a valid list"
+        )
+
+        self.assertNotEqual(
+            len(list_hosts_response),
+            0,
+            "Check Host is available"
+        )
+
+        self.assertEqual(
+            list_hosts_response[0].hahost,
+            False,
+            "The virtual machine is not ha enabled so check if VM is created on host which is also not ha enabled"
+        )
+
+        self.debug("Disabling the maintenance mode for host %s" % vm_with_ha_enabled.hostid)
+        cmd = cancelHostMaintenance.cancelHostMaintenanceCmd()
+        cmd.id = vm_with_ha_enabled.hostid
+        self.apiclient.cancelHostMaintenance(cmd)
+
+    @attr(configuration="ha.tag")
+    @attr(speed="slow")
+    @attr(tags=["advanced", "advancedns", "sg", "basic", "eip", "simulator", "multihost"])
+    def test_06_no_vm_without_ha_gets_migrated_to_ha_host_in_live_migration(self):
+        """ Verify that none of the VMs without HA enabled migrate to an ha tagged host during live migration """
+
+        # Steps,
+        #1. Fresh install CS that supports this feature
+        #2. Create Basic zone, pod, cluster, add 3 hosts to cluster (host1, host2, host3), secondary & primary Storage
+        #3. When adding host3, assign the HA host tag.
+        #4. Create VMs with and without the Compute Service Offering with the HA tag.
+        #5. Note the VMs on host1 and whether any of the VMs have their 'HA enabled' flags enabled.
+        #6. Put host1 into maintenance mode.
+        # Validations,
+        #1. Make sure the VMs are created on either host1 or host2 and not on host3
+        #2. Putting host1 into maintenance mode should trigger a live migration. Make sure the VMs are not migrated to HA enabled host3.
+
+        # create and verify virtual machine with HA disabled service offering
+        virtual_machine_without_ha = VirtualMachine.create(
+            self.apiclient,
+            self.services["virtual_machine"],
+            accountid=self.account.name,
+            domainid=self.account.domainid,
+            serviceofferingid=self.service_offering_without_ha.id
+        )
+
+        vms = VirtualMachine.list(
+            self.apiclient,
+            id=virtual_machine_without_ha.id,
+            listall=True
+        )
+
+        self.assertEqual(
+            isinstance(vms, list),
+            True,
+            "List VMs should return valid response for deployed VM"
+        )
+
+        self.assertNotEqual(
+            len(vms),
+            0,
+            "List VMs should return valid response for deployed VM"
+        )
+
+        vm_with_ha_disabled = vms[0]
+
+        #Verify the virtual machine got created on non HA host
+        list_hosts_response = list_hosts(
+            self.apiclient,
+            id=vm_with_ha_disabled.hostid
+        )
+        self.assertEqual(
+            isinstance(list_hosts_response, list),
+            True,
+            "Check list response returns a valid list"
+        )
+
+        self.assertNotEqual(
+            len(list_hosts_response),
+            0,
+            "Check Host is available"
+        )
+
+        self.assertEqual(
+            list_hosts_response[0].hahost,
+            False,
+            "The virtual machine is not ha enabled so check if VM is created on host which is also not ha enabled"
+        )
+
+        #put the Host in maintainance mode
+        self.debug("Enabling maintenance mode for host %s" % vm_with_ha_disabled.hostid)
+        cmd = prepareHostForMaintenance.prepareHostForMaintenanceCmd()
+        cmd.id = vm_with_ha_disabled.hostid
+        self.apiclient.prepareHostForMaintenance(cmd)
+
+        timeout = self.services["timeout"]
+
+        #verify the VM live migration happened to another running host
+        self.debug("Waiting for VM to come up")
+        wait_for_vm(
+            self.apiclient,
+            virtualmachineid=vm_with_ha_disabled.id,
+            interval=timeout
+        )
+
+        vms = VirtualMachine.list(
+            self.apiclient,
+            id=vm_with_ha_disabled.id,
+            listall=True
+        )
+
+        self.assertEqual(
+            isinstance(vms, list),
+            True,
+            "List VMs should return valid response for deployed VM"
+        )
+
+        self.assertNotEqual(
+            len(vms),
+            0,
+            "List VMs should return valid response for deployed VM"
+        )
+
+        list_hosts_response = list_hosts(
+            self.apiclient,
+            id=vms[0].hostid
+        )
+        self.assertEqual(
+            isinstance(list_hosts_response, list),
+            True,
+            "Check list response returns a valid list"
+        )
+
+        self.assertNotEqual(
+            len(list_hosts_response),
+            0,
+            "Check Host is available"
+        )
+
+        self.assertEqual(
+            list_hosts_response[0].hahost,
+            False,
+            "The virtual machine is not ha enabled so check if VM is created on host which is also not ha enabled"
+        )
+
+        self.debug("Disabling the maintenance mode for host %s" % vm_with_ha_disabled.hostid)
+        cmd = cancelHostMaintenance.cancelHostMaintenanceCmd()
+        cmd.id = vm_with_ha_disabled.hostid
+        self.apiclient.cancelHostMaintenance(cmd)


[44/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1

Posted by ah...@apache.org.
CLOUDSTACK-3016: remove zonetype parameter from listTemplates, listIsos API.


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

Branch: refs/heads/vmsync
Commit: 880029844b7cd63a59e75e7ce0285716a34f1934
Parents: cb35ec6
Author: Jessica Wang <je...@apache.org>
Authored: Mon Jun 17 16:08:38 2013 -0700
Committer: Jessica Wang <je...@apache.org>
Committed: Mon Jun 17 16:08:38 2013 -0700

----------------------------------------------------------------------
 .../api/command/user/iso/ListIsosCmd.java       |  7 -------
 .../command/user/template/ListTemplatesCmd.java |  8 --------
 .../com/cloud/storage/dao/VMTemplateDao.java    |  2 +-
 .../cloud/storage/dao/VMTemplateDaoImpl.java    | 21 ++++++--------------
 .../com/cloud/server/ManagementServerImpl.java  | 12 +++++------
 5 files changed, 13 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/88002984/api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java b/api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java
index f872c12..3219601 100644
--- a/api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java
@@ -78,9 +78,6 @@ public class ListIsosCmd extends BaseListTaggedResourcesCmd {
             description="the ID of the zone")
     private Long zoneId;
 
-    @Parameter(name=ApiConstants.ZONE_TYPE, type=CommandType.STRING, description="the network type of the zone that the virtual machine belongs to")
-    private String zoneType;
-    
     /////////////////////////////////////////////////////
     /////////////////// Accessors ///////////////////////
     /////////////////////////////////////////////////////
@@ -118,10 +115,6 @@ public class ListIsosCmd extends BaseListTaggedResourcesCmd {
         return zoneId;
     }
 
-    public String getZoneType() {
-        return zoneType;
-    }
-    
     public boolean listInReadyState() {
         Account account = UserContext.current().getCaller();
         // It is account specific if account is admin type and domainId and accountName are not null

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/88002984/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
index f0fc241..aeb76f5 100644
--- a/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java
@@ -68,10 +68,6 @@ public class ListTemplatesCmd extends BaseListTaggedResourcesCmd {
     @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType = ZoneResponse.class,
             description="list templates by zoneId")
     private Long zoneId;
-    
-    @Parameter(name=ApiConstants.ZONE_TYPE, type=CommandType.STRING, description="the network type of the zone that the virtual machine belongs to")
-    private String zoneType;
-    
     /////////////////////////////////////////////////////
     /////////////////// Accessors ///////////////////////
     /////////////////////////////////////////////////////
@@ -96,10 +92,6 @@ public class ListTemplatesCmd extends BaseListTaggedResourcesCmd {
         return zoneId;
     }
 
-    public String getZoneType() {
-        return zoneType;
-    }
-    
     public boolean listInReadyState() {
 
         Account account = UserContext.current().getCaller();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/88002984/engine/schema/src/com/cloud/storage/dao/VMTemplateDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/dao/VMTemplateDao.java b/engine/schema/src/com/cloud/storage/dao/VMTemplateDao.java
index 8520757..7c66dd4 100755
--- a/engine/schema/src/com/cloud/storage/dao/VMTemplateDao.java
+++ b/engine/schema/src/com/cloud/storage/dao/VMTemplateDao.java
@@ -56,7 +56,7 @@ public interface VMTemplateDao extends GenericDao<VMTemplateVO, Long>, StateDao<
 	public Set<Pair<Long, Long>> searchTemplates(String name, String keyword, TemplateFilter templateFilter, boolean isIso,
 	        List<HypervisorType> hypers, Boolean bootable, DomainVO domain, Long pageSize, Long startIndex, Long zoneId,
 	        HypervisorType hyperType, boolean onlyReady, boolean showDomr, List<Account> permittedAccounts, Account caller,
-	        ListProjectResourcesCriteria listProjectResourcesCriteria, Map<String, String> tags, String zoneType);
+	        ListProjectResourcesCriteria listProjectResourcesCriteria, Map<String, String> tags);
 	
     public Set<Pair<Long, Long>> searchSwiftTemplates(String name, String keyword, TemplateFilter templateFilter,
             boolean isIso, List<HypervisorType> hypers, Boolean bootable, DomainVO domain, Long pageSize, Long startIndex,

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/88002984/engine/schema/src/com/cloud/storage/dao/VMTemplateDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/storage/dao/VMTemplateDaoImpl.java b/engine/schema/src/com/cloud/storage/dao/VMTemplateDaoImpl.java
index 25ae933..d45ef73 100755
--- a/engine/schema/src/com/cloud/storage/dao/VMTemplateDaoImpl.java
+++ b/engine/schema/src/com/cloud/storage/dao/VMTemplateDaoImpl.java
@@ -521,7 +521,7 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
 	public Set<Pair<Long, Long>> searchTemplates(String name, String keyword, TemplateFilter templateFilter,
 	        boolean isIso, List<HypervisorType> hypers, Boolean bootable, DomainVO domain, Long pageSize, Long startIndex,
 	        Long zoneId, HypervisorType hyperType, boolean onlyReady, boolean showDomr,List<Account> permittedAccounts,
-	        Account caller, ListProjectResourcesCriteria listProjectResourcesCriteria, Map<String, String> tags, String zoneType) {
+	        Account caller, ListProjectResourcesCriteria listProjectResourcesCriteria, Map<String, String> tags) {
         StringBuilder builder = new StringBuilder();
         if (!permittedAccounts.isEmpty()) {
             for (Account permittedAccount : permittedAccounts) {
@@ -565,12 +565,7 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
         	if ((templateFilter == TemplateFilter.featured) || (templateFilter == TemplateFilter.community)) {
         	    dataCenterJoin = " INNER JOIN data_center dc on (h.data_center_id = dc.id)";
         	}
-        	
-        	if (zoneType != null) {
-        	    dataCenterJoin = " INNER JOIN template_host_ref thr on (t.id = thr.template_id) INNER JOIN host h on (thr.host_id = h.id)";
-                dataCenterJoin += " INNER JOIN data_center dc on (h.data_center_id = dc.id)";
-            }
-        	
+        	        	
         	if (templateFilter == TemplateFilter.sharedexecutable || templateFilter == TemplateFilter.shared ){
         	    lpjoin = " INNER JOIN launch_permission lp ON t.id = lp.template_id ";
         	}
@@ -697,7 +692,7 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
             }
 
             sql += whereClause + getExtrasWhere(templateFilter, name, keyword, isIso, bootable, hyperType, zoneId,
-                    onlyReady, showDomr, zoneType) + groupByClause + getOrderByLimit(pageSize, startIndex);
+                    onlyReady, showDomr) + groupByClause + getOrderByLimit(pageSize, startIndex);
 
             pstmt = txn.prepareStatement(sql);
             rs = pstmt.executeQuery();
@@ -758,7 +753,7 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
         return templateZonePairList;
 	}
 
-	private String getExtrasWhere(TemplateFilter templateFilter, String name, String keyword, boolean isIso, Boolean bootable, HypervisorType hyperType, Long zoneId, boolean onlyReady, boolean showDomr, String zoneType) {
+	private String getExtrasWhere(TemplateFilter templateFilter, String name, String keyword, boolean isIso, Boolean bootable, HypervisorType hyperType, Long zoneId, boolean onlyReady, boolean showDomr) {
 	    String sql = "";
         if (keyword != null) {
             sql += " t.name LIKE \"%" + keyword + "%\" AND";
@@ -788,15 +783,11 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem
         		sql += " AND h.data_center_id = " +zoneId;
             }
         }else if (zoneId != null){
-        	sql += " AND tzr.zone_id = " +zoneId+ " AND tzr.removed is null" ;        	     	
+        	sql += " AND tzr.zone_id = " +zoneId+ " AND tzr.removed is null" ;
         }else{
         	sql += " AND tzr.removed is null ";
         }
-        
-        if (zoneType != null){            
-            sql += " AND dc.networktype = '" + zoneType + "'";
-        }   
-        
+                
         if (!showDomr){
         	sql += " AND t.type != '" +Storage.TemplateType.SYSTEM.toString() + "'";
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/88002984/server/src/com/cloud/server/ManagementServerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java
index 5a332b4..dea761d 100755
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@ -1719,7 +1719,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
         HypervisorType hypervisorType = HypervisorType.getType(cmd.getHypervisor());
         return listTemplates(cmd.getId(), cmd.getIsoName(), cmd.getKeyword(), isoFilter, true, cmd.isBootable(), cmd.getPageSizeVal(),
                 cmd.getStartIndex(), cmd.getZoneId(), hypervisorType, true, cmd.listInReadyState(), permittedAccounts, caller,
-                listProjectResourcesCriteria, tags, cmd.getZoneType());
+                listProjectResourcesCriteria, tags);
     }
 
     @Override
@@ -1752,12 +1752,12 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
         HypervisorType hypervisorType = HypervisorType.getType(cmd.getHypervisor());
 
         return listTemplates(id, cmd.getTemplateName(), cmd.getKeyword(), templateFilter, false, null, cmd.getPageSizeVal(), cmd.getStartIndex(),
-                cmd.getZoneId(), hypervisorType, showDomr, cmd.listInReadyState(), permittedAccounts, caller, listProjectResourcesCriteria, tags, cmd.getZoneType());
+                cmd.getZoneId(), hypervisorType, showDomr, cmd.listInReadyState(), permittedAccounts, caller, listProjectResourcesCriteria, tags);
     }
 
     private Set<Pair<Long, Long>> listTemplates(Long templateId, String name, String keyword, TemplateFilter templateFilter, boolean isIso,
             Boolean bootable, Long pageSize, Long startIndex, Long zoneId, HypervisorType hyperType, boolean showDomr, boolean onlyReady,
-            List<Account> permittedAccounts, Account caller, ListProjectResourcesCriteria listProjectResourcesCriteria, Map<String, String> tags, String zoneType) {
+            List<Account> permittedAccounts, Account caller, ListProjectResourcesCriteria listProjectResourcesCriteria, Map<String, String> tags) {
 
         VMTemplateVO template = null;
         if (templateId != null) {
@@ -1798,7 +1798,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
                         startIndex, zoneId, hyperType, onlyReady, showDomr, permittedAccounts, caller, tags);
                 Set<Pair<Long, Long>> templateZonePairSet2 = new HashSet<Pair<Long, Long>>();
                 templateZonePairSet2 = _templateDao.searchTemplates(name, keyword, templateFilter, isIso, hypers, bootable, domain, pageSize,
-                        startIndex, zoneId, hyperType, onlyReady, showDomr, permittedAccounts, caller, listProjectResourcesCriteria, tags, zoneType);
+                        startIndex, zoneId, hyperType, onlyReady, showDomr, permittedAccounts, caller, listProjectResourcesCriteria, tags);
 
                 for (Pair<Long, Long> tmpltPair : templateZonePairSet2) {
                     if (!templateZonePairSet.contains(new Pair<Long, Long>(tmpltPair.first(), -1L))) {
@@ -1822,7 +1822,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
                 Set<Pair<Long, Long>> templateZonePairSet2 = new HashSet<Pair<Long, Long>>();
                 templateZonePairSet2 = _templateDao.searchTemplates(name, keyword, templateFilter, isIso, hypers,
                         bootable, domain, pageSize, startIndex, zoneId, hyperType, onlyReady, showDomr,
-                        permittedAccounts, caller, listProjectResourcesCriteria, tags, zoneType);
+                        permittedAccounts, caller, listProjectResourcesCriteria, tags);
 
                 for (Pair<Long, Long> tmpltPair : templateZonePairSet2) {
                     if (!templateZonePairSet.contains(new Pair<Long, Long>(tmpltPair.first(), -1L))) {
@@ -1840,7 +1840,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
         } else {
             if (template == null) {
                 templateZonePairSet = _templateDao.searchTemplates(name, keyword, templateFilter, isIso, hypers, bootable, domain, pageSize,
-                        startIndex, zoneId, hyperType, onlyReady, showDomr, permittedAccounts, caller, listProjectResourcesCriteria, tags, zoneType);
+                        startIndex, zoneId, hyperType, onlyReady, showDomr, permittedAccounts, caller, listProjectResourcesCriteria, tags);
             } else {
                 // if template is not public, perform permission check here
                 if (!template.isPublicTemplate() && caller.getType() != Account.ACCOUNT_TYPE_ADMIN) {


[24/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1

Posted by ah...@apache.org.
list the VPCs with vpc id not network id

test failed because of incorrectly listing the VPC using the networkid.

Signed-off-by: Prasanna Santhanam <ts...@apache.org>


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

Branch: refs/heads/vmsync
Commit: 363a7b933c4c7a7cbec096775d991f7430e70968
Parents: f8965b6
Author: Prasanna Santhanam <ts...@apache.org>
Authored: Mon Jun 17 22:25:01 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Mon Jun 17 22:25:01 2013 +0530

----------------------------------------------------------------------
 test/integration/component/test_vpc.py           | 4 ++--
 test/integration/smoke/test_portable_publicip.py | 1 -
 2 files changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/363a7b93/test/integration/component/test_vpc.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc.py b/test/integration/component/test_vpc.py
index 510e297..cc70695 100644
--- a/test/integration/component/test_vpc.py
+++ b/test/integration/component/test_vpc.py
@@ -1651,7 +1651,7 @@ class TestVPC(cloudstackTestCase):
     
     @attr(tags=["advanced", "intervlan"])
     def test_11_deploy_vm_wo_network_netdomain(self):
-        """ Test deployment of vm in a VPC without network netdomain
+        """ Test deployment of vm in a VPC without network domain
         """
 
         # 1. Create VPC without providing networkDomain.
@@ -2410,7 +2410,7 @@ class TestVPC(cloudstackTestCase):
 
         vpc_networks = VPC.list(
                                     self.apiclient,
-                                    id=network.id
+                                    id=vpc.id
                           )
         
         self.assertEqual(

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/363a7b93/test/integration/smoke/test_portable_publicip.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_portable_publicip.py b/test/integration/smoke/test_portable_publicip.py
index 5b2fbc7..9a3a398 100644
--- a/test/integration/smoke/test_portable_publicip.py
+++ b/test/integration/smoke/test_portable_publicip.py
@@ -21,7 +21,6 @@ from marvin.cloudstackAPI import *
 from marvin.integration.lib.utils import *
 from marvin.integration.lib.base import *
 from marvin.integration.lib.common import *
-from marvin import remoteSSHClient
 from nose.plugins.attrib import attr
 
 class Services:


[42/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1

Posted by ah...@apache.org.
CLOUDSTACK-2956:createStoragePools API should ignore passed clusterId
and podId parameters in creating zone scoped primary storage


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

Branch: refs/heads/vmsync
Commit: 4c26dd6ae5663e75d5303a977e786a2d920ec267
Parents: 56d390d
Author: Min Chen <mi...@citrix.com>
Authored: Mon Jun 17 15:41:05 2013 -0700
Committer: Min Chen <mi...@citrix.com>
Committed: Mon Jun 17 15:57:52 2013 -0700

----------------------------------------------------------------------
 server/src/com/cloud/storage/StorageManagerImpl.java | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4c26dd6a/server/src/com/cloud/storage/StorageManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/StorageManagerImpl.java b/server/src/com/cloud/storage/StorageManagerImpl.java
index d38b35e..655eaea 100755
--- a/server/src/com/cloud/storage/StorageManagerImpl.java
+++ b/server/src/com/cloud/storage/StorageManagerImpl.java
@@ -777,6 +777,9 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
 
         HypervisorType hypervisorType = HypervisorType.KVM;
         if (scopeType == ScopeType.ZONE) {
+            // ignore passed clusterId and podId
+            clusterId = null;
+            podId = null;
             String hypervisor = cmd.getHypervisor();
             if (hypervisor != null) {
                 try {


[17/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1

Posted by ah...@apache.org.
CLOUDSTACK-3019: add missing tags for test integration.component.test_advancedsg_networks.py


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

Branch: refs/heads/vmsync
Commit: f4dcca6e47d77e41e634c5d78fd403e1b4ba4b6d
Parents: 0587d3a
Author: Wei Zhou <w....@leaseweb.com>
Authored: Mon Jun 17 10:40:40 2013 +0200
Committer: Wei Zhou <w....@leaseweb.com>
Committed: Mon Jun 17 10:40:40 2013 +0200

----------------------------------------------------------------------
 test/integration/component/test_advancedsg_networks.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f4dcca6e/test/integration/component/test_advancedsg_networks.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_advancedsg_networks.py b/test/integration/component/test_advancedsg_networks.py
index e1694f1..f8774be 100644
--- a/test/integration/component/test_advancedsg_networks.py
+++ b/test/integration/component/test_advancedsg_networks.py
@@ -246,6 +246,7 @@ class TestNetworksInAdvancedSG(cloudstackTestCase):
             raise Exception("Warning: Exception during network cleanup : %s" % e)
         return
 
+    @attr(tags = ["advancedsg"])
     def test_createIsolatedNetwork(self):
         """ Test Isolated Network """
         
@@ -423,8 +424,9 @@ class TestNetworksInAdvancedSG(cloudstackTestCase):
         except Exception as e:
             self.debug("Network creation failed because create isolated network is invalid in advanced zone with security groups.")
 
+    @attr(tags = ["advancedsg"])
     def test_createSharedNetwork_withoutSG(self):
-        """ Test Shared Network with used vlan 01 """
+        """ Test Shared Network with without SecurityProvider """
         
         # Steps,
         #  1. create an Admin account
@@ -574,6 +576,7 @@ class TestNetworksInAdvancedSG(cloudstackTestCase):
         except Exception as e:
             self.debug("Network creation failed because there is no SecurityProvider in the network offering.")
     
+    @attr(tags = ["advancedsg"])
     def test_deployVM_SharedwithSG(self):
         """ Test VM deployment in shared networks with SecurityProvider """
         


[18/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1

Posted by ah...@apache.org.
Fix VPC tests related to user roles

Many vpc tests fail because of incorrect apiClient passed in to create
the VPC, network etc. The exact method used is getUserApiClient to fetch
the apiclient for a specific user.

Signed-off-by: Prasanna Santhanam <ts...@apache.org>


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

Branch: refs/heads/vmsync
Commit: 28b598b4acde49be61caade95824a60e213108b9
Parents: a5189b1
Author: Prasanna Santhanam <ts...@apache.org>
Authored: Mon Jun 17 17:31:10 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Mon Jun 17 17:32:05 2013 +0530

----------------------------------------------------------------------
 setup/dev/advanced.cfg                      |   3 +-
 test/integration/component/test_vpc.py      | 158 ++++++++---------------
 tools/marvin/marvin/cloudstackTestClient.py |   1 +
 3 files changed, 59 insertions(+), 103 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/28b598b4/setup/dev/advanced.cfg
----------------------------------------------------------------------
diff --git a/setup/dev/advanced.cfg b/setup/dev/advanced.cfg
index 3020165..3d0854d 100644
--- a/setup/dev/advanced.cfg
+++ b/setup/dev/advanced.cfg
@@ -218,7 +218,8 @@
             "mgtSvrIp": "localhost",
             "passwd": "password",
             "user": "root",
-            "port": 8096
+            "port": 8096,
+            "hypervisor" : "simulator"
         }
     ]
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/28b598b4/test/integration/component/test_vpc.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc.py b/test/integration/component/test_vpc.py
index 0afeb77..510e297 100644
--- a/test/integration/component/test_vpc.py
+++ b/test/integration/component/test_vpc.py
@@ -20,6 +20,7 @@
 #Import Local Modules
 from nose.plugins.attrib import attr
 from marvin.cloudstackTestCase import *
+from marvin.cloudstackException import cloudstackAPIException
 from marvin.cloudstackAPI import *
 from marvin.integration.lib.utils import *
 from marvin.integration.lib.base import *
@@ -820,7 +821,7 @@ class TestVPC(cloudstackTestCase):
                         )
         return
 
-    @attr(tags=["advanced", "intervlan"])
+    @attr(tags=["advanced", "intervlan", "multiple"])
     def test_07_restart_network_vm_running(self):
         """ Test Restart VPC when there are multiple networks associated
         """
@@ -1923,8 +1924,7 @@ class TestVPC(cloudstackTestCase):
 
     @attr(tags=["advanced", "intervlan"])
     def test_14_deploy_vm_1(self):
-        """ Test deployment of vm in a network from user account. But the VPC is created
-            without account/domain ID
+        """ Test vm deploy in network by a user where VPC was created without account/domain ID
         """
 
         # 1. Create VPC without providing account/domain ID.
@@ -1935,18 +1935,19 @@ class TestVPC(cloudstackTestCase):
                             self.apiclient,
                             self.services["account"]
                             )
-        self.debug("Created account: %s" % user.account.name)
+        self.debug("Created account: %s" % user.name)
         self.cleanup.append(user)
 
         self.services["vpc"]["cidr"] = "10.1.1.1/16"
         self.debug("creating a VPC network in the account: %s" %
-                                                    user.account.name)
+                                                    user.name)
 
-        userapiclient = self.testClient.createNewApiClient(
-                                        UserName=user.account.name,
-                                        DomainName=user.account.domain,
+        userapiclient = self.testClient.createUserApiClient(
+                                        UserName=user.name,
+                                        DomainName=user.domain,
                                         acctType=0)
 
+
         vpc = VPC.create(
                          userapiclient,
                          self.services["vpc"],
@@ -1999,8 +2000,7 @@ class TestVPC(cloudstackTestCase):
 
     @attr(tags=["advanced", "intervlan"])
     def test_15_deploy_vm_2(self):
-        """ Test deployment of vm in a network from domain admin account. But the VPC is created
-            without account/domain ID
+        """ Test deployment of vm in a network in a domain admin account where VPC is created without account/domain ID
         """
 
         # 1. Create VPC without providing account/domain ID.
@@ -2016,18 +2016,18 @@ class TestVPC(cloudstackTestCase):
                             self.apiclient,
                             self.services["account"]
                             )
-        self.debug("Created account: %s" % user.account.name)
+        self.debug("Created account: %s" % user.name)
         self.cleanup.append(user)
 
         self.services["vpc"]["cidr"] = "10.1.1.1/16"
         self.debug("creating a VPC network in the account: %s" %
-                                                    user.account.name)
+                                                    user.name)
 
         #0 - User, 1 - Root Admin, 2 - Domain Admin
-        userapiclient = self.testClient.createNewApiClient(
-                                UserName=user.account.name,
-                                DomainName=self.services["domain"]["name"],
-                                acctType=2)
+        userapiclient = self.testClient.getUserApiClient(
+                                account=user.name,
+                                domain=self.services["domain"]["name"],
+                                type=2)
 
         vpc = VPC.create(
                          userapiclient,
@@ -2092,23 +2092,23 @@ class TestVPC(cloudstackTestCase):
                             self.apiclient,
                             self.services["account"]
                             )
-        self.debug("Created account: %s" % user.account.name)
+        self.debug("Created account: %s" % user.name)
         self.cleanup.append(user)
 
         self.services["vpc"]["cidr"] = "10.1.1.1/16"
         self.debug("creating a VPC network in the account: %s" %
-                                                    user.account.name)
+                                                    user.name)
 
-        userapiclient = self.testClient.createNewApiClient(
-                                        UserName=user.account.name,
-                                        DomainName=user.account.domain,
-                                        acctType=0)
+        userapiclient = self.testClient.getUserApiClient(
+                                        account=user.name,
+                                        domain=user.domain,
+                                        type=0)
 
         vpc = VPC.create(
                          self.apiclient,
                          self.services["vpc"],
-                         account=user.account.name,
-                         domainid=user.account.domainid,
+                         account=user.name,
+                         domainid=user.domainid,
                          vpcofferingid=self.vpc_off.id,
                          zoneid=self.zone.id,
                          )
@@ -2176,82 +2176,39 @@ class TestVPC(cloudstackTestCase):
                             self.apiclient,
                             self.services["domain_admin"]
                             )
-        self.debug("Created account: %s" % domain_admin.account.name)
+        self.debug("Created account: %s" % domain_admin.name)
         self.cleanup.append(domain_admin)
-        da_apiclient = self.testClient.createNewApiClient(
-                                        UserName=domain_admin.account.name,
-                                        #DomainName=self.services["domain"]["name"],
-                                        DomainName=domain_admin.account.domain,
-                                        acctType=2)
+        da_apiclient = self.testClient.getUserApiClient(
+                                        account=domain_admin.name,
+                                        domain=domain_admin.domain,
+                                        type=2)
 
         user = Account.create(
                             self.apiclient,
                             self.services["account"]
                             )
-        self.debug("Created account: %s" % user.account.name)
+        self.debug("Created account: %s" % user.name)
         self.cleanup.append(user)
 
         self.services["vpc"]["cidr"] = "10.1.1.1/16"
         self.debug("creating a VPC network in the account: %s" %
-                                                    user.account.name)
+                                                    user.name)
 
         #0 - User, 1 - Root Admin, 2 - Domain Admin
-        userapiclient = self.testClient.createNewApiClient(
-                                        UserName=user.account.name,
-                                        DomainName=user.account.domain,
-                                        acctType=0)
-
-        vpc = VPC.create(
-                         da_apiclient,
-                         self.services["vpc"],
-                         account=user.account.name,
-                         domainid=user.account.domainid,
-                         vpcofferingid=self.vpc_off.id,
-                         zoneid=self.zone.id,
-                         )
-        self.validate_vpc_network(vpc)
-
-        self.network_offering = NetworkOffering.create(
-                                            self.apiclient,
-                                            self.services["network_offering"],
-                                            conservemode=False
-                                            )
-        # Enable Network offering
-        self.network_offering.update(self.apiclient, state='Enabled')
-        self._cleanup.append(self.network_offering)
-
-        gateway = vpc.cidr.split('/')[0]
-        # Split the cidr to retrieve gateway
-        # for eg. cidr = 10.0.0.1/24
-        # Gateway = 10.0.0.1
-
-        # Creating network using the network offering created
-        self.debug("Creating network with network offering: %s" %
-                                                    self.network_offering.id)
-        network = Network.create(
-                                userapiclient,
-                                self.services["network"],
-                                networkofferingid=self.network_offering.id,
-                                zoneid=self.zone.id,
-                                gateway=gateway,
-                                vpcid=vpc.id
-                                )
-        self.debug("Created network with ID: %s" % network.id)
+        userapiclient = self.testClient.getUserApiClient(
+                                        account=user.name,
+                                        domain=user.domain,
+                                        type=0)
 
-        # Spawn an instance in that network
-        virtual_machine = VirtualMachine.create(
-                                  userapiclient,
-                                  self.services["virtual_machine"],
-                                  serviceofferingid=self.service_offering.id,
-                                  networkids=[str(network.id)]
-                                  )
-        self.debug("Deployed VM in network: %s" % network.id)
-
-        self.assertNotEqual(virtual_machine,
-                None,
-                "VM creation in the network failed")
-
-        return
+        with self.assertRaises(cloudstackAPIException):
+            vpc = VPC.create(
+                             da_apiclient,
+                             self.services["vpc"],
+                             account=user.name,
+                             domainid=user.domainid,
+                             vpcofferingid=self.vpc_off.id,
+                             zoneid=self.zone.id,
+                             )
 
     @attr(tags=["advanced", "intervlan"])
     def test_18_create_net_for_user_diff_domain_by_doadmin(self):
@@ -2271,29 +2228,29 @@ class TestVPC(cloudstackTestCase):
                             self.apiclient,
                             self.services["domain_admin"]
                             )
-        self.debug("Created account: %s" % domain_admin.account.name)
+        self.debug("Created account: %s" % domain_admin.name)
         self.cleanup.append(domain_admin)
-        da_apiclient = self.testClient.createNewApiClient(
-                                        UserName=domain_admin.account.name,
-                                        DomainName=self.services["domain"]["name"],
-                                        acctType=2)
+        da_apiclient = self.testClient.getUserApiClient(
+                                        account=domain_admin.name,
+                                        domain=self.services["domain"]["name"],
+                                        type=2)
 
         user = Account.create(
                             self.apiclient,
                             self.services["account"]
                             )
-        self.debug("Created account: %s" % user.account.name)
+        self.debug("Created account: %s" % user.name)
         self.cleanup.append(user)
 
         self.services["vpc"]["cidr"] = "10.1.1.1/16"
         self.debug("creating a VPC network in the account: %s" %
-                                                    user.account.name)
+                                                    user.name)
 
         #0 - User, 1 - Root Admin, 2 - Domain Admin
-        userapiclient = self.testClient.createNewApiClient(
-                                        UserName=user.account.name,
-                                        DomainName=user.account.domain,
-                                        acctType=0)
+        userapiclient = self.testClient.getUserApiClient(
+                                        account=user.name,
+                                        domain=user.domain,
+                                        type=0)
 
         vpc = VPC.create(
                          da_apiclient,
@@ -2467,7 +2424,4 @@ class TestVPC(cloudstackTestCase):
 
         self.assertEqual(vpc_networks[0].displaytext,
              new_display_text,
-             "Updation of VPC display text failed.")
-
-
-
+             "Updation of VPC display text failed.")
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/28b598b4/tools/marvin/marvin/cloudstackTestClient.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/cloudstackTestClient.py b/tools/marvin/marvin/cloudstackTestClient.py
index d85a61c..37380d6 100644
--- a/tools/marvin/marvin/cloudstackTestClient.py
+++ b/tools/marvin/marvin/cloudstackTestClient.py
@@ -121,6 +121,7 @@ class cloudstackTestClient(object):
             apiKey, securityKey, self.connection.asyncTimeout, self.connection.logging)
         self.userApiClient = cloudstackAPIClient.CloudStackAPIClient(newUserConnection)
         self.userApiClient.connection = newUserConnection
+        self.userApiClient.hypervisor = self.apiClient.hypervisor
         return self.userApiClient
 
     def close(self):


[23/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1

Posted by ah...@apache.org.
Concentrated planner granularity is at pod level

user.concentrated pod planner will try and put the VMs in the same pod.
Correcting the assertion to verify same pod and not same cluster. Test
may have passed earlier because of presence of single pod in the
deployment.

Signed-off-by: Prasanna Santhanam <ts...@apache.org>


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

Branch: refs/heads/vmsync
Commit: f8965b6f07e32275f5463d4a89a973030b51b123
Parents: 6a5c9d7
Author: Prasanna Santhanam <ts...@apache.org>
Authored: Mon Jun 17 19:44:33 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Mon Jun 17 19:44:33 2013 +0530

----------------------------------------------------------------------
 .../test_deploy_vms_with_varied_deploymentplanners.py   | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f8965b6f/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py b/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py
index af83299..fc8e716 100644
--- a/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py
+++ b/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py
@@ -16,7 +16,7 @@
 # under the License.
 
 from marvin.cloudstackTestCase import cloudstackTestCase
-from marvin.integration.lib.base import Account, VirtualMachine, ServiceOffering, Host
+from marvin.integration.lib.base import Account, VirtualMachine, ServiceOffering, Host, Cluster
 from marvin.integration.lib.common import get_zone, get_domain, get_template, cleanup_resources
 
 from nose.plugins.attrib import attr
@@ -77,6 +77,7 @@ class TestDeployVmWithVariedPlanners(cloudstackTestCase):
         )
         cls.services["account"] = cls.account.name
         cls.hosts = Host.list(cls.apiclient, type='Routing')
+        cls.clusters = Cluster.list(cls.apiclient)
         cls.cleanup = [
             cls.account
         ]
@@ -241,10 +242,13 @@ class TestDeployVmWithVariedPlanners(cloudstackTestCase):
         )
         vm1clusterid = filter(lambda c: c.id == vm1.hostid, self.hosts)[0].clusterid
         vm2clusterid = filter(lambda c: c.id == vm2.hostid, self.hosts)[0].clusterid
+
+        vm1podid = filter(lambda p: p.id == vm1clusterid, self.clusters)[0].podid
+        vm2podid = filter(lambda p: p.id == vm2clusterid, self.clusters)[0].podid
         self.assertEqual(
-            vm1clusterid,
-            vm2clusterid,
-            msg="VMs (%s, %s) meant to be concentrated are deployed on different clusters (%s, %s)" % (vm1.id, vm2.id, vm1clusterid, vm2clusterid)
+            vm1podid,
+            vm2podid,
+            msg="VMs (%s, %s) meant to be pod concentrated are deployed on different pods (%s, %s)" % (vm1.id, vm2.id, vm1clusterid, vm2clusterid)
         )
 
     @classmethod


[49/50] [abbrv] Merge from master

Posted by ah...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
index ab66bb0,8da5176..81eebe4
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@@ -3168,9 -3185,16 +3178,16 @@@ public class VirtualNetworkApplianceMan
                  String vlanId = ipAddr.getVlanTag();
                  String vlanGateway = ipAddr.getGateway();
                  String vlanNetmask = ipAddr.getNetmask();
-                 String vifMacAddress = ipAddr.getMacAddress();
+                 String vifMacAddress = null;
+                 // For non-source nat IP, set the mac to be something based on first public nic's MAC
+                 // We cannot depends on first ip because we need to deal with first ip of other nics
+                 if (!ipAddr.isSourceNat() && ipAddr.getVlanId() != 0) {
+                 	vifMacAddress = NetUtils.generateMacOnIncrease(baseMac, ipAddr.getVlanId());
+                 } else {
+                 	vifMacAddress = ipAddr.getMacAddress();
+                 }
  
 -                IpAddressTO ip = new IpAddressTO(ipAddr.getAccountId(), ipAddr.getAddress().addr(), add, firstIP, 
 +                IpAddressTO ip = new IpAddressTO(ipAddr.getAccountId(), ipAddr.getAddress().addr(), add, firstIP,
                          sourceNat, vlanId, vlanGateway, vlanNetmask, vifMacAddress, networkRate, ipAddr.isOneToOneNat());
  
                  ip.setTrafficType(network.getTrafficType());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/server/src/com/cloud/network/rules/RulesManagerImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/server/src/com/cloud/network/vpc/NetworkACLServiceImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/server/src/com/cloud/server/ManagementServerImpl.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/server/ManagementServerImpl.java
index 52d573d,dea761d..2c20bc6
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@@ -965,32 -1006,12 +968,12 @@@ public class ManagementServerImpl exten
          Object hypervisorType = cmd.getHypervisorType();
          Object clusterType = cmd.getClusterType();
          Object allocationState = cmd.getAllocationState();
-         String zoneType = cmd.getZoneType();
          String keyword = cmd.getKeyword();
-         zoneId = _accountMgr.checkAccessAndSpecifyAuthority(CallContext.current().getCallingAccount(), zoneId);
--
-         
-     	Filter searchFilter = new Filter(ClusterVO.class, "id", true, cmd.getStartIndex(), cmd.getPageSizeVal());
-         
-         SearchBuilder<ClusterVO> sb = _clusterDao.createSearchBuilder();
-         sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ);
-         sb.and("name", sb.entity().getName(), SearchCriteria.Op.LIKE);
-         sb.and("podId", sb.entity().getPodId(), SearchCriteria.Op.EQ);
-         sb.and("dataCenterId", sb.entity().getDataCenterId(), SearchCriteria.Op.EQ);
-         sb.and("hypervisorType", sb.entity().getHypervisorType(), SearchCriteria.Op.EQ);
-         sb.and("clusterType", sb.entity().getClusterType(), SearchCriteria.Op.EQ);
-         sb.and("allocationState", sb.entity().getAllocationState(), SearchCriteria.Op.EQ);
-         
-         if(zoneType != null) {
-             SearchBuilder<DataCenterVO> zoneSb = _dcDao.createSearchBuilder();
-             zoneSb.and("zoneNetworkType", zoneSb.entity().getNetworkType(), SearchCriteria.Op.EQ);
-             sb.join("zoneSb", zoneSb, sb.entity().getDataCenterId(), zoneSb.entity().getId(), JoinBuilder.JoinType.INNER);
-         }
 -        zoneId = _accountMgr.checkAccessAndSpecifyAuthority(UserContext.current().getCaller(), zoneId);
 -
 +        
++        zoneId = _accountMgr.checkAccessAndSpecifyAuthority(CallContext.current().getCallingAccount(), zoneId);
 +        
-         SearchCriteria<ClusterVO> sc = sb.create();
          if (id != null) {
-             sc.setParameters("id", id);
+             sc.addAnd("id", SearchCriteria.Op.EQ, id);
          }
  
          if (name != null) {
@@@ -1436,24 -1456,9 +1418,9 @@@
          Long zoneId = cmd.getZoneId();
          Object keyword = cmd.getKeyword();
          Object allocationState = cmd.getAllocationState();
-         String zoneType = cmd.getZoneType();
-         zoneId = _accountMgr.checkAccessAndSpecifyAuthority(CallContext.current().getCallingAccount(), zoneId);
  
-     	
-     	Filter searchFilter = new Filter(HostPodVO.class, "dataCenterId", true, cmd.getStartIndex(), cmd.getPageSizeVal());
-         SearchBuilder<HostPodVO> sb = _hostPodDao.createSearchBuilder();
-         sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ);
-         sb.and("name", sb.entity().getName(), SearchCriteria.Op.LIKE);
-         sb.and("dataCenterId", sb.entity().getDataCenterId(), SearchCriteria.Op.EQ);
-         sb.and("allocationState", sb.entity().getAllocationState(), SearchCriteria.Op.EQ);
-         
-         if(zoneType != null) {
-             SearchBuilder<DataCenterVO> zoneSb = _dcDao.createSearchBuilder();
-             zoneSb.and("zoneNetworkType", zoneSb.entity().getNetworkType(), SearchCriteria.Op.EQ);
-             sb.join("zoneSb", zoneSb, sb.entity().getDataCenterId(), zoneSb.entity().getId(), JoinBuilder.JoinType.INNER);
-         }
 -        zoneId = _accountMgr.checkAccessAndSpecifyAuthority(UserContext.current().getCaller(), zoneId);
 -
++        zoneId = _accountMgr.checkAccessAndSpecifyAuthority(CallContext.current().getCallingAccount(), zoneId);
 +               
-         SearchCriteria<HostPodVO> sc = sb.create();
          if (keyword != null) {
              SearchCriteria<HostPodVO> ssc = _hostPodDao.createSearchCriteria();
              ssc.addOr("name", SearchCriteria.Op.LIKE, "%" + keyword + "%");
@@@ -3072,8 -3077,7 +3035,7 @@@
      @Override
      public Pair<List<? extends VirtualMachine>, Integer> searchForSystemVm(ListSystemVMsCmd cmd) {
          String type = cmd.getSystemVmType();
 -        Long zoneId = _accountMgr.checkAccessAndSpecifyAuthority(UserContext.current().getCaller(), cmd.getZoneId());
 +        Long zoneId = _accountMgr.checkAccessAndSpecifyAuthority(CallContext.current().getCallingAccount(), cmd.getZoneId());
-         String zoneType = cmd.getZoneType();
          Long id = cmd.getId();
          String name = cmd.getSystemVmName();
          String state = cmd.getState();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/server/src/com/cloud/storage/StorageManagerImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/server/src/com/cloud/storage/VolumeManagerImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
index 6e218f8,c720169..0c78c4c
--- a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
+++ b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
@@@ -572,10 -571,10 +571,10 @@@ public class SnapshotManagerImpl extend
          String keyword = cmd.getKeyword();
          String snapshotTypeStr = cmd.getSnapshotType();
          String intervalTypeStr = cmd.getIntervalType();
-         String zoneType = cmd.getZoneType();
          Map<String, String> tags = cmd.getTags();
+         Long zoneId = cmd.getZoneId();
          
 -        Account caller = UserContext.current().getCaller();
 +        Account caller = CallContext.current().getCallingAccount();
          List<Long> permittedAccounts = new ArrayList<Long>();
  
          // Verify parameters
@@@ -602,25 -601,20 +601,20 @@@
          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<ResourceTagVO> tagSearch = _resourceTagDao.createSearchBuilder();
 -        for (int count=0; count < tags.size(); count++) {
 -            tagSearch.or().op("key" + String.valueOf(count), tagSearch.entity().getKey(), SearchCriteria.Op.EQ);
 -            tagSearch.and("value" + String.valueOf(count), tagSearch.entity().getValue(), SearchCriteria.Op.EQ);
 -            tagSearch.cp();
 -        }
 -        tagSearch.and("resourceType", tagSearch.entity().getResourceType(), SearchCriteria.Op.EQ);
 -        sb.groupBy(sb.entity().getId());
 -        sb.join("tagSearch", tagSearch, sb.entity().getId(), tagSearch.entity().getResourceId(), JoinBuilder.JoinType.INNER);
 -    }
 +            SearchBuilder<ResourceTagVO> tagSearch = _resourceTagDao.createSearchBuilder();
 +            for (int count=0; count < tags.size(); count++) {
 +                tagSearch.or().op("key" + String.valueOf(count), tagSearch.entity().getKey(), SearchCriteria.Op.EQ);
 +                tagSearch.and("value" + String.valueOf(count), tagSearch.entity().getValue(), SearchCriteria.Op.EQ);
 +                tagSearch.cp();
 +            }
 +            tagSearch.and("resourceType", tagSearch.entity().getResourceType(), SearchCriteria.Op.EQ);
 +            sb.groupBy(sb.entity().getId());
 +            sb.join("tagSearch", tagSearch, sb.entity().getId(), tagSearch.entity().getResourceId(), JoinBuilder.JoinType.INNER);
 +        }
  
-         if(zoneType != null) {
-             SearchBuilder<DataCenterVO> zoneSb = _dcDao.createSearchBuilder();
-             zoneSb.and("zoneNetworkType", zoneSb.entity().getNetworkType(), SearchCriteria.Op.EQ);    
-             sb.join("zoneSb", zoneSb, sb.entity().getDataCenterId(), zoneSb.entity().getId(), JoinBuilder.JoinType.INNER);
-         }
-         
          SearchCriteria<SnapshotVO> sc = sb.create();
          _accountMgr.buildACLSearchCriteria(sc, domainId, isRecursive, permittedAccounts, listProjectResourcesCriteria);
  
@@@ -638,10 -632,10 +632,10 @@@
              }
          }
  
-         if(zoneType != null) {
-             sc.setJoinParameters("zoneSb", "zoneNetworkType", zoneType);          
+         if (zoneId != null) {
+             sc.setParameters("dataCenterId", zoneId);
          }
 -
 +        
          if (name != null) {
              sc.setParameters("name", "%" + name + "%");
          }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java
index 1902b3a,4696bb5..3f9d533
--- a/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java
+++ b/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java
@@@ -57,6 -55,8 +56,7 @@@ import com.cloud.user.User
  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;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/server/src/com/cloud/storage/upload/UploadMonitorImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/server/src/com/cloud/vm/UserVmManagerImpl.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/vm/UserVmManagerImpl.java
index d37ef95,e8ea024..32ba298
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@@ -3407,6 -3393,10 +3379,10 @@@ public class UserVmManagerImpl extends 
  
      @Override
      public void collectVmDiskStatistics (UserVmVO userVm) {
+         // support KVM and XenServer only
+         if (!userVm.getHypervisorType().equals(HypervisorType.XenServer)
+                 && !userVm.getHypervisorType().equals(HypervisorType.KVM))
 -            return;        
++            return;
      	// Collect vm disk statistics from host before stopping Vm
      	long hostId = userVm.getHostId();
      	List<String> vmNames = new ArrayList<String>();
@@@ -3905,8 -3895,12 +3881,11 @@@
                              + " already has max Running VMs(count includes system VMs), cannot migrate to this host");
          }
  
-         collectVmDiskStatistics(vm);
+         UserVmVO uservm = _vmDao.findById(vmId);
+         if (uservm != null) {
+             collectVmDiskStatistics(uservm);
+         }
 -        VMInstanceVO migratedVm = _itMgr.migrate(vm, srcHostId, dest);
 -        return migratedVm;
 +        return _itMgr.migrate(vm.getUuid(), srcHostId, dest);
      }
  
      private boolean checkIfHostIsDedicated(HostVO host) {
@@@ -4634,4 -4684,24 +4605,23 @@@
          if (vm.getState() == State.Running)
              collectVmDiskStatistics(vm);
      }
+     
+     private void encryptAndStorePassword(UserVmVO vm, String password) {
+         String sshPublicKey = vm.getDetail("SSH.PublicKey");
+         if (sshPublicKey != null && !sshPublicKey.equals("")
+                 && password != null && !password.equals("saved_password")) {
+             if (!sshPublicKey.startsWith("ssh-rsa")) {
+                 s_logger.warn("Only RSA public keys can be used to encrypt a vm password.");
+                 return;
+             }
+             String encryptedPasswd = RSAHelper.encryptWithSSHPublicKey(
+                     sshPublicKey, password);
+             if (encryptedPasswd == null) {
+                 throw new CloudRuntimeException("Error encrypting password");
+             }
+ 
+             vm.setDetail("Encrypted.Password", encryptedPasswd);
+             _vmDao.saveDetails(vm);
+         }
+     }
 -
  }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e2edae17/setup/db/db/schema-410to420.sql
----------------------------------------------------------------------


[02/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1

Posted by ah...@apache.org.
test_accounts.TesttemplateHierarchy;ostype added

Signed-off-by: Prasanna Santhanam <ts...@apache.org>


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

Branch: refs/heads/vmsync
Commit: 2f345c5b4dcac464770f1f7719e07cf73c5f6ea8
Parents: 6d14053
Author: rayeesn <ra...@citrix.com>
Authored: Sat Jun 15 15:17:32 2013 -0700
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Sun Jun 16 11:10:37 2013 +0530

----------------------------------------------------------------------
 test/integration/component/test_accounts.py | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2f345c5b/test/integration/component/test_accounts.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_accounts.py b/test/integration/component/test_accounts.py
index 3f106c3..ec135b1 100644
--- a/test/integration/component/test_accounts.py
+++ b/test/integration/component/test_accounts.py
@@ -84,6 +84,7 @@ class Services:
                                 "isfeatured": True,
                                 "ispublic": True,
                                 "isextractable": True,
+                                "ostype": 'CentOS 5.3 (64-bit)',
                         },
                         "natrule": {
                                     "publicport": 22,


[29/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1

Posted by ah...@apache.org.
CLOUDSTACK-2902: Updating repository refs

Conflicts:

	docs/zh-TW/configure-package-repository.po


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

Branch: refs/heads/vmsync
Commit: 9ef366e4b3d7e237503d7dd6a1f4b7af4b74b445
Parents: 2572627
Author: Chip Childers <ch...@apache.org>
Authored: Mon Jun 17 13:46:30 2013 -0400
Committer: Chip Childers <ch...@apache.org>
Committed: Mon Jun 17 13:49:05 2013 -0400

----------------------------------------------------------------------
 docs/en-US/configure-package-repository.xml | 4 ++--
 docs/pot/configure-package-repository.pot   | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ef366e4/docs/en-US/configure-package-repository.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/configure-package-repository.xml b/docs/en-US/configure-package-repository.xml
index c8ba48f..cda4677 100644
--- a/docs/en-US/configure-package-repository.xml
+++ b/docs/en-US/configure-package-repository.xml
@@ -44,7 +44,7 @@
         <title>DEB package repository</title>
         <para>You can add a DEB package repository to your apt sources with the following commands. Please note that only packages for Ubuntu 12.04 LTS (precise) are being built at this time.</para>
         <para>Use your preferred editor and open (or create) <filename>/etc/apt/sources.list.d/cloudstack.list</filename>. Add the community provided repository to the file:</para>
-<programlisting>deb http://cloudstack.apt-get.eu/ubuntu precise 4.0</programlisting>
+<programlisting>deb http://cloudstack.apt-get.eu/ubuntu precise 4.1</programlisting>
         <para>We now have to add the public key to the trusted keys.</para>
         <programlisting language="Bash"><prompt>$</prompt> <command>wget</command> -O - http://cloudstack.apt-get.eu/release.asc|apt-key add -</programlisting>
         <para>Now update your local apt cache.</para>
@@ -60,7 +60,7 @@
         <programlisting>
 [cloudstack]
 name=cloudstack
-baseurl=<replaceable>http://cloudstack.apt-get.eu/rhel/4.0/</replaceable>
+baseurl=<replaceable>http://cloudstack.apt-get.eu/rhel/4.1/</replaceable>
 enabled=1
 gpgcheck=0
         </programlisting>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9ef366e4/docs/pot/configure-package-repository.pot
----------------------------------------------------------------------
diff --git a/docs/pot/configure-package-repository.pot b/docs/pot/configure-package-repository.pot
index e915358..c0ee374 100644
--- a/docs/pot/configure-package-repository.pot
+++ b/docs/pot/configure-package-repository.pot
@@ -60,7 +60,7 @@ msgstr ""
 
 #. Tag: programlisting
 #, no-c-format
-msgid "deb http://cloudstack.apt-get.eu/ubuntu precise 4.0"
+msgid "deb http://cloudstack.apt-get.eu/ubuntu precise 4.1"
 msgstr ""
 
 #. Tag: para
@@ -118,7 +118,7 @@ msgstr ""
 msgid "\n"
 "[cloudstack]\n"
 "name=cloudstack\n"
-"baseurl=<replaceable>http://cloudstack.apt-get.eu/rhel/4.0/</replaceable>\n"
+"baseurl=<replaceable>http://cloudstack.apt-get.eu/rhel/4.1/</replaceable>\n"
 "enabled=1\n"
 "gpgcheck=0\n"
 "        "


[34/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1

Posted by ah...@apache.org.
String instantiation is not needed

Removed a String instntiation, test case added

Signed-off-by: Laszlo Hornyak <la...@gmail.com>


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

Branch: refs/heads/vmsync
Commit: 564013bec0d4356232d93ac52a3e44638578bff0
Parents: ce8ada0
Author: Laszlo Hornyak <la...@gmail.com>
Authored: Sat Jun 8 21:39:52 2013 +0200
Committer: Chip Childers <ch...@gmail.com>
Committed: Mon Jun 17 19:17:22 2013 +0100

----------------------------------------------------------------------
 utils/src/com/cloud/utils/net/NetUtils.java      | 2 +-
 utils/test/com/cloud/utils/net/NetUtilsTest.java | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/564013be/utils/src/com/cloud/utils/net/NetUtils.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/net/NetUtils.java b/utils/src/com/cloud/utils/net/NetUtils.java
index 5c13454..6099379 100755
--- a/utils/src/com/cloud/utils/net/NetUtils.java
+++ b/utils/src/com/cloud/utils/net/NetUtils.java
@@ -257,7 +257,7 @@ public class NetUtils {
             return ipFromInetAddress(addr);
         }
 
-        return new String("127.0.0.1");
+        return "127.0.0.1";
     }
 
     public static String ipFromInetAddress(InetAddress addr) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/564013be/utils/test/com/cloud/utils/net/NetUtilsTest.java
----------------------------------------------------------------------
diff --git a/utils/test/com/cloud/utils/net/NetUtilsTest.java b/utils/test/com/cloud/utils/net/NetUtilsTest.java
index 38fe21d..3cfc98f 100644
--- a/utils/test/com/cloud/utils/net/NetUtilsTest.java
+++ b/utils/test/com/cloud/utils/net/NetUtilsTest.java
@@ -168,4 +168,9 @@ public class NetUtilsTest extends TestCase {
     	newMac = NetUtils.generateMacOnIncrease(mac, 16);
     	assertTrue(newMac.equals("06:00:0f:00:45:67"));
     }
+
+    @Test
+    public void testGetLocalIPString() {
+        assertNotNull(NetUtils.getLocalIPString());
+    }
 }


[03/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1

Posted by ah...@apache.org.
cloudmonkey: Bump up version of cloudmonkey to 4.2.xx

Signed-off-by: Rohit Yadav <ro...@wingify.com>


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

Branch: refs/heads/vmsync
Commit: 1a058d77939819ef8a00130064bfb9ca4f108ebe
Parents: 2f345c5
Author: Rohit Yadav <ro...@wingify.com>
Authored: Sun Jun 16 18:33:34 2013 +0530
Committer: Rohit Yadav <ro...@wingify.com>
Committed: Sun Jun 16 18:33:34 2013 +0530

----------------------------------------------------------------------
 tools/cli/cloudmonkey/config.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1a058d77/tools/cli/cloudmonkey/config.py
----------------------------------------------------------------------
diff --git a/tools/cli/cloudmonkey/config.py b/tools/cli/cloudmonkey/config.py
index aaf97eb..36f7e77 100644
--- a/tools/cli/cloudmonkey/config.py
+++ b/tools/cli/cloudmonkey/config.py
@@ -18,7 +18,7 @@
 
 # Use following rules for versioning:
 # <cloudstack version>-<cli increment, starts from 0>
-__version__ = "4.1.0-0"
+__version__ = "4.2.0-0"
 __description__ = "Command Line Interface for Apache CloudStack"
 __maintainer__ = "Rohit Yadav"
 __maintaineremail__ = "bhaisaab@apache.org"


[46/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1

Posted by ah...@apache.org.
CLOUDSTACK-3016: remove zonetype parameter from listNetworks API.


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

Branch: refs/heads/vmsync
Commit: 3e852cc29b428f3e5454d7d415174758f9da0602
Parents: 5d0a1ce
Author: Jessica Wang <je...@apache.org>
Authored: Mon Jun 17 16:25:25 2013 -0700
Committer: Jessica Wang <je...@apache.org>
Committed: Mon Jun 17 16:26:09 2013 -0700

----------------------------------------------------------------------
 .../command/user/network/ListNetworksCmd.java   |  7 ------
 .../com/cloud/network/NetworkServiceImpl.java   | 25 ++++++++------------
 2 files changed, 10 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3e852cc2/api/src/org/apache/cloudstack/api/command/user/network/ListNetworksCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/ListNetworksCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/ListNetworksCmd.java
index d25e2c0..afce092 100644
--- a/api/src/org/apache/cloudstack/api/command/user/network/ListNetworksCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/network/ListNetworksCmd.java
@@ -48,9 +48,6 @@ public class ListNetworksCmd extends BaseListTaggedResourcesCmd {
             description="the Zone ID of the network")
     private Long zoneId;
 
-    @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.TYPE, type=CommandType.STRING, description="the type of the network. Supported values are: Isolated and Shared")
     private String guestIpType;
 
@@ -99,10 +96,6 @@ public class ListNetworksCmd extends BaseListTaggedResourcesCmd {
         return zoneId;
     }
 
-    public String getZoneType() {
-        return zoneType;
-    }
-    
     public String getGuestIpType() {
         return guestIpType;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3e852cc2/server/src/com/cloud/network/NetworkServiceImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkServiceImpl.java b/server/src/com/cloud/network/NetworkServiceImpl.java
index f026dbc..aace68d 100755
--- a/server/src/com/cloud/network/NetworkServiceImpl.java
+++ b/server/src/com/cloud/network/NetworkServiceImpl.java
@@ -1355,7 +1355,6 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
         Long id = cmd.getId();
         String keyword = cmd.getKeyword();
         Long zoneId = cmd.getZoneId();
-        String zoneType = cmd.getZoneType();
         Account caller = UserContext.current().getCaller();
         Long domainId = cmd.getDomainId();
         String accountName = cmd.getAccountName();
@@ -1503,40 +1502,40 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
             if (!permittedAccounts.isEmpty()) {
                 //get account level networks
                 networksToReturn.addAll(listAccountSpecificNetworks(
-                        buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType,
-                                physicalNetworkId, aclType, skipProjectNetworks, restartRequired, specifyIpRanges, vpcId, tags, zoneType), searchFilter,
+                        buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType, 
+                                physicalNetworkId, aclType, skipProjectNetworks, restartRequired, specifyIpRanges, vpcId, tags), searchFilter,
                         permittedAccounts));
                 //get domain level networks
                 if (domainId != null) {
                     networksToReturn
                     .addAll(listDomainLevelNetworks(
                             buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType,
-                                    physicalNetworkId, aclType, true, restartRequired, specifyIpRanges, vpcId, tags, zoneType), searchFilter,
+                                    physicalNetworkId, aclType, true, restartRequired, specifyIpRanges, vpcId, tags), searchFilter,
                                     domainId, false));
                 }
             } else {
                 //add account specific networks
                 networksToReturn.addAll(listAccountSpecificNetworksByDomainPath(
-                        buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType,
-                                physicalNetworkId, aclType, skipProjectNetworks, restartRequired, specifyIpRanges, vpcId, tags, zoneType), searchFilter, path,
+                        buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType, 
+                                physicalNetworkId, aclType, skipProjectNetworks, restartRequired, specifyIpRanges, vpcId, tags), searchFilter, path,
                         isRecursive));
                 //add domain specific networks of domain + parent domains
                 networksToReturn.addAll(listDomainSpecificNetworksByDomainPath(
-                        buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType,
-                                physicalNetworkId, aclType, skipProjectNetworks, restartRequired, specifyIpRanges, vpcId, tags, zoneType), searchFilter, path,
+                        buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType, 
+                                physicalNetworkId, aclType, skipProjectNetworks, restartRequired, specifyIpRanges, vpcId, tags), searchFilter, path,
                                 isRecursive));
                 //add networks of subdomains
                 if (domainId == null) {
                     networksToReturn
                     .addAll(listDomainLevelNetworks(
                             buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType,
-                                    physicalNetworkId, aclType, true, restartRequired, specifyIpRanges, vpcId, tags, zoneType), searchFilter,
+                                    physicalNetworkId, aclType, true, restartRequired, specifyIpRanges, vpcId, tags), searchFilter,
                                     caller.getDomainId(), true));
                 }
             }
         } else {
             networksToReturn = _networksDao.search(buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId,
-                    guestIpType, trafficType, physicalNetworkId, null, skipProjectNetworks, restartRequired, specifyIpRanges, vpcId, tags, zoneType),
+                    guestIpType, trafficType, physicalNetworkId, null, skipProjectNetworks, restartRequired, specifyIpRanges, vpcId, tags),
                     searchFilter);
         }
 
@@ -1581,7 +1580,7 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
 
     private SearchCriteria<NetworkVO> buildNetworkSearchCriteria(SearchBuilder<NetworkVO> sb, String keyword, Long id,
             Boolean isSystem, Long zoneId, String guestIpType, String trafficType, Long physicalNetworkId,
-            String aclType, boolean skipProjectNetworks, Boolean restartRequired, Boolean specifyIpRanges, Long vpcId, Map<String, String> tags, String zoneType) {
+            String aclType, boolean skipProjectNetworks, Boolean restartRequired, Boolean specifyIpRanges, Long vpcId, Map<String, String> tags) {
 
         SearchCriteria<NetworkVO> sc = sb.create();
 
@@ -1603,10 +1602,6 @@ public class NetworkServiceImpl extends ManagerBase implements  NetworkService {
             sc.addAnd("dataCenterId", SearchCriteria.Op.EQ, zoneId);
         }
 
-        if(zoneType != null) {
-            sc.setJoinParameters("zoneSearch", "networkType", zoneType);
-        }
-
         if (guestIpType != null) {
             sc.addAnd("guestType", SearchCriteria.Op.EQ, guestIpType);
         }


[19/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1

Posted by ah...@apache.org.
Fix the listVPC based on user roles

listVPC based on user roles uses the old account.account reference
causing the test to fail.

Signed-off-by: Prasanna Santhanam <ts...@apache.org>


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

Branch: refs/heads/vmsync
Commit: a5189b1550139c2bcf2a0982ddbedf8effcd13d4
Parents: f4dcca6
Author: Prasanna Santhanam <ts...@apache.org>
Authored: Mon Jun 17 13:36:29 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Mon Jun 17 17:32:05 2013 +0530

----------------------------------------------------------------------
 test/integration/component/test_vpc.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a5189b15/test/integration/component/test_vpc.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_vpc.py b/test/integration/component/test_vpc.py
index acf7a8e..0afeb77 100644
--- a/test/integration/component/test_vpc.py
+++ b/test/integration/component/test_vpc.py
@@ -795,16 +795,16 @@ class TestVPC(cloudstackTestCase):
                          self.services["vpc"],
                          vpcofferingid=self.vpc_off.id,
                          zoneid=self.zone.id,
-                         account=self.user.account.name,
-                         domainid=self.user.account.domainid
+                         account=self.user.name,
+                         domainid=self.user.domainid
                          )
         self.validate_vpc_network(vpc_2)
 
         self.debug("Validating list VPCs call by passing account and domain")
         vpcs = VPC.list(
                         self.apiclient,
-                        account=self.user.account.name,
-                        domainid=self.user.account.domainid,
+                        account=self.user.name,
+                        domainid=self.user.domainid,
                         listall=True
                     )
         self.assertEqual(


[05/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1

Posted by ah...@apache.org.
CLOUDSTACK-2976: At zone level setting same parameter page is getting
displayed repeatedly when you scroll down


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

Branch: refs/heads/vmsync
Commit: 2fb18db7b1484fbc7cedf616b2970fe596586db8
Parents: 2f345c5
Author: Isaac Chiang <is...@gmail.com>
Authored: Sun Jun 16 23:04:33 2013 +0800
Committer: Isaac Chiang <is...@gmail.com>
Committed: Sun Jun 16 23:04:33 2013 +0800

----------------------------------------------------------------------
 ui/scripts/ui/widgets/listView.js | 26 ++++++++++++++++++++------
 1 file changed, 20 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2fb18db7/ui/scripts/ui/widgets/listView.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui/widgets/listView.js b/ui/scripts/ui/widgets/listView.js
index ba4d288..8dbc2f6 100644
--- a/ui/scripts/ui/widgets/listView.js
+++ b/ui/scripts/ui/widgets/listView.js
@@ -1327,6 +1327,12 @@
             });
             $table.dataTable(null, { noSelect: uiCustom });
 
+            if(args.data &&
+               args.data.length < pageSize &&
+               options.setEndTable) {
+                options.setEndTable();
+            }
+
             setTimeout(function() {
               $table.dataTable('refresh');
             });
@@ -1467,6 +1473,12 @@
     var page = 1;
     var actions = listViewData.actions;
     var reorder = listViewData.reorder;
+    var tableHeight = $table.height();
+    var endTable = false;
+    var setEndTable = function() {
+      endTable = true;
+    }
+
 
     var $switcher;
     if (args.sections) {
@@ -1572,7 +1584,8 @@
       {
         context: args.context,
         reorder: reorder,
-        detailView: listViewData.detailView
+        detailView: listViewData.detailView,
+        setEndTable: setEndTable
       }
     );
 
@@ -1625,7 +1638,8 @@
         {
           context: $listView.data('view-args').context,
           reorder: listViewData.reorder,
-          detailView: listViewData.detailView
+          detailView: listViewData.detailView,
+          setEndTable: setEndTable
         }
       );
     };
@@ -1675,7 +1689,8 @@
         {
           context: $listView.data('view-args').context,
           reorder: listViewData.reorder,
-          detailView: listViewData.detailView
+          detailView: listViewData.detailView,
+          setEndTable: setEndTable 
         }
       );
     };
@@ -1728,8 +1743,6 @@
       return false;
     });		
 				
-    var tableHeight = $table.height();
-    var endTable = false;
 
     // Infinite scrolling event
     $listView.bind('scroll', function(event) {
@@ -1767,7 +1780,8 @@
             filterBy: filterBy
           }, actions, {
             reorder: listViewData.reorder,
-            detailView: listViewData.detailView
+            detailView: listViewData.detailView,
+            setEndTable: setEndTable
           });
           $table.height() == tableHeight ? endTable = true : tableHeight = $table.height();
         }


[13/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1

Posted by ah...@apache.org.
Add Shiva Teja's proposal to GSoC docbook


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

Branch: refs/heads/vmsync
Commit: a3d585ea4effc3a326858e777a7f785ddf44dfe2
Parents: ac48e5d
Author: Shiva Teja <sh...@gmail.com>
Authored: Fri Jun 14 00:54:03 2013 +0530
Committer: Sebastien Goasguen <ru...@gmail.com>
Committed: Mon Jun 17 02:20:37 2013 -0400

----------------------------------------------------------------------
 docs/en-US/gsoc-shiva.xml | 70 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 70 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a3d585ea/docs/en-US/gsoc-shiva.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/gsoc-shiva.xml b/docs/en-US/gsoc-shiva.xml
new file mode 100644
index 0000000..400af3c
--- /dev/null
+++ b/docs/en-US/gsoc-shiva.xml
@@ -0,0 +1,70 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "CloudStack_GSoC_Guide.ent">
+%BOOK_ENTITIES;
+]>
+
+<!-- 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.
+-->
+
+<chapter id="gsoc-shiva">
+        <title>Shiva Teja's 2013 GSoC Proposal</title>
+        <para>This chapter describes Shiva Teja's 2013 Google Summer of Code project within the &PRODUCT; ASF project. It is a copy paste of the submitted proposal.</para>
+	<section id="gsoc-abstract-shiva">
+		<title>Abstract</title>
+		<para>
+			The aim of this project is to create a new modular UI for Apache CloudStack using Bootstrap by Twitter and Backbone.js. To achieve this easily, I'll be creating a RESTful wrapper API on top of the current CloudStack API. I hope this project will make custom UIs for CloudStack very easy.</para>
+
+		<para>Why does CloudStack need a new UI?</para>
+
+		<para>The current UI cannot be reused easliy to make a custom UI. The UI I will be making using backbone.js can be reused very easily to make custom UIs. The models, views, routers etc can remain the same in all the UIs. The user interface can be changed just by changing the templates. Check the implementation details below for further details.</para>
+
+		<para>Why does it need a RESTful wrapper API ?</para>
+
+		<para>Backbone.js heavily depends on RESTful architecture. Making a new UI with backbone.js using a query based API might not be easy.</para>
+	</section>
+	<section id="gsoc-deliverables-shiva">
+		<title>List of deliverables</title>
+		<orderedlist>
+			<listitem><para>A new UI for CloudStack(with almost all features in the current UI and new ones, if any).</para></listitem>
+			<listitem><para>A RESTful wrapper API on top of the CloudStack API</para></listitem>
+			<listitem><para>Some documentation about using this UI to make a custom UI.</para></listitem>
+		</orderedlist>
+	</section>
+	<section id="gsoc-approach-shiva">
+		<title>Approach</title>
+		<para>Wrapper API: Backbone.js, by default, uses four HTTP methods(GET, PUT, POST, DELETE) for communicating with the server. It uses GET to fetch a resource from the server, POST to create a resource, PUT to update the resource and DELETE to delete the resource. A query based API can probably be used to make the UI by overriding backbone's<ulink url="http://backbonejs.org/#Sync"><citetitle> default sync function</citetitle></ulink>. But it makes more sense to have an API which supports the above mentioned method and is resource based. This RESTful API works on top of the CloudStack API. The main task is to map the combinations of these HTTP methods and the resources to appropriate CloudStack API command. The other task is to decide on how the URLs should look like. Say for starting a virtual machine, for it to be RESTful, we have to use POST as we are creating a resource, or a PUT as we are changing the state of a virtual machine. So the possible options on the URL could be to do
  a POST /runningvirtualmachines and respond with 201 Created code or a PUT on /virtualmachines/id and respond with 200 OK. If these are decided, the wrapper can be generated or be written manually, which can use defined patters to map to appropriate CloudStack API commands(Similar to what cloudmonkey does. See this <ulink url="https://github.com/shivateja/cloudstack-restful-api"><citetitle>prototype</citetitle></ulink>. I can use cloudmonkey's code to generate the required API entity verb relationships. Each verb will have a set of rules saying what method should be used in the RESTful API and how should it look like in the URL. Another possible way could be to group entities first manually and write the wrapper manually(something like zone/pods/cluster). Some possibilities have been discussed in <ulink url="http://mail-archives.apache.org/mod_mbox/cloudstack-dev/201304.mbox/%3CCAJrLSbaqa08uHw_xETt7Q59Nex%3DThQzvqEJyoXK8Q-OwN04Suw%40mail.gmail.com%3E"><citetitle>this thread</citetit
 le></ulink>.</para>
+
+		<para>UI: It will be a single page app. It'll use <ulink url="http://underscorejs.org/#template">client side templating</ulink> for rendering. This makes it very easy to make a custom UI because it can be achieved just by changing the templates. Backbone views will make use of these templates to render the appropriate models/collections. A completely new interface can be written just by changing the templates. Javascript code can completely remain the same. The views will take care of appropriate DOM events. Such event will correspond to appropriate model/collection chages, thus causing appropriate API calls.</para>
+	</section>
+	<section id="gsoc-schedule-shiva">
+		<title>Approximate Schedle</title>
+		<para>Till June 17 - Decide on how the RESTful API should look like and design algorithms to generate the wrapper.</para>
+		<para>July 5(soft deadline), July 10(hard deadline) : Wrapper API will be ready.</para>
+		<para>July 12(soft) - July 15(hard): Make basic wireframes and designs for the website and get them approved.</para>
+		<para>July 29(mid term evaluation) : All the basic models, views, routes of the UI should be ready along with a few templates.</para>
+		<para>August 15(hard deadline, shouldn't take much time actually) - A basic usable UI where users can just list all the entities which are present in the current UI's main navigation( Like Instances, Templates, Accounts etc)</para>
+		<para>September 1(hard) - From this UI, users should be able to launch instances, edit settings of most of the entities.</para>
+		<para>September 16(Pencil down!) - Fix some design tweaks and finish a completely usable interface with functions similar to current UI.</para>
+		<para>September 23 - Finish the documentation on how to use this UI to make custom UIs.</para>
+	</section>
+	<section id="gsoc-aboutme-shiva">
+		<title>About Me</title>
+		<para> I am a 2nd year computer science undergrad studying at IIT Mandi, India. I've been using Python for an year and a half now. I've used Django, Flask and Tornado for my small projects. Along with Python, I use C++ for competitive programming. Recently, I fell in love with Haskell. I've always been fascinated about web technologies.</para>
+	</section>
+</chapter>


[08/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1

Posted by ah...@apache.org.
CLOUDSTACK-3020: Fix assert error

If you do not give a name during vm creation,  UUID will be set for Name
and Display name will be blank.

Signed-off-by: Prasanna Santhanam <ts...@apache.org>


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

Branch: refs/heads/vmsync
Commit: bf0265d21d77dbc28bc61f46c535ca75b727d115
Parents: ae27d66
Author: rayeesn <ra...@citrix.com>
Authored: Sat Jun 15 10:26:13 2013 -0700
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Mon Jun 17 10:05:02 2013 +0530

----------------------------------------------------------------------
 test/integration/component/test_custom_hostname.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bf0265d2/test/integration/component/test_custom_hostname.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_custom_hostname.py b/test/integration/component/test_custom_hostname.py
index c9db215..e569215 100644
--- a/test/integration/component/test_custom_hostname.py
+++ b/test/integration/component/test_custom_hostname.py
@@ -300,7 +300,7 @@ class TestInstanceNameFlagTrue(cloudstackTestCase):
                          "Running",
                          "Vm state should be running after deployment"
                          )
-        self.assertEqual(
+        self.assertNotEqual(
                          vm.displayname,
                          vm.id,
                          "Vm display name should not match the given name"


[15/50] [abbrv] Moving maintenance mode into component/maint

Posted by ah...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0587d3a4/test/integration/component/maint/test_vpc_host_maintenance.py
----------------------------------------------------------------------
diff --git a/test/integration/component/maint/test_vpc_host_maintenance.py b/test/integration/component/maint/test_vpc_host_maintenance.py
new file mode 100644
index 0000000..8fc427a
--- /dev/null
+++ b/test/integration/component/maint/test_vpc_host_maintenance.py
@@ -0,0 +1,561 @@
+# 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.
+
+""" Component tests VM life cycle in VPC network functionality
+"""
+#Import Local Modules
+import marvin
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from marvin.integration.lib.utils import *
+from marvin.integration.lib.base import *
+from marvin.integration.lib.common import *
+from marvin.remoteSSHClient import remoteSSHClient
+import datetime
+
+
+class Services:
+    """Test VM life cycle in VPC network services
+    """
+
+    def __init__(self):
+        self.services = {
+                         "account": {
+                                    "email": "test@test.com",
+                                    "firstname": "Test",
+                                    "lastname": "User",
+                                    "username": "test",
+                                    # Random characters are appended for unique
+                                    # username
+                                    "password": "password",
+                                    },
+                         "service_offering": {
+                                    "name": "Tiny Instance",
+                                    "displaytext": "Tiny Instance",
+                                    "cpunumber": 1,
+                                    "cpuspeed": 100,
+                                    "memory": 64,
+                                    },
+                        "service_offering_1": {
+                                    "name": "Tiny Instance- tagged host 1",
+                                    "displaytext": "Tiny off-tagged host2",
+                                    "cpunumber": 1,
+                                    "cpuspeed": 100,
+                                    "memory": 64,
+                                    "tags": "HOST_TAGS_HERE"
+                                    },
+                         "service_offering_2": {
+                                    "name": "Tiny Instance- tagged host 2",
+                                    "displaytext": "Tiny off-tagged host2",
+                                    "cpunumber": 1,
+                                    "cpuspeed": 100,
+                                    "memory": 64,
+                                    "tags": "HOST_TAGS_HERE"
+                                    },
+                         "network_offering": {
+                                    "name": 'VPC Network offering',
+                                    "displaytext": 'VPC Network off',
+                                    "guestiptype": 'Isolated',
+                                    "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding,Lb,UserData,StaticNat,NetworkACL',
+                                    "traffictype": 'GUEST',
+                                    "availability": 'Optional',
+                                    "useVpc": 'on',
+                                    "serviceProviderList": {
+                                            "Dhcp": 'VpcVirtualRouter',
+                                            "Dns": 'VpcVirtualRouter',
+                                            "SourceNat": 'VpcVirtualRouter',
+                                            "PortForwarding": 'VpcVirtualRouter',
+                                            "Lb": 'VpcVirtualRouter',
+                                            "UserData": 'VpcVirtualRouter',
+                                            "StaticNat": 'VpcVirtualRouter',
+                                            "NetworkACL": 'VpcVirtualRouter'
+                                        },
+                                },
+                         "network_offering_no_lb": {
+                                    "name": 'VPC Network offering',
+                                    "displaytext": 'VPC Network off',
+                                    "guestiptype": 'Isolated',
+                                    "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding,UserData,StaticNat,NetworkACL',
+                                    "traffictype": 'GUEST',
+                                    "availability": 'Optional',
+                                    "useVpc": 'on',
+                                    "serviceProviderList": {
+                                            "Dhcp": 'VpcVirtualRouter',
+                                            "Dns": 'VpcVirtualRouter',
+                                            "SourceNat": 'VpcVirtualRouter',
+                                            "PortForwarding": 'VpcVirtualRouter',
+                                            "UserData": 'VpcVirtualRouter',
+                                            "StaticNat": 'VpcVirtualRouter',
+                                            "NetworkACL": 'VpcVirtualRouter'
+                                        },
+                                },
+                         "network_off_shared": {
+                                    "name": 'Shared Network offering',
+                                    "displaytext": 'Shared Network offering',
+                                    "guestiptype": 'Shared',
+                                    "traffictype": 'GUEST',
+                                    "availability": 'Optional',
+                                    "useVpc": 'on',
+                                    "specifyIpRanges": True,
+                                    "specifyVlan": True
+                                    },
+                         "vpc_offering": {
+                                    "name": 'VPC off',
+                                    "displaytext": 'VPC off',
+                                    "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding,Lb,UserData,StaticNat',
+                                },
+                         "vpc": {
+                                 "name": "TestVPC",
+                                 "displaytext": "TestVPC",
+                                 "cidr": '10.0.0.1/24'
+                                 },
+                         "network": {
+                                  "name": "Test Network",
+                                  "displaytext": "Test Network",
+                                  "netmask": '255.255.255.0',
+                                  "limit": 5,
+                                  # Max networks allowed as per hypervisor
+                                  # Xenserver -> 5, VMWare -> 9
+                                },
+                         "lbrule": {
+                                    "name": "SSH",
+                                    "alg": "leastconn",
+                                    # Algorithm used for load balancing
+                                    "privateport": 22,
+                                    "publicport": 2222,
+                                    "openfirewall": False,
+                                    "startport": 2222,
+                                    "endport": 2222,
+                                    "protocol": "TCP",
+                                    "cidrlist": '0.0.0.0/0',
+                                },
+                         "natrule": {
+                                    "privateport": 22,
+                                    "publicport": 22,
+                                    "startport": 22,
+                                    "endport": 22,
+                                    "protocol": "TCP",
+                                    "cidrlist": '0.0.0.0/0',
+                                },
+                         "fw_rule": {
+                                    "startport": 1,
+                                    "endport": 6000,
+                                    "cidr": '0.0.0.0/0',
+                                    # Any network (For creating FW rule)
+                                    "protocol": "TCP"
+                                },
+                         "http_rule": {
+                                    "startport": 80,
+                                    "endport": 80,
+                                    "cidrlist": '0.0.0.0/0',
+                                    "protocol": "ICMP"
+                                },
+                         "virtual_machine": {
+                                    "displayname": "Test VM",
+                                    "username": "root",
+                                    "password": "password",
+                                    "ssh_port": 22,
+                                    "hypervisor": 'XenServer',
+                                    # Hypervisor type should be same as
+                                    # hypervisor type of cluster
+                                    "privateport": 22,
+                                    "publicport": 22,
+                                    "protocol": 'TCP',
+                                    "userdata": 'This is sample data',
+                                },
+                         "ostype": 'CentOS 5.3 (64-bit)',
+                         # Cent OS 5.3 (64 bit)
+                         "sleep": 60,
+                         "timeout": 10,
+                         "mode": 'advanced'
+                    }
+
+
+class TestVMLifeCycleHostmaintenance(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+                               TestVMLifeCycleHostmaintenance,
+                               cls
+                               ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+                            cls.api_client,
+                            cls.zone.id,
+                            cls.services["ostype"]
+                            )
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+
+        cls.service_offering_1 = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering_1"]
+                                            )
+        cls.service_offering_2 = ServiceOffering.create(
+                                            cls.api_client,
+                                            cls.services["service_offering_2"]
+                                            )
+        cls.vpc_off = VpcOffering.create(
+                                     cls.api_client,
+                                     cls.services["vpc_offering"]
+                                     )
+        cls.vpc_off.update(cls.api_client, state='Enabled')
+
+        cls.account = Account.create(
+                                     cls.api_client,
+                                     cls.services["account"],
+                                     admin=True,
+                                     domainid=cls.domain.id
+                                     )
+
+        cls.vpc_off = VpcOffering.create(
+                                     cls.api_client,
+                                     cls.services["vpc_offering"]
+                                     )
+
+        cls.vpc_off.update(cls.api_client, state='Enabled')
+
+        cls.services["vpc"]["cidr"] = '10.1.1.1/16'
+        cls.vpc = VPC.create(
+                         cls.api_client,
+                         cls.services["vpc"],
+                         vpcofferingid=cls.vpc_off.id,
+                         zoneid=cls.zone.id,
+                         account=cls.account.name,
+                         domainid=cls.account.domainid
+                         )
+
+        cls.nw_off = NetworkOffering.create(
+                                            cls.api_client,
+                                            cls.services["network_offering"],
+                                            conservemode=False
+                                            )
+        # Enable Network offering
+        cls.nw_off.update(cls.api_client, state='Enabled')
+
+        # Creating network using the network offering created
+        cls.network_1 = Network.create(
+                                cls.api_client,
+                                cls.services["network"],
+                                accountid=cls.account.name,
+                                domainid=cls.account.domainid,
+                                networkofferingid=cls.nw_off.id,
+                                zoneid=cls.zone.id,
+                                gateway='10.1.1.1',
+                                vpcid=cls.vpc.id
+                                )
+        cls.nw_off_no_lb = NetworkOffering.create(
+                                    cls.api_client,
+                                    cls.services["network_offering_no_lb"],
+                                    conservemode=False
+                                    )
+        # Enable Network offering
+        cls.nw_off_no_lb.update(cls.api_client, state='Enabled')
+
+        # Creating network using the network offering created
+        cls.network_2 = Network.create(
+                                cls.api_client,
+                                cls.services["network"],
+                                accountid=cls.account.name,
+                                domainid=cls.account.domainid,
+                                networkofferingid=cls.nw_off_no_lb.id,
+                                zoneid=cls.zone.id,
+                                gateway='10.1.2.1',
+                                vpcid=cls.vpc.id
+                                )
+        # Spawn an instance in that network
+        cls.vm_1 = VirtualMachine.create(
+                                  cls.api_client,
+                                  cls.services["virtual_machine"],
+                                  accountid=cls.account.name,
+                                  domainid=cls.account.domainid,
+                                  serviceofferingid=cls.service_offering_1.id,
+                                  networkids=[str(cls.network_1.id)]
+                                  )
+        # Spawn an instance in that network
+        cls.vm_2 = VirtualMachine.create(
+                                  cls.api_client,
+                                  cls.services["virtual_machine"],
+                                  accountid=cls.account.name,
+                                  domainid=cls.account.domainid,
+                                  serviceofferingid=cls.service_offering_1.id,
+                                  networkids=[str(cls.network_1.id)]
+                                  )
+        cls.vm_3 = VirtualMachine.create(
+                                  cls.api_client,
+                                  cls.services["virtual_machine"],
+                                  accountid=cls.account.name,
+                                  domainid=cls.account.domainid,
+                                  serviceofferingid=cls.service_offering_2.id,
+                                  networkids=[str(cls.network_2.id)]
+                                  )
+        routers = Router.list(
+                              cls.api_client,
+                              account=cls.account.name,
+                              domainid=cls.account.domainid,
+                              listall=True
+                              )
+        if isinstance(routers, list):
+            cls.vpcvr = routers[0]
+
+        cls._cleanup = [
+                        cls.service_offering_1,
+                        cls.service_offering_2,
+                        cls.nw_off,
+                        cls.nw_off_no_lb,
+                        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            cls.account.delete(cls.api_client)
+            wait_for_cleanup(cls.api_client, ["account.cleanup.interval"])
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+
+            # Waiting for network cleanup to delete vpc offering
+            wait_for_cleanup(cls.api_client, ["network.gc.wait",
+                                              "network.gc.interval"])
+            cls.vpc_off.delete(cls.api_client)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.debug("Check the status of VPC virtual router")
+        routers = Router.list(
+                              self.apiclient,
+                              networkid=self.network_1.id,
+                              listall=True
+                              )
+        if not isinstance(routers, list):
+            raise Exception("No response from list routers API")
+
+        self.router = routers[0]
+        if self.router.state == "Running":
+            Router.stop(self.apiclient, id=self.router.id)
+
+        self.cleanup = []
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def validate_vm_deployment(self):
+        """Validates VM deployment on different hosts"""
+
+        vms = VirtualMachine.list(
+                                  self.apiclient,
+                                  account=self.account.name,
+                                  domainid=self.account.domainid,
+                                  networkid=self.network_1.id,
+                                  listall=True
+                                  )
+        self.assertEqual(
+                         isinstance(vms, list),
+                         True,
+                         "List VMs shall return a valid response"
+                         )
+        host_1 = vms[0].hostid
+        self.debug("Host for network 1: %s" % vms[0].hostid)
+
+        vms = VirtualMachine.list(
+                                  self.apiclient,
+                                  account=self.account.name,
+                                  domainid=self.account.domainid,
+                                  networkid=self.network_2.id,
+                                  listall=True
+                                  )
+        self.assertEqual(
+                         isinstance(vms, list),
+                         True,
+                         "List VMs shall return a valid response"
+                         )
+        host_2 = vms[0].hostid
+        self.debug("Host for network 2: %s" % vms[0].hostid)
+
+        self.assertNotEqual(
+                host_1,
+                host_2,
+                "Both the virtual machines should be deployed on diff hosts "
+                )
+        return
+
+    @attr(tags=["advanced", "intervlan"])
+    def test_01_enable_maintenance_with_vpc_nw(self):
+        """ Test enable Maintenance Mode on Hosts which have VPC elements
+        """
+
+        # Validate the following
+        # 1. Create a VPC with cidr - 10.1.1.1/16
+        # 2. Add network1(10.1.1.1/24) and network2(10.1.2.1/24) to this VPC.
+        # 3. Deploy vm1 and vm2 in network1 and vm3 and vm4 in network2. Make
+        #    sure vm1 and vm3 are deployed on one host in the cluster while
+        #    vm2 and vm4 are deployed on the other host in the cluster. This
+        #    can be done using host's tags & service offerings with host tags
+        # Steps:
+        # 1.Enable Maintenance on one of host on which VPCVR is present
+        # Validations:
+        # 1. Successfully push the host into maintenance mode.
+        # 2. VMs present on the above host should successfully migrate to the
+        #    other host present in the cluster
+
+        self.validate_vm_deployment()
+        self.debug("Stop the host on which the VPC virtual router is running")
+        try:
+            Host.enableMaintenance(self.apiclient, id=self.vpcvr.hostid)
+        except Exception as e:
+            self.fail("Failed to enable maintenance mode on host: %s" % e)
+
+        self.debug(
+            "Check if all instances belonging to the account are up again?")
+        routers = Router.list(
+                              self.apiclient,
+                              account=self.account.name,
+                              domainid=self.account.domainid,
+                              listall=True
+                              )
+        self.assertEqual(
+                         isinstance(routers, list),
+                         True,
+                         "List routers shall return a valid VPCVR for account"
+                         )
+        for router in routers:
+            self.assertEqual(
+                             router.state,
+                             "Running",
+                             "Router state should be running after migration"
+                             )
+        vms = VirtualMachine.list(
+                                  self.apiclient,
+                                  account=self.account.name,
+                                  domainid=self.account.domainid,
+                                  listall=True
+                                  )
+        self.assertEqual(
+                    isinstance(vms, list),
+                    True,
+                    "VM response should return instances running for account"
+                    )
+        for vm in vms:
+            self.assertEqual(
+                             vm.state,
+                             "Ruuning",
+                             "Vm state should be running after migration"
+                             )
+        return
+
+    @attr(tags=["advanced", "intervlan"])
+    def test_02_cancel_maintenance(self):
+        """ Test cancel Maintenance Mode on the above Hosts + Migrate VMs Back
+        """
+
+        # Steps
+        # 1. Cancel Maintenance Mode on the host.
+        # 2. Migrate the VMs back onto the host on which Maintenance mode is
+        #    cancelled.
+        # Validate the following
+        # 1. Successfully cancel the Maintenance mode on the host.
+        # 2. Migrate the VMs back successfully onto the host.
+        # 3. Check that the network connectivity exists with the migrated VMs.
+
+        self.debug("Cancel host maintenence on which the VPCVR is running")
+        try:
+            Host.cancelMaintenance(self.apiclient, id=self.vpcvr.hostid)
+        except Exception as e:
+            self.fail("Failed to enable maintenance mode on host: %s" % e)
+
+        self.debug(
+            "Migrating the instances back to the host: %s" %
+                                                        self.vpcvr.hostid)
+        try:
+            cmd = migrateSystemVm.migrateSystemVmCmd()
+            cmd.hostid = self.vpcvr.hostid
+            cmd.virtualmachineid = self.vpcvr.id
+            self.apiclient.migrateSystemVm(cmd)
+        except Exception as e:
+            self.fail("Failed to migrate VPCVR back: %s" % e)
+
+        self.debug("Check the status of router after migration")
+        routers = Router.list(
+                              self.apiclient,
+                              id=self.vpcvr.id,
+                              listall=True
+                              )
+        self.assertEqual(
+                         isinstance(routers, list),
+                         True,
+                         "List routers shall return the valid response"
+                         )
+        self.assertEqual(
+                         routers[0].state,
+                         "Running",
+                         "Router state should be running"
+                         )
+        #  TODO: Check for the network connectivity
+        return
+
+    @attr(tags=["advanced", "intervlan"])
+    def test_03_reconnect_host(self):
+        """ Test reconnect Host which has VPC elements
+        """
+
+        # Steps:
+        # 1.Reconnect one of the host on which VPC Virtual Router is present.
+        # Validate the following
+        # 1. Host should successfully reconnect.
+        # 2. Network connectivity to all the VMs on the host should not be
+        #    effected due to reconnection.
+
+        self.debug("Reconnecting the host where VPC VR is running")
+        try:
+            Host.reconnect(self.apiclient, id=self.vpcvr.hostid)
+        except Exception as e:
+            self.fail("Failed to reconnect to host: %s" % e)
+
+        self.debug("Check the status of router after migration")
+        routers = Router.list(
+                              self.apiclient,
+                              id=self.vpcvr.id,
+                              listall=True
+                              )
+        self.assertEqual(
+                         isinstance(routers, list),
+                         True,
+                         "List routers shall return the valid response"
+                         )
+        self.assertEqual(
+                         routers[0].state,
+                         "Running",
+                         "Router state should be running"
+                         )
+        #  TODO: Check for the network connectivity
+        return
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0587d3a4/test/integration/component/maint/test_vpc_on_host_maintenance.py
----------------------------------------------------------------------
diff --git a/test/integration/component/maint/test_vpc_on_host_maintenance.py b/test/integration/component/maint/test_vpc_on_host_maintenance.py
new file mode 100644
index 0000000..6630ee6
--- /dev/null
+++ b/test/integration/component/maint/test_vpc_on_host_maintenance.py
@@ -0,0 +1,323 @@
+# 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.
+
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from marvin.integration.lib.utils import *
+from marvin.integration.lib.base import *
+from marvin.integration.lib.common import *
+
+
+class Services:
+    """Test VPC services
+    """
+
+    def __init__(self):
+        self.services = {
+                         "account": {
+                                    "email": "test@test.com",
+                                    "firstname": "Test",
+                                    "lastname": "User",
+                                    "username": "test",
+                                    # Random characters are appended for unique
+                                    # username
+                                    "password": "password",
+                                    },
+                          "service_offering": {
+                                    "name": "Tiny Instance",
+                                    "displaytext": "Tiny Instance",
+                                    "cpunumber": 1,
+                                    "cpuspeed": 100,
+                                    "memory": 128,
+                                    },
+                         "vpc_offering": {
+                                    "name": 'VPC off',
+                                    "displaytext": 'VPC off',
+                                    "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding,Vpn,Lb,UserData,StaticNat,NetworkACL',
+                                },
+                         "vpc": {
+                                 "name": "TestVPC",
+                                 "displaytext": "TestVPC",
+                                 "cidr": '10.0.0.1/24'
+                                 },
+                         "virtual_machine": {
+                                    "displayname": "Test VM",
+                                    "username": "root",
+                                    "password": "password",
+                                    "ssh_port": 22,
+                                    "hypervisor": 'XenServer',
+                                    # Hypervisor type should be same as
+                                    # hypervisor type of cluster
+                                    "privateport": 22,
+                                    "publicport": 22,
+                                    "protocol": 'TCP',
+                                },
+                         "ostype": 'CentOS 5.3 (64-bit)',
+                         # Cent OS 5.3 (64 bit)
+                         "sleep": 60,
+                         "timeout": 10
+                    }
+
+class TestVPCHostMaintenance(cloudstackTestCase):
+
+    @classmethod
+    def setUpClass(cls):
+        cls.api_client = super(
+            TestVPCHostMaintenance,
+            cls
+        ).getClsTestClient().getApiClient()
+        cls.services = Services().services
+        # Get Zone, Domain and templates
+        cls.domain = get_domain(cls.api_client, cls.services)
+        cls.zone = get_zone(cls.api_client, cls.services)
+        cls.template = get_template(
+            cls.api_client,
+            cls.zone.id,
+            cls.services["ostype"]
+        )
+        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+        cls.services["virtual_machine"]["template"] = cls.template.id
+        cls.services["mode"] = cls.zone.networktype
+
+        cls.service_offering = ServiceOffering.create(
+            cls.api_client,
+            cls.services["service_offering"]
+        )
+        cls.vpc_off = VpcOffering.create(
+            cls.api_client,
+            cls.services["vpc_offering"]
+        )
+        cls.vpc_off.update(cls.api_client, state='Enabled')
+        hosts = Host.list(
+            cls.api_client,
+            zoneid=cls.zone.id,
+            listall=True,
+            type='Routing'
+        )
+
+        if isinstance(hosts, list):
+            for host in hosts:
+                Host.enableMaintenance(
+                    cls.api_client,
+                    id=host.id
+                )
+
+                timeout = cls.services["timeout"]
+                while True:
+                    time.sleep(cls.services["sleep"])
+                    hosts_states = Host.list(
+                        cls.api_client,
+                        id=host.id,
+                        listall=True
+                    )
+                    if hosts_states[0].resourcestate == 'PrepareForMaintenance':
+                        # Wait for sometimetill host goes in maintenance state
+                        time.sleep(cls.services["sleep"])
+                    elif hosts_states[0].resourcestate == 'Maintenance':
+                        time.sleep(cls.services["sleep"])
+                        break
+                    elif timeout == 0:
+                        raise unittest.SkipTest(
+                            "Failed to enable maintenance mode on %s" % host.name)
+                    timeout = timeout - 1
+
+        cls._cleanup = [
+            cls.service_offering,
+            cls.vpc_off
+        ]
+        return
+
+    @classmethod
+    def tearDownClass(cls):
+        try:
+            #Cleanup resources used
+            cleanup_resources(cls.api_client, cls._cleanup)
+            hosts = Host.list(
+                cls.api_client,
+                zoneid=cls.zone.id,
+                listall=True,
+                type='Routing'
+            )
+            if isinstance(hosts, list):
+                for host in hosts:
+                    Host.cancelMaintenance(
+                        cls.api_client,
+                        id=host.id
+                    )
+                hosts_states = Host.list(
+                    cls.api_client,
+                    id=host.id,
+                    listall=True
+                )
+                if hosts_states[0].resourcestate != 'Enabled':
+                    raise Exception(
+                        "Failed to cancel maintenance mode on %s" % (host.name))
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def setUp(self):
+        self.apiclient = self.testClient.getApiClient()
+        self.dbclient = self.testClient.getDbConnection()
+        self.account = Account.create(
+            self.apiclient,
+            self.services["account"],
+            admin=True,
+            domainid=self.domain.id
+        )
+        self.cleanup = [self.account]
+        return
+
+    def tearDown(self):
+        try:
+            #Clean up, terminate the created network offerings
+            cleanup_resources(self.apiclient, self.cleanup)
+            interval = list_configurations(
+                self.apiclient,
+                name='network.gc.interval'
+            )
+            wait = list_configurations(
+                self.apiclient,
+                name='network.gc.wait'
+            )
+            # Sleep to ensure that all resources are deleted
+            time.sleep(int(interval[0].value) + int(wait[0].value))
+        except Exception as e:
+            raise Exception("Warning: Exception during cleanup : %s" % e)
+        return
+
+    def validate_vpc_offering(self, vpc_offering):
+        """Validates the VPC offering"""
+
+        self.debug("Check if the VPC offering is created successfully?")
+        vpc_offs = VpcOffering.list(
+            self.apiclient,
+            id=vpc_offering.id
+        )
+        self.assertEqual(
+            isinstance(vpc_offs, list),
+            True,
+            "List VPC offerings should return a valid list"
+        )
+        self.assertEqual(
+            vpc_offering.name,
+            vpc_offs[0].name,
+            "Name of the VPC offering should match with listVPCOff data"
+        )
+        self.debug(
+            "VPC offering is created successfully - %s" %
+            vpc_offering.name)
+        return
+
+    def validate_vpc_network(self, network, state=None):
+        """Validates the VPC network"""
+
+        self.debug("Check if the VPC network is created successfully?")
+        vpc_networks = VPC.list(
+            self.apiclient,
+            id=network.id
+        )
+        self.assertEqual(
+            isinstance(vpc_networks, list),
+            True,
+            "List VPC network should return a valid list"
+        )
+        self.assertEqual(
+            network.name,
+            vpc_networks[0].name,
+            "Name of the VPC network should match with listVPC data"
+        )
+        if state:
+            self.assertEqual(
+                vpc_networks[0].state,
+                state,
+                "VPC state should be '%s'" % state
+            )
+        self.debug("VPC network validated - %s" % network.name)
+        return
+
+    @attr(tags=["advanced", "intervlan"])
+    def test_01_create_vpc_host_maintenance(self):
+        """ Test VPC when host is in maintenance mode
+        """
+
+        # Validate the following
+        # 1. Put the host in maintenance mode.
+        # 2. Attempt to Create a VPC with cidr - 10.1.1.1/16
+        # 3. VPC will be created but will be in "Disabled" state
+
+        self.debug("creating a VPC network in the account: %s" %
+                   self.account.name)
+        self.services["vpc"]["cidr"] = '10.1.1.1/16'
+        vpc = VPC.create(
+            self.apiclient,
+            self.services["vpc"],
+            vpcofferingid=self.vpc_off.id,
+            zoneid=self.zone.id,
+            account=self.account.name,
+            domainid=self.account.domainid
+        )
+        self.validate_vpc_network(vpc, state='Disabled')
+        return
+
+    @attr(tags=["advanced", "intervlan"])
+    def test_02_create_vpc_wait_gc(self):
+        """ Test VPC when host is in maintenance mode and wait till nw gc
+        """
+
+        # Validate the following
+        # 1. Put the host in maintenance mode.
+        # 2. Attempt to Create a VPC with cidr - 10.1.1.1/16
+        # 3. Wait for the VPC GC thread to run.
+        # 3. VPC will be created but will be in "Disabled" state and should
+        #    get deleted
+
+        self.debug("creating a VPC network in the account: %s" %
+                   self.account.name)
+        self.services["vpc"]["cidr"] = '10.1.1.1/16'
+        vpc = VPC.create(
+            self.apiclient,
+            self.services["vpc"],
+            vpcofferingid=self.vpc_off.id,
+            zoneid=self.zone.id,
+            account=self.account.name,
+            domainid=self.account.domainid
+        )
+        self.validate_vpc_network(vpc, state='Disabled')
+        interval = list_configurations(
+            self.apiclient,
+            name='network.gc.interval'
+        )
+        wait = list_configurations(
+            self.apiclient,
+            name='network.gc.wait'
+        )
+        self.debug("Sleep till network gc thread runs..")
+        # Sleep to ensure that all resources are deleted
+        time.sleep(int(interval[0].value) + int(wait[0].value))
+        vpcs = VPC.list(
+            self.apiclient,
+            id=vpc.id,
+            listall=True
+        )
+        self.assertEqual(
+            vpcs,
+            None,
+            "List VPC should not return anything after network gc"
+        )
+        return

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0587d3a4/test/integration/component/test_high_availability.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_high_availability.py b/test/integration/component/test_high_availability.py
deleted file mode 100644
index 7b0f78e..0000000
--- a/test/integration/component/test_high_availability.py
+++ /dev/null
@@ -1,1079 +0,0 @@
-#!/usr/bin/env python
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-""" P1 tests for high availability
-"""
-#Import Local Modules
-import marvin
-from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import *
-from marvin.cloudstackAPI import *
-from marvin.integration.lib.utils import *
-from marvin.integration.lib.base import *
-from marvin.integration.lib.common import *
-from marvin import remoteSSHClient
-import datetime
-
-
-class Services:
-    """Test network offering Services
-    """
-
-    def __init__(self):
-        self.services = {
-                         "account": {
-                                    "email": "test@test.com",
-                                    "firstname": "HA",
-                                    "lastname": "HA",
-                                    "username": "HA",
-                                    # Random characters are appended for unique
-                                    # username
-                                    "password": "password",
-                                    },
-                         "service_offering": {
-                                    "name": "Tiny Instance",
-                                    "displaytext": "Tiny Instance",
-                                    "cpunumber": 1,
-                                    "cpuspeed": 100,    # in MHz
-                                    "memory": 128,       # In MBs
-                                    },
-                         "lbrule": {
-                                    "name": "SSH",
-                                    "alg": "roundrobin",
-                                    # Algorithm used for load balancing
-                                    "privateport": 22,
-                                    "publicport": 2222,
-                                },
-                         "natrule": {
-                                    "privateport": 22,
-                                    "publicport": 22,
-                                    "protocol": "TCP"
-                                },
-                         "fw_rule": {
-                                    "startport": 1,
-                                    "endport": 6000,
-                                    "cidr": '55.55.0.0/11',
-                                    # Any network (For creating FW rule)
-                                },
-                         "virtual_machine": {
-                                    "displayname": "VM",
-                                    "username": "root",
-                                    "password": "password",
-                                    "ssh_port": 22,
-                                    "hypervisor": 'XenServer',
-                                    # Hypervisor type should be same as
-                                    # hypervisor type of cluster
-                                    "privateport": 22,
-                                    "publicport": 22,
-                                    "protocol": 'TCP',
-                                },
-                         "templates": {
-                                "displaytext": "Public Template",
-                                "name": "Public template",
-                                "ostype": 'CentOS 5.3 (64-bit)',
-                                "url": "http://download.cloud.com/releases/2.0.0/UbuntuServer-10-04-64bit.vhd.bz2",
-                                "hypervisor": 'XenServer',
-                                "format": 'VHD',
-                                "isfeatured": True,
-                                "ispublic": True,
-                                "isextractable": True,
-                                "templatefilter": 'self',
-                         },
-                         "ostype": 'CentOS 5.3 (64-bit)',
-                         # Cent OS 5.3 (64 bit)
-                         "sleep": 60,
-                         "timeout": 100,
-                         "mode": 'advanced'
-                    }
-
-
-class TestHighAvailability(cloudstackTestCase):
-
-    @classmethod
-    def setUpClass(cls):
-
-        cls.api_client = super(
-                               TestHighAvailability,
-                               cls
-                               ).getClsTestClient().getApiClient()
-        cls.services = Services().services
-        # Get Zone, Domain and templates
-        cls.domain = get_domain(
-                                cls.api_client,
-                                cls.services
-                            )
-        cls.zone = get_zone(
-                            cls.api_client,
-                            cls.services
-                            )
-        cls.pod = get_pod(
-                          cls.api_client,
-                          zoneid=cls.zone.id,
-                          services=cls.services
-                          )
-        cls.template = get_template(
-                                    cls.api_client,
-                                    cls.zone.id,
-                                    cls.services["ostype"]
-                            )
-        cls.services["virtual_machine"]["zoneid"] = cls.zone.id
-        cls.services["virtual_machine"]["template"] = cls.template.id
-
-        cls.service_offering = ServiceOffering.create(
-                                            cls.api_client,
-                                            cls.services["service_offering"],
-                                            offerha=True
-                                            )
-        cls._cleanup = [
-                        cls.service_offering,
-                        ]
-        return
-
-    @classmethod
-    def tearDownClass(cls):
-        try:
-            #Cleanup resources used
-            cleanup_resources(cls.api_client, cls._cleanup)
-        except Exception as e:
-            raise Exception("Warning: Exception during cleanup : %s" % e)
-        return
-
-    def setUp(self):
-        self.apiclient = self.testClient.getApiClient()
-        self.dbclient = self.testClient.getDbConnection()
-        self.account = Account.create(
-                                     self.apiclient,
-                                     self.services["account"],
-                                     admin=True,
-                                     domainid=self.domain.id
-                                     )
-        self.cleanup = [self.account]
-        return
-
-    def tearDown(self):
-        try:
-            #Clean up, terminate the created accounts, domains etc
-            cleanup_resources(self.apiclient, self.cleanup)
-        except Exception as e:
-            raise Exception("Warning: Exception during cleanup : %s" % e)
-        return
-
-    @attr(tags = ["advanced", "advancedns", "multihost"])
-    def test_01_host_maintenance_mode(self):
-        """Test host maintenance mode
-        """
-
-
-        # Validate the following
-        # 1. Create Vms. Acquire IP. Create port forwarding & load balancing
-        #    rules for Vms.
-        # 2. Host 1: put to maintenance mode. All Vms should failover to Host
-        #    2 in cluster. Vms should be in running state. All port forwarding
-        #    rules and load balancing Rules should work.
-        # 3. After failover to Host 2 succeeds, deploy Vms. Deploy Vms on host
-        #    2 should succeed.
-        # 4. Host 1: cancel maintenance mode.
-        # 5. Host 2 : put to maintenance mode. All Vms should failover to
-        #    Host 1 in cluster.
-        # 6. After failover to Host 1 succeeds, deploy VMs. Deploy Vms on
-        #    host 1 should succeed.
-
-        hosts = Host.list(
-                          self.apiclient,
-                          zoneid=self.zone.id,
-                          resourcestate='Enabled',
-                          type='Routing'
-                          )
-        self.assertEqual(
-                         isinstance(hosts, list),
-                         True,
-                         "List hosts should return valid host response"
-                         )
-        self.assertGreaterEqual(
-                         len(hosts),
-                         2,
-                         "There must be two hosts present in a cluster"
-                        )
-        self.debug("Checking HA with hosts: %s, %s" % (
-                                                       hosts[0].name,
-                                                       hosts[1].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.name,
-                                  domainid=self.account.domainid,
-                                  serviceofferingid=self.service_offering.id
-                                  )
-        vms = VirtualMachine.list(
-                                  self.apiclient,
-                                  id=virtual_machine.id,
-                                  listall=True
-                                  )
-        self.assertEqual(
-                    isinstance(vms, list),
-                    True,
-                    "List VMs should return valid response for deployed VM"
-                    )
-        self.assertNotEqual(
-                    len(vms),
-                    0,
-                    "List VMs should return valid response for deployed VM"
-                    )
-        vm = vms[0]
-        self.debug("Deployed VM on host: %s" % vm.hostid)
-        self.assertEqual(
-                         vm.state,
-                         "Running",
-                         "Deployed VM should be in RUnning state"
-                         )
-        networks = Network.list(
-                                self.apiclient,
-                                account=self.account.name,
-                                domainid=self.account.domainid,
-                                listall=True
-                                )
-        self.assertEqual(
-                    isinstance(networks, list),
-                    True,
-                    "List networks should return valid list for the account"
-                    )
-        network = networks[0]
-
-        self.debug("Associating public IP for account: %s" %
-                                            self.account.name)
-        public_ip = PublicIPAddress.create(
-                                    self.apiclient,
-                                    accountid=self.account.name,
-                                    zoneid=self.zone.id,
-                                    domainid=self.account.domainid,
-                                    networkid=network.id
-                                    )
-
-        self.debug("Associated %s with network %s" % (
-                                        public_ip.ipaddress.ipaddress,
-                                        network.id
-                                        ))
-        self.debug("Creating PF rule for IP address: %s" %
-                                        public_ip.ipaddress.ipaddress)
-        nat_rule = NATRule.create(
-                                 self.apiclient,
-                                 virtual_machine,
-                                 self.services["natrule"],
-                                 ipaddressid=public_ip.ipaddress.id
-                                 )
-
-        self.debug("Creating LB rule on IP with NAT: %s" %
-                                    public_ip.ipaddress.ipaddress)
-
-        # Create Load Balancer rule on IP already having NAT rule
-        lb_rule = LoadBalancerRule.create(
-                                    self.apiclient,
-                                    self.services["lbrule"],
-                                    ipaddressid=public_ip.ipaddress.id,
-                                    accountid=self.account.name
-                                    )
-        self.debug("Created LB rule with ID: %s" % lb_rule.id)
-
-        # Should be able to SSH VM
-        try:
-            self.debug("SSH into VM: %s" % virtual_machine.id)
-            ssh = virtual_machine.get_ssh_client(
-                                    ipaddress=public_ip.ipaddress.ipaddress)
-        except Exception as e:
-            self.fail("SSH Access failed for %s: %s" % \
-                      (virtual_machine.ipaddress, e)
-                      )
-
-        first_host = vm.hostid
-        self.debug("Enabling maintenance mode for host %s" % vm.hostid)
-        cmd = prepareHostForMaintenance.prepareHostForMaintenanceCmd()
-        cmd.id = first_host
-        self.apiclient.prepareHostForMaintenance(cmd)
-
-        self.debug("Waiting for SSVMs to come up")
-        wait_for_ssvms(
-                       self.apiclient,
-                       zoneid=self.zone.id,
-                       podid=self.pod.id,
-                      )
-
-        timeout = self.services["timeout"]
-        # Poll and check state of VM while it migrates from one host to another
-        while True:
-            vms = VirtualMachine.list(
-                                  self.apiclient,
-                                  id=virtual_machine.id,
-                                  listall=True
-                                  )
-            self.assertEqual(
-                    isinstance(vms, list),
-                    True,
-                    "List VMs should return valid response for deployed VM"
-                    )
-            self.assertNotEqual(
-                    len(vms),
-                    0,
-                    "List VMs should return valid response for deployed VM"
-                    )
-            vm = vms[0]
-
-            self.debug("VM 1 state: %s" % vm.state)
-            if vm.state in ["Stopping",
-                            "Stopped",
-                            "Running",
-                            "Starting",
-                            "Migrating"]:
-                if vm.state == "Running":
-                    break
-                else:
-                    time.sleep(self.services["sleep"])
-                    timeout = timeout - 1
-            else:
-                self.fail(
-                    "VM migration from one-host-to-other failed while enabling maintenance"
-                    )
-        second_host = vm.hostid
-        self.assertEqual(
-                vm.state,
-                "Running",
-                "VM should be in Running state after enabling host maintenance"
-                )
-        # Should be able to SSH VM
-        try:
-            self.debug("SSH into VM: %s" % virtual_machine.id)
-            ssh = virtual_machine.get_ssh_client(
-                                    ipaddress=public_ip.ipaddress.ipaddress)
-        except Exception as e:
-            self.fail("SSH Access failed for %s: %s" % \
-                      (virtual_machine.ipaddress, e)
-                      )
-        self.debug("Deploying VM in account: %s" % self.account.name)
-        # Spawn an instance on other host
-        virtual_machine_2 = VirtualMachine.create(
-                                  self.apiclient,
-                                  self.services["virtual_machine"],
-                                  accountid=self.account.name,
-                                  domainid=self.account.domainid,
-                                  serviceofferingid=self.service_offering.id
-                                  )
-        vms = VirtualMachine.list(
-                                  self.apiclient,
-                                  id=virtual_machine_2.id,
-                                  listall=True
-                                  )
-        self.assertEqual(
-                    isinstance(vms, list),
-                    True,
-                    "List VMs should return valid response for deployed VM"
-                    )
-        self.assertNotEqual(
-                    len(vms),
-                    0,
-                    "List VMs should return valid response for deployed VM"
-                    )
-        vm = vms[0]
-        self.debug("Deployed VM on host: %s" % vm.hostid)
-        self.debug("VM 2 state: %s" % vm.state)
-        self.assertEqual(
-                         vm.state,
-                         "Running",
-                         "Deployed VM should be in Running state"
-                         )
-
-        self.debug("Canceling host maintenance for ID: %s" % first_host)
-        cmd = cancelHostMaintenance.cancelHostMaintenanceCmd()
-        cmd.id = first_host
-        self.apiclient.cancelHostMaintenance(cmd)
-        self.debug("Maintenance mode canceled for host: %s" % first_host)
-
-        self.debug("Enabling maintenance mode for host %s" % second_host)
-        cmd = prepareHostForMaintenance.prepareHostForMaintenanceCmd()
-        cmd.id = second_host
-        self.apiclient.prepareHostForMaintenance(cmd)
-        self.debug("Maintenance mode enabled for host: %s" % second_host)
-
-        self.debug("Waiting for SSVMs to come up")
-        wait_for_ssvms(
-                       self.apiclient,
-                       zoneid=self.zone.id,
-                       podid=self.pod.id,
-                      )
-
-        # Poll and check the status of VMs
-        timeout = self.services["timeout"]
-        while True:
-            vms = VirtualMachine.list(
-                                  self.apiclient,
-                                  account=self.account.name,
-                                  domainid=self.account.domainid,
-                                  listall=True
-                                  )
-            self.assertEqual(
-                    isinstance(vms, list),
-                    True,
-                    "List VMs should return valid response for deployed VM"
-                    )
-            self.assertNotEqual(
-                    len(vms),
-                    0,
-                    "List VMs should return valid response for deployed VM"
-                    )
-            vm = vms[0]
-            self.debug(
-                "VM state after enabling maintenance on first host: %s" %
-                                                                    vm.state)
-            if vm.state in [
-                            "Stopping",
-                            "Stopped",
-                            "Running",
-                            "Starting",
-                            "Migrating"
-                            ]:
-                if vm.state == "Running":
-                    break
-                else:
-                    time.sleep(self.services["sleep"])
-                    timeout = timeout - 1
-            else:
-                self.fail(
-                    "VM migration from one-host-to-other failed while enabling maintenance"
-                    )
-
-                # Poll and check the status of VMs
-        timeout = self.services["timeout"]
-        while True:
-            vms = VirtualMachine.list(
-                                  self.apiclient,
-                                  account=self.account.name,
-                                  domainid=self.account.domainid,
-                                  listall=True
-                                  )
-            self.assertEqual(
-                    isinstance(vms, list),
-                    True,
-                    "List VMs should return valid response for deployed VM"
-                    )
-            self.assertNotEqual(
-                    len(vms),
-                    0,
-                    "List VMs should return valid response for deployed VM"
-                    )
-            vm = vms[1]
-            self.debug(
-                "VM state after enabling maintenance on first host: %s" %
-                                                                    vm.state)
-            if vm.state in [
-                            "Stopping",
-                            "Stopped",
-                            "Running",
-                            "Starting",
-                            "Migrating"
-                            ]:
-                if vm.state == "Running":
-                    break
-                else:
-                    time.sleep(self.services["sleep"])
-                    timeout = timeout - 1
-            else:
-                self.fail(
-                    "VM migration from one-host-to-other failed while enabling maintenance"
-                    )
-
-        for vm in vms:
-            self.debug(
-                "VM states after enabling maintenance mode on host: %s - %s" %
-                                                    (first_host, vm.state))
-            self.assertEqual(
-                         vm.state,
-                         "Running",
-                         "Deployed VM should be in Running state"
-                         )
-
-        # Spawn an instance on other host
-        virtual_machine_3 = VirtualMachine.create(
-                                  self.apiclient,
-                                  self.services["virtual_machine"],
-                                  accountid=self.account.name,
-                                  domainid=self.account.domainid,
-                                  serviceofferingid=self.service_offering.id
-                                  )
-        vms = VirtualMachine.list(
-                                  self.apiclient,
-                                  id=virtual_machine_3.id,
-                                  listall=True
-                                  )
-        self.assertEqual(
-                    isinstance(vms, list),
-                    True,
-                    "List VMs should return valid response for deployed VM"
-                    )
-        self.assertNotEqual(
-                    len(vms),
-                    0,
-                    "List VMs should return valid response for deployed VM"
-                    )
-        vm = vms[0]
-
-        self.debug("Deployed VM on host: %s" % vm.hostid)
-        self.debug("VM 3 state: %s" % vm.state)
-        self.assertEqual(
-                         vm.state,
-                         "Running",
-                         "Deployed VM should be in Running state"
-                         )
-
-        # Should be able to SSH VM
-        try:
-            self.debug("SSH into VM: %s" % virtual_machine.id)
-            ssh = virtual_machine.get_ssh_client(
-                                    ipaddress=public_ip.ipaddress.ipaddress)
-        except Exception as e:
-            self.fail("SSH Access failed for %s: %s" % \
-                      (virtual_machine.ipaddress, e)
-                      )
-
-        self.debug("Canceling host maintenance for ID: %s" % second_host)
-        cmd = cancelHostMaintenance.cancelHostMaintenanceCmd()
-        cmd.id = second_host
-        self.apiclient.cancelHostMaintenance(cmd)
-        self.debug("Maintenance mode canceled for host: %s" % second_host)
-
-        self.debug("Waiting for SSVMs to come up")
-        wait_for_ssvms(
-                       self.apiclient,
-                       zoneid=self.zone.id,
-                       podid=self.pod.id,
-                      )
-        return
-
-    @attr(tags = ["advanced", "advancedns", "multihost"])
-    def test_02_host_maintenance_mode_with_activities(self):
-        """Test host maintenance mode with activities
-        """
-
-
-        # Validate the following
-        # 1. Create Vms. Acquire IP. Create port forwarding & load balancing
-        #    rules for Vms.
-        # 2. While activities are ongoing: Create snapshots, recurring
-        #    snapshots, create templates, download volumes, Host 1: put to
-        #    maintenance mode. All Vms should failover to Host 2 in cluster
-        #    Vms should be in running state. All port forwarding rules and
-        #    load balancing Rules should work.
-        # 3. After failover to Host 2 succeeds, deploy Vms. Deploy Vms on host
-        #    2 should succeed. All ongoing activities in step 3 should succeed
-        # 4. Host 1: cancel maintenance mode.
-        # 5. While activities are ongoing: Create snapshots, recurring
-        #    snapshots, create templates, download volumes, Host 2: put to
-        #    maintenance mode. All Vms should failover to Host 1 in cluster.
-        # 6. After failover to Host 1 succeeds, deploy VMs. Deploy Vms on
-        #    host 1 should succeed. All ongoing activities in step 6 should
-        #    succeed.
-
-        hosts = Host.list(
-                          self.apiclient,
-                          zoneid=self.zone.id,
-                          resourcestate='Enabled',
-                          type='Routing'
-                          )
-        self.assertEqual(
-                         isinstance(hosts, list),
-                         True,
-                         "List hosts should return valid host response"
-                         )
-        self.assertGreaterEqual(
-                         len(hosts),
-                         2,
-                         "There must be two hosts present in a cluster"
-                        )
-        self.debug("Checking HA with hosts: %s, %s" % (
-                                                       hosts[0].name,
-                                                       hosts[1].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.name,
-                                  domainid=self.account.domainid,
-                                  serviceofferingid=self.service_offering.id
-                                  )
-        vms = VirtualMachine.list(
-                                  self.apiclient,
-                                  id=virtual_machine.id,
-                                  listall=True
-                                  )
-        self.assertEqual(
-                    isinstance(vms, list),
-                    True,
-                    "List VMs should return valid response for deployed VM"
-                    )
-        self.assertNotEqual(
-                    len(vms),
-                    0,
-                    "List VMs should return valid response for deployed VM"
-                    )
-        vm = vms[0]
-        self.debug("Deployed VM on host: %s" % vm.hostid)
-        self.assertEqual(
-                         vm.state,
-                         "Running",
-                         "Deployed VM should be in RUnning state"
-                         )
-        networks = Network.list(
-                                self.apiclient,
-                                account=self.account.name,
-                                domainid=self.account.domainid,
-                                listall=True
-                                )
-        self.assertEqual(
-                    isinstance(networks, list),
-                    True,
-                    "List networks should return valid list for the account"
-                    )
-        network = networks[0]
-
-        self.debug("Associating public IP for account: %s" %
-                                            self.account.name)
-        public_ip = PublicIPAddress.create(
-                                    self.apiclient,
-                                    accountid=self.account.name,
-                                    zoneid=self.zone.id,
-                                    domainid=self.account.domainid,
-                                    networkid=network.id
-                                    )
-
-        self.debug("Associated %s with network %s" % (
-                                        public_ip.ipaddress.ipaddress,
-                                        network.id
-                                        ))
-        self.debug("Creating PF rule for IP address: %s" %
-                                        public_ip.ipaddress.ipaddress)
-        nat_rule = NATRule.create(
-                                 self.apiclient,
-                                 virtual_machine,
-                                 self.services["natrule"],
-                                 ipaddressid=public_ip.ipaddress.id
-                                 )
-
-        self.debug("Creating LB rule on IP with NAT: %s" %
-                                    public_ip.ipaddress.ipaddress)
-
-        # Create Load Balancer rule on IP already having NAT rule
-        lb_rule = LoadBalancerRule.create(
-                                    self.apiclient,
-                                    self.services["lbrule"],
-                                    ipaddressid=public_ip.ipaddress.id,
-                                    accountid=self.account.name
-                                    )
-        self.debug("Created LB rule with ID: %s" % lb_rule.id)
-
-        # Should be able to SSH VM
-        try:
-            self.debug("SSH into VM: %s" % virtual_machine.id)
-            ssh = virtual_machine.get_ssh_client(
-                                    ipaddress=public_ip.ipaddress.ipaddress)
-        except Exception as e:
-            self.fail("SSH Access failed for %s: %s" % \
-                      (virtual_machine.ipaddress, e)
-                      )
-        # Get the Root disk of VM
-        volumes = list_volumes(
-                            self.apiclient,
-                            virtualmachineid=virtual_machine.id,
-                            type='ROOT',
-                            listall=True
-                            )
-        volume = volumes[0]
-        self.debug(
-            "Root volume of VM(%s): %s" % (
-                                            virtual_machine.name,
-                                            volume.name
-                                            ))
-        # Create a snapshot from the ROOTDISK
-        self.debug("Creating snapshot on ROOT volume: %s" % volume.name)
-        snapshot = Snapshot.create(self.apiclient, volumes[0].id)
-        self.debug("Snapshot created: ID - %s" % snapshot.id)
-
-        snapshots = list_snapshots(
-                                   self.apiclient,
-                                   id=snapshot.id,
-                                   listall=True
-                                   )
-        self.assertEqual(
-                            isinstance(snapshots, list),
-                            True,
-                            "Check list response returns a valid list"
-                        )
-        self.assertNotEqual(
-                            snapshots,
-                            None,
-                            "Check if result exists in list snapshots call"
-                            )
-        self.assertEqual(
-                            snapshots[0].id,
-                            snapshot.id,
-                            "Check snapshot id in list resources call"
-                        )
-
-        # Generate template from the snapshot
-        self.debug("Generating template from snapshot: %s" % snapshot.name)
-        template = Template.create_from_snapshot(
-                                                 self.apiclient,
-                                                 snapshot,
-                                                 self.services["templates"]
-                                                 )
-        self.debug("Created template from snapshot: %s" % template.id)
-
-        templates = list_templates(
-                                self.apiclient,
-                                templatefilter=\
-                                self.services["templates"]["templatefilter"],
-                                id=template.id
-                                )
-
-        self.assertEqual(
-                isinstance(templates, list),
-                True,
-                "List template call should return the newly created template"
-                )
-
-        self.assertEqual(
-                    templates[0].isready,
-                    True,
-                    "The newly created template should be in ready state"
-                    )
-
-        first_host = vm.hostid
-        self.debug("Enabling maintenance mode for host %s" % vm.hostid)
-        cmd = prepareHostForMaintenance.prepareHostForMaintenanceCmd()
-        cmd.id = first_host
-        self.apiclient.prepareHostForMaintenance(cmd)
-
-        self.debug("Waiting for SSVMs to come up")
-        wait_for_ssvms(
-                       self.apiclient,
-                       zoneid=self.zone.id,
-                       podid=self.pod.id,
-                      )
-
-        timeout = self.services["timeout"]
-        # Poll and check state of VM while it migrates from one host to another
-        while True:
-            vms = VirtualMachine.list(
-                                  self.apiclient,
-                                  id=virtual_machine.id,
-                                  listall=True
-                                  )
-            self.assertEqual(
-                    isinstance(vms, list),
-                    True,
-                    "List VMs should return valid response for deployed VM"
-                    )
-            self.assertNotEqual(
-                    len(vms),
-                    0,
-                    "List VMs should return valid response for deployed VM"
-                    )
-            vm = vms[0]
-
-            self.debug("VM 1 state: %s" % vm.state)
-            if vm.state in ["Stopping",
-                            "Stopped",
-                            "Running",
-                            "Starting",
-                            "Migrating"]:
-                if vm.state == "Running":
-                    break
-                else:
-                    time.sleep(self.services["sleep"])
-                    timeout = timeout - 1
-            else:
-                self.fail(
-                    "VM migration from one-host-to-other failed while enabling maintenance"
-                    )
-        second_host = vm.hostid
-        self.assertEqual(
-                vm.state,
-                "Running",
-                "VM should be in Running state after enabling host maintenance"
-                )
-        # Should be able to SSH VM
-        try:
-            self.debug("SSH into VM: %s" % virtual_machine.id)
-            ssh = virtual_machine.get_ssh_client(
-                                    ipaddress=public_ip.ipaddress.ipaddress)
-        except Exception as e:
-            self.fail("SSH Access failed for %s: %s" % \
-                      (virtual_machine.ipaddress, e)
-                      )
-        self.debug("Deploying VM in account: %s" % self.account.name)
-        # Spawn an instance on other host
-        virtual_machine_2 = VirtualMachine.create(
-                                  self.apiclient,
-                                  self.services["virtual_machine"],
-                                  accountid=self.account.name,
-                                  domainid=self.account.domainid,
-                                  serviceofferingid=self.service_offering.id
-                                  )
-        vms = VirtualMachine.list(
-                                  self.apiclient,
-                                  id=virtual_machine_2.id,
-                                  listall=True
-                                  )
-        self.assertEqual(
-                    isinstance(vms, list),
-                    True,
-                    "List VMs should return valid response for deployed VM"
-                    )
-        self.assertNotEqual(
-                    len(vms),
-                    0,
-                    "List VMs should return valid response for deployed VM"
-                    )
-        vm = vms[0]
-        self.debug("Deployed VM on host: %s" % vm.hostid)
-        self.debug("VM 2 state: %s" % vm.state)
-        self.assertEqual(
-                         vm.state,
-                         "Running",
-                         "Deployed VM should be in Running state"
-                         )
-
-        self.debug("Canceling host maintenance for ID: %s" % first_host)
-        cmd = cancelHostMaintenance.cancelHostMaintenanceCmd()
-        cmd.id = first_host
-        self.apiclient.cancelHostMaintenance(cmd)
-        self.debug("Maintenance mode canceled for host: %s" % first_host)
-
-        # Get the Root disk of VM
-        volumes = list_volumes(
-                            self.apiclient,
-                            virtualmachineid=virtual_machine_2.id,
-                            type='ROOT',
-                            listall=True
-                            )
-        volume = volumes[0]
-        self.debug(
-            "Root volume of VM(%s): %s" % (
-                                            virtual_machine_2.name,
-                                            volume.name
-                                            ))
-        # Create a snapshot from the ROOTDISK
-        self.debug("Creating snapshot on ROOT volume: %s" % volume.name)
-        snapshot = Snapshot.create(self.apiclient, volumes[0].id)
-        self.debug("Snapshot created: ID - %s" % snapshot.id)
-
-        snapshots = list_snapshots(
-                                   self.apiclient,
-                                   id=snapshot.id,
-                                   listall=True
-                                   )
-        self.assertEqual(
-                            isinstance(snapshots, list),
-                            True,
-                            "Check list response returns a valid list"
-                        )
-        self.assertNotEqual(
-                            snapshots,
-                            None,
-                            "Check if result exists in list snapshots call"
-                            )
-        self.assertEqual(
-                            snapshots[0].id,
-                            snapshot.id,
-                            "Check snapshot id in list resources call"
-                        )
-
-        # Generate template from the snapshot
-        self.debug("Generating template from snapshot: %s" % snapshot.name)
-        template = Template.create_from_snapshot(
-                                                 self.apiclient,
-                                                 snapshot,
-                                                 self.services["templates"]
-                                                 )
-        self.debug("Created template from snapshot: %s" % template.id)
-
-        templates = list_templates(
-                                self.apiclient,
-                                templatefilter=\
-                                self.services["templates"]["templatefilter"],
-                                id=template.id
-                                )
-
-        self.assertEqual(
-                isinstance(templates, list),
-                True,
-                "List template call should return the newly created template"
-                )
-
-        self.assertEqual(
-                    templates[0].isready,
-                    True,
-                    "The newly created template should be in ready state"
-                    )
-
-        self.debug("Enabling maintenance mode for host %s" % second_host)
-        cmd = prepareHostForMaintenance.prepareHostForMaintenanceCmd()
-        cmd.id = second_host
-        self.apiclient.prepareHostForMaintenance(cmd)
-        self.debug("Maintenance mode enabled for host: %s" % second_host)
-
-        self.debug("Waiting for SSVMs to come up")
-        wait_for_ssvms(
-                       self.apiclient,
-                       zoneid=self.zone.id,
-                       podid=self.pod.id,
-                      )
-
-        # Poll and check the status of VMs
-        timeout = self.services["timeout"]
-        while True:
-            vms = VirtualMachine.list(
-                                  self.apiclient,
-                                  account=self.account.name,
-                                  domainid=self.account.domainid,
-                                  listall=True
-                                  )
-            self.assertEqual(
-                    isinstance(vms, list),
-                    True,
-                    "List VMs should return valid response for deployed VM"
-                    )
-            self.assertNotEqual(
-                    len(vms),
-                    0,
-                    "List VMs should return valid response for deployed VM"
-                    )
-            vm = vms[0]
-            self.debug(
-                "VM state after enabling maintenance on first host: %s" %
-                                                                    vm.state)
-            if vm.state in ["Stopping",
-                            "Stopped",
-                            "Running",
-                            "Starting",
-                            "Migrating"]:
-                if vm.state == "Running":
-                    break
-                else:
-                    time.sleep(self.services["sleep"])
-                    timeout = timeout - 1
-            else:
-                self.fail(
-                    "VM migration from one-host-to-other failed while enabling maintenance"
-                    )
-
-        # Poll and check the status of VMs
-        timeout = self.services["timeout"]
-        while True:
-            vms = VirtualMachine.list(
-                                  self.apiclient,
-                                  account=self.account.name,
-                                  domainid=self.account.domainid,
-                                  listall=True
-                                  )
-            self.assertEqual(
-                    isinstance(vms, list),
-                    True,
-                    "List VMs should return valid response for deployed VM"
-                    )
-            self.assertNotEqual(
-                    len(vms),
-                    0,
-                    "List VMs should return valid response for deployed VM"
-                    )
-            vm = vms[1]
-            self.debug(
-                "VM state after enabling maintenance on first host: %s" %
-                                                                    vm.state)
-            if vm.state in ["Stopping",
-                            "Stopped",
-                            "Running",
-                            "Starting",
-                            "Migrating"]:
-                if vm.state == "Running":
-                    break
-                else:
-                    time.sleep(self.services["sleep"])
-                    timeout = timeout - 1
-            else:
-                self.fail(
-                    "VM migration from one-host-to-other failed while enabling maintenance"
-                    )
-
-        for vm in vms:
-            self.debug(
-                "VM states after enabling maintenance mode on host: %s - %s" %
-                                                    (first_host, vm.state))
-            self.assertEqual(
-                         vm.state,
-                         "Running",
-                         "Deployed VM should be in Running state"
-                         )
-
-        # Spawn an instance on other host
-        virtual_machine_3 = VirtualMachine.create(
-                                  self.apiclient,
-                                  self.services["virtual_machine"],
-                                  accountid=self.account.name,
-                                  domainid=self.account.domainid,
-                                  serviceofferingid=self.service_offering.id
-                                  )
-        vms = VirtualMachine.list(
-                                  self.apiclient,
-                                  id=virtual_machine_3.id,
-                                  listall=True
-                                  )
-        self.assertEqual(
-                    isinstance(vms, list),
-                    True,
-                    "List VMs should return valid response for deployed VM"
-                    )
-        self.assertNotEqual(
-                    len(vms),
-                    0,
-                    "List VMs should return valid response for deployed VM"
-                    )
-        vm = vms[0]
-
-        self.debug("Deployed VM on host: %s" % vm.hostid)
-        self.debug("VM 3 state: %s" % vm.state)
-        self.assertEqual(
-                         vm.state,
-                         "Running",
-                         "Deployed VM should be in Running state"
-                         )
-
-        self.debug("Canceling host maintenance for ID: %s" % second_host)
-        cmd = cancelHostMaintenance.cancelHostMaintenanceCmd()
-        cmd.id = second_host
-        self.apiclient.cancelHostMaintenance(cmd)
-        self.debug("Maintenance mode canceled for host: %s" % second_host)
-
-        self.debug("Waiting for SSVMs to come up")
-        wait_for_ssvms(
-                       self.apiclient,
-                       zoneid=self.zone.id,
-                       podid=self.pod.id,
-                      )
-        return


[28/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1

Posted by ah...@apache.org.
Revert "CLOUDSTACK-2902: Fixing references to 4.1 repository for this release"

This reverts commit 76d3c27bf4c0ab3690840e56ca162935cea91d48.


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

Branch: refs/heads/vmsync
Commit: 25726277975fb9e39ade7c08d680a93d33dc16b2
Parents: fc16e29
Author: Chip Childers <ch...@apache.org>
Authored: Mon Jun 17 13:47:19 2013 -0400
Committer: Chip Childers <ch...@apache.org>
Committed: Mon Jun 17 13:49:05 2013 -0400

----------------------------------------------------------------------
 docs/en-US/Release_Notes.xml                | 8 ++++----
 docs/en-US/configure-package-repository.xml | 4 ++--
 docs/pot/configure-package-repository.pot   | 4 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/25726277/docs/en-US/Release_Notes.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/Release_Notes.xml b/docs/en-US/Release_Notes.xml
index b9861ee..2ae8732 100644
--- a/docs/en-US/Release_Notes.xml
+++ b/docs/en-US/Release_Notes.xml
@@ -398,7 +398,7 @@ under the License.
           SSH keypair assigned to a virtual machine.</para>
       </section>
     </section>
-    <section id="issues-fixed-4.1">
+    <section id="issues-fixed-4.0">
       <title>Issues Fixed in 4.1.0</title>
       <para>Apache CloudStack uses <ulink url="https://issues.apache.org/jira/browse/CLOUDSTACK"
           >Jira</ulink> to track its issues. All new features and bugs for 4.1.0 have been tracked
@@ -4775,7 +4775,7 @@ service cloudstack-agent restart
               <programlisting language="Bash">
 [apache-cloudstack]
 name=Apache CloudStack
-baseurl=http://cloudstack.apt-get.eu/rhel/4.1/
+baseurl=http://cloudstack.apt-get.eu/rhel/4.0/
 enabled=1
 gpgcheck=0
                             </programlisting>
@@ -5067,7 +5067,7 @@ service cloudstack-agent restart
               <programlisting language="Bash">
 [apache-cloudstack]
 name=Apache CloudStack
-baseurl=http://cloudstack.apt-get.eu/rhel/4.1/
+baseurl=http://cloudstack.apt-get.eu/rhel/4.0/
 enabled=1
 gpgcheck=0
                             </programlisting>
@@ -5663,7 +5663,7 @@ service cloudstack-agent restart
               <programlisting language="Bash">
 [apache-cloudstack]
 name=Apache CloudStack
-baseurl=http://cloudstack.apt-get.eu/rhel/4.1/
+baseurl=http://cloudstack.apt-get.eu/rhel/4.0/
 enabled=1
 gpgcheck=0
                             </programlisting>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/25726277/docs/en-US/configure-package-repository.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/configure-package-repository.xml b/docs/en-US/configure-package-repository.xml
index cda4677..c8ba48f 100644
--- a/docs/en-US/configure-package-repository.xml
+++ b/docs/en-US/configure-package-repository.xml
@@ -44,7 +44,7 @@
         <title>DEB package repository</title>
         <para>You can add a DEB package repository to your apt sources with the following commands. Please note that only packages for Ubuntu 12.04 LTS (precise) are being built at this time.</para>
         <para>Use your preferred editor and open (or create) <filename>/etc/apt/sources.list.d/cloudstack.list</filename>. Add the community provided repository to the file:</para>
-<programlisting>deb http://cloudstack.apt-get.eu/ubuntu precise 4.1</programlisting>
+<programlisting>deb http://cloudstack.apt-get.eu/ubuntu precise 4.0</programlisting>
         <para>We now have to add the public key to the trusted keys.</para>
         <programlisting language="Bash"><prompt>$</prompt> <command>wget</command> -O - http://cloudstack.apt-get.eu/release.asc|apt-key add -</programlisting>
         <para>Now update your local apt cache.</para>
@@ -60,7 +60,7 @@
         <programlisting>
 [cloudstack]
 name=cloudstack
-baseurl=<replaceable>http://cloudstack.apt-get.eu/rhel/4.1/</replaceable>
+baseurl=<replaceable>http://cloudstack.apt-get.eu/rhel/4.0/</replaceable>
 enabled=1
 gpgcheck=0
         </programlisting>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/25726277/docs/pot/configure-package-repository.pot
----------------------------------------------------------------------
diff --git a/docs/pot/configure-package-repository.pot b/docs/pot/configure-package-repository.pot
index c0ee374..e915358 100644
--- a/docs/pot/configure-package-repository.pot
+++ b/docs/pot/configure-package-repository.pot
@@ -60,7 +60,7 @@ msgstr ""
 
 #. Tag: programlisting
 #, no-c-format
-msgid "deb http://cloudstack.apt-get.eu/ubuntu precise 4.1"
+msgid "deb http://cloudstack.apt-get.eu/ubuntu precise 4.0"
 msgstr ""
 
 #. Tag: para
@@ -118,7 +118,7 @@ msgstr ""
 msgid "\n"
 "[cloudstack]\n"
 "name=cloudstack\n"
-"baseurl=<replaceable>http://cloudstack.apt-get.eu/rhel/4.1/</replaceable>\n"
+"baseurl=<replaceable>http://cloudstack.apt-get.eu/rhel/4.0/</replaceable>\n"
 "enabled=1\n"
 "gpgcheck=0\n"
 "        "


[25/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1

Posted by ah...@apache.org.
CLOUDSTACK-2902: Fixing references to 4.1 repository for this release


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

Branch: refs/heads/vmsync
Commit: 76d3c27bf4c0ab3690840e56ca162935cea91d48
Parents: 363a7b9
Author: Nils <ba...@gmail.com>
Authored: Mon Jun 17 15:46:39 2013 +0200
Committer: Chip Childers <ch...@apache.org>
Committed: Mon Jun 17 13:02:48 2013 -0400

----------------------------------------------------------------------
 docs/en-US/Release_Notes.xml                | 8 ++++----
 docs/en-US/configure-package-repository.xml | 4 ++--
 docs/pot/configure-package-repository.pot   | 4 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/76d3c27b/docs/en-US/Release_Notes.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/Release_Notes.xml b/docs/en-US/Release_Notes.xml
index 2ae8732..b9861ee 100644
--- a/docs/en-US/Release_Notes.xml
+++ b/docs/en-US/Release_Notes.xml
@@ -398,7 +398,7 @@ under the License.
           SSH keypair assigned to a virtual machine.</para>
       </section>
     </section>
-    <section id="issues-fixed-4.0">
+    <section id="issues-fixed-4.1">
       <title>Issues Fixed in 4.1.0</title>
       <para>Apache CloudStack uses <ulink url="https://issues.apache.org/jira/browse/CLOUDSTACK"
           >Jira</ulink> to track its issues. All new features and bugs for 4.1.0 have been tracked
@@ -4775,7 +4775,7 @@ service cloudstack-agent restart
               <programlisting language="Bash">
 [apache-cloudstack]
 name=Apache CloudStack
-baseurl=http://cloudstack.apt-get.eu/rhel/4.0/
+baseurl=http://cloudstack.apt-get.eu/rhel/4.1/
 enabled=1
 gpgcheck=0
                             </programlisting>
@@ -5067,7 +5067,7 @@ service cloudstack-agent restart
               <programlisting language="Bash">
 [apache-cloudstack]
 name=Apache CloudStack
-baseurl=http://cloudstack.apt-get.eu/rhel/4.0/
+baseurl=http://cloudstack.apt-get.eu/rhel/4.1/
 enabled=1
 gpgcheck=0
                             </programlisting>
@@ -5663,7 +5663,7 @@ service cloudstack-agent restart
               <programlisting language="Bash">
 [apache-cloudstack]
 name=Apache CloudStack
-baseurl=http://cloudstack.apt-get.eu/rhel/4.0/
+baseurl=http://cloudstack.apt-get.eu/rhel/4.1/
 enabled=1
 gpgcheck=0
                             </programlisting>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/76d3c27b/docs/en-US/configure-package-repository.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/configure-package-repository.xml b/docs/en-US/configure-package-repository.xml
index c8ba48f..cda4677 100644
--- a/docs/en-US/configure-package-repository.xml
+++ b/docs/en-US/configure-package-repository.xml
@@ -44,7 +44,7 @@
         <title>DEB package repository</title>
         <para>You can add a DEB package repository to your apt sources with the following commands. Please note that only packages for Ubuntu 12.04 LTS (precise) are being built at this time.</para>
         <para>Use your preferred editor and open (or create) <filename>/etc/apt/sources.list.d/cloudstack.list</filename>. Add the community provided repository to the file:</para>
-<programlisting>deb http://cloudstack.apt-get.eu/ubuntu precise 4.0</programlisting>
+<programlisting>deb http://cloudstack.apt-get.eu/ubuntu precise 4.1</programlisting>
         <para>We now have to add the public key to the trusted keys.</para>
         <programlisting language="Bash"><prompt>$</prompt> <command>wget</command> -O - http://cloudstack.apt-get.eu/release.asc|apt-key add -</programlisting>
         <para>Now update your local apt cache.</para>
@@ -60,7 +60,7 @@
         <programlisting>
 [cloudstack]
 name=cloudstack
-baseurl=<replaceable>http://cloudstack.apt-get.eu/rhel/4.0/</replaceable>
+baseurl=<replaceable>http://cloudstack.apt-get.eu/rhel/4.1/</replaceable>
 enabled=1
 gpgcheck=0
         </programlisting>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/76d3c27b/docs/pot/configure-package-repository.pot
----------------------------------------------------------------------
diff --git a/docs/pot/configure-package-repository.pot b/docs/pot/configure-package-repository.pot
index e915358..c0ee374 100644
--- a/docs/pot/configure-package-repository.pot
+++ b/docs/pot/configure-package-repository.pot
@@ -60,7 +60,7 @@ msgstr ""
 
 #. Tag: programlisting
 #, no-c-format
-msgid "deb http://cloudstack.apt-get.eu/ubuntu precise 4.0"
+msgid "deb http://cloudstack.apt-get.eu/ubuntu precise 4.1"
 msgstr ""
 
 #. Tag: para
@@ -118,7 +118,7 @@ msgstr ""
 msgid "\n"
 "[cloudstack]\n"
 "name=cloudstack\n"
-"baseurl=<replaceable>http://cloudstack.apt-get.eu/rhel/4.0/</replaceable>\n"
+"baseurl=<replaceable>http://cloudstack.apt-get.eu/rhel/4.1/</replaceable>\n"
 "enabled=1\n"
 "gpgcheck=0\n"
 "        "


[47/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1

Posted by ah...@apache.org.
CLOUDSTACK-3016: remove zonetype parameter from listSnapshots API.


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

Branch: refs/heads/vmsync
Commit: fea9a0ed1243f344800acad04493b1708c0ae39f
Parents: 3e852cc
Author: Jessica Wang <je...@apache.org>
Authored: Mon Jun 17 16:39:45 2013 -0700
Committer: Jessica Wang <je...@apache.org>
Committed: Mon Jun 17 16:39:45 2013 -0700

----------------------------------------------------------------------
 .../cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java      | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fea9a0ed/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java
----------------------------------------------------------------------
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 611b127..8859ba5 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
@@ -63,6 +63,7 @@ public class ListSnapshotsCmd extends BaseListTaggedResourcesCmd {
     @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "list snapshots by zone id")
     private Long zoneId;
 
+    
     /////////////////////////////////////////////////////
     /////////////////// Accessors ///////////////////////
     /////////////////////////////////////////////////////


[04/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1

Posted by ah...@apache.org.
cloumonkey: Remove junk from requester.py

This fix removes junk from 6e22843acb6bbd61260849fac171bba61ac6650f which was
supposed to just improve error messages and not messup the whole async block
logic and go into an infinite recursion or fail with some key error.

Signed-off-by: Rohit Yadav <ro...@wingify.com>


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

Branch: refs/heads/vmsync
Commit: 10f9516015121fc0521616d3b6d675ac7561c7d9
Parents: 1a058d7
Author: Rohit Yadav <ro...@wingify.com>
Authored: Sun Jun 16 18:34:32 2013 +0530
Committer: Rohit Yadav <ro...@wingify.com>
Committed: Sun Jun 16 18:34:32 2013 +0530

----------------------------------------------------------------------
 tools/cli/cloudmonkey/requester.py | 47 ++++++++-------------------------
 1 file changed, 11 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/10f95160/tools/cli/cloudmonkey/requester.py
----------------------------------------------------------------------
diff --git a/tools/cli/cloudmonkey/requester.py b/tools/cli/cloudmonkey/requester.py
index d2dae6d..b06e1fc 100644
--- a/tools/cli/cloudmonkey/requester.py
+++ b/tools/cli/cloudmonkey/requester.py
@@ -125,61 +125,36 @@ def monkeyrequest(command, args, isasync, asyncblock, logger, host, port,
         command = "queryAsyncJobResult"
         request = {'jobid': jobid}
         timeout = int(timeout)
-        pollperiod = 3
+        pollperiod = 2
         progress = 1
         while timeout > 0:
             print '\r' + '.' * progress,
             sys.stdout.flush()
-            progress += 1
+            time.sleep(pollperiod)
             timeout = timeout - pollperiod
+            progress += 1
             logger_debug(logger, "Job %s to timeout in %ds" % (jobid, timeout))
-            sys.stdout.flush()
-            if re.match("queryAsyncJobResult", command):
-                time.sleep(pollperiod)
-            else:
-                response, error = monkeyrequest(command, request, isasync,
-                                                asyncblock, logger,
-                                                host, port,  apikey, secretkey,
-                                                timeout, protocol, path)
+            response, error = make_request(command, request, logger,
+                                           host, port, apikey, secretkey,
+                                           protocol, path)
+            if error is not None:
+                return response, error
 
+            response = process_json(response)
             responsekeys = filter(lambda x: 'response' in x, response.keys())
 
             if len(responsekeys) < 1:
-                time.sleep(pollperiod)
                 continue
 
             result = response[responsekeys[0]]
             jobstatus = result['jobstatus']
-            jobresultcode = result['jobresultcode']
-            try:
-                jobresult = result["jobresult"]
-                logger_debug(logger, "jobresult %s" % (jobresult))
-                sys.stdout.flush()
-                return response, None
-            except KeyError:
-                logger_debug(logger, "No jobresult yet %s" % (result))
-                sys.stdout.flush()
-
-            if jobresultcode != 0:
-                error = "Error: resultcode %d for jobid %s" % (jobresultcode,
-                                                               jobid)
-                logger_debug(logger, "%s" % (error))
-                return response, error
-            else:
-                # if we get a valid respons resultcode give back results
-                response, error = monkeyrequest(command, request, isasync,
-                                                asyncblock, logger,
-                                                host, port,  apikey, secretkey,
-                                                timeout, protocol, path)
-                logger_debug(logger, "Ok: %s" % (jobid))
-                return response, error
-
             if jobstatus == 2:
+                jobresult = result["jobresult"]
                 error = "\rAsync job %s failed\nError %s, %s" % (jobid,
                         jobresult["errorcode"], jobresult["errortext"])
                 return response, error
             elif jobstatus == 1:
-                print '\r',
+                print "\r" + " " * progress,
                 return response, error
             else:
                 logger_debug(logger, "We should not arrive here!")


[20/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1

Posted by ah...@apache.org.
Global config to disable an account from acquiring public ips and guest vlans from the system if the account
has dedicated resources and the dedicated resources have all been consumed - use.system.public.ips and use.system.guest.vlans
Both configs are configurable at the account level too.


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

Branch: refs/heads/vmsync
Commit: 770cf02ccff2e4eac04a332216d1c575f18639be
Parents: 28b598b
Author: Likitha Shetty <li...@citrix.com>
Authored: Fri Jun 14 14:51:08 2013 +0530
Committer: Likitha Shetty <li...@citrix.com>
Committed: Mon Jun 17 17:54:36 2013 +0530

----------------------------------------------------------------------
 .../schema/src/com/cloud/dc/dao/DataCenterDao.java   |  2 +-
 .../src/com/cloud/dc/dao/DataCenterDaoImpl.java      | 15 ++++++++++-----
 .../network/guru/BigSwitchVnsGuestNetworkGuru.java   |  2 +-
 .../com/cloud/network/guru/OvsGuestNetworkGuru.java  |  3 ++-
 server/src/com/cloud/configuration/Config.java       |  9 ++++++++-
 server/src/com/cloud/network/NetworkManagerImpl.java |  5 ++++-
 .../cloud/network/guru/ExternalGuestNetworkGuru.java |  3 ++-
 .../src/com/cloud/network/guru/GuestNetworkGuru.java | 11 ++++++++++-
 setup/db/db/schema-410to420.sql                      |  3 +++
 9 files changed, 41 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/770cf02c/engine/schema/src/com/cloud/dc/dao/DataCenterDao.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/dao/DataCenterDao.java b/engine/schema/src/com/cloud/dc/dao/DataCenterDao.java
index e54b9bb..ed6e696 100755
--- a/engine/schema/src/com/cloud/dc/dao/DataCenterDao.java
+++ b/engine/schema/src/com/cloud/dc/dao/DataCenterDao.java
@@ -36,7 +36,7 @@ public interface DataCenterDao extends GenericDao<DataCenterVO, Long> {
     Pair<String, Long> allocatePrivateIpAddress(long id, long podId, long instanceId, String reservationId);
     DataCenterIpAddressVO allocatePrivateIpAddress(long id, String reservationId);
     String allocateLinkLocalIpAddress(long id, long podId, long instanceId, String reservationId);
-    String allocateVnet(long dcId, long physicalNetworkId, long accountId, String reservationId);
+    String allocateVnet(long dcId, long physicalNetworkId, long accountId, String reservationId, boolean canUseSystemGuestVlans);
     
     void releaseVnet(String vnet, long dcId, long physicalNetworkId, long accountId, String reservationId);
     void releasePrivateIpAddress(String ipAddress, long dcId, Long instanceId);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/770cf02c/engine/schema/src/com/cloud/dc/dao/DataCenterDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/dc/dao/DataCenterDaoImpl.java b/engine/schema/src/com/cloud/dc/dao/DataCenterDaoImpl.java
index 4d9d010..503306f 100755
--- a/engine/schema/src/com/cloud/dc/dao/DataCenterDaoImpl.java
+++ b/engine/schema/src/com/cloud/dc/dao/DataCenterDaoImpl.java
@@ -192,22 +192,27 @@ public class DataCenterDaoImpl extends GenericDaoBase<DataCenterVO, Long> implem
     }
 
     @Override
-    public String allocateVnet(long dataCenterId, long physicalNetworkId, long accountId, String reservationId) {
+    public String allocateVnet(long dataCenterId, long physicalNetworkId, long accountId, String reservationId,
+            boolean canUseSystemGuestVlans) {
         ArrayList<Long> dedicatedVlanDbIds = new ArrayList<Long>();
+        boolean useDedicatedGuestVlans = false;
         List<AccountGuestVlanMapVO> maps = _accountGuestVlanMapDao.listAccountGuestVlanMapsByAccount(accountId);
         for (AccountGuestVlanMapVO map : maps) {
             dedicatedVlanDbIds.add(map.getId());
         }
         if (dedicatedVlanDbIds != null && !dedicatedVlanDbIds.isEmpty()) {
+            useDedicatedGuestVlans = true;
             DataCenterVnetVO vo = _vnetAllocDao.take(physicalNetworkId, accountId, reservationId, dedicatedVlanDbIds);
             if (vo != null)
                 return vo.getVnet();
         }
-        DataCenterVnetVO vo = _vnetAllocDao.take(physicalNetworkId, accountId, reservationId, null);
-        if (vo == null) {
-            return null;
+        if (!useDedicatedGuestVlans || (useDedicatedGuestVlans && canUseSystemGuestVlans)) {
+            DataCenterVnetVO vo = _vnetAllocDao.take(physicalNetworkId, accountId, reservationId, null);
+            if (vo != null) {
+                return vo.getVnet();
+            }
         }
-        return vo.getVnet();
+        return null;
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/770cf02c/plugins/network-elements/bigswitch-vns/src/com/cloud/network/guru/BigSwitchVnsGuestNetworkGuru.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/guru/BigSwitchVnsGuestNetworkGuru.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/guru/BigSwitchVnsGuestNetworkGuru.java
index e753b13..f660b7c 100644
--- a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/guru/BigSwitchVnsGuestNetworkGuru.java
+++ b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/guru/BigSwitchVnsGuestNetworkGuru.java
@@ -162,7 +162,7 @@ public class BigSwitchVnsGuestNetworkGuru extends GuestNetworkGuru {
         }
 
         String vnet = _dcDao.allocateVnet(dcId, physicalNetworkId,
-                        network.getAccountId(), context.getReservationId());
+                network.getAccountId(), context.getReservationId(), canUseSystemGuestVlan(network.getAccountId()));
         if (vnet == null) {
             throw new InsufficientVirtualNetworkCapcityException("Unable to allocate vnet as a " +
                         "part of network " + network + " implement ", DataCenter.class, dcId);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/770cf02c/plugins/network-elements/ovs/src/com/cloud/network/guru/OvsGuestNetworkGuru.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/ovs/src/com/cloud/network/guru/OvsGuestNetworkGuru.java b/plugins/network-elements/ovs/src/com/cloud/network/guru/OvsGuestNetworkGuru.java
index 781b4b9..bbdf110 100644
--- a/plugins/network-elements/ovs/src/com/cloud/network/guru/OvsGuestNetworkGuru.java
+++ b/plugins/network-elements/ovs/src/com/cloud/network/guru/OvsGuestNetworkGuru.java
@@ -94,7 +94,8 @@ public class OvsGuestNetworkGuru extends GuestNetworkGuru {
     protected void allocateVnet(Network network, NetworkVO implemented, long dcId,
             long physicalNetworkId, String reservationId) throws InsufficientVirtualNetworkCapcityException {
         if (network.getBroadcastUri() == null) {
-            String vnet = _dcDao.allocateVnet(dcId, physicalNetworkId, network.getAccountId(), reservationId);
+            String vnet = _dcDao.allocateVnet(dcId, physicalNetworkId, network.getAccountId(), reservationId,
+                    canUseSystemGuestVlan(network.getAccountId()));
             if (vnet == null) {
                 throw new InsufficientVirtualNetworkCapcityException("Unable to allocate vnet as a part of network " + network + " implement ", DataCenter.class, dcId);
             }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/770cf02c/server/src/com/cloud/configuration/Config.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java
index 5ee0fad..5432ab6 100755
--- a/server/src/com/cloud/configuration/Config.java
+++ b/server/src/com/cloud/configuration/Config.java
@@ -216,7 +216,14 @@ public enum Config {
     AlertPurgeInterval("Advanced", ManagementServer.class, Integer.class, "alert.purge.interval", "86400", "The interval (in seconds) to wait before running the alert purge thread", null),
     AlertPurgeDelay("Advanced", ManagementServer.class, Integer.class, "alert.purge.delay", "0", "Alerts older than specified number days will be purged. Set this value to 0 to never delete alerts", null),
     HostReservationReleasePeriod("Advanced", ManagementServer.class, Integer.class, "host.reservation.release.period", "300000", "The interval in milliseconds between host reservation release checks", null),
-    
+    UseSystemPublicIps("Advanced", ManagementServer.class, Boolean.class, "use.system.public.ips", "true",
+            "If true, when account has dedicated public ip range(s), once the ips dedicated to the account have been" +
+            " consumed ips will be acquired from the system pool",
+            null, ConfigurationParameterScope.account.toString()),
+    UseSystemGuestVlans("Advanced", ManagementServer.class, Boolean.class, "use.system.guest.vlans", "true",
+                "If true, when account has dedicated guest vlan range(s), once the vlans dedicated to the account have been" +
+                " consumed vlans will be allocated from the system pool",
+                null, ConfigurationParameterScope.account.toString()),
 
     // LB HealthCheck Interval.
     LBHealthCheck("Advanced", ManagementServer.class, String.class, "healthcheck.update.interval", "600",

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/770cf02c/server/src/com/cloud/network/NetworkManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java
index d6a6450..f563335 100755
--- a/server/src/com/cloud/network/NetworkManagerImpl.java
+++ b/server/src/com/cloud/network/NetworkManagerImpl.java
@@ -445,7 +445,10 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
 
         // If all the dedicated IPs of the owner are in use fetch an IP from the system pool
         if (addrs.size() == 0 && fetchFromDedicatedRange) {
-            if (nonDedicatedVlanDbIds != null && !nonDedicatedVlanDbIds.isEmpty()) {
+            // Verify if account is allowed to acquire IPs from the system
+            boolean useSystemIps = Boolean.parseBoolean(_configServer.getConfigValue(Config.UseSystemPublicIps.key(),
+                    Config.ConfigurationParameterScope.account.toString(), owner.getId()));
+            if(useSystemIps && nonDedicatedVlanDbIds != null && !nonDedicatedVlanDbIds.isEmpty()) {
                 fetchFromDedicatedRange = false;
                 sc.setParameters("vlanId", nonDedicatedVlanDbIds.toArray());
                 errorMessage.append(", vlanId id=" + nonDedicatedVlanDbIds.toArray());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/770cf02c/server/src/com/cloud/network/guru/ExternalGuestNetworkGuru.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/guru/ExternalGuestNetworkGuru.java b/server/src/com/cloud/network/guru/ExternalGuestNetworkGuru.java
index eb1b3dc..87098f5 100644
--- a/server/src/com/cloud/network/guru/ExternalGuestNetworkGuru.java
+++ b/server/src/com/cloud/network/guru/ExternalGuestNetworkGuru.java
@@ -130,7 +130,8 @@ public class ExternalGuestNetworkGuru extends GuestNetworkGuru {
         // Get a vlan tag
         int vlanTag;
         if (config.getBroadcastUri() == null) {
-            String vnet = _dcDao.allocateVnet(zone.getId(), config.getPhysicalNetworkId(), config.getAccountId(), context.getReservationId());
+            String vnet = _dcDao.allocateVnet(zone.getId(), config.getPhysicalNetworkId(), config.getAccountId(),
+                    context.getReservationId(), canUseSystemGuestVlan(config.getAccountId()));
 
             try {
                 vlanTag = Integer.parseInt(vnet);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/770cf02c/server/src/com/cloud/network/guru/GuestNetworkGuru.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/guru/GuestNetworkGuru.java b/server/src/com/cloud/network/guru/GuestNetworkGuru.java
index 32ce744..89b0694 100755
--- a/server/src/com/cloud/network/guru/GuestNetworkGuru.java
+++ b/server/src/com/cloud/network/guru/GuestNetworkGuru.java
@@ -26,6 +26,7 @@ import javax.ejb.Local;
 import javax.inject.Inject;
 
 import com.cloud.event.ActionEventUtils;
+import com.cloud.server.ConfigurationServer;
 import com.cloud.utils.Pair;
 import org.apache.log4j.Logger;
 
@@ -98,6 +99,8 @@ public abstract class GuestNetworkGuru extends AdapterBase implements NetworkGur
     IPAddressDao _ipAddressDao;
     @Inject 
     protected PhysicalNetworkDao _physicalNetworkDao;    
+    @Inject
+    ConfigurationServer _configServer;
     Random _rand = new Random(System.currentTimeMillis());
 
     private static final TrafficType[] _trafficTypes = {TrafficType.Guest};
@@ -155,6 +158,11 @@ public abstract class GuestNetworkGuru extends AdapterBase implements NetworkGur
         return _isolationMethods;
     }
 
+    public boolean canUseSystemGuestVlan(long accountId) {
+        return Boolean.parseBoolean(_configServer.getConfigValue(Config.UseSystemGuestVlans.key(),
+            Config.ConfigurationParameterScope.account.toString(), accountId));
+    }
+
     protected abstract boolean canHandle(NetworkOffering offering, final NetworkType networkType, PhysicalNetwork physicalNetwork);
 
     @Override
@@ -260,7 +268,8 @@ public abstract class GuestNetworkGuru extends AdapterBase implements NetworkGur
     protected void allocateVnet(Network network, NetworkVO implemented, long dcId,
     		long physicalNetworkId, String reservationId) throws InsufficientVirtualNetworkCapcityException {
         if (network.getBroadcastUri() == null) {
-            String vnet = _dcDao.allocateVnet(dcId, physicalNetworkId, network.getAccountId(), reservationId);
+            String vnet = _dcDao.allocateVnet(dcId, physicalNetworkId, network.getAccountId(), reservationId,
+                    canUseSystemGuestVlan(network.getAccountId()));
             if (vnet == null) {
                 throw new InsufficientVirtualNetworkCapcityException("Unable to allocate vnet as a " +
                 		"part of network " + network + " implement ", DataCenter.class, dcId);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/770cf02c/setup/db/db/schema-410to420.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-410to420.sql b/setup/db/db/schema-410to420.sql
index bcfbcc9..272fc42 100644
--- a/setup/db/db/schema-410to420.sql
+++ b/setup/db/db/schema-410to420.sql
@@ -1854,3 +1854,6 @@ SET foreign_key_checks = 1;
 UPDATE `cloud`.`snapshot_policy` set uuid=id WHERE uuid is NULL;
 #update shared sg enabled network with not null name in Advance Security Group enabled network
 UPDATE `cloud`.`networks` set name='Shared SG enabled network', display_text='Shared SG enabled network' WHERE name IS null AND traffic_type='Guest' AND data_center_id IN (select id from data_center where networktype='Advanced' and is_security_group_enabled=1) AND acl_type='Domain';
+
+INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'use.system.public.ips', 'true', 'If true, when account has dedicated public ip range(s), once the ips dedicated to the account have been consumed ips will be acquired from the system pool');
+INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'use.system.guest.vlans', 'true', 'If true, when account has dedicated guest vlan range(s), once the vlans dedicated to the account have been consumed vlans will be allocated from the system pool');


[40/50] [abbrv] git commit: updated refs/heads/vmsync to e2edae1

Posted by ah...@apache.org.
CLOUDSTACK-3016: remove zonetype parameter from listClusters API.


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

Branch: refs/heads/vmsync
Commit: 9d0d02222b4083fe3cb9f5aac9deb5be12bea018
Parents: 9e7356c
Author: Jessica Wang <je...@apache.org>
Authored: Mon Jun 17 15:28:39 2013 -0700
Committer: Jessica Wang <je...@apache.org>
Committed: Mon Jun 17 15:28:39 2013 -0700

----------------------------------------------------------------------
 .../command/admin/cluster/ListClustersCmd.java  |  8 +---
 .../com/cloud/server/ManagementServerImpl.java  | 45 ++++++--------------
 2 files changed, 13 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9d0d0222/api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java b/api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java
index f2dd349..0417b18 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java
@@ -70,9 +70,6 @@ public class ListClustersCmd extends BaseListCmd {
     @Parameter(name=ApiConstants.MANAGED_STATE, type=CommandType.STRING, description="whether this cluster is managed by cloudstack")
     private String managedState;
 
-    @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.SHOW_CAPACITIES, type=CommandType.BOOLEAN, description="flag to display the capacity of the clusters")
     private Boolean showCapacities;
 
@@ -117,10 +114,7 @@ public class ListClustersCmd extends BaseListCmd {
         this.managedState = managedstate;
     }
 
-    public String getZoneType() {
-        return zoneType;
-    }
-    
+
     public Boolean getShowCapacities() {
         return showCapacities;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9d0d0222/server/src/com/cloud/server/ManagementServerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java
index 96c72e4..f09aa21 100755
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@ -996,67 +996,46 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
 
     @Override
     public Pair<List<? extends Cluster>, Integer> searchForClusters(ListClustersCmd cmd) {
-    	Object id = cmd.getId();
+        Filter searchFilter = new Filter(ClusterVO.class, "id", true, cmd.getStartIndex(), cmd.getPageSizeVal());
+        SearchCriteria<ClusterVO> sc = _clusterDao.createSearchCriteria();
+
+        Object id = cmd.getId();
         Object name = cmd.getClusterName();
         Object podId = cmd.getPodId();
         Long zoneId = cmd.getZoneId();
         Object hypervisorType = cmd.getHypervisorType();
         Object clusterType = cmd.getClusterType();
         Object allocationState = cmd.getAllocationState();
-        String zoneType = cmd.getZoneType();
         String keyword = cmd.getKeyword();
-        zoneId = _accountMgr.checkAccessAndSpecifyAuthority(UserContext.current().getCaller(), zoneId);
-
-
-    	Filter searchFilter = new Filter(ClusterVO.class, "id", true, cmd.getStartIndex(), cmd.getPageSizeVal());
-
-        SearchBuilder<ClusterVO> sb = _clusterDao.createSearchBuilder();
-        sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ);
-        sb.and("name", sb.entity().getName(), SearchCriteria.Op.LIKE);
-        sb.and("podId", sb.entity().getPodId(), SearchCriteria.Op.EQ);
-        sb.and("dataCenterId", sb.entity().getDataCenterId(), SearchCriteria.Op.EQ);
-        sb.and("hypervisorType", sb.entity().getHypervisorType(), SearchCriteria.Op.EQ);
-        sb.and("clusterType", sb.entity().getClusterType(), SearchCriteria.Op.EQ);
-        sb.and("allocationState", sb.entity().getAllocationState(), SearchCriteria.Op.EQ);
-
-        if(zoneType != null) {
-            SearchBuilder<DataCenterVO> zoneSb = _dcDao.createSearchBuilder();
-            zoneSb.and("zoneNetworkType", zoneSb.entity().getNetworkType(), SearchCriteria.Op.EQ);
-            sb.join("zoneSb", zoneSb, sb.entity().getDataCenterId(), zoneSb.entity().getId(), JoinBuilder.JoinType.INNER);
-        }
 
+        zoneId = _accountMgr.checkAccessAndSpecifyAuthority(UserContext.current().getCaller(), zoneId);
 
-        SearchCriteria<ClusterVO> sc = sb.create();
         if (id != null) {
-            sc.setParameters("id", id);
+            sc.addAnd("id", SearchCriteria.Op.EQ, id);
         }
 
         if (name != null) {
-            sc.setParameters("name", "%" + name + "%");
+            sc.addAnd("name", SearchCriteria.Op.LIKE, "%" + name + "%");
         }
 
         if (podId != null) {
-            sc.setParameters("podId", podId);
+            sc.addAnd("podId", SearchCriteria.Op.EQ, podId);
         }
 
         if (zoneId != null) {
-            sc.setParameters("dataCenterId", zoneId);
+            sc.addAnd("dataCenterId", SearchCriteria.Op.EQ, zoneId);
         }
 
         if (hypervisorType != null) {
-            sc.setParameters("hypervisorType", hypervisorType);
+            sc.addAnd("hypervisorType", SearchCriteria.Op.EQ, hypervisorType);
         }
 
         if (clusterType != null) {
-            sc.setParameters("clusterType", clusterType);
+            sc.addAnd("clusterType", SearchCriteria.Op.EQ, clusterType);
         }
 
         if (allocationState != null) {
-            sc.setParameters("allocationState", allocationState);
-        }
-
-        if(zoneType != null) {
-            sc.setJoinParameters("zoneSb", "zoneNetworkType", zoneType);
+            sc.addAnd("allocationState", SearchCriteria.Op.EQ, allocationState);
         }
 
         if (keyword != null) {