1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #18310 from rhvgoyal/log-fs-creation

devmapper: Log start and end of filesystem creation
This commit is contained in:
Phil Estes 2015-12-01 09:49:13 -05:00
commit c8891158bd

View file

@ -574,7 +574,7 @@ func determineDefaultFS() string {
return "ext4" return "ext4"
} }
func (devices *DeviceSet) createFilesystem(info *devInfo) error { func (devices *DeviceSet) createFilesystem(info *devInfo) (err error) {
devname := info.DevName() devname := info.DevName()
args := []string{} args := []string{}
@ -584,12 +584,19 @@ func (devices *DeviceSet) createFilesystem(info *devInfo) error {
args = append(args, devname) args = append(args, devname)
var err error
if devices.filesystem == "" { if devices.filesystem == "" {
devices.filesystem = determineDefaultFS() devices.filesystem = determineDefaultFS()
} }
logrus.Infof("devmapper: Creating filesystem %s on device %s", devices.filesystem, info.Name())
defer func() {
if err != nil {
logrus.Infof("devmapper: Error while creating filesystem %s on device %s: %v", devices.filesystem, info.Name(), err)
} else {
logrus.Infof("devmapper: Successfully created filesystem %s on device %s", devices.filesystem, info.Name())
}
}()
switch devices.filesystem { switch devices.filesystem {
case "xfs": case "xfs":
err = exec.Command("mkfs.xfs", args...).Run() err = exec.Command("mkfs.xfs", args...).Run()
@ -605,11 +612,7 @@ func (devices *DeviceSet) createFilesystem(info *devInfo) error {
default: default:
err = fmt.Errorf("Unsupported filesystem type %s", devices.filesystem) err = fmt.Errorf("Unsupported filesystem type %s", devices.filesystem)
} }
if err != nil { return
return err
}
return nil
} }
func (devices *DeviceSet) migrateOldMetaData() error { func (devices *DeviceSet) migrateOldMetaData() error {