Skip to content

Adding a manifest to sapi application causes issues with sapi service #4

Description

@caius

Steps to reproduce

  1. Create a new manifest in sapi

     sdc-sapi /manifests -X POST -d '{
       "name": "chd_test",
       "path": "/tmp/test",
       "template": "testing"
     }'
    
  2. Login to sapi0 zone, and check whether that manifest has been created in /sapi/sapi_manifests

    (Spoiler: it hasn’t)

  3. Add the manifest to the sapi application, so it gets picked up by config-agent everywhere

     sdc-sapi /applications/$(sdc-sapi /applications?name=sdc | json -H 0.uuid) -X PUT -d '
     {
       "action":"update",
       "manifests":{
         "chd_test":"'$(sdc-sapi /manifests | json -H -c 'name=="chd_test"' 0.uuid)'"
       }
     }'
    
  4. Trigger a sapi sync to make it refresh the local cache

Expected result

  • sapi0 caches the manifest in local storage, along with the application change
  • config-agent pushes out the changes everywhere
  • sapi service can be restarted happily (& the hourly local storage refresh happens successfully)

Actual Result

  • sapi0 local storage doesn't contain the new manifest

      [root@052ffb5b-353e-4de5-95d0-47c8509ca4ca (dc1:sapi0) ~]# ls -l /sapi/sapi_manifests/9c563244-7467-443d-a34b-67e59d49191f
      ls: cannot access /sapi/sapi_manifests/9c563244-7467-443d-a34b-67e59d49191f: No such file or directory
    
  • sapi service hourly refresh causes a core dump, due to the manifest not being on disk

      [2017-05-11T20:05:26.092Z]  INFO: sapi/16519 on 052ffb5b-353e-4de5-95d0-47c8509ca4ca: refreshing local stor from moray...
      [2017-05-11T20:05:26.405Z]  WARN: sapi/16519 on 052ffb5b-353e-4de5-95d0-47c8509ca4ca: object 9c563244-7467-443d-a34b-67e59d49191f doesn't exist
      Uncaught TypeError: Cannot read property 'value' of null
      
      FROM
      /opt/smartdc/sapi/lib/server/stor/moray_local.js:199:30
      /opt/smartdc/sapi/lib/server/stor/moray_local.js:198:45
      /opt/smartdc/sapi/node_modules/vasync/lib/vasync.js:84:5
      /opt/smartdc/sapi/lib/server/stor/local.js:155:17
      fs.js:266:14
      Object.oncomplete (fs.js:107:15)
    

It looks from testing like creating a manifest through sdc-sapi on the headnode, that doesn't get written out to the local storage on sapi0 zone. This then has the knock-on effect of causing the local storage refresh (either hourly or at startup) to bail out, due to the manifest not being found in local storage.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions