@@ -364,6 +364,16 @@ func (o *snapshotter) checkTurboOCI(labels map[string]string) (bool, string, str
364
364
return false , "" , ""
365
365
}
366
366
367
+ func (o * snapshotter ) isPrepareRootfs (info snapshots.Info ) bool {
368
+ if _ , ok := info .Labels [label .TargetSnapshotRef ]; ok {
369
+ return false
370
+ }
371
+ if info .Labels [label .SnapshotType ] == "image" {
372
+ return false
373
+ }
374
+ return true
375
+ }
376
+
367
377
func (o * snapshotter ) createMountPoint (ctx context.Context , kind snapshots.Kind , key string , parent string , opts ... snapshots.Opt ) (_ []mount.Mount , retErr error ) {
368
378
369
379
ctx , t , err := o .ms .TransactionContext (ctx , true )
@@ -384,6 +394,7 @@ func (o *snapshotter) createMountPoint(ctx context.Context, kind snapshots.Kind,
384
394
if err != nil {
385
395
return nil , err
386
396
}
397
+ log .G (ctx ).Infof ("sn: %s, labels:[%+v]" , id , info .Labels )
387
398
defer func () {
388
399
// the transaction rollback makes created snapshot invalid, just clean it.
389
400
if retErr != nil && rollback {
@@ -495,8 +506,8 @@ func (o *snapshotter) createMountPoint(ctx context.Context, kind snapshots.Kind,
495
506
writeType := o .getWritableType (ctx , parentID , info )
496
507
497
508
// If Preparing for rootfs, find metadata from its parent (top layer), launch and mount backstore device.
498
- if _ , ok := info . Labels [ label . TargetSnapshotRef ]; ! ok {
499
- log .G (ctx ).Infof ("Preparing rootfs. writeType: %s" , writeType )
509
+ if o . isPrepareRootfs ( info ) {
510
+ log .G (ctx ).Infof ("Preparing rootfs(%s) . writeType: %s" , s . ID , writeType )
500
511
if writeType != RoDir {
501
512
stype = storageTypeLocalBlock
502
513
if err := o .constructOverlayBDSpec (ctx , key , true ); err != nil {
@@ -515,8 +526,8 @@ func (o *snapshotter) createMountPoint(ctx context.Context, kind snapshots.Kind,
515
526
parentIsAccelLayer := parentInfo .Labels [label .AccelerationLayer ] == "yes"
516
527
needRecordTrace := info .Labels [label .RecordTrace ] == "yes"
517
528
recordTracePath := info .Labels [label .RecordTracePath ]
518
- log .G (ctx ).Infof ("Prepare rootfs (parentIsAccelLayer: %t, needRecordTrace: %t, recordTracePath: %s)" ,
519
- parentIsAccelLayer , needRecordTrace , recordTracePath )
529
+ log .G (ctx ).Infof ("Prepare rootfs (sn: %s, parentIsAccelLayer: %t, needRecordTrace: %t, recordTracePath: %s)" ,
530
+ id , parentIsAccelLayer , needRecordTrace , recordTracePath )
520
531
521
532
if parentIsAccelLayer {
522
533
log .G (ctx ).Infof ("get accel-layer in parent (id: %s)" , id )
0 commit comments