saltstack-formulas / lxd-formula

http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html
Other
21 stars 18 forks source link

Redhat Support #9

Open noelmcloughlin opened 6 years ago

noelmcloughlin commented 6 years ago

I updated the formula with this commit and tested on Fedora 27. Interested in feedback.

noelmcloughlin commented 6 years ago
# salt-call --local saltutil.sync_modules
local:
    - modules.lxd
# salt-call --local saltutil.sync_states
local:
    - states.lxd
    - states.lxd_container
    - states.lxd_image
    - states.lxd_profile

# sudo salt-call --local lxd.version
'lxd' __virtual__ returned False: The lxd execution module cannot be loaded: pylxd "2.2.4" is not supported, you need at least pylxd "2.2.5"

# sudo  salt-call --local lxd.pylxd_version
'lxd' __virtual__ returned False: The lxd execution module cannot be loaded: pylxd "2.2.4" is not supported, you need at least pylxd "2.2.5"
jochumdev commented 6 years ago

Its fine if you downgrade the requirement in _modules/lxd.py:66 to 2.2.4.

noelmcloughlin commented 6 years ago

Just upgraded with pip there.

# pip install --upgrade pylxd
Collecting pylxd
  Downloading pylxd-2.2.6.tar.gz (71kB)
..

# sudo salt-call --local lxd.version
local:
    2.21
[root@iedx10 salt]# sudo  salt-call --local lxd.pylxd_version
local:
    2.2.6
noelmcloughlin commented 6 years ago

Needs some work. 👎

$ sudo salt-call state.highstate --local

[ERROR   ] Failed to set SELinux to Permissive mode
[ERROR   ] Command 'lxd init --auto --storage-backend="dir" --trust-password="PaSsW0rD" --network-address="[::]" --network-port="8443"' failed with return code: 1
[ERROR   ] output: error: cannot listen on https socket: listen tcp 0.0.0.0:8443: bind: address already in use
[ERROR   ] cannot listen on https socket: listen tcp 0.0.0.0:8443: bind: address already in use
[ERROR   ] not found
[ERROR   ] Failed to connect to "https://images.linuxcontainers.org", looks like the SSL verification failed, error was: You have given an invalid cert path: "/root/.config/lxc/client.crt", the file does not exists or is not a file.
[ERROR   ] not found
[ERROR   ] not found
[ERROR   ] not found
[WARNING ] The function "module.run" is using its deprecated version and will expire in version "Sodium".
[ERROR   ] Module function lxd.container_execute threw an exception. Exception: Container 'ubuntu-xenial3' not found
[WARNING ] The function "module.run" is using its deprecated version and will expire in version "Sodium".
[ERROR   ] Module function lxd.container_file_put threw an exception. Exception: Container 'ubuntu-xenial3' not found
[WARNING ] The function "module.run" is using its deprecated version and will expire in version "Sodium".
[ERROR   ] Module function lxd.container_execute threw an exception. Exception: Container 'ubuntu-xenial3' not found
local:
----------
          ID: lxd_client
    Function: pkg.installed
      Result: True
     Comment: All specified packages are already installed
     Started: 12:52:25.248100
    Duration: 2701.969 ms
     Changes:   
----------
          ID: lxd_python
    Function: pkg.installed
      Result: True
     Comment: All specified packages are already installed
     Started: 12:52:27.950308
    Duration: 0.749 ms
     Changes:   
----------
          ID: lxd_selinux_mode
    Function: selinux.mode
        Name: permissive
      Result: False
     Comment: Failed to set SELinux to Permissive mode
     Started: 12:52:27.952236
    Duration: 1033.322 ms
     Changes:   
----------
          ID: lxd_lxc_upstream_repo
    Function: pkgrepo.managed
      Result: True
     Comment: Package repo 'lxd_lxc_upstream_repo' already configured
     Started: 12:52:28.985820
    Duration: 28.069 ms
     Changes:   
----------
          ID: lxd_lxd_upstream_repo
    Function: pkgrepo.managed
      Result: True
     Comment: Package repo 'lxd_lxd_upstream_repo' already configured
     Started: 12:52:29.014117
    Duration: 28.085 ms
     Changes:   
----------
          ID: lxd_subuid
    Function: file.append
        Name: /etc/subuid
      Result: True
     Comment: File /etc/subuid is in correct state
     Started: 12:52:29.042419
    Duration: 16.335 ms
     Changes:   
----------
          ID: lxd_subgid
    Function: file.append
        Name: /etc/subgid
      Result: True
     Comment: File /etc/subgid is in correct state
     Started: 12:52:29.058971
    Duration: 14.518 ms
     Changes:   
----------
          ID: lxd_lxd
    Function: pkg.installed
      Result: True
     Comment: All specified packages are already installed
     Started: 12:52:29.075449
    Duration: 0.881 ms
     Changes:   
----------
          ID: lxd_lxd_service
    Function: lxd.init
      Result: False
     Comment: cannot listen on https socket: listen tcp 0.0.0.0:8443: bind: address already in use
     Started: 12:52:29.077104
    Duration: 1051.428 ms
     Changes:   
----------
          ID: lxd_lxd_service
    Function: service.running
        Name: lxd
      Result: True
     Comment: The service lxd is already running
     Started: 12:52:30.129780
    Duration: 105.892 ms
     Changes:   
----------
          ID: lxd_config_password
    Function: lxd.config_managed
        Name: core.trust_password
      Result: True
     Comment: "core.trust_password" is already set (we don't known if the password is correct)
     Started: 12:52:30.237197
    Duration: 45.174 ms
     Changes:   
----------
          ID: lxd_profile_local_autostart
    Function: lxd_profile.present
        Name: autostart
      Result: True
     Comment: Profile "autostart" has been created
     Started: 12:52:30.282915
    Duration: 65.63 ms
     Changes:   
              ----------
              created:
                  Profile "autostart" has been created
----------
          ID: lxd_profile_local_shared_mount
    Function: lxd_profile.present
        Name: shared_mount
      Result: False
     Comment: not found
     Started: 12:52:30.348903
    Duration: 40.889 ms
     Changes:   
----------
          ID: lxd_profile_local_small
    Function: lxd_profile.present
        Name: small
      Result: True
     Comment: Profile "small" has been created
     Started: 12:52:30.390112
    Duration: 50.894 ms
     Changes:   
              ----------
              created:
                  Profile "small" has been created
----------
          ID: lxd_image_local_busybox
    Function: lxd_image.present
        Name: busybox
      Result: True
     Comment: 1 changes
     Started: 12:52:30.441359
    Duration: 374.583 ms
     Changes:   
              ----------
              aliases:
                  - Added alias "busybox"
----------
          ID: lxd_image_local_xenial_amd64
    Function: lxd_image.present
        Name: xenial/amd64
      Result: False
     Comment: Failed to connect to "https://images.linuxcontainers.org", looks like the SSL verification failed, error was: You have given an invalid cert path: "/root/.config/lxc/client.crt", the file does not exists or is not a file.
     Started: 12:52:30.816257
    Duration: 13.355 ms
     Changes:   
----------
          ID: lxd_image_local_trusty_amd64
    Function: lxd_image.present
        Name: trusty_amd64
      Result: True
     Comment: 1 changes
     Started: 12:52:30.830032
    Duration: 107475.162 ms
     Changes:   
              ----------
              aliases:
                  - Added alias "trusty_amd64"
----------
          ID: lxd_image_local_trusty_amd64_url
    Function: lxd_image.present
        Name: trusty_amd64_url
      Result: True
     Comment: 1 changes
     Started: 12:54:18.305531
    Duration: 1249.661 ms
     Changes:   
              ----------
              aliases:
                  - Removed alias "busybox"
                  - Added alias "trusty_amd64_url"
----------
          ID: lxd_container_local_ubuntu-xenial0
    Function: lxd_container.present
        Name: ubuntu-xenial0
      Result: False
     Comment: not found
     Started: 12:54:19.555595
    Duration: 32.435 ms
     Changes:   
----------
          ID: lxd_container_local_ubuntu-xenial2
    Function: lxd_container.present
        Name: ubuntu-xenial2
      Result: False
     Comment: not found
     Started: 12:54:19.589512
    Duration: 33.476 ms
     Changes:   
----------
          ID: lxd_container_local_ubuntu-xenial3
    Function: lxd_container.present
        Name: ubuntu-xenial3
      Result: False
     Comment: not found
     Started: 12:54:19.623298
    Duration: 33.696 ms
     Changes:   
----------
          ID: lxd_container_local_ubuntu-xenial3_check_executed
    Function: module.run
        Name: lxd.container_execute
      Result: False
     Comment: One or more requisite failed: lxd.containers.lxd_container_local_ubuntu-xenial3
     Changes:   
----------
          ID: lxd_container_local_ubuntu-xenial3_bse_1
    Function: module.run
        Name: lxd.container_execute
      Result: False
     Comment: Module function lxd.container_execute threw an exception. Exception: Container 'ubuntu-xenial3' not found
     Started: 12:54:19.659729
    Duration: 13.177 ms
     Changes:   
----------
          ID: lxd_container_local_ubuntu-xenial3_bsc_2
    Function: module.run
        Name: lxd.container_file_put
      Result: False
     Comment: Module function lxd.container_file_put threw an exception. Exception: Container 'ubuntu-xenial3' not found
     Started: 12:54:19.673673
    Duration: 20.464 ms
     Changes:   
----------
          ID: lxd_container_local_ubuntu-xenial3_bse_2
    Function: module.run
        Name: lxd.container_execute
      Result: False
     Comment: One or more requisite failed: lxd.containers.lxd_container_local_ubuntu-xenial3_bsc_2
     Changes:   
----------
          ID: lxd_container_local_ubuntu-xenial3_bse_3
    Function: module.run
        Name: lxd.container_execute
      Result: False
     Comment: Module function lxd.container_execute threw an exception. Exception: Container 'ubuntu-xenial3' not found
     Started: 12:54:19.696208
    Duration: 15.007 ms
     Changes:   
----------
          ID: lxd_container_local_ubuntu-xenial3_restart
    Function: module.run
        Name: lxd.container_restart
      Result: False
     Comment: One or more requisite failed: lxd.containers.lxd_container_local_ubuntu-xenial3_bse_1, lxd.containers.lxd_container_local_ubuntu-xenial3_bse_2, lxd.containers.lxd_container_local_ubuntu-xenial3_bse_3
     Changes:   
----------
          ID: lxd_container_local_ubuntu-xenial3_make_executed
    Function: module.run
        Name: lxd.container_execute
      Result: False
     Comment: One or more requisite failed: lxd.containers.lxd_container_local_ubuntu-xenial3_restart, lxd.containers.lxd_container_local_ubuntu-xenial3_bse_1, lxd.containers.lxd_container_local_ubuntu-xenial3_bse_2, lxd.containers.lxd_container_local_ubuntu-xenial3_bse_3
     Changes:   

Summary for local
-------------
Succeeded: 14 (changed=5)
Failed:    14
-------------
Total states run:     28
Total run time:  114.445 s
noelmcloughlin commented 5 years ago

Running lxd state on CentOS gives this output. This issue needs work.

    Rendering SLS 'base:lxd.client' failed: Jinja variable 'None' has no attribute 'client'
----------
    Rendering SLS 'base:lxd.python' failed: Jinja variable 'None' has no attribute 'python'
----------
    Rendering SLS 'base:lxd.lxd' failed: Jinja variable 'None' has no attribute 'lxd'
noelmcloughlin commented 5 years ago

Same output on OpenSUSE.

Dr-Bone commented 5 years ago

same for ArchLinux. Do you have some hints what could be done to make it work?

noelmcloughlin commented 5 years ago

From a formula perspective this repo needs osfamilymap.yaml file added with with dicts for RedHat and Suse and archlinux. There are lots of example repos already using osfamilymap.yaml so you could check those before adding it here .. It's a small piece of work to get rid of these "Rendering SLS" errors on Centos/archlinux/suse/etc.

The second challenge is to see if this technically works - I would be interested in exploring how to make lxc work - this is separate issue to "Rendering SLS" errors.