cmd/juju/storage: add binding/life to details #7047

Closed
wants to merge 3 commits into
from

Conversation

Projects
None yet
2 participants
Member

axw commented Feb 28, 2017

Description of change

When displaying the details of storage in YAML or
JSON format, include the binding and life of the entity.
The binding will be simplified to the kind of the entity,
which is "model", "machine", "application", or "unit".

QA steps

  1. juju bootstrap
  2. juju deploy postgresql --storage pgdata=1G
  3. juju storage --format=yaml
    check that the storage includes life and binding fields

Documentation changes

This is primarily for debugging, does not need documentation at present.

Bug reference

None.

axw added some commits Feb 27, 2017

cmd/juju/storage: add "binding" to storage details
When displaying the details of volumes and filesystems
in YAML or JSON format, include the binding of the entity.
This will be simplified to the kind of the entity, which
is either "model", "machine", "application", or "unit".

Can you also QA with an older client

@@ -544,21 +554,42 @@ type VolumeDetails struct {
// VolumeTag is the tag for the volume.
VolumeTag string `json:"volume-tag"`
+ // BindingTag is the tag of an entity to which the
+ // volume's lifetime is bound.
@wallyworld

wallyworld Mar 3, 2017

Owner

include comment about old api version?
here and below

+type VolumeAttachmentDetails struct {
+ // NOTE(axw) for backwards-compatibility, this must not be given a
+ // json tag. This ensures that we collapse VolumeAttachmentInfo.
+ VolumeAttachmentInfo
@wallyworld

wallyworld Mar 3, 2017

Owner

can we add a todo here to remove this compatibility struct when we get a chance to rev up the api
here and below

@@ -190,6 +191,7 @@ func createStorageDetails(st storageAccess, si state.StorageInstance) (*params.S
a.Unit().String(),
machineTag.String(),
location,
+ params.Life(a.Life().String()),
@wallyworld

wallyworld Mar 3, 2017

Owner

would prefer named fields
we use named fields below in StorageDetails struct initialisation

@@ -178,7 +178,8 @@ func (s mockListAPI) ListVolumes(machines []string) ([]params.VolumeDetailsListR
// storage db-dir/1001, which is attached to unit
// abc/0.
{
- VolumeTag: "volume-0-0",
+ VolumeTag: "volume-0-0",
+ BindingTag: "storage-db-dir-1001",
@wallyworld

wallyworld Mar 3, 2017

Owner

can we include setting the Life attribute

Member

axw commented Mar 3, 2017

This PR will be superseded. I'll address comments in the new PR.

@axw axw closed this Mar 3, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment