cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From weiz...@apache.org
Subject [4/4] git commit: updated refs/heads/master to 382391f
Date Thu, 31 Oct 2013 10:49:36 GMT
CLOUDSTACK-4987: only shared network and isolated network with same account can be assigned
to a VM
(cherry picked from commit 743eed8771ce0fc382c3f1018e42d357d79163c5)


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

Branch: refs/heads/master
Commit: 382391f270836c5840076858fac62eac318e3f27
Parents: bad2390
Author: Wei Zhou <w.zhou@leaseweb.com>
Authored: Thu Oct 31 11:27:56 2013 +0100
Committer: Wei Zhou <w.zhou@leaseweb.com>
Committed: Thu Oct 31 11:37:31 2013 +0100

----------------------------------------------------------------------
 server/src/com/cloud/vm/UserVmManagerImpl.java |  9 ++++++++-
 ui/scripts/instances.js                        |  5 +++--
 ui/scripts/network.js                          | 10 ++++------
 3 files changed, 15 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/382391f2/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 a0c7151..80a4036 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -925,6 +925,10 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager,
Vir
         if(network == null) {
             throw new InvalidParameterValueException("unable to find a network with id "
+ networkId);
         }
+        if (!(network.getGuestType() == Network.GuestType.Shared && network.getAclType()
== ACLType.Domain)
+                && !(network.getAclType() == ACLType.Account && network.getAccountId()
== vmInstance.getAccountId())) {
+            throw new InvalidParameterValueException("only shared network or isolated network
with the same account_id can be added to vmId: " + vmId);
+        }
         List<NicVO> allNics = _nicDao.listByVmId(vmInstance.getId());
         for(NicVO nic : allNics){
             if(nic.getNetworkId() == network.getId())
@@ -2661,7 +2665,10 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager,
Vir
                         + network.getId() + " doesn't belong to zone "
                         + zone.getId());
             }
-
+            if (!(network.getGuestType() == Network.GuestType.Shared && network.getAclType()
== ACLType.Domain)
+                    && !(network.getAclType() == ACLType.Account && network.getAccountId()
== accountId)) {
+                throw new InvalidParameterValueException("only shared network or isolated
network with the same account_id can be added to vm");
+            }
             IpAddresses requestedIpPair = null;
             if (requestedIps != null && !requestedIps.isEmpty()) {
                 requestedIpPair = requestedIps.get(network.getId());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/382391f2/ui/scripts/instances.js
----------------------------------------------------------------------
diff --git a/ui/scripts/instances.js b/ui/scripts/instances.js
index ac8605a..a3d4ca5 100644
--- a/ui/scripts/instances.js
+++ b/ui/scripts/instances.js
@@ -1789,8 +1789,9 @@
                                                 $.ajax({
                                                     url: createURL('listNetworks'),
                                                     data: {
-                                                        listAll: true,
-                                                        zoneid: args.context.instances[0].zoneid
+                                                        zoneid: args.context.instances[0].zoneid,
+                                                        account: args.context.instances[0].account,
+                                                        domainid: args.context.instances[0].domainid
                                                     },
                                                     success: function(json) {
                                                         args.response.success({

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/382391f2/ui/scripts/network.js
----------------------------------------------------------------------
diff --git a/ui/scripts/network.js b/ui/scripts/network.js
index fabbe1c..708b2f1 100755
--- a/ui/scripts/network.js
+++ b/ui/scripts/network.js
@@ -617,12 +617,10 @@
                                     });
                                 }
 
-                                if (args.$form.find('.form-item[rel=domain]').css("display")
!= "none") {
-                                    if (args.data.domain != null && args.data.domain.length
> 0) {
-                                        $.extend(dataObj, {
-                                            domainid: args.data.domain
-                                        });
-                                    }
+                                if (args.data.domain != null && args.data.domain.length
> 0) {
+                                    $.extend(dataObj, {
+                                        domainid: args.data.domain
+                                    });
                                     if (args.data.account != null && args.data.account.length
> 0) {
                                         $.extend(dataObj, {
                                             account: args.data.account


Mime
View raw message