forked from cloudfoundry/bosh-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
migrate_disk.go
54 lines (43 loc) · 1.18 KB
/
migrate_disk.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package action
import (
"errors"
boshplatform "github.com/cloudfoundry/bosh-agent/platform"
boshdirs "github.com/cloudfoundry/bosh-agent/settings/directories"
bosherr "github.com/cloudfoundry/bosh-utils/errors"
)
type MigrateDiskAction struct {
platform boshplatform.Platform
dirProvider boshdirs.Provider
}
func NewMigrateDisk(
platform boshplatform.Platform,
dirProvider boshdirs.Provider,
) (action MigrateDiskAction) {
action.platform = platform
action.dirProvider = dirProvider
return
}
func (a MigrateDiskAction) IsAsynchronous(_ ProtocolVersion) bool {
return true
}
func (a MigrateDiskAction) IsPersistent() bool {
return false
}
func (a MigrateDiskAction) IsLoggable() bool {
return true
}
func (a MigrateDiskAction) Run() (value interface{}, err error) {
err = a.platform.MigratePersistentDisk(a.dirProvider.StoreDir(), a.dirProvider.StoreMigrationDir())
if err != nil {
err = bosherr.WrapError(err, "Migrating persistent disk")
return
}
value = map[string]string{}
return
}
func (a MigrateDiskAction) Resume() (interface{}, error) {
return nil, errors.New("not supported")
}
func (a MigrateDiskAction) Cancel() error {
return errors.New("not supported")
}