@@ -32,7 +32,7 @@ type Storage interface {
32
32
Type () string
33
33
RootPath () string
34
34
35
- Init () error
35
+ Init (c * apitypes. HyperConfig ) error
36
36
CleanUp () error
37
37
38
38
PrepareContainer (mountId , sharedDir string , readonly bool ) (* runv.VolumeDescription , error )
@@ -103,14 +103,18 @@ func (dms *DevMapperStorage) RootPath() string {
103
103
return dms .rootPath
104
104
}
105
105
106
- func (dms * DevMapperStorage ) Init () error {
106
+ func (dms * DevMapperStorage ) Init (c * apitypes.HyperConfig ) error {
107
+ size := storage .DEFAULT_DM_POOL_SIZE
108
+ if c .StorageBaseSize > 0 {
109
+ size = c .StorageBaseSize
110
+ }
107
111
dmPool := dm.DeviceMapper {
108
112
Datafile : filepath .Join (utils .HYPER_ROOT , "lib" ) + "/data" ,
109
113
Metadatafile : filepath .Join (utils .HYPER_ROOT , "lib" ) + "/metadata" ,
110
114
DataLoopFile : storage .DEFAULT_DM_DATA_LOOP ,
111
115
MetadataLoopFile : storage .DEFAULT_DM_META_LOOP ,
112
116
PoolName : dms .VolPoolName ,
113
- Size : storage . DEFAULT_DM_POOL_SIZE ,
117
+ Size : size ,
114
118
}
115
119
dms .DmPoolData = & dmPool
116
120
rand .Seed (time .Now ().UnixNano ())
@@ -289,7 +293,7 @@ func (a *AufsStorage) RootPath() string {
289
293
return a .rootPath
290
294
}
291
295
292
- func (* AufsStorage ) Init () error { return nil }
296
+ func (* AufsStorage ) Init (c * apitypes. HyperConfig ) error { return nil }
293
297
294
298
func (* AufsStorage ) CleanUp () error { return nil }
295
299
@@ -361,7 +365,7 @@ func (o *OverlayFsStorage) RootPath() string {
361
365
return o .rootPath
362
366
}
363
367
364
- func (* OverlayFsStorage ) Init () error { return nil }
368
+ func (* OverlayFsStorage ) Init (c * apitypes. HyperConfig ) error { return nil }
365
369
366
370
func (* OverlayFsStorage ) CleanUp () error { return nil }
367
371
@@ -437,7 +441,7 @@ func (s *BtrfsStorage) subvolumesDirID(id string) string {
437
441
return filepath .Join (s .RootPath (), "subvolumes" , id )
438
442
}
439
443
440
- func (* BtrfsStorage ) Init () error { return nil }
444
+ func (* BtrfsStorage ) Init (c * apitypes. HyperConfig ) error { return nil }
441
445
442
446
func (* BtrfsStorage ) CleanUp () error { return nil }
443
447
@@ -514,7 +518,7 @@ func (s *RawBlockStorage) RootPath() string {
514
518
return s .rootPath
515
519
}
516
520
517
- func (s * RawBlockStorage ) Init () error {
521
+ func (s * RawBlockStorage ) Init (c * apitypes. HyperConfig ) error {
518
522
if err := os .MkdirAll (filepath .Join (s .RootPath (), "volumes" ), 0700 ); err != nil {
519
523
return err
520
524
}
@@ -583,7 +587,7 @@ func (v *VBoxStorage) RootPath() string {
583
587
return v .rootPath
584
588
}
585
589
586
- func (* VBoxStorage ) Init () error { return nil }
590
+ func (* VBoxStorage ) Init (c * apitypes. HyperConfig ) error { return nil }
587
591
588
592
func (* VBoxStorage ) CleanUp () error { return nil }
589
593
0 commit comments