@@ -160,6 +160,7 @@ func hsmImportAction(c *cli.Context) error {
160
160
layout := llapi .DefaultDataLayout ()
161
161
layout .StripeCount = c .Int ("stripe_count" )
162
162
layout .StripeSize = c .Int ("stripe_size" )
163
+ layout .PoolName = c .String ("pool" )
163
164
164
165
debug .Printf ("%v, %v, %v, %v" , archive , uuid , hash , args [0 ])
165
166
_ , err = hsm .Import (args [0 ], archive , fi , layout )
@@ -178,7 +179,7 @@ func hsmImportAction(c *cli.Context) error {
178
179
return nil
179
180
}
180
181
181
- func clone (srcPath , targetPath string , stripeCount , stripeSize int , requiredState llapi.HsmStateFlag ) error {
182
+ func clone (srcPath , targetPath string , stripeCount , stripeSize int , poolName string , requiredState llapi.HsmStateFlag ) error {
182
183
srcStat , err := os .Stat (srcPath )
183
184
if err != nil {
184
185
return errors .Wrap (err , srcPath )
@@ -221,6 +222,11 @@ func clone(srcPath, targetPath string, stripeCount, stripeSize int, requiredStat
221
222
layout .StripeSize = stripeSize
222
223
223
224
}
225
+
226
+ if poolName != "" {
227
+ layout .PoolName = poolName
228
+ }
229
+
224
230
//debug.Printf("%v, %v, %v, %v", archive, uuid, hash, srcPath)
225
231
_ , err = hsm .Import (targetPath , uint (archive ), srcStat , layout )
226
232
if err != nil {
@@ -246,7 +252,7 @@ func hsmCloneAction(c *cli.Context) error {
246
252
return errors .New ("HSM clone requires source and destination argument" )
247
253
}
248
254
249
- return clone (args [0 ], args [1 ], c .Int ("stripe_count" ), c .Int ("stripe_size" ), llapi .HsmFileArchived )
255
+ return clone (args [0 ], args [1 ], c .Int ("stripe_count" ), c .Int ("stripe_size" ), c . String ( "pool" ), llapi .HsmFileArchived )
250
256
}
251
257
252
258
// tempName returns a tempname based on path provided
@@ -260,7 +266,7 @@ func hsmRestripeAction(c *cli.Context) error {
260
266
return errors .New ("Can only restripe one file at a time." )
261
267
}
262
268
tempFile := tempName (args [0 ])
263
- err := clone (args [0 ], tempFile , c .Int ("stripe_count" ), c .Int ("stripe_size" ), llapi .HsmFileReleased )
269
+ err := clone (args [0 ], tempFile , c .Int ("stripe_count" ), c .Int ("stripe_size" ), c . String ( "pool" ), llapi .HsmFileReleased )
264
270
if err != nil {
265
271
os .Remove (tempFile )
266
272
return errors .Wrap (err , "Unable to restripe" )
0 commit comments