Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] TypeError: __init__() takes 1 positional argument but 2 were given #143

Closed
wuwei3 opened this issue Aug 13, 2019 · 50 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@wuwei3
Copy link

wuwei3 commented Aug 13, 2019

Describe the bug
I copied the https://github.com/atolab/fog05_demo/blob/master/fim_api/lifecycle_nonetwork.py
and execute the file, pass the params, but get the error:

9

Did I pass the wrong params?

To Reproduce
Steps to reproduce the behavior:

  1. copy the content of https://github.com/atolab/fog05_demo/blob/master/fim_api/lifecycle_nonetwork.py
  2. upload to server
  3. execute the py file
  4. See error

Desktop (please complete the following information):

  • OS: Ubuntu 16
  • Version: master
  • Involved plugin: All
@wuwei3 wuwei3 added the bug Something isn't working label Aug 13, 2019
@gabrik gabrik self-assigned this Aug 13, 2019
@gabrik
Copy link
Contributor

gabrik commented Aug 13, 2019

Hi @wuwei3, you are passing the right arguments I just tested it, but I cannot get the error, can you paste the content of the kvm_fdu.json file?

Because the error is in the FDU object creation

@wuwei3
Copy link
Author

wuwei3 commented Aug 13, 2019

kvm_fdu.txt

@gabrik
Copy link
Contributor

gabrik commented Aug 13, 2019

Thanks, from what I can see you are using a wrong descriptor, the last update modified a little bit the descriptor format
It should be like this:

{
    "id": "test-kvm-fdu",
    "name": "test",
    "computation_requirements": {
        "cpu_arch": "x86_64",
        "cpu_min_freq": 0,
        "cpu_min_count": 1,
        "ram_size_mb": 128,
        "storage_size_gb": 10
    },
    "image": {
        "uri": "file:///home/ubuntu/alpine.tar.gz",
        "checksum": "21f436639dda7941a26d1eb0c5427862fd19910b",
        "format": "tar.gz"
    },
    "hypervisor": "KVM",
    "migration_kind": "LIVE",
    "interfaces": [
        {
            "name": "eth0",
            "is_mgmt": false,
            "if_type": "INTERNAL",
            "mac_address": "be:ef:be:ef:00:01",
            "virtual_interface": {
                "intf_type": "VIRTIO",
                "vpci": "0:0:0",
                "bandwidth": 10
            },
            "cp_id": "fdu-cp-1"
        }
    ],
    "io_ports": [],
    "connection_points": [
        {
            "id": "fdu-cp-1",
            "name": "fdu-cp1",
            "vld_ref": "6cc2aa30-1dcf-4c93-a57e-433fd0bd498e"
        }
    ],
    "depends_on": []
}

Can you also check if you have the fog05-im python package installed?

pip3 list | grep fog05
fog05                    0.2.0
fog05-im                 0.2.0

Also I see that you are using a .tag.gz image with a KVM hypervisor, I think it will not work, as tipically KVM accepts image formats not compressed one, are you sure it is a KVM image and not an LXD one?

@wuwei3
Copy link
Author

wuwei3 commented Aug 13, 2019

Hi,
This is the 'pip3 list | grep fog05' result

4

And I am sorry, I don't have the KVM or LXD, so if it is not exits, it will throw error?

@gabrik
Copy link
Contributor

gabrik commented Aug 13, 2019

Ok, just to be sure do a git pull of the latest version and run

$ make -C src/im/python/ && sudo make -C src/im/python/ install
$ sudo make -C src/api/python/api/ install

If you do not have installed in the node the plugin for LXD or KVM it will not be able to instantiate the FDU.

In order to install the LXD plugin (for instance...)

sudo make -C fos-plugins/LXD install

and then edit the `/etc/fos/plugins/LXD/LXD_plugin.json" file with the correct nodeid

@wuwei3
Copy link
Author

wuwei3 commented Aug 14, 2019

"image": {
"uri": "file:///home/ubuntu/alpine.tar.gz",
"checksum": "21f436639dda7941a26d1eb0c5427862fd19910b",
"format": "tar.gz"
},

for this one, if I didn't have the 'alpine.tar.gz', what will happen?

is it this error?

4

@gabrik
Copy link
Contributor

gabrik commented Aug 14, 2019

Yes, you will have that error, in this case you can use another image, like one coming from the LXD repositiory, just using this portion as image:

"image": {
        "uri": "lxd://alpine/3.6",
        "checksum": "",
        "format": ""
    },

it will fetch the image from the LXD repository

@wuwei3
Copy link
Author

wuwei3 commented Aug 15, 2019

For the

"uri": "lxd://alpine/3.6"

You mean, this one could be run normally? I tried, it was the same error above.

Could you help me for how to get one image from remote? I mean, with the correct uri which could be run correctly. Thanks

@wuwei3
Copy link
Author

wuwei3 commented Aug 15, 2019

And I got another problme,

I executed the script files in ubuntu 16:

$ ./etc/systemd/enable
$ ./etc/systemd/start

but, if I execute the 'lxc list', got error:

3

But I get no problem in ubuntu14,

5

I don't know why, the different is I used 'Start Eclipse fog05 FIM by hand' in ubuntu 14, used the 'Start Eclipse fog05 FIM using systemd' in ubuntu 16.

@gabrik
Copy link
Contributor

gabrik commented Aug 18, 2019

All the fog05 components runs under a user called fos, that should be able to access the LXD daemon, so it should be part of the lxd group.

Can you try to run:

sudo -u fos lxc list

If you get a connection error this means that you have to add the user to the lxd group

sudo usermod -aG lxd fos

@gabrik
Copy link
Contributor

gabrik commented Aug 19, 2019

@wuwei3 can you also paste the output of the LXD plugin? I'm wondering if for some reason it is unable to get the image from the LXD repo

@zrnapoleon
Copy link

@gabrik Hello, wuwei3 and me work together. And I tried to run the LXD plugin by hand in ubuntu 16 (the other 4 YAKS, Agent, Linux and Linux-bridge have been run succesully):
sudo -u fos /etc/fos/plugins/LXD/LXD_plugin /etc/fos/plugins/LXD/LXD_plugin.json
But I got a NewConnectionError :
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='127.0.0.1', port=8443): Max retries exceeded with url: /1.0 (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f0d5565b2e8>: Failed to establish a new connection: [Errno 111] Connection refused',))

@zrnapoleon
Copy link

@gabrik And if i trt to run those plugins using Systemctl i met an error:

sudo ./etc/systemd/enable.sh

image

@gabrik
Copy link
Contributor

gabrik commented Aug 21, 2019

Hi @zrnapoleon,

This seems a misconfiguration of the LXD daemon, because for some reason the plugin is unable to contact the running daemon.
I suggest first to check if there is something listening on port 8443 on localhost, if yes, then I guess that the user 'fos' is not in the lxd group.
Or you may need to remove lxd and reinstall it from snap

$ sudo apt remove --purge lxd
$ sudo snap remove lxd
$ sudo snap install lxd

@zrnapoleon
Copy link

Hi @gabrik

I did just as you recommended but still cant enable those plugins:

image

@gabrik
Copy link
Contributor

gabrik commented Aug 22, 2019

before starting the LXD plugin can you run:

$ sudo lxd init

Then please verify if there is something listening on port 8443 using

$ sudo netstat -tlpn

If yes, please verify that the fos uses is inside the lxd group

$ sudo -u fos groups

@zrnapoleon
Copy link

Hi @gabrik,
I did:
$ sudo apt remove --purge lxd
$ sudo snap remove lxd
$ sudo snap install lxd
$ sudo lxd init
image

Parameters set for lxd INIT
image

ifconfig:
image

sudo netstat -tlpn
image
Nothing listening on port 8443

image

cd fos-plugins/LXD/
sudo make install

image

@gabrik
Copy link
Contributor

gabrik commented Aug 22, 2019

Ok, I see, the problem is that LXD it is not listening on port 8443, so the plugin is not able to connect.

Can you check if it is actually running:

$ sudo systemctl status snap.lxd.daemon

And then verify that the python3 client is working:

$ python3
> from pylxd import Client
> c = Client()

Please paste any error you get

Then try by deletting /var/lib/lxd/unix.socket and retry the python code, and to start the plugin manually

sudo -u fos /etc/fos/plugins/LXD/LXD_plugin /etc/fos/plugins/LXD/LXD_plugin.json

And paste the output

@zrnapoleon
Copy link

$ sudo systemctl status snap.lxd.daemon

image

python3 client
image
image
image
image

deleted /var/lib/lxd/unix.socket
image
python code again:
image
image

sudo -u fos /etc/fos/plugins/LXD/LXD_plugin /etc/fos/plugins/LXD/LXD_plugin.json
image

@gabrik
Copy link
Contributor

gabrik commented Aug 23, 2019

Ok, I see, can you try to reinstall the pylxd client.

$ sudo pip3 uninstall pylxd -y 
$ sudo pip3 install pylxd

Then probably there is a missing package for python api, which I need to fix the make file

So from the fog05 repo directory

$ cd /src/im/python
$ make
$ sudo make install

And then verify the operativity of the lxd plugin

@zrnapoleon
Copy link

I sucessfully reinstalled the pylxd client. but i got a error when i install the package for python:
image
it seams that i should install a python module "pyangbind" which has been already installed, i dont know why:
image

@gabrik
Copy link
Contributor

gabrik commented Aug 26, 2019

Hi @zrnapoleon, I guess you have to install pyang

sudo pip3 install pyang

And then the same steps as before to install the python package, you do not need sudo during make, only for make install

$ cd src/im/python
$ make
$ sudo make install

@zrnapoleon
Copy link

image
yeah, i checked and found that i have already installed it
i still got the following error when i instal the package:
image
image

@gabrik
Copy link
Contributor

gabrik commented Aug 26, 2019

I see, can you do a sudo make clean and then try the make

I guess there is some file with wrong permission due to the previous usage of sudo

@zrnapoleon
Copy link

Yeah it is!
image

And then i should try to start the plugin manually:
sudo -u fos /etc/fos/plugins/LXD/LXD_plugin /etc/fos/plugins/LXD/LXD_plugin.json
image
image

Or it still has something else need to fix before i do that?

@gabrik
Copy link
Contributor

gabrik commented Aug 26, 2019

This is strange, I think you have the pyangbind installed, can you try to execute sudo pip3 list | grep yang

You should get something like this:

$ sudo pip3 list | grep yang
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
pyang (1.7.5)
pyangbind (0.8.1)

@zrnapoleon
Copy link

Yeah, i have already instaled those 2 modules
image

@gabrik
Copy link
Contributor

gabrik commented Aug 26, 2019

In this case I think there is something strange in the path used by python to resolve the modules.
Can you run ls -ln /usr/bin/python3

@gabrik
Copy link
Contributor

gabrik commented Aug 26, 2019

I see, and if you run sudo -u fos ls -ln /usr/bin/python3 you get the same result?

Because I think that they are using two different path for python modules and so it cannot find the correct module

@eclipse-fog05 eclipse-fog05 deleted a comment from zrnapoleon Aug 26, 2019
@zrnapoleon
Copy link

i think they are the same result:
image

@gabrik
Copy link
Contributor

gabrik commented Aug 26, 2019

I see.
Then let's try to understand if there is something in the path
Can you run python3 -c "import sys; print(sys.path)" and sudo -u fos python3 -c "import sys; print(sys.path)" they should be the same

@zrnapoleon
Copy link

there is a little diff:
image

@gabrik
Copy link
Contributor

gabrik commented Aug 26, 2019

Ok then in this case we can check if the pyangbind is installed in that path
ls -ln /home/ubuntu/.local/lib/python3.6/site-packages | grep yang

@zrnapoleon
Copy link

yeah:
image

@gabrik
Copy link
Contributor

gabrik commented Aug 26, 2019

Ok, I think we can try to solve this by running this:

sudo -u fos sudo pip3 install pyangbind

Then it should be able to install in the right path, I still do not understand why it is installed in the user python path and not system-wide

@zrnapoleon
Copy link

but it was installed in the user python path again...
image

@gabrik
Copy link
Contributor

gabrik commented Aug 26, 2019

Ok then, remove it and reinstall it.

sudo pip3 uninstall pyangbind -y
sudo -H pip3 install pyangbind

I do not know if there is a way to force pip to install system-wide, usually install with sudo should make pip aware of the usage of system-wide path

Edit:

The -H flag on sudo should do the trick

@zrnapoleon
Copy link

Hi @gabrik ,

Thanks for your help and it seams that i have sucessfully started the lxd plugin:
image
but, if I execute the 'lxc list', got error, and the fos uses is inside the lxd group:
image

@gabrik
Copy link
Contributor

gabrik commented Aug 27, 2019

Hi @zrnapoleon

Can you check which lxc client is ubuntu using?
It should return something like this:

$ which lxc
/snap/bin/lxc

Or you can try with sudo -H -u fos lxc list

@zrnapoleon
Copy link

it returens like this:
image

@gabrik
Copy link
Contributor

gabrik commented Aug 27, 2019

Ok then you have to remove the old client in order to use the one shiped by snap

$ sudo apt remove --purge lxd-client

and now with which lxc you should get the right one.

But just for your infomation it is not an issue if fos user cannot do lxc list as to see containers you can still use your normal account

@zrnapoleon
Copy link

Yeah, for one node it works bur for the onther not:
image

image

@gabrik
Copy link
Contributor

gabrik commented Aug 27, 2019

This things drive me crazy...

Can you try a reboot on the node that is not working and then run lxc list ?
It makes no sense that it knows that it has to use /snap/bin/lxc but it uses /usr/bin/lxc

@zrnapoleon
Copy link

I rebooted the node then it solved. @gabrik Thank you very much for your patience and detailed explanation.

@gabrik
Copy link
Contributor

gabrik commented Aug 27, 2019

You are welcome!
Let me know if we can close this issue and in case of other problems/questions you can open other ones

@zrnapoleon
Copy link

@gabrik one more question: i dont know why each time i reboot my node, the yaksd service will start automaticlly, if i dont kill the ps, i cant do "yaksd -vv" to start the yaksd plugin manually:
image
image
and cant use systemed to start it:
image

@gabrik
Copy link
Contributor

gabrik commented Aug 27, 2019

@zrnapoleon the enable.sh enables autostart of yaksd and other components.

You can run

$ sudo systemctl disable yaks
$ sudo systemctl disable fos_agent
$ sudo systemctl disable fos_linux
$ sudo systemctl disable fos_linuxbridge
$ sudo systemctl disable fos_lxd

To disable this behaviour, then you can start it manually or using the script start.sh

To verify that error I guess you can run

$ sudo systemctl enable yaks
$ journalctl -xe

And copy the output so we can verify why is going in error

@zrnapoleon
Copy link

image

@gabrik
Copy link
Contributor

gabrik commented Aug 27, 2019

I see no errors in the output, I can also see output coming from yaksd so, I guess we can ignore that Failed to execute operation...

@zrnapoleon
Copy link

Ok, thanks! Ithink we can close this issue and in case of other questions we can open other one.

@gabrik gabrik closed this as completed Aug 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants