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

smartos.image_present fails with "does not exist" #51503

Closed
garethhowell opened this issue Feb 5, 2019 · 7 comments

Comments

@garethhowell
Copy link

commented Feb 5, 2019

one for @sjorge

Description of Issue/Question

Running a state that includes the function smartos.image_present fails even though imgadm list shows the named image as available.

Setup

Start of kvm_docker1.sls

ac99517a-72ac-44c0-90e6-c7ce3d944a0a:
  smartos.image_present

docker1.agdon.net:
  smartos.vm_present:
    - vmconfig:
        image_uuid: ac99517a-72ac-44c0-90e6-c7ce3d944a0a
        brand: kvm
        alias: docker1
...

partial output of imgadm list on global zone

imgadm avail -o uuid,name,version,os,type,published | grep zvol
...
6b47e1d9-36b8-4b6f-8764-5ff5fe6d120b  ubuntu-certified-16.04          20181005    linux    zvol          2018-10-11T12:43:25Z
ac99517a-72ac-44c0-90e6-c7ce3d944a0a  ubuntu-certified-18.04          20180808    linux    zvol          2018-10-11T12:45:24Z
d6e56c0e-1e51-11e9-8ff1-2fecf38a5566  centos-7                        20190122    linux    zvol          2019-01-22T14:27:25Z

Output of running state

sudo salt global_deneb state.apply kvm_docker1
global_deneb:
----------
          ID: ac99517a-72ac-44c0-90e6-c7ce3d944a0a
    Function: smartos.image_present
      Result: False
     Comment: image ac99517a-72ac-44c0-90e6-c7ce3d944a0a does not exists
     Started: 14:55:24.895018
    Duration: 4160.295 ms
     Changes:   
----------
          ID: docker1.agdon.net
    Function: smartos.vm_present
      Result: False
     Comment: image ac99517a-72ac-44c0-90e6-c7ce3d944a0a not installed
     Started: 14:55:29.055885
    Duration: 1488.961 ms
     Changes:   

Summary for global_deneb
------------
Succeeded: 0
Failed:    2
------------
Total states run:     2
Total run time:   5.649 s
ERROR: Minions returned with non-zero exit code

Steps to Reproduce Issue

Create the sls and run

Versions Report

(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
Master

Salt Version:
           Salt: 2019.2.0-556-g8af9765
 
Dependency Versions:
           cffi: 1.5.2
       cherrypy: Not Installed
       dateutil: Not Installed
      docker-py: Not Installed
          gitdb: 2.0.2
      gitpython: 2.1.5
         Jinja2: 2.8
        libgit2: 0.24.0
       M2Crypto: 0.21.1
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: Not Installed
      pycparser: 2.14
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: 0.24.0
         Python: 2.7.12 (default, Nov 12 2018, 14:36:49)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 15.2.0
          smmap: 2.0.3
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.1.4
 
System Versions:
           dist: Ubuntu 16.04 xenial
         locale: UTF-8
        machine: x86_64
        release: 4.3.0
         system: Linux
        version: Ubuntu 16.04 xenial

Minion

Salt Version:
           Salt: 2019.2.0-544-gb76b281
 
Dependency Versions:
           cffi: 1.11.5
       cherrypy: Not Installed
       dateutil: Not Installed
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
         Jinja2: 2.10
        libgit2: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.5.6
   mysql-python: Not Installed
      pycparser: 2.19
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.15 (default, Jan 28 2019, 05:17:09)
   python-gnupg: Not Installed
         PyYAML: 3.13
          PyZMQ: 17.1.2
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 5.1.1
            ZMQ: 4.2.5
 
System Versions:
           dist:   
         locale: UTF-8
        machine: i86pc
        release: 5.11
         system: SunOS
        version: Not Installed
@sjorge

This comment has been minimized.

Copy link
Contributor

commented Feb 5, 2019

@sjorge

This comment has been minimized.

Copy link
Contributor

commented Feb 5, 2019

Some quick testing...

local:
----------
          ID: ac99517a-72ac-44c0-90e6-c7ce3d944a0a
    Function: smartos.image_present
      Result: True
     Comment: image ac99517a-72ac-44c0-90e6-c7ce3d944a0a imported
     Started: 15:37:00.547571
    Duration: 222145.518 ms
     Changes:
              ----------
              ac99517a-72ac-44c0-90e6-c7ce3d944a0a:
                  ubuntu-certified-18.04@20180808 [2018-10-11T12:45:24.804Z]

Summary for local
------------
Succeeded: 1 (changed=1)
Failed:    0
------------
Total states run:     1
Total run time: 222.146 s

Initial run is OK

[root@carbon ~]# salt-call state.apply test
local:
  Name: ac99517a-72ac-44c0-90e6-c7ce3d944a0a - Function: smartos.image_present - Result: Clean Started: - 15:41:50.155082 Duration: 819.683 ms

Summary for local
------------
Succeeded: 1
Failed:    0
------------
Total states run:     1
Total run time: 819.683 ms

Follow up run OK.

[root@carbon ~]# salt-call --versions-report
Salt Version:
           Salt: 2019.2.0rc2

Dependency Versions:
           cffi: 1.11.5
       cherrypy: Not Installed
       dateutil: 2.7.2
      docker-py: Not Installed
          gitdb: 2.0.3
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.9.6
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.5.6
   mysql-python: Not Installed
      pycparser: 2.18
       pycrypto: Not Installed
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.14 (default, Apr  7 2018, 10:43:27)
   python-gnupg: Not Installed
         PyYAML: 3.12
          PyZMQ: 17.0.0
           RAET: Not Installed
          smmap: 2.0.3
        timelib: Not Installed
        Tornado: 4.5.3
            ZMQ: 4.2.3

System Versions:
           dist:
         locale: UTF-8
        machine: i86pc
        release: 5.11
         system: SunOS
        version: Not Installed
@sjorge

This comment has been minimized.

Copy link
Contributor

commented Feb 5, 2019

You might be hitting the same or similar bug as #51383 is trying to fix.

I had this change applied when testing.

@garethhowell

This comment has been minimized.

Copy link
Author

commented Feb 6, 2019

It’s possible, but I don’t think this is an invalid image. After posting, I did some investigation.

I imported the image manually, but the state still failed. I then commented out the clause with the test in it and the subsequent state passed. However, as posted, the state was wrong. The reference to the image should have been in the disks section, not the main vmconfig.

The only thing that is different about that image is that it is a zvol and does not mount on /zones after it is imported.

@sjorge

This comment has been minimized.

Copy link
Contributor

commented Feb 6, 2019

With the patch from #51383 this state works fine for me:

ac99517a-72ac-44c0-90e6-c7ce3d944a0a:
  smartos.image_present

kvmtest:
  smartos.vm_present:
    - config:
        auto_import: true
        reprovision: true
    - vmconfig:
        brand: kvm
        ram: 1024
        nics:
          "82:1b:8e:49:e9:12":
            nic_tag: trunk
            model: virtio
            mtu: 1500
            ips:
              - 10.23.10.229/24
            vlan_id: 10
        disks:
          disk0:
            image_uuid: ac99517a-72ac-44c0-90e6-c7ce3d944a0a
            model: virtio
            compression: lz4

I did not look ath the smartos.vm_present yet, because if the smartos.image_present fails there is no point in looking at that one yet (similar code paths)

First run it imports the image (this takes up to 15 minutes), runs after that are happy. So if you can confirm you see the same with the patch applied. That would be great, if not we can start trying to figure out why it is still failing for you.

local:
----------
          ID: ac99517a-72ac-44c0-90e6-c7ce3d944a0a
    Function: smartos.image_present
      Result: True
     Comment: image ac99517a-72ac-44c0-90e6-c7ce3d944a0a imported
     Started: 09:25:06.357769
    Duration: 149651.284 ms
     Changes:
              ----------
              ac99517a-72ac-44c0-90e6-c7ce3d944a0a:
                  ubuntu-certified-18.04@20180808 [2018-10-11T12:45:24.804Z]

Summary for local
------------
Succeeded: 1 (changed=1)
Failed:    0
------------
Total states run:     1
Total run time: 149.651 s
[root@carbon ~]# salt-call state.sls test
local:
  Name: ac99517a-72ac-44c0-90e6-c7ce3d944a0a - Function: smartos.image_present - Result: Clean Started: - 09:28:35.930957 Duration: 841.681 ms

Summary for local
------------
Succeeded: 1
Failed:    0
------------
Total states run:     1
Total run time: 841.681 ms
[root@carbon ~]# salt-call state.sls test
local:
  Name: ac99517a-72ac-44c0-90e6-c7ce3d944a0a - Function: smartos.image_present - Result: Clean Started: - 09:33:09.646854 Duration: 825.272 ms
----------
          ID: kvmtest
    Function: smartos.vm_present
      Result: True
     Comment: vm kvmtest created
     Started: 09:33:10.472721
    Duration: 8636.092 ms
     Changes:
              ----------
              kvmtest:
                  ----------
                  brand:
                      kvm
                  ram:
                      1024
                  nics:
                      |_
                        ----------
                        nic_tag:
                            trunk
                        model:
                            virtio
                        mtu:
                            1500
                        ips:
                            - 10.23.10.229/24
                        vlan_id:
                            10
                        mac:
                            82:1b:8e:49:e9:12
                  disks:
                      |_
                        ----------
                        image_uuid:
                            ac99517a-72ac-44c0-90e6-c7ce3d944a0a
                        model:
                            virtio
                        compression:
                            lz4
                  hostname:
                      kvmtest

Summary for local
------------
Succeeded: 2 (changed=1)
Failed:    0
------------
Total states run:     2
Total run time:   9.461 s

After adding the vm, that works Ok fro me too.

@garethhowell

This comment has been minimized.

Copy link
Author

commented Feb 7, 2019

@garethhowell

This comment has been minimized.

Copy link
Author

commented Feb 9, 2019

That worked fine. I updated to the latest develop.
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.