diff --git a/docker/compose/local-cluster-compose.yml b/docker/compose/local-cluster-compose.yml index 89a1ed0cb..82095ae18 100644 --- a/docker/compose/local-cluster-compose.yml +++ b/docker/compose/local-cluster-compose.yml @@ -24,7 +24,7 @@ services: ports: - 8080:8080 - 18080:18080 - command: 'volume -mserver="master0:9333,master1:9334,master2:9335" -port=8080 -ip=volume1 -publicUrl=localhost:8080' + command: 'volume -mserver="master0:9333,master1:9334,master2:9335" -port=8080 -ip=volume1 -publicUrl=localhost:8080 -preStopSeconds=1 -disk=ssd1' depends_on: - master0 - master1 @@ -34,7 +34,7 @@ services: ports: - 8082:8082 - 18082:18082 - command: 'volume -mserver="master0:9333,master1:9334,master2:9335" -port=8082 -ip=volume2 -publicUrl=localhost:8082' + command: 'volume -mserver="master0:9333,master1:9334,master2:9335" -port=8082 -ip=volume2 -publicUrl=localhost:8082 -preStopSeconds=1 -disk=ssd1' depends_on: - master0 - master1 @@ -44,7 +44,7 @@ services: ports: - 8083:8083 - 18083:18083 - command: 'volume -mserver="master0:9333,master1:9334,master2:9335" -port=8083 -ip=volume3 -publicUrl=localhost:8083' + command: 'volume -mserver="master0:9333,master1:9334,master2:9335" -port=8083 -ip=volume3 -publicUrl=localhost:8083 -preStopSeconds=1' depends_on: - master0 - master1 diff --git a/weed/server/volume_server_handlers_admin.go b/weed/server/volume_server_handlers_admin.go index 29bd70d71..7e6c06871 100644 --- a/weed/server/volume_server_handlers_admin.go +++ b/weed/server/volume_server_handlers_admin.go @@ -17,7 +17,7 @@ func (vs *VolumeServer) statusHandler(w http.ResponseWriter, r *http.Request) { for _, loc := range vs.store.Locations { if dir, e := filepath.Abs(loc.Directory); e == nil { newDiskStatus := stats.NewDiskStatus(dir) - newDiskStatus.DiskType = loc.GetDiskType() + newDiskStatus.DiskType = loc.DiskType.String() ds = append(ds, newDiskStatus) } } @@ -34,7 +34,7 @@ func (vs *VolumeServer) statsDiskHandler(w http.ResponseWriter, r *http.Request) for _, loc := range vs.store.Locations { if dir, e := filepath.Abs(loc.Directory); e == nil { newDiskStatus := stats.NewDiskStatus(dir) - newDiskStatus.DiskType = loc.GetDiskType() + newDiskStatus.DiskType = loc.DiskType.String() ds = append(ds, newDiskStatus) } } diff --git a/weed/server/volume_server_handlers_ui.go b/weed/server/volume_server_handlers_ui.go index 95c7549d2..437e5c45d 100644 --- a/weed/server/volume_server_handlers_ui.go +++ b/weed/server/volume_server_handlers_ui.go @@ -20,7 +20,7 @@ func (vs *VolumeServer) uiStatusHandler(w http.ResponseWriter, r *http.Request) for _, loc := range vs.store.Locations { if dir, e := filepath.Abs(loc.Directory); e == nil { newDiskStatus := stats.NewDiskStatus(dir) - newDiskStatus.DiskType = loc.GetDiskType() + newDiskStatus.DiskType = loc.DiskType.String() ds = append(ds, newDiskStatus) } } diff --git a/weed/server/volume_server_ui/templates.go b/weed/server/volume_server_ui/templates.go index 2a93c3441..6a8bb6f55 100644 --- a/weed/server/volume_server_ui/templates.go +++ b/weed/server/volume_server_ui/templates.go @@ -69,7 +69,7 @@ var StatusTpl = template.Must(template.New("status").Funcs(funcMap).Parse(` Path - Type + Disk Total Free Usage @@ -129,6 +129,7 @@ var StatusTpl = template.Must(template.New("status").Funcs(funcMap).Parse(` Id Collection + Disk Data Size Files Trash @@ -141,6 +142,7 @@ var StatusTpl = template.Must(template.New("status").Funcs(funcMap).Parse(` {{ .Id }} {{ .Collection }} + {{ .DiskType }} {{ bytesToHumanReadable .Size }} {{ .FileCount }} {{ .DeleteCount }} / {{bytesToHumanReadable .DeletedByteCount}} diff --git a/weed/storage/disk_location.go b/weed/storage/disk_location.go index a7be3a559..7292c23f6 100644 --- a/weed/storage/disk_location.go +++ b/weed/storage/disk_location.go @@ -373,10 +373,3 @@ func (l *DiskLocation) CheckDiskSpace() { } } - -func (l *DiskLocation) GetDiskType() string { - if l.DiskType == SsdType { - return "SSD" - } - return "HDD" -} diff --git a/weed/storage/store.go b/weed/storage/store.go index 482e8998c..4bb05649c 100644 --- a/weed/storage/store.go +++ b/weed/storage/store.go @@ -173,6 +173,7 @@ func collectStatForOneVolume(vid needle.VolumeId, v *Volume) (s *VolumeInfo) { ReadOnly: v.IsReadOnly(), Ttl: v.Ttl, CompactRevision: uint32(v.CompactionRevision), + DiskType: v.DiskType().String(), } s.RemoteStorageName, s.RemoteStorageKey = v.RemoteStorageNameKey() diff --git a/weed/storage/volume_disk_type.go b/weed/storage/volume_disk_type.go index e97002120..4d14ada63 100644 --- a/weed/storage/volume_disk_type.go +++ b/weed/storage/volume_disk_type.go @@ -24,3 +24,10 @@ func ToDiskType(vt string) (diskType DiskType) { } return } + +func (diskType DiskType) String() string{ + if diskType == "" { + return "hdd" + } + return string(diskType) +}