fixes for libvirt domain import
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
adb44a864f
commit
20e958559e
|
@ -42,6 +42,10 @@ func (d *Droplets) FormatTEXT() string {
|
||||||
return prototext.Format(d)
|
return prototext.Format(d)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (d *Droplet) FormatTEXT() string {
|
||||||
|
return prototext.Format(d)
|
||||||
|
}
|
||||||
|
|
||||||
func (e *Events) FormatTEXT() string {
|
func (e *Events) FormatTEXT() string {
|
||||||
return prototext.Format(e)
|
return prototext.Format(e)
|
||||||
}
|
}
|
||||||
|
|
48
human.go
48
human.go
|
@ -115,15 +115,25 @@ func (d *Droplet) SprintHeader() string {
|
||||||
|
|
||||||
switch d.Current.State {
|
switch d.Current.State {
|
||||||
case DropletState_ON:
|
case DropletState_ON:
|
||||||
dur := time.Since(d.Current.OnSince.AsTime()) // time since 'ON'
|
var dur string
|
||||||
header += fmt.Sprintf(" (on :%3s)", FormatDuration(dur))
|
if d.Current.OnSince != nil {
|
||||||
|
dur = ""
|
||||||
|
} else {
|
||||||
|
t := time.Since(d.Current.OnSince.AsTime()) // time since 'OFF'
|
||||||
|
dur = FormatDuration(t)
|
||||||
|
}
|
||||||
|
header += fmt.Sprintf(" (on :%3s)", dur)
|
||||||
case DropletState_OFF:
|
case DropletState_OFF:
|
||||||
// everything is as it should be with this vm
|
var dur string
|
||||||
dur := time.Since(d.Current.OffSince.AsTime()) // time since 'OFF'
|
if d.Current.OffSince != nil {
|
||||||
header += fmt.Sprintf(" (off:%3s)", FormatDuration(dur))
|
dur = ""
|
||||||
|
} else {
|
||||||
|
t := time.Since(d.Current.OffSince.AsTime()) // time since 'OFF'
|
||||||
|
dur = FormatDuration(t)
|
||||||
|
}
|
||||||
|
header += fmt.Sprintf(" (off:%3s)", dur)
|
||||||
default:
|
default:
|
||||||
dur := time.Since(d.Current.OffSince.AsTime()) // use 'OFF' here?
|
header += fmt.Sprintf(" (?? :%3s)", "")
|
||||||
header += fmt.Sprintf(" (?? :%3s)", FormatDuration(dur))
|
|
||||||
}
|
}
|
||||||
return header
|
return header
|
||||||
}
|
}
|
||||||
|
@ -143,15 +153,25 @@ func (d *Droplet) SprintDumpHeader() string {
|
||||||
|
|
||||||
switch d.Current.State {
|
switch d.Current.State {
|
||||||
case DropletState_ON:
|
case DropletState_ON:
|
||||||
dur := time.Since(d.Current.OnSince.AsTime()) // time since 'ON'
|
var dur string
|
||||||
header += fmt.Sprintf(" (on :%3s)", FormatDuration(dur))
|
if d.Current.OnSince != nil {
|
||||||
|
dur = ""
|
||||||
|
} else {
|
||||||
|
t := time.Since(d.Current.OnSince.AsTime()) // time since 'ON'
|
||||||
|
dur = FormatDuration(t)
|
||||||
|
}
|
||||||
|
header += fmt.Sprintf(" (on :%3s)", dur)
|
||||||
case DropletState_OFF:
|
case DropletState_OFF:
|
||||||
// everything is as it should be with this vm
|
var dur string
|
||||||
dur := time.Since(d.Current.OffSince.AsTime()) // time since 'OFF'
|
if d.Current.OffSince != nil {
|
||||||
header += fmt.Sprintf(" (off:%3s)", FormatDuration(dur))
|
dur = ""
|
||||||
|
} else {
|
||||||
|
t := time.Since(d.Current.OffSince.AsTime()) // time since 'OFF'
|
||||||
|
dur = FormatDuration(t)
|
||||||
|
}
|
||||||
|
header += fmt.Sprintf(" (off:%3s)", dur)
|
||||||
default:
|
default:
|
||||||
dur := time.Since(d.Current.OffSince.AsTime()) // use 'OFF' here?
|
header += fmt.Sprintf(" (?? :%3s)", "")
|
||||||
header += fmt.Sprintf(" (?? :%3s)", FormatDuration(dur))
|
|
||||||
}
|
}
|
||||||
return header
|
return header
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue