Fix devmapper backend in docker info
| ... | ... |
@@ -100,7 +100,7 @@ type DeviceSet struct {
|
| 100 | 100 |
dataLoopbackSize int64 |
| 101 | 101 |
metaDataLoopbackSize int64 |
| 102 | 102 |
baseFsSize uint64 |
| 103 |
- userFilesystem string // FS specified by user using dm.fs |
|
| 103 |
+ filesystem string |
|
| 104 | 104 |
mountOptions string |
| 105 | 105 |
mkfsArgs []string |
| 106 | 106 |
dataDevice string // block or loop dev |
| ... | ... |
@@ -149,6 +149,8 @@ type Status struct {
|
| 149 | 149 |
Metadata DiskUsage |
| 150 | 150 |
// BaseDeviceSize is base size of container and image |
| 151 | 151 |
BaseDeviceSize uint64 |
| 152 |
+ // BaseDeviceFS is backing filesystem. |
|
| 153 |
+ BaseDeviceFS string |
|
| 152 | 154 |
// SectorSize size of the vector. |
| 153 | 155 |
SectorSize uint64 |
| 154 | 156 |
// UdevSyncSupported is true if sync is supported. |
| ... | ... |
@@ -584,12 +586,11 @@ func (devices *DeviceSet) createFilesystem(info *devInfo) error {
|
| 584 | 584 |
|
| 585 | 585 |
var err error |
| 586 | 586 |
|
| 587 |
- fs := devices.userFilesystem |
|
| 588 |
- if fs == "" {
|
|
| 589 |
- fs = determineDefaultFS() |
|
| 587 |
+ if devices.filesystem == "" {
|
|
| 588 |
+ devices.filesystem = determineDefaultFS() |
|
| 590 | 589 |
} |
| 591 | 590 |
|
| 592 |
- switch fs {
|
|
| 591 |
+ switch devices.filesystem {
|
|
| 593 | 592 |
case "xfs": |
| 594 | 593 |
err = exec.Command("mkfs.xfs", args...).Run()
|
| 595 | 594 |
case "ext4": |
| ... | ... |
@@ -602,7 +603,7 @@ func (devices *DeviceSet) createFilesystem(info *devInfo) error {
|
| 602 | 602 |
} |
| 603 | 603 |
err = exec.Command("tune2fs", append([]string{"-c", "-1", "-i", "0"}, devname)...).Run()
|
| 604 | 604 |
default: |
| 605 |
- err = fmt.Errorf("Unsupported filesystem type %s", fs)
|
|
| 605 |
+ err = fmt.Errorf("Unsupported filesystem type %s", devices.filesystem)
|
|
| 606 | 606 |
} |
| 607 | 607 |
if err != nil {
|
| 608 | 608 |
return err |
| ... | ... |
@@ -889,6 +890,10 @@ func (devices *DeviceSet) getBaseDeviceSize() uint64 {
|
| 889 | 889 |
return info.Size |
| 890 | 890 |
} |
| 891 | 891 |
|
| 892 |
+func (devices *DeviceSet) getBaseDeviceFS() string {
|
|
| 893 |
+ return devices.filesystem |
|
| 894 |
+} |
|
| 895 |
+ |
|
| 892 | 896 |
func (devices *DeviceSet) verifyBaseDeviceUUIDFS(baseInfo *devInfo) error {
|
| 893 | 897 |
devices.Lock() |
| 894 | 898 |
defer devices.Unlock() |
| ... | ... |
@@ -911,14 +916,15 @@ func (devices *DeviceSet) verifyBaseDeviceUUIDFS(baseInfo *devInfo) error {
|
| 911 | 911 |
// If user specified a filesystem using dm.fs option and current |
| 912 | 912 |
// file system of base image is not same, warn user that dm.fs |
| 913 | 913 |
// will be ignored. |
| 914 |
- if devices.userFilesystem != "" {
|
|
| 914 |
+ if devices.filesystem != "" {
|
|
| 915 | 915 |
fs, err := ProbeFsType(baseInfo.DevName()) |
| 916 | 916 |
if err != nil {
|
| 917 | 917 |
return err |
| 918 | 918 |
} |
| 919 | 919 |
|
| 920 |
- if fs != devices.userFilesystem {
|
|
| 921 |
- logrus.Warnf("Base device already exists and has filesystem %s on it. User specified filesystem %s will be ignored.", fs, devices.userFilesystem)
|
|
| 920 |
+ if fs != devices.filesystem {
|
|
| 921 |
+ logrus.Warnf("Base device already exists and has filesystem %s on it. User specified filesystem %s will be ignored.", fs, devices.filesystem)
|
|
| 922 |
+ devices.filesystem = fs |
|
| 922 | 923 |
} |
| 923 | 924 |
} |
| 924 | 925 |
return nil |
| ... | ... |
@@ -2271,6 +2277,7 @@ func (devices *DeviceSet) Status() *Status {
|
| 2271 | 2271 |
status.DeferredDeleteEnabled = devices.deferredDelete |
| 2272 | 2272 |
status.DeferredDeletedDeviceCount = devices.nrDeletedDevices |
| 2273 | 2273 |
status.BaseDeviceSize = devices.getBaseDeviceSize() |
| 2274 |
+ status.BaseDeviceFS = devices.getBaseDeviceFS() |
|
| 2274 | 2275 |
|
| 2275 | 2276 |
totalSizeInSectors, _, dataUsed, dataTotal, metadataUsed, metadataTotal, err := devices.poolStatus() |
| 2276 | 2277 |
if err == nil {
|
| ... | ... |
@@ -2369,7 +2376,7 @@ func NewDeviceSet(root string, doInit bool, options []string, uidMaps, gidMaps [ |
| 2369 | 2369 |
if val != "ext4" && val != "xfs" {
|
| 2370 | 2370 |
return nil, fmt.Errorf("Unsupported filesystem %s\n", val)
|
| 2371 | 2371 |
} |
| 2372 |
- devices.userFilesystem = val |
|
| 2372 |
+ devices.filesystem = val |
|
| 2373 | 2373 |
case "dm.mkfsarg": |
| 2374 | 2374 |
devices.mkfsArgs = append(devices.mkfsArgs, val) |
| 2375 | 2375 |
case "dm.mountopt": |
| ... | ... |
@@ -80,7 +80,7 @@ func (d *Driver) Status() [][2]string {
|
| 80 | 80 |
{"Pool Name", s.PoolName},
|
| 81 | 81 |
{"Pool Blocksize", fmt.Sprintf("%s", units.HumanSize(float64(s.SectorSize)))},
|
| 82 | 82 |
{"Base Device Size", fmt.Sprintf("%s", units.HumanSize(float64(s.BaseDeviceSize)))},
|
| 83 |
- {"Backing Filesystem", backingFs},
|
|
| 83 |
+ {"Backing Filesystem", s.BaseDeviceFS},
|
|
| 84 | 84 |
{"Data file", s.DataFile},
|
| 85 | 85 |
{"Metadata file", s.MetadataFile},
|
| 86 | 86 |
{"Data Space Used", fmt.Sprintf("%s", units.HumanSize(float64(s.Data.Used)))},
|