cloudstack-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CLOUDSTACK-10164) UI - not able to create a VPC
Date Thu, 30 Nov 2017 21:10:00 GMT

    [ https://issues.apache.org/jira/browse/CLOUDSTACK-10164?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16273434#comment-16273434
] 

ASF GitHub Bot commented on CLOUDSTACK-10164:
---------------------------------------------

rhtyd closed pull request #2345: CLOUDSTACK-10164: bugfix allow users to create a VPC through
the UI.
URL: https://github.com/apache/cloudstack/pull/2345
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/plugins/network-elements/nuage-vsp/src/com/cloud/network/manager/NuageVspManagerImpl.java
b/plugins/network-elements/nuage-vsp/src/com/cloud/network/manager/NuageVspManagerImpl.java
index 1bbef4ec2c7..96016e6bb53 100644
--- a/plugins/network-elements/nuage-vsp/src/com/cloud/network/manager/NuageVspManagerImpl.java
+++ b/plugins/network-elements/nuage-vsp/src/com/cloud/network/manager/NuageVspManagerImpl.java
@@ -57,6 +57,7 @@
 import java.util.Arrays;
 import java.util.Comparator;
 import java.util.HashMap;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.Optional;
@@ -845,18 +846,23 @@ private String findNuageVspCmsIdForDevice(long deviceId) {
         if (passedPhysicalNetworkId != null) {
             physicalNetworkId = Optional.of(passedPhysicalNetworkId);
         } else if (zoneId != null) {
-            physicalNetworkId = Optional.of(getPhysicalNetworkBasedOnZone(zoneId));
+            physicalNetworkId = Optional.ofNullable(getPhysicalNetworkBasedOnZone(zoneId));
         } else {
             throw new InvalidParameterValueException("No zoneid or physicalnetworkid specified.");
         }
 
-        List<VspDomainTemplate> domainTemplates;
+        if (!physicalNetworkId.isPresent()) {
+            return new LinkedList<>();
+        }
 
-        ListVspDomainTemplatesCommand agentCmd = new ListVspDomainTemplatesCommand(vspDomain,
keyword);
         Long hostId = getNuageVspHostId(physicalNetworkId.get());
+        if (hostId == null) {
+            return new LinkedList<>();
+        }
 
+        ListVspDomainTemplatesCommand agentCmd = new ListVspDomainTemplatesCommand(vspDomain,
keyword);
         ListVspDomainTemplatesAnswer answer = (ListVspDomainTemplatesAnswer) _agentMgr.easySend(hostId,
agentCmd);
-        domainTemplates = answer.getDomainTemplates();
+        List<VspDomainTemplate> domainTemplates = answer.getDomainTemplates();
 
         return domainTemplates.stream()
                        .map(NuageVspManagerImpl::createDomainTemplateResponse)
@@ -926,6 +932,10 @@ public boolean checkIfDomainTemplateExist(Long domainId, String domainTemplate,
     @Override
     public boolean entityExist(EntityExistsCommand cmd, Long physicalNetworkId){
         Long hostId = getNuageVspHostId(physicalNetworkId);
+        if (hostId == null) {
+            throw new CloudRuntimeException("There is no Nuage VSP device configured on physical
network " + physicalNetworkId);
+        }
+
         Answer answer = _agentMgr.easySend(hostId, cmd);
         if (answer != null) {
             return answer.getResult();
@@ -1168,7 +1178,7 @@ private Long getNuageVspHostId(long physicalNetworkId) {
             return config.getHostId();
         }
 
-        throw new CloudRuntimeException("There is no Nuage VSP device configured on physical
network " + physicalNetworkId);
+        return null;
     }
 
     @DB
diff --git a/ui/scripts/network.js b/ui/scripts/network.js
index 16feaf1f835..66ab75a42f0 100644
--- a/ui/scripts/network.js
+++ b/ui/scripts/network.js
@@ -5245,65 +5245,66 @@
                                                 args.context.domainTemplateMap = [];
                                                 args.context.globalDomainTemplateUsed = [];
                                             }
-                                                $.ajax({
-                                                    url: createURL('listNuageVspDomainTemplates'),
-                                                    dataType: "json",
-                                                    data: {
-                                                        zoneid: args.zoneid
-                                                    },
-                                                    async: true,
-                                                    success: function (json) {
-                                                        $.ajax({
-                                                            url: createURL('listNuageVspGlobalDomainTemplate'),
-                                                            dataType: "json",
-                                                            data: {
-                                                                name: "nuagevsp.vpc.domaintemplate.name"
-                                                            },
-                                                            async: true,
-                                                            success: function(PDTjson){
-                                                                var domaintemplates = json.listnuagevspdomaintemplatesresponse.domaintemplates
? json.listnuagevspdomaintemplatesresponse.domaintemplates : [];
-                                                                var preConfiguredDomainTemplate
= PDTjson.listnuagevspglobaldomaintemplateresponse.count == 1 ? PDTjson.listnuagevspglobaldomaintemplateresponse.domaintemplates[0].name
: "";
 
-                                                                if (!domaintemplates.length)
{
-                                                                    args.$form.find("[rel=nuageusedomaintemplate]").hide();
-                                                                }
+                                            $.ajax({
+                                                url: createURL('listNuageVspDomainTemplates'),
+                                                dataType: "json",
+                                                data: {
+                                                    zoneid: args.zoneid
+                                                },
+                                                async: true,
+                                                error: function(XMLHttpRequest, textStatus,
errorThrown) {
+                                                    args.response.success({});
+                                                },
+                                                success: function (json) {
+                                                    $.ajax({
+                                                        url: createURL('listNuageVspGlobalDomainTemplate'),
+                                                        dataType: "json",
+                                                        data: {
+                                                            name: "nuagevsp.vpc.domaintemplate.name"
+                                                        },
+                                                        async: true,
+                                                        success: function(PDTjson){
+                                                            var domaintemplates = json.listnuagevspdomaintemplatesresponse.domaintemplates
? json.listnuagevspdomaintemplatesresponse.domaintemplates : [];
+                                                            var preConfiguredDomainTemplate
= PDTjson.listnuagevspglobaldomaintemplateresponse.count == 1 ? PDTjson.listnuagevspglobaldomaintemplateresponse.domaintemplates[0].name
: "";
 
-                                                                var index = -1;
-                                                                $.each(domaintemplates, function(key,value)
{
-                                                                    if (preConfiguredDomainTemplate
== value.name) {
-                                                                        index = key;
-                                                                    }
-                                                                });
+                                                            if (!domaintemplates.length)
{
+                                                                args.$form.find("[rel=nuageusedomaintemplate]").hide();
+                                                            }
 
-                                                                //Set global pre configured
DT as the default by placing it to the top of the drop down list.
-                                                                if (index != -1) {
-                                                                    domaintemplates.unshift(domaintemplates[index]);
-                                                                    domaintemplates.splice(index
+ 1, 1);
-                                                                    args.$form.find("[rel=nuageusedomaintemplate]").show();
-                                                                    args.$form.find("[rel=nuagedomaintemplatelist]").show();
-                                                                    args.$form.find("[rel=nuageusedomaintemplate]").find("input").attr('checked',
true);
-                                                                    args.context.globalDomainTemplateUsed[args.zoneid]
= true;
-                                                                } else {
-                                                                    args.context.globalDomainTemplateUsed[args.zoneid]
= false;
+                                                            var index = -1;
+                                                            $.each(domaintemplates, function(key,value)
{
+                                                                if (preConfiguredDomainTemplate
== value.name) {
+                                                                    index = key;
                                                                 }
+                                                            });
 
-                                                                args.context.domainTemplateMap[args.zoneid]
= domaintemplates;
-                                                                args.response.success({
-                                                                    data: $.map(domaintemplates,
function (dt) {
-                                                                        return {
-                                                                            id: dt.name,
-                                                                            description:
dt.description
-                                                                        };
-                                                                    })
-                                                                });
+                                                            //Set global pre configured DT
as the default by placing it to the top of the drop down list.
+                                                            if (index != -1) {
+                                                                domaintemplates.unshift(domaintemplates[index]);
+                                                                domaintemplates.splice(index
+ 1, 1);
+                                                                args.$form.find("[rel=nuageusedomaintemplate]").show();
+                                                                args.$form.find("[rel=nuagedomaintemplatelist]").show();
+                                                                args.$form.find("[rel=nuageusedomaintemplate]").find("input").attr('checked',
true);
+                                                                args.context.globalDomainTemplateUsed[args.zoneid]
= true;
+                                                            } else {
+                                                                args.context.globalDomainTemplateUsed[args.zoneid]
= false;
                                                             }
-                                                        });
 
-                                                    }
-                                                });
-
-                                            //}
+                                                            args.context.domainTemplateMap[args.zoneid]
= domaintemplates;
+                                                            args.response.success({
+                                                                data: $.map(domaintemplates,
function (dt) {
+                                                                    return {
+                                                                        id: dt.name,
+                                                                        description: dt.description
+                                                                    };
+                                                                })
+                                                            });
+                                                        }
+                                                    });
 
+                                                }
+                                            });
                                         }
 
                                     }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> UI - not able to create a VPC
> -----------------------------
>
>                 Key: CLOUDSTACK-10164
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10164
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the default.) 
>          Components: UI
>    Affects Versions: 4.11.0.0
>            Reporter: Sigert Goeminne
>            Assignee: Sigert Goeminne
>            Priority: Blocker
>
> I'm not able to create a vpc through the UI.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message