apache / cloudstack

Apache CloudStack is an opensource Infrastructure as a Service (IaaS) cloud computing platform
https://cloudstack.apache.org/
Apache License 2.0
2.06k stars 1.1k forks source link

Create VM error in iso network/KVM #3531

Closed digitalgust closed 5 years ago

digitalgust commented 5 years ago
ISSUE TYPE
COMPONENT NAME
System vm
CLOUDSTACK VERSION
cloudstack 4.11.3.0
template 4.11.3
CONFIGURATION

advance network KVM guest CIDR 172.16.1.0/16 manage_network & storage_network on cloudbr0 connect to hardware switch 0 public_newwork & guest_network on cloudbr1 connect to hardware switch 1 public traffic: gateway 10.0.0.1/8 reserve ip:10.0.99.100 - 10.0.99.199 pod: gateway 192.168.101.254/24 reserve ip : 192.168.101.100 - 192.168.101.199 vlan : 1000-1009 storage traffic: gateway192.168.100.254/24, reserve ip: 192.168.100.100 - 192.168.100.199 host : 192.168.101.50/24

OS / ENVIRONMENT

centos 7.6

SUMMARY

New install cloudstack , add advance network zone, system vm startup , ssvm cvm both "UP" , then "add isolated network" ok , state show allocated, then "add instance" , using "CentOS 5.5(64-bit) no GUI (KVM)" template that download completed. then error occured. no vrouter gerneted. the main error:

Unable to allocate vnet as a part of network Ntwk[204|Guest|8] implement Scope=interface com.cloud.dc.DataCenter; id=1

full log:


2019-07-30 19:32:54,368 INFO  [c.c.v.VirtualMachineManagerImpl] (Work-Job-Executor-9:ctx-c61c8bb0 job-37/job-39 ctx-4bd3af96) (logid:7ff32765) Insufficient capacity 
com.cloud.exception.InsufficientVirtualNetworkCapacityException: Unable to allocate vnet as a part of network Ntwk[204|Guest|8] implement Scope=interface com.cloud.dc.DataCenter; id=1
    at com.cloud.network.guru.GuestNetworkGuru.allocateVnet(GuestNetworkGuru.java:291)
    at com.cloud.network.guru.GuestNetworkGuru.implement(GuestNetworkGuru.java:320)
    at com.cloud.network.guru.ExternalGuestNetworkGuru.implement(ExternalGuestNetworkGuru.java:132)
    at org.apache.cloudstack.engine.orchestration.NetworkOrchestrator.implementNetwork(NetworkOrchestrator.java:1048)
    at org.apache.cloudstack.engine.orchestration.NetworkOrchestrator.implementNetwork(NetworkOrchestrator.java:987)
    at org.apache.cloudstack.engine.orchestration.NetworkOrchestrator.prepare(NetworkOrchestrator.java:1558)
    at com.cloud.vm.VirtualMachineManagerImpl.orchestrateStart(VirtualMachineManagerImpl.java:1111)
    at com.cloud.vm.VirtualMachineManagerImpl.orchestrateStart(VirtualMachineManagerImpl.java:4937)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.cloud.vm.VmWorkJobHandlerProxy.handleVmWorkJob(VmWorkJobHandlerProxy.java:107)
    at com.cloud.vm.VirtualMachineManagerImpl.handleVmWorkJob(VirtualMachineManagerImpl.java:5100)
    at com.cloud.vm.VmWorkJobDispatcher.runJob(VmWorkJobDispatcher.java:102)
    at org.apache.cloudstack.framework.jobs.impl.AsyncJobManagerImpl$5.runInContext(AsyncJobManagerImpl.java:581)
    at org.apache.cloudstack.managed.context.ManagedContextRunnable$1.run(ManagedContextRunnable.java:49)
    at org.apache.cloudstack.managed.context.impl.DefaultManagedContext$1.call(DefaultManagedContext.java:56)
    at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.callWithContext(DefaultManagedContext.java:103)
    at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.runWithContext(DefaultManagedContext.java:53)
    at org.apache.cloudstack.managed.context.ManagedContextRunnable.run(ManagedContextRunnable.java:46)
    at org.apache.cloudstack.framework.jobs.impl.AsyncJobManagerImpl$5.run(AsyncJobManagerImpl.java:529)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
STEPS TO REPRODUCE
EXPECTED RESULTS
vm created.
ACTUAL RESULTS
vm not created, state "Error"
digitalgust commented 5 years ago

I debug and trace the the mgmt code , found out the problem that database cloud.op_dc_vnet_alloc table have nothing , compare the other database of our production cloud, the table recorded vlan that setup in Zone creation, then i add a row manually , add a vm again , success. Now i will try to find out the cause why not the cloud.op_dc_vnet_alloc added rows on zone creation .

digitalgust commented 5 years ago

update bug summary: Issue : MgmtUI call api to create physical network when Zone creation, forgot vnetRange parameter when create physical network 2 ,

mgmt log:

2019-08-01 17:36:50,729 DEBUG [c.c.a.ApiServlet] (qtp532087022-19:ctx-6362ba4e) (logid:85dbf67a) ===START===  10.0.1.11 -- GET  command=createPhysicalNetwork&zoneid=7a2a1e5b-d0cc-4580-9891-ae9a3cb0095e&name=Physical%20Network%201&isolationmethods=VLAN&response=json&_=1564652210626
2019-08-01 17:36:50,756 DEBUG [c.c.a.ApiServlet] (qtp532087022-21:ctx-50abb42c) (logid:1a5a22a7) ===START===  10.0.1.11 -- GET  command=createPhysicalNetwork&zoneid=7a2a1e5b-d0cc-4580-9891-ae9a3cb0095e&name=Physical%20Network%202&isolationmethods=VLAN&response=json&_=1564652210627

so java source method call parameter vnetRange is null, can't insert into vlans to database

public PhysicalNetwork com.cloud.network.NetworkServiceImpl. createPhysicalNetwork(final Long zoneId, final String vnetRange, final String networkSpeed, final List<String> isolationMethods,
            String broadcastDomainRangeStr, final Long domainId, final List<String> tags, final String name){
...
           if (vnetRange != null) { //  ;;------------------------ vnetRange is null
                addOrRemoveVnets(vnetRange.split(","), pNetwork);
            }
...
}

/ui/scripts/zoneWizard.js bug here , forgot vlanRangeStart and vlanRangeEnd para:

                    } else if (args.data.zone.networkType == "Advanced") {
                        $(args.data.physicalNetworks).each(function(index) {
                            var thisPhysicalNetwork = this;
                            var array1 = [];
                            array1.push("&name=" + todb(thisPhysicalNetwork.name));
                            if (thisPhysicalNetwork.isolationMethod != null && thisPhysicalNetwork.isolationMethod.length > 0)
                                array1.push("&isolationmethods=" + todb(thisPhysicalNetwork.isolationMethod));
                            $.ajax({
                                url: createURL("createPhysicalNetwork&zoneid=" + args.data.returnedZone.id + array1.join("")),

Please fix it

rohityadavcloud commented 5 years ago

@digitalgust when deploying via the UI, after it creates the VLAN ip ranges, it updates the vlan range for the physical network and it runs the updatePhysicalNetwork API with the provided vlan range. Please specify the VLAN range here:

Screenshot from 2019-08-01 15-58-59

digitalgust commented 5 years ago

Yes , i have filled the vlan id when installation every times , but vlan id not in db . so i debug it to find the cause. unknow cause! maybe i reinstalled multiple times , installed different versions of cloudstack , 4.9/4.10/4.11/4.12 , is there a cached js file in browse ?

i reinstall management before one hour ago , the vlan correctly inserted into db . now , looks everything is works.

i will close the issue.

rohityadavcloud commented 5 years ago

That could be setup/installation issue, thanks for confirming @digitalgust.