Skip to content

Commit f54461a

Browse files
author
Dingane Hlaluku
committed
Allow users to create L2 network types
1 parent f7327c7 commit f54461a

3 files changed

Lines changed: 6 additions & 13 deletions

File tree

server/src/com/cloud/network/NetworkServiceImpl.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,8 +1101,8 @@ public Network createGuestNetwork(CreateNetworkCmd cmd) throws InsufficientCapac
11011101
}
11021102

11031103
// Only Admin can create Shared networks
1104-
if ((ntwkOff.getGuestType() == GuestType.Shared || ntwkOff.getGuestType() == GuestType.L2) && !_accountMgr.isAdmin(caller.getId())) {
1105-
throw new InvalidParameterValueException("Only Admins can create network with guest type " + GuestType.Shared + " or " + GuestType.L2);
1104+
if ((ntwkOff.getGuestType() == GuestType.Shared) && !_accountMgr.isAdmin(caller.getId())) {
1105+
throw new InvalidParameterValueException("Only Admins can create network with guest type " + GuestType.Shared);
11061106
}
11071107

11081108
// Check if the network is domain specific
@@ -1822,8 +1822,8 @@ public boolean deleteNetwork(long networkId, boolean forced) {
18221822

18231823
Account owner = _accountMgr.getAccount(network.getAccountId());
18241824

1825-
// Only Admin can delete Shared and L2 networks
1826-
if ((network.getGuestType() == GuestType.Shared || network.getGuestType() == GuestType.L2) && !_accountMgr.isAdmin(caller.getId())) {
1825+
// Only Admin can delete Shared
1826+
if ((network.getGuestType() == GuestType.Shared) && !_accountMgr.isAdmin(caller.getId())) {
18271827
throw new InvalidParameterValueException("Only Admins can delete network with guest type " + network.getGuestType());
18281828
}
18291829

ui/scripts/network.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,7 @@
795795
isHeader: true
796796
}),
797797

798-
rootAdminAddL2Network: $.extend({}, addL2GuestNetwork.def, {
798+
AddL2Network: $.extend({}, addL2GuestNetwork.def, {
799799
isHeader: true
800800
})
801801

ui/scripts/sharedFunctions.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -831,13 +831,6 @@ var addL2GuestNetwork = {
831831
}
832832
},
833833

834-
preFilter: function(args) {
835-
if (isAdmin())
836-
return true;
837-
else
838-
return false;
839-
},
840-
841834
createForm: {
842835
title: 'label.add.l2.guest.network',
843836
fields: {
@@ -867,7 +860,7 @@ var addL2GuestNetwork = {
867860
url: createURL('listZones'),
868861
success: function(json) {
869862
var zones = $.grep(json.listzonesresponse.zone, function(zone) {
870-
return (zone.networktype == 'Advanced' && zone.securitygroupsenabled != true); //Isolated networks can only be created in Advanced SG-disabled zone (but not in Basic zone nor Advanced SG-enabled zone)
863+
return (zone.networktype == 'Advanced'); //Isolated networks can only be created in Advanced SG-disabled zone (but not in Basic zone nor Advanced SG-enabled zone)
871864
});
872865

873866
args.response.success({

0 commit comments

Comments
 (0)