@@ -80,13 +80,24 @@ func (d Driver) Create(req *v.CreateRequest) error {
80
80
size )
81
81
}
82
82
83
+ sparse := false
84
+ sparseStr , sparsePresent := req .Options ["sparsePresent" ]
85
+ if sparsePresent {
86
+ sparse , err = strconv .ParseBool (sparseStr )
87
+ if err != nil {
88
+ return errors .Wrapf (err ,
89
+ "Error creating volume '%s' - cannot parse 'sparse' option value '%s' as bool" ,
90
+ req .Name , sparseStr )
91
+ }
92
+ }
93
+
83
94
uid := - 1
84
95
uidStr , uidPresent := req .Options ["uid" ]
85
96
if uidPresent && len (uidStr ) > 0 {
86
97
uid , err = strconv .Atoi (uidStr )
87
98
if err != nil {
88
99
return errors .Wrapf (err ,
89
- "Error creating volume '%s' - cannot parse 'uid' option '%s' as an integer" ,
100
+ "Error creating volume '%s' - cannot parse 'uid' option value '%s' as an integer" ,
90
101
req .Name , uidStr )
91
102
}
92
103
if uid < 0 {
@@ -106,7 +117,7 @@ func (d Driver) Create(req *v.CreateRequest) error {
106
117
gid , err = strconv .Atoi (gidStr )
107
118
if err != nil {
108
119
return errors .Wrapf (err ,
109
- "Error creating volume '%s' - cannot parse 'gid' option '%s' as an integer" ,
120
+ "Error creating volume '%s' - cannot parse 'gid' option value '%s' as an integer" ,
110
121
req .Name , gidStr )
111
122
}
112
123
if gid < 0 {
@@ -141,7 +152,7 @@ func (d Driver) Create(req *v.CreateRequest) error {
141
152
142
153
logger .Debug ().Msg ("starting creation" )
143
154
144
- err = d .manager .Create (req .Name , sizeInBytes , uid , gid , mode )
155
+ err = d .manager .Create (req .Name , sizeInBytes , sparse , uid , gid , mode )
145
156
if err != nil {
146
157
return err
147
158
}
0 commit comments