cnplab / cosmos

ClickOS toolstack
BSD 3-Clause "New" or "Revised" License
18 stars 16 forks source link

Probem openning ClickOS console with cosmos #3

Closed lbondan closed 10 years ago

lbondan commented 10 years ago

After create and start a ClickOS VM with 'xl' and 'cosmos', I tried to open a ClickOS console with the command:

xl console clickos

However, the console stops and I can't access the VM. My terminal shows the following message:

Xen Minimal OS! start_info: 0x1c0000(VA) nr_pages: 0xc00 shared_inf: 0x2ffa4000(MA) pt_base: 0x1c3000(VA) nr_pt_frames: 0x5 mfn_list: 0x1ba000(VA) mod_start: 0x0(VA) mod_len: 0 flags: 0x0 cmd_line: stack: 0x177040-0x197040 MM: Init _text: 0x0(VA) _etext: 0xe13fd(VA) _erodata: 0x15d000(VA) _edata: 0x15ebb8(VA) stack start: 0x177040(VA) _end: 0x1b9010(VA) start_pfn: 1cb max_pfn: c00 Mapping memory range 0x400000 - 0xc00000 setting 0x0-0x15d000 readonly skipped 0x1000 MM: Initialise page allocator for 1cf000(1cf000)-c00000(c00000) MM: done Demand map pfns at c01000-2000c01000. Heap resides at 2000c02000-4000c02000. Initialising timer interface Initialising console ... done. gnttab_table mapped at 0xc01000. Initialising scheduler Thread "Idle": pointer: 0x2000c02050, stack: 0x1e0000 Thread "xenstore": pointer: 0x2000c02800, stack: 0x1f0000 xenbus initialised on irq 1 mfn 0x124079 Thread "shutdown": pointer: 0x2000c02fb0, stack: 0x200000 Dummy main: start_info=0x197040 Thread "main": pointer: 0x2000c03760, stack: 0x210000 sparsing 0MB at 176000 "main"

And nothing else happens. I'm don't know where is the problem, but it appears to be with cosmos.

Any idea about how to solve this problem?

jpemartins commented 10 years ago

Hey Lucas,

It looks that you just booted ClickOS but didnt instantiate a click config. Could you paste here the sequence of commands you did?

Normally, you first need to do "xl create" and afterwards "cosmos start "

lbondan commented 10 years ago

Hi João,

After generate the ClickOS image, I did the following commands:

xl create example.cfg cosmos start clickos mirror.click.

The "example.cfg" and "mirror.click" are the same examples available in https://cnp.neclab.eu/getting-started/

jpemartins commented 10 years ago

My bad, there is a slight change in the click config process that I didn't clarify in the web page. you are using clickos v0.1 right? If thats the case, try using cosmos tag "v0.1" and redo those steps.

That tag is specifically for clickos v0.1 and since upstreaming there has been some changes and improvements here and there.

Thanks!

lbondan commented 10 years ago

Ok. Where can I set the "v0.1" tag?

jpemartins commented 10 years ago

git checkout v0.1

lbondan commented 10 years ago

I'm trying the following:

!/bin/sh

git clone git://xenbits.xen.org/xen.git export XEN_ROOT=pwd/xen git clone https://github.com/cnplab/mini-os.git #-b stable-v0.1 export MINIOS_ROOT=pwd/mini-os git clone https://github.com/cnplab/toolchain #-b v0.1 cd toolchain make cd - export NEWLIB_ROOT=pwd/toolchain/x86_64-root/x86_64-xen-elf export LWIP_ROOT=pwd/toolchain/x86_64-root/x86_64-xen-elf git clone https://github.com/cnplab/clickos.git #-b v0.1 cd clickos ./configure --enable-minios --with-xen=$XEN_ROOT make minios

After that, I clone cosmos:

git clone https://github.com/cnplab/cosmos

and change to "v0.1" on cosmos:

git checkout v0.1

Te result after perform "make" on cosmos is the following: MKD /root/nfv/cosmos/build MKD /root/nfv/cosmos/dist MKD /root/nfv/cosmos/dist/bin MKD /root/nfv/cosmos/dist/lib MKD /root/nfv/cosmos/build/libxcl MKD /root/nfv/cosmos/build/libcosmos MKD /root/nfv/cosmos/build/cosmos CC /root/nfv/cosmos/src/main.c CC /root/nfv/cosmos/src/clickos.c CC /root/nfv/cosmos/src/domain_none.c /root/nfv/cosmos/src/domain_none.c:54:6: warning: function declaration isn’t a prototype [-Wstrict-prototypes] void domain_ctx_free() ^ /root/nfv/cosmos/src/domain_none.c: In function ‘domain_ctx_init’: /root/nfv/cosmos/src/domain_none.c:52:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ LD /root/nfv/cosmos/dist/bin/cosmos

Then:

xl create example.cfg cosmos start clickos mirror.click xl console clickos

And the problem with 'xl console clickos' remains.

Am I forgetting something? Probably a ClickOS tag?

jpemartins commented 10 years ago

Looks like the v0.1 tag in cosmos is not needed since you are using clickos "master" branch. Instead you should use "master" for cosmos repository.

It is weird you have issues, I did a few tests before releasing v0.2 (mirror included) and everything worked fine.

We will try to reproduce things here and get back to you.

In the meantime could you tell us which the commit hash in the following repositories: clickos, mini-os, and cosmos?

Thanks for reporting :-)

lbondan commented 10 years ago

The hash codes are the following: clickos: c197357ac6ceaa7f44c430643c1a6cdef330a6f5 mini-os: ae9a7bf10d6620d196dece2b7bfd186d4bcbd908 cosmos: 17cbf68cef45b47e40011e3f9ec090d50c0ef313

Thank you for your support João. I'm a "newbee" with virtualization technologies, but I'm very interested in to use ClickOS as my NFV platform.

fmanco commented 10 years ago

Hi Lucas

Unfortunately when compiling cosmos without DOMLIB you cannot use a domain name to start a configuration. You can either try to compile cosmos with a DOMLIB, for instance make DOMLIB=xcl, or start the configuration using the domain id.

If it still doesn't work please let me know the output of cosmos. Thanks.

jpemartins commented 10 years ago

When compiling without a DOMLIB there is no conversion from name to id and that is the reason why you click config doesnt start.

To get the correspondent domain id you can run the following:

DOMID=xl list | grep clickos | awk -F' ' '{ print $2 }'

And then:

cosmos start $DOMID mirror.click

I think it solves your issue. Good point @fmanco :-D

But compiling with a DOMLIB removes of using xl tool and lets you work with cosmos alone.

Cheers

lbondan commented 10 years ago

Hi Filipe and João,

I tried make cosmos with DOMLIB=xl and used the DOMID as João suggested. In xl list, clickos appears now running (State = r-----) and the the result of xl console clikcos is now different:

xl console clickos

Xen Minimal OS! start_info: 0x1c0000(VA) nr_pages: 0xc00 shared_inf: 0x5082a000(MA) pt_base: 0x1c3000(VA) nr_pt_frames: 0x5 mfn_list: 0x1ba000(VA) mod_start: 0x0(VA) mod_len: 0 flags: 0x0 cmd_line: stack: 0x177040-0x197040 MM: Init _text: 0x0(VA) _etext: 0xe13fd(VA) _erodata: 0x15d000(VA) _edata: 0x15ebb8(VA) stack start: 0x177040(VA) _end: 0x1b9010(VA) start_pfn: 1cb max_pfn: c00 Mapping memory range 0x400000 - 0xc00000 setting 0x0-0x15d000 readonly skipped 0x1000 MM: Initialise page allocator for 1cf000(1cf000)-c00000(c00000) MM: done Demand map pfns at c01000-2000c01000. Heap resides at 2000c02000-4000c02000. Initialising timer interface Initialising console ... done. gnttab_table mapped at 0xc01000. Initialising scheduler Thread "Idle": pointer: 0x2000c02050, stack: 0x1e0000 Thread "xenstore": pointer: 0x2000c02800, stack: 0x1f0000 xenbus initialised on irq 1 mfn 0x12414a Thread "shutdown": pointer: 0x2000c02fb0, stack: 0x200000 Dummy main: start_info=0x197040 Thread "main": pointer: 0x2000c03760, stack: 0x210000 sparsing 0MB at 176000 "main" [on_status:205] router id 0 [on_status:206] status change to Running Thread "click": pointer: 0x2000c10a00, stack: 0x230000 Failed to read /local/domain/0/backend/vif/23/0/feature-netmap. ****** NETFRONT for device/vif/0

net TX ring size 256 net RX ring size 256 backend at /local/domain/0/backend/vif/23/0 mac is 00:15:17:15:5d:74


[router_thread:157] Starting driver...

It worked!

Now, how can I analyze if the Click configuration (mirror.click) is working properly? I want to try the firewall available in the website too, as João demonstrated in his NSDI presentation.

Again, thank you guys!

jpemartins commented 10 years ago

Glad to hear that!

Mirror is just swapping src and dst MAC addresses. If you want a quicker example try the ponger example.

But seeing if it works it's up to your linux networking skills. I think it helps reading a bit more about click/bridge/networking and trying things out :-)

Good luck with your experiments! Cheers

shashibici commented 9 years ago

Hi there,

I encountered a similar problem as lbondan did. (We have similar outputs.) I follow the instructions from here: http://cnp.neclab.eu/getting-started#clickos except that I use my own Xen configuration file and click configuration file (see below). Then I tested the Ponger, but no results. (i.e. Nothing was printed in xl console, even though I open an new xl console for observation.)

What I did to run click0:

1) brctl addbr xenbr0 2) ifconfig xenbr0 up 3) ifconfig xenbr0 172.16.97.80 4) route add default gw 172.16.97.2 xenbr0 5) brctl addif xenbr0 eth0 6) xl create ./minios/config.xen (content of config.xen see below) 7) cosmos start $DOMID ponger.click (content of ponger.click see below) 8) xl console click0

What I did after click0 is running:

1) ping 172.16.97.81 -I xenbr0 (the ping receives response and it goes well) 2) open a new console for click0: 'xl console click0' 3) observe the output in the new console. 4) Nothing was observed.

The out put of 'xl console click0' :

Xen Minimal OS! start_info: 0x1c2000(VA) nr_pages: 0xc00 shared_inf: 0x7f360000(MA) pt_base: 0x1c5000(VA) nr_pt_frames: 0x5 mfn_list: 0x1bc000(VA) mod_start: 0x0(VA) mod_len: 0 flags: 0x0 cmd_line: stack: 0x179040-0x199040 MM: Init _text: 0x0(VA) _etext: 0xe2336(VA) _erodata: 0x15f000(VA) _edata: 0x160bb8(VA) stack start: 0x179040(VA) _end: 0x1bb010(VA) start_pfn: 1cd max_pfn: c00 Mapping memory range 0x400000 - 0xc00000 setting 0x0-0x15f000 readonly skipped 0x1000 MM: Initialise page allocator for 1d1000(1d1000)-c00000(c00000) MM: done Demand map pfns at c01000-2000c01000. Heap resides at 2000c02000-4000c02000. Initialising timer interface Initialising console ... done. gnttab_table mapped at 0xc01000. Initialising scheduler Thread "Idle": pointer: 0x2000c02050, stack: 0x1e0000 Thread "xenstore": pointer: 0x2000c02800, stack: 0x1f0000 xenbus initialised on irq 1 mfn 0x7f35c Thread "shutdown": pointer: 0x2000c02fb0, stack: 0x200000 Dummy main: start_info=0x199040 Thread "main": pointer: 0x2000c03760, stack: 0x210000 sparsing 0MB at 178000 "main" [on_status:205] router id 0 [on_status:206] status change to Running Thread "click": pointer: 0x2000c10bd0, stack: 0x230000 Failed to read /local/domain/0/backend/vif/8/0/feature-netmap. ****** NETFRONT for device/vif/0

net TX ring size 256 net RX ring size 256 backend at /local/domain/0/backend/vif/8/0 mac is 00:15:17:15:5d:74


[router_thread:157] Starting driver...

Output when I shutdown click0 using 'xl shutdown click0' :

[app_shutdown:365] Requested shutdown reason=poweroff [router_stop:172] Stopping all routers...

[router_stop:179] Stopping instance = 0...

[router_thread:160] Stopping driver...

close network: backend at /local/domain/0/backend/vif/8/0 [router_thread:164] Master/driver stopped, closing router_thread Thread "click" exited. [router_stop:186] Stopped all routers...

[main:350] Shutting down... close(0) close(1) close(2) main returned 0 MiniOS will shutdown (reason = poweroff) ...

I think clickos elements perhaps did not work.

Carefully compared with the output shown on this site: http://cnp.neclab.eu/getting-started#clickos , I found that after "main", it does not have "-d" or "standard". Also, "[on:82] * 18 for clickos/0/elements" and "[on:82] * 17 for clickos/0/control" are missing.

Content of config.xen

kernel = './minios/build/clickos_x86_64' vcpus = '1' memory = '12' vif = ['mac=00:15:17:15:5d:74,bridge=xenbr0'] name = 'click0' on_crash = 'preserve'

Content of ponger.click

define($IP 172.16.97.81); define($MAC 00:15:17:15:5d:75);

source :: FromDevice;
sink   :: ToDevice;
// classifies packets 
c :: Classifier(
    12/0806 20/0001, // ARP Requests goes to output 0
    12/0806 20/0002, // ARP Replies to output 1
    12/0800, // ICMP Requests to output 2
    -); // without a match to output 3

arpq :: ARPQuerier($IP, $MAC);
arpr :: ARPResponder($IP $MAC);

source -> c;
c[0] -> ARPPrint -> arpr -> sink;
c[1] -> [1]arpq;
Idle -> [0]arpq;
arpq -> ARPPrint -> sink;
c[2] -> CheckIPHeader(14) -> ICMPPingResponder() -> EtherMirror() -> sink;
c[3] -> Discard;

Best wishes, Hongda

fmanco commented 9 years ago

Hey Hongda

I'm not sure of what's your question. As far as I can see everything is working ok. What do you expect to see in the console?

For instance, if you want to see the ICMP packets, you need to print them in your click configuration (using the IPPrint element). Also, you can only see the messages once. The console is buffered by xenconsoled and dump to your terminal with xl console.

Filipe

shashibici commented 9 years ago

Thank you so much, Filipe!

I observed ICMP packets, using IPPrint element. Everything goes well.

I think I need more study on click element and keep using ClickOS to do some more experiments.

Hongda

fmanco commented 9 years ago

Great!

Best Regards Filipe