Dear all,

Anyone implemented LXC on CloudStack before and can provide some advice?
Documentation is a bit limited on this area. Other than below
documentations, any other pointers anyone can provide?

http://docs.cloudstack.apache.org/projects/cloudstack-installation/en/4.8/hypervisor/lxc.html
https://cwiki.apache.org/confluence/display/CLOUDSTACK/LXC+Template+creation
https://cwiki.apache.org/confluence/display/CLOUDSTACK/LXC+Support+in+Cloudstack
https://cwiki.apache.org/confluence/display/CLOUDSTACK/LXC+Enhancements

Looking forward to your reply, thank you.

Cheers.

-ip-


On Fri, Jun 10, 2016 at 6:39 PM, Cloud List <cloud-l...@sg.or.id> wrote:

> Dear all,
>
> We tried to setup an LXC cluster and add an LXC host into a test
> CloudStack 4.8.0.1 environment. The cluster is created and the LXC host is
> created successfully. We also tried to follow below documentation to create
> an Ubuntu LXC template -- we are running Ubuntu 12.04.5 LTS.
>
>
> https://cwiki.apache.org/confluence/display/CLOUDSTACK/LXC+Template+creation
>
> ===
> Install lxc: apt-get install lxc
>
> Create  a container with any name, in our case 'ubuntu':
>
> sudo lxc-create -t download -n ubuntu -- --dist ubuntu --release trusty
> --arch amd64
>
> Creation of the LXC container will take a lot of time, it will be stored
> here: /var/lib/lxc/ubuntu
>
> Next stop the container:
> sudo lxc-stop -n ubuntu
>
> Next create a temp director, tar the rootfs and export the template:
> mkdir -p /tmp/lxc-template
> cd /tmp/lxc-template
> sudo tar --numeric-owner -czf /tmp/lxc-template/template.tar.gz
> /var/lib/lxc/ubuntu/rootfs/
> ===
>
> As per suggestion from Rohit on another thread, I saved the template file
> as .tar and register it to cloudstack with HVM disabled. I then tried to
> create an LXC container instance using the template, but after a long
> "Creating" process, the provisioning will fail with insufficient capacity
> error.
>
> ===
> 2016-06-10 18:24:45,468 DEBUG [o.a.c.f.j.i.AsyncJobManagerImpl]
> (API-Job-Executor-44:ctx-c8a4afdc job-232) (logid:523a0c37) Complete async
> job-232, jobStatus: FAILED, resultCode: 530, result:
> org.apache.cloudstack.api.response.ExceptionR
> esponse/null/{"uuidList":[],"errorcode":530,"errortext":"Unable to start a
> VM due to insufficient capacity"}
> ===
>
> Further check on the LXC host's agent.log shows that the provisioning
> failed due to libvirt exception, which says that the configuration is
> unsupported because the system lacks NETNS support
>
> "LibvirtException: unsupported configuration: System lacks NETNS support"
>
> See excerpts of the logs below:
>
> ===
> 2016-06-10 18:24:43,740 DEBUG
> [resource.wrapper.LibvirtStartCommandWrapper] (agentRequest-Handler-1:null)
> starting i-2-42-VM: <domain type='lxc'>
> <name>i-2-42-VM</name>
> <uuid>c29a74fb-e4bc-4aa2-bef4-3c8844de87df</uuid>
> <description>Ubuntu 14.04 (64-bit)</description>
> <clock offset='utc'>
> <timer name='kvmclock' >
> </timer>
> </clock>
> <features>
> <pae/>
> <apic/>
> <acpi/>
> </features>
> <devices>
> <emulator></emulator>
> <interface type='bridge'>
> <source bridge='cloudbr0'/>
> <mac address='06:a5:1c:00:00:2a'/>
> <model type='virtio'/>
> </interface>
> <filesystem type='mount'>
>   <source
> dir='/mnt/d7678837-9f9f-32ab-99f3-b508feb3595a/6d26a879-999f-4cba-bfcc-1d2d9e70af5c'/>
>   <target dir='/'/>
> </filesystem>
> <serial type='pty'>
> <target port='0'/>
> </serial>
> <console type='pty'>
> <target port='0'/>
> </console>
> </devices>
> <memory>1048576</memory>
> <devices>
> <memballoon model='none'/>
> </devices>
> <vcpu>1</vcpu>
> <os>
> <type>exe</type>
> <init>/sbin/init</init>
> </os>
> <cputune>
> <shares>1000</shares>
> </cputune>
> <cpu></cpu><on_reboot>restart</on_reboot>
> <on_poweroff>destroy</on_poweroff>
> <on_crash>destroy</on_crash>
> </domain>
>
> 2016-06-10 18:24:43,743 WARN
> [resource.wrapper.LibvirtStartCommandWrapper] (agentRequest-Handler-1:null)
> LibvirtException
> org.libvirt.LibvirtException: unsupported configuration: System lacks
> NETNS support
>         at org.libvirt.ErrorHandler.processError(Unknown Source)
>         at org.libvirt.ErrorHandler.processError(Unknown Source)
>         at org.libvirt.Connect.domainCreateXML(Unknown Source)
>         at
> com.cloud.hypervisor.kvm.resource.LibvirtComputingResource.startVM(LibvirtComputingResource.java:1293)
>         at
> com.cloud.hypervisor.kvm.resource.wrapper.LibvirtStartCommandWrapper.execute(LibvirtStartCommandWrapper.java:82)
>         at
> com.cloud.hypervisor.kvm.resource.wrapper.LibvirtStartCommandWrapper.execute(LibvirtStartCommandWrapper.java:46)
>         at
> com.cloud.hypervisor.kvm.resource.wrapper.LibvirtRequestWrapper.execute(LibvirtRequestWrapper.java:75)
>         at
> com.cloud.hypervisor.kvm.resource.LibvirtComputingResource.executeRequest(LibvirtComputingResource.java:1317)
>         at com.cloud.agent.Agent.processRequest(Agent.java:522)
>         at com.cloud.agent.Agent$AgentRequestHandler.doTask(Agent.java:830)
>         at com.cloud.utils.nio.Task.call(Task.java:83)
>         at com.cloud.utils.nio.Task.call(Task.java:29)
>         at java.util.concurrent.FutureTask.run(FutureTask.java:262)
>         at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>         at java.lang.Thread.run(Thread.java:745)
> 2016-06-10 18:24:43,744 DEBUG [kvm.storage.KVMStoragePoolManager]
> (agentRequest-Handler-1:null) Disconnecting disk
> 6d26a879-999f-4cba-bfcc-1d2d9e70af5c
> 2016-06-10 18:24:43,744 INFO  [kvm.storage.LibvirtStorageAdaptor]
> (agentRequest-Handler-1:null) Trying to fetch storage pool
> d7678837-9f9f-32ab-99f3-b508feb3595a from libvirt
> 2016-06-10 18:24:43,744 DEBUG [kvm.resource.LibvirtConnection]
> (agentRequest-Handler-1:null) Looking for libvirtd connection at: lxc:///
> 2016-06-10 18:24:43,751 DEBUG [kvm.storage.LibvirtStorageAdaptor]
> (agentRequest-Handler-1:null) Succesfully refreshed pool
> d7678837-9f9f-32ab-99f3-b508feb3595a Capacity: 483387244544 Used:
> 127107334144 Available: 356279910400
> 2016-06-10 18:24:43,757 DEBUG [cloud.agent.Agent]
> (agentRequest-Handler-1:null) Seq 7-8790463522673787745:  { Ans: , MgmtId:
> 181122461655966, via: 7, Ver: v1, Flags: 10,
> [{"com.cloud.agent.api.StartAnswer":{"vm":{"id":42,"name":"i-2-42-VM","type":"User","cpus":1,"minSpeed":1000,"maxSpeed":2000,"minRam":1073741824,"maxRam":1073741824,"arch":"x86_64","os":"Ubuntu
> 14.04 (64-bit)","platformEmulator":"Ubuntu
> 14.04","bootArgs":"","enableHA":true,"limitCpuUse":true,"enableDynamicallyScaleVm":false,"vncPassword":"hOWX3h7K6kkOpL316OApzQ","vncAddr":"192.168.3.202","params":{"memoryOvercommitRatio":"1.0","cpuOvercommitRatio":"2.0","Message.ReservedCapacityFreed.Flag":"false"},"uuid":"c29a74fb-e4bc-4aa2-bef4-3c8844de87df","disks":[{"data":{"org.apache.cloudstack.storage.to.VolumeObjectTO":{"uuid":"6d26a879-999f-4cba-bfcc-1d2d9e70af5c","volumeType":"ROOT","dataStore":{"org.apache.cloudstack.storage.to.PrimaryDataStoreTO":{"uuid":"d7678837-9f9f-32ab-99f3-b508feb3595a","id":5,"poolType":"NetworkFilesystem","host":"192.168.0.242","path":"/export/cloudstack3","port":2049,"url":"NetworkFilesystem://
> 192.168.0.242/export/cloudstack3/?ROLE=Primary&STOREUUID=d7678837-9f9f-32ab-99f3-b508feb3595a"}},"name":"ROOT-42","size":479057920,"path":"6d26a879-999f-4cba-bfcc-1d2d9e70af5c","volumeId":50,"vmName":"i-2-42-VM","accountId":2,"format":"DIR","provisioningType":"THIN","id":50,"deviceId":0,"cacheMode":"NONE","hypervisorType":"LXC"}},"diskSeq":0,"path":"6d26a879-999f-4cba-bfcc-1d2d9e70af5c","type":"ROOT","_details":{"managed":"false","storagePort":"2049","storageHost":"192.168.0.242","volumeSize":"479057920"}},{"data":{"org.apache.cloudstack.storage.to.TemplateObjectTO":{"id":0,"format":"ISO","accountId":0,"hvm":false}},"diskSeq":3,"type":"ISO"}],"nics":[{"deviceId":0,"networkRateMbps":100,"defaultNic":true,"pxeDisable":false,"nicUuid":"938ed009-54fa-4dd9-be7c-e5c95ab4fd27","uuid":"4b8f3aa8-21bb-4362-b695-ab4e41141227","ip":"192.168.0.192","netmask":"255.255.255.0","gateway":"192.168.0.1","mac":"06:a5:1c:00:00:2a","dns1":"8.8.8.8","dns2":"8.8.4.4","broadcastType":"Native","type":"Guest","broadcastUri":"vlan://untagged","isSecurityGroupEnabled":true}]},"result":false,"details":"unsupported
> configuration: System lacks NETNS support","wait":0}}] }
> 2016-06-10 18:24:43,935 DEBUG [cloud.agent.Agent]
> (agentRequest-Handler-2:null) Request:Seq 7-8790463522673787746:  { Cmd ,
> MgmtId: 181122461655966, via: 7, Ver: v1, Flags: 100011,
> [{"com.cloud.agent.api.StopCommand":{"isProxy":false,"executeInSequence":false,"checkBeforeCleanup":false,"vmName":"i-2-42-VM","wait":0}}]
> }
> 2016-06-10 18:24:43,936 DEBUG [cloud.agent.Agent]
> (agentRequest-Handler-2:null) Processing command:
> com.cloud.agent.api.StopCommand
> 2016-06-10 18:24:43,936 DEBUG [kvm.resource.LibvirtConnection]
> (agentRequest-Handler-2:null) Looking for libvirtd connection at:
> qemu:///system
> 2016-06-10 18:24:43,937 DEBUG [kvm.resource.LibvirtConnection]
> (agentRequest-Handler-2:null) Can not find KVM connection for Instance:
> i-2-42-VM, continuing.
> 2016-06-10 18:24:43,938 DEBUG [kvm.resource.LibvirtConnection]
> (agentRequest-Handler-2:null) Looking for libvirtd connection at: lxc:///
> 2016-06-10 18:24:43,939 DEBUG [kvm.resource.LibvirtConnection]
> (agentRequest-Handler-2:null) Can not find LXC connection for Instance:
> i-2-42-VM, continuing.
> 2016-06-10 18:24:43,939 WARN  [kvm.resource.LibvirtConnection]
> (agentRequest-Handler-2:null) Can not find a connection for Instance
> i-2-42-VM. Assuming the default connection.
> 2016-06-10 18:24:43,939 DEBUG [kvm.resource.LibvirtConnection]
> (agentRequest-Handler-2:null) Looking for libvirtd connection at: lxc:///
> 2016-06-10 18:24:43,940 DEBUG [kvm.resource.LibvirtComputingResource]
> (agentRequest-Handler-2:null) Failed to get dom xml:
> org.libvirt.LibvirtException: Domain not found: No domain with matching
> name 'i-2-42-VM'
> 2016-06-10 18:24:43,941 DEBUG [kvm.resource.LibvirtComputingResource]
> (agentRequest-Handler-2:null) Failed to get dom xml:
> org.libvirt.LibvirtException: Domain not found: No domain with matching
> name 'i-2-42-VM'
> 2016-06-10 18:24:43,941 DEBUG [kvm.resource.LibvirtComputingResource]
> (agentRequest-Handler-2:null) Try to stop the vm at first
> 2016-06-10 18:24:43,942 DEBUG [kvm.resource.LibvirtComputingResource]
> (agentRequest-Handler-2:null) VM i-2-42-VM doesn't exist, no need to stop it
> 2016-06-10 18:24:43,943 DEBUG [cloud.agent.Agent]
> (agentRequest-Handler-2:null) Seq 7-8790463522673787746:  { Ans: , MgmtId:
> 181122461655966, via: 7, Ver: v1, Flags: 10,
> [{"com.cloud.agent.api.StopAnswer":{"result":true,"wait":0}}] }
> 2016-06-10 18:25:02,268 DEBUG [kvm.resource.LibvirtConnection]
> (UgentTask-5:null) Looking for libvirtd connection at: lxc:///
> 2016-06-10 18:25:02,271 DEBUG [kvm.resource.LibvirtConnection]
> (UgentTask-5:null) Looking for libvirtd connection at: qemu:///system
> ===
>
> I checked and the system indeed supports namespace as per below result:
>
> ===
> root@sc-test-kvm-04:/var/log/cloudstack/agent# ip netns show
> blue
> ===
>
> Any pointers on how we can resolve the problem?
>
> Looking forward to your reply, thank you.
>
> Cheers.
>
> -ip-
>
>

Reply via email to