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

devmapper: Log start and end of filesystem creation

ext4 filesystem creation can take a long time on 100G thin device and
systemd might time out and kill docker service. Often user is left thinking
why docker is taking so long and logs don't give any hint. Log an info
message in journal for start and end of filesystem creation. That way
a user can look at logs and figure out that filesystem creation is
taking long time.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
This commit is contained in:
Vivek Goyal 2015-12-01 13:05:46 +00:00 committed by root
parent f187bdbb9b
commit a489e685c0

View file

@ -574,7 +574,7 @@ func determineDefaultFS() string {
return "ext4"
}
func (devices *DeviceSet) createFilesystem(info *devInfo) error {
func (devices *DeviceSet) createFilesystem(info *devInfo) (err error) {
devname := info.DevName()
args := []string{}
@ -584,12 +584,19 @@ func (devices *DeviceSet) createFilesystem(info *devInfo) error {
args = append(args, devname)
var err error
if devices.filesystem == "" {
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 {
case "xfs":
err = exec.Command("mkfs.xfs", args...).Run()
@ -605,11 +612,7 @@ func (devices *DeviceSet) createFilesystem(info *devInfo) error {
default:
err = fmt.Errorf("Unsupported filesystem type %s", devices.filesystem)
}
if err != nil {
return err
}
return nil
return
}
func (devices *DeviceSet) migrateOldMetaData() error {