cmd/juju/storage: revise storage tabular format #7066

Merged
merged 4 commits into from Mar 3, 2017
Prev

cmd/juju/storage: show storage type

  • Loading branch information...
commit fa75bb44923f8aafaf70a8c7615d64dafb494ea0 @axw axw committed Mar 3, 2017
@@ -41,11 +41,11 @@ func (s *ListSuite) TestList(c *gc.C) {
// Default format is tabular
`
\[Storage\]
-Unit Id Pool Provider id Size Status Message
-postgresql/0 db-dir/1100 attached
-transcode/0 db-dir/1000 pending creating volume
-transcode/0 shared-fs/0 radiance provider-supplied-volume-4 1.0GiB attached
-transcode/1 shared-fs/0 radiance provider-supplied-volume-4 1.0GiB attached
+Unit Id Type Pool Provider id Size Status Message
+postgresql/0 db-dir/1100 block attached
+transcode/0 db-dir/1000 block pending creating volume
+transcode/0 shared-fs/0 filesystem radiance provider-supplied-volume-4 1.0GiB attached
+transcode/1 shared-fs/0 filesystem radiance provider-supplied-volume-4 1.0GiB attached
`[1:])
}
@@ -58,11 +58,11 @@ func (s *ListSuite) TestListNoPool(c *gc.C) {
// Default format is tabular
`
\[Storage\]
-Unit Id Provider id Size Status Message
-postgresql/0 db-dir/1100 attached
-transcode/0 db-dir/1000 pending creating volume
-transcode/0 shared-fs/0 provider-supplied-volume-4 1.0GiB attached
-transcode/1 shared-fs/0 provider-supplied-volume-4 1.0GiB attached
+Unit Id Type Provider id Size Status Message
+postgresql/0 db-dir/1100 block attached
+transcode/0 db-dir/1000 block pending creating volume
+transcode/0 shared-fs/0 filesystem provider-supplied-volume-4 1.0GiB attached
+transcode/1 shared-fs/0 filesystem provider-supplied-volume-4 1.0GiB attached
`[1:])
}
@@ -48,7 +48,7 @@ func formatStorageListTabular(
}
}
- w.Print("Unit", "Id")
+ w.Print("Unit", "Id", "Type")
if len(storagePool) > 0 {
// Older versions of Juju do not include
// the pool name in the storage details.
@@ -71,7 +71,7 @@ func formatStorageListTabular(
}
continue
}
- for unitId, a := range storageInfo.Attachments.Units {
+ for unitId := range storageInfo.Attachments.Units {
byStorage := byUnit[unitId]
if byStorage == nil {
byStorage = make(map[string]storageAttachmentInfo)
@@ -80,7 +80,7 @@ func formatStorageListTabular(
byStorage[storageId] = storageAttachmentInfo{
storageId: storageId,
unitId: unitId,
- location: a.Location,
+ kind: storageInfo.Kind,
status: storageInfo.Status,
}
}
@@ -110,6 +110,7 @@ func formatStorageListTabular(
}
w.Print(info.unitId)
w.Print(info.storageId)
+ w.Print(info.kind)
if len(storagePool) > 0 {
w.Print(storagePool[info.storageId])
}
@@ -129,7 +130,7 @@ func formatStorageListTabular(
type storageAttachmentInfo struct {
storageId string
unitId string
- location string
+ kind string
status EntityStatus
}
@@ -128,8 +128,8 @@ func (s *cmdStorageSuite) TestStorageList(c *gc.C) {
expected := `
[Storage]
-Unit Id Provider id Size Status Message
-storage-block/0 data/0 pending
+Unit Id Type Provider id Size Status Message
+storage-block/0 data/0 block pending
`[1:]
runList(c, expected)
@@ -142,8 +142,8 @@ func (s *cmdStorageSuite) TestStorageListPersistent(c *gc.C) {
// will be persistent until it has been provisioned.
expected := `
[Storage]
-Unit Id Provider id Size Status Message
-storage-block/0 data/0 pending
+Unit Id Type Provider id Size Status Message
+storage-block/0 data/0 block pending
`[1:]
runList(c, expected)
@@ -555,8 +555,8 @@ func (s *cmdStorageSuite) TestStorageAddToUnitHasVolumes(c *gc.C) {
c.Assert(err, jc.ErrorIsNil)
c.Assert(testing.Stdout(context), gc.Equals, `
[Storage]
-Unit Id Provider id Size Status Message
-storage-filesystem/0 data/0 pending
+Unit Id Type Provider id Size Status Message
+storage-filesystem/0 data/0 filesystem pending
`[1:])
c.Assert(testing.Stderr(context), gc.Equals, "")
@@ -578,9 +578,9 @@ storage-filesystem/0 data/0 pending
c.Assert(err, jc.ErrorIsNil)
c.Assert(testing.Stdout(context), gc.Equals, `
[Storage]
-Unit Id Provider id Size Status Message
-storage-filesystem/0 data/0 pending
-storage-filesystem/0 data/1 pending
+Unit Id Type Provider id Size Status Message
+storage-filesystem/0 data/0 filesystem pending
+storage-filesystem/0 data/1 filesystem pending
`[1:])
c.Assert(testing.Stderr(context), gc.Equals, "")