eclipse-fog05 / fog05

End-to-End Compute, Storage and Networking Virtualisation.
http://fog05.io/
Other
56 stars 24 forks source link

[BUG]ModuleNotFoundError: No module named 'fog05' #131

Closed wuwei3 closed 5 years ago

wuwei3 commented 5 years ago

Describe the bug I download the source code from master, while I execute the command

sudo -u fos fos_linux /etc/fos/plugins/linux/linux_plugin.json

I got the error message "ModuleNotFoundError: No module named 'fog05'"

nofog05

I go to the "/usr/bin", open the fos_linux file, find:

fromplugins

how can I get these plugins?

To Reproduce

  1. install all the plugins
  2. execute the command
  3. exception throws

Expected behavior it should be start normally.

Desktop (please complete the following information):

Additional context Could you guys provide more detail on how to install the fog05? Like what plugins and dependencies need to install? what neccessary SDk need to install, what version of linux OS can insatll, etc.

gabrik commented 5 years ago

Hi @wuwei3, seems that you installed only the plugins but not the actual fog05 library. Some installation instruction are provided in INSTALL.md

But as you have already installed the plugins you can just run from the fog05 directory

$ ./fos_install.sh

It will install the agent and the python libraries.

Regarding the requirements:

Then you need to start YAKS and the agent prior to start the plugins

For YAKS

$ yaks -vv

For the agent:

$ sudo -u fos fagent -c /etc/fos/agent.json -v

this only if you are starting it by hands, or you can just use the systemd integration.

sudo systemctl start yaks
sudo systemctl start fos_agent
sudo systemctl start fos_linux
sudo systemctl start fos_linuxbridge
sudo systemctl start fos_lxd
wuwei3 commented 5 years ago

Hi gabrik, $ ./fos_install.sh I have executed, but i don't know whether the fog05 libraries are be installed, the log is below installlog.txt

As you said, the OS requirement is need ubuntu16 at least, for now, I am using the ubuntu14, so that means I will not successful install the fog05?

And what is the best version of python, I am using the python 3.7, it's ok for fog05?

gabrik commented 5 years ago

Hi @wuwei3 From the log everithing seems installed.

You can check it running yaksd -vv or fagent

Then you can start all the fog05 services in the node using systemctl

sudo systemctl start yaks
sudo systemctl start fos_agent
sudo systemctl start fos_linux
sudo systemctl start fos_linuxbridge
sudo systemctl start fos_lxd
wuwei3 commented 5 years ago

But the problem is what I said above,

I executed the "yaksd -vv" and "sudo -u fos fagent -c /etc/fos/agent.json -v" are ok,

but while I executing the "sudo -u fos fos_linux /etc/fos/plugins/linux/linux_plugin.json"

I got the exception: ModuleNotFoundError: No module named 'fog05'

And the "systemctl" not support in ubuntu14, I am using the ubuntu14, so I can't using the first way to start (Start Eclipse fog05 FIM using systemd) , so I have to use the second way(Start Eclipse fog05 FIM by hand), then, I encountered the exception.

gabrik commented 5 years ago

Ok, this is strange, because from the log the module is installed.

Can you check if it is actually installed? pip should create this directory when the library is installed: /usr/local/lib/python3.7/dist-packages/fog05-0.2.0a1-py3.7.egg

gabrik commented 5 years ago

Got the problem. Your pip is installing in python3.4

Copying fog05-0.2.0.a1-py3.4.egg to /usr/local/lib/python3.4/dist-packages
fog05 0.2.0.a1 is already the active version in easy-install.pth

Installed /usr/local/lib/python3.4/dist-packages/fog05-0.2.0.a1-py3.4.egg

Can you post the output of ls -ls /usr/bin/python3

wuwei3 commented 5 years ago

yes, you are right, I find it in pyhon3.4, this the output of 'ls -ls /usr/bin/python3'

2

gabrik commented 5 years ago

Ok, can you try to install the module by hands.

$ cd fog05/src/api/python/api
$ sudo python3.7 setup.py install

And then verify the installation using

$ python3.7
>>> from fog05 import FIMAPI
wuwei3 commented 5 years ago

it's ok for now. I executed the "from fog05 import FIMAPI", no error

gabrik commented 5 years ago

I guess is something strange that comes with Ubuntu 14.04. Let me know if now the plugins works and if there is any other error

wuwei3 commented 5 years ago

Another issue:

while I executing the "sudo -u fos /etc/fos/plugins/linuxbridge/linuxbridge_plugin /etc/fos/plugins/linuxbridge/linuxbridge_plugin.json", got the error:

3

gabrik commented 5 years ago

Can you paste the content of /etc/fos/plugins/linuxbridge/linuxbridge_plugin.json

wuwei3 commented 5 years ago

{ "configuration": { "vlan_range": [ 50, 100 ], "vlan_interface": "ens2", "use_vlan": false, "dataplane_interface": "eth0" "nodeid": "854010fa36cf92f13163ce6d5851aee4", "ylocator": "tcp/127.0.0.1:7887" }, "description": "linux Bridge network plugin", "requirements": [ "jinja2" ], "type": "network", "uuid": "d42b4163-af35-423a-acb4-a228290cf0be", "version": 1, "name": "linuxbridge" }

wuwei3 commented 5 years ago

for the command "sudo -u fos fos_linux /etc/fos/plugins/linux/linux_plugin.json", I still got error

6

gabrik commented 5 years ago

In linuxbridge_plugin.json there is a missing coma between "dataplane_interface": "eth0" and "nodeid": "854010fa36cf92f13163ce6d5851aee4" and also I see that the nodeid is not correct as it should follow UUID4 definition.

So update all your plugin configuration file with the correct nodeid coming from this script fog05/fos-plugins/LXD/to_uuid.sh Those configuration file are:

wuwei3 commented 5 years ago

but the nodeid is I got from "/var/lib/dbus/machine-id", as the install.md said, there is no "/etc/machine-id" in ubuntu14, I search on google, people said the file is under "/var/lib/dbus/", not correct?

gabrik commented 5 years ago

Well it this case you can use custom node id, by passing to the agent the parameter --id and use the same ID in the configuration files, you can get a valid UUID from https://www.uuidgenerator.net/ or by using uuidgen

So the command to start the agent becomes

sudo -u fos /etc/fos/agent -c /etc/fos/agent.json --id <some uuid> -v 

This reminds me why Ubuntu14 is not very supported

wuwei3 commented 5 years ago

while I executed the "Linux Plugin"-> "sudo -u fos fos_linux /etc/fos/plugins/linux/linux_plugin.json". I got some warning message:

16

it is normal? not impact anything?

gabrik commented 5 years ago

Mmm... I see, I guess there is a bug and so it search for the scripts in the same directory of the plugin file.

Just try to start it passing the full path of Linux plugin:

sudo -u fos /etc/fos/plugin/linux/linux_plugin /etc/fos/plugins/linux/linux_plugin.json

This should solve the problem

wuwei3 commented 5 years ago

sudo -u fos /etc/fos/plugin/linux/linux_plugin /etc/fos/plugins/linux/linux_plugin.json

it said ,not this command

55

gabrik commented 5 years ago

Sorry my bad I forgot an 's' in the path Correct one is:

sudo -u fos /etc/fos/plugins/linux/linux_plugin /etc/fos/plugins/linux/linux_plugin.json
wuwei3 commented 5 years ago

Great, it successful start, Thanks very much!!!!

But I have another question:

what API I can use ? is there any APi document on git?

There is example in your install.md,

api = FIMAPI(locator='127.0.0.1')

is there another API except the list() and close()?

gabrik commented 5 years ago

Sure, you can check some example here

There is an actual documentation, but I guess it is a little bit outdated

wuwei3 commented 5 years ago

Thanks, another question:

if I want to install fog05 on ubuntu 16, should I to install python? if yes, what is the best version of python for compatible fog 05?

gabrik commented 5 years ago

Yes, you should install python. In the VMs used for testing we use the default version for Ubuntu 16.04, which I guess is python3.5 or 3.6

Fell free to close the issue when you do not have any other question

wuwei3 commented 5 years ago

Ok, you could close, no question for now.