cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From weiz...@apache.org
Subject git commit: updated refs/heads/4.2 to 743eed8
Date Thu, 31 Oct 2013 10:28:44 GMT
Updated Branches:
  refs/heads/4.2 e47dfb673 -> 743eed877


CLOUDSTACK-4987: only shared network and isolated network with same account can be assigned
to a VM


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

Branch: refs/heads/4.2
Commit: 743eed8771ce0fc382c3f1018e42d357d79163c5
Parents: e47dfb6
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:27:56 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/743eed87/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 a88a63b..d29d1ec 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -924,6 +924,10 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager,
Use
         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())
@@ -2685,7 +2689,10 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager,
Use
                         + 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/743eed87/ui/scripts/instances.js
----------------------------------------------------------------------
diff --git a/ui/scripts/instances.js b/ui/scripts/instances.js
index 3ad99f7..025084b 100644
--- a/ui/scripts/instances.js
+++ b/ui/scripts/instances.js
@@ -1801,8 +1801,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/743eed87/ui/scripts/network.js
----------------------------------------------------------------------
diff --git a/ui/scripts/network.js b/ui/scripts/network.js
index 8f548cd..e5bd39b 100755
--- a/ui/scripts/network.js
+++ b/ui/scripts/network.js
@@ -623,12 +623,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