ClusterHQ / unofficial-flocker-tools

A tool to make installing Flocker with container orchestration tools easier and more fun
https://clusterhq.com/
11 stars 9 forks source link

Prototype volumes cli fix #9

Closed binocarlos closed 9 years ago

binocarlos commented 9 years ago

I was seeing a dataset which had a different primary property between /v1/configuration/datasets and /v1/state/datasets

/v1/configuration/datasets

$ curl -s --cacert $PWD/cluster.crt --cert $PWD/flockerdemo.crt --key $PWD/flockerdemo.key https://54.159.138.139:4523/v1/configuration/datasets | jq .
[
  {
    "deleted": false,
    "dataset_id": "374b483a-d80e-4028-ae80-0f1f904b9118",
    "maximum_size": 107374182400,
    "primary": "af0a2275-1869-406c-a523-4297c32d5b88",
    "metadata": {
      "name": "test1"
    }
  },
  {
    "deleted": false,
    "dataset_id": "00a8cc7c-ec54-418e-b50d-cb6011a74c13",
    "maximum_size": 107374182400,
    "primary": "af0a2275-1869-406c-a523-4297c32d5b88",
    "metadata": {
      "name": "workgrr"
    }
  }
]

/v1/state/datasets

$ curl -s --cacert $PWD/cluster.crt --cert $PWD/flockerdemo.crt --key $PWD/flockerdemo.key https://54.159.138.139:4523/v1/state/datasets | jq .
[
  {
    "primary": "af0a2275-1869-406c-a523-4297c32d5b88",
    "path": "/flocker/374b483a-d80e-4028-ae80-0f1f904b9118",
    "dataset_id": "374b483a-d80e-4028-ae80-0f1f904b9118",
    "maximum_size": 107374182400
  },
  {
    "primary": "9aaa7366-6c63-40b9-b9cd-56ae7964ea40",
    "path": "/flocker/00a8cc7c-ec54-418e-b50d-cb6011a74c13",
    "dataset_id": "00a8cc7c-ec54-418e-b50d-cb6011a74c13",
    "maximum_size": 107374182400
  }
]

The output without this PR:

$ ./flocker-volumes.py list -l
DATASET                                SIZE      METADATA       STATUS     SERVER
374b483a-d80e-4028-ae80-0f1f904b9118   100.00G   name=test1     attached   af0a2275-1869-406c-a523-4297c32d5b88 (10.136.99.9)
00a8cc7c-ec54-418e-b50d-cb6011a74c13   100.00G   name=workgrr   attached   af0a2275-1869-406c-a523-4297c32d5b88 (10.136.99.9)

And with this PR:

$ ./flocker-volumes.py list -l
DATASET                                SIZE      METADATA       STATUS     SERVER
374b483a-d80e-4028-ae80-0f1f904b9118   100.00G   name=test1     attached   af0a2275-1869-406c-a523-4297c32d5b88 (10.136.99.9)
00a8cc7c-ec54-418e-b50d-cb6011a74c13   100.00G   name=workgrr   pending    9aaa7366-6c63-40b9-b9cd-56ae7964ea40 (10.154.43.137)

It basically checks the the primary property of the state and configuration match otherwise flags the dataset as diverged

lukemarsden commented 9 years ago

I don't see diverged in your sample output and this PR should be against prototype-volumes-cli branch please.

robhaswell commented 9 years ago

This branch is going to have been hosed by the setuptools changes.