ソースを参照

Merge pull request #20156 from tonistiigi/migration-remove-hard-failure

Don’t stop daemon on migration hard failure
Brian Goff 9 年 前
コミット
3fd1f6fa8b
3 ファイル変更4 行追加3 行削除
  1. 1 1
      daemon/daemon.go
  2. 1 1
      layer/migration.go
  3. 2 1
      migrate/v1/migratev1.go

+ 1 - 1
daemon/daemon.go

@@ -748,7 +748,7 @@ func NewDaemon(config *Config, registryService *registry.Service) (daemon *Daemo
 
 
 	migrationStart := time.Now()
 	migrationStart := time.Now()
 	if err := v1.Migrate(config.Root, graphDriver, d.layerStore, d.imageStore, referenceStore, distributionMetadataStore); err != nil {
 	if err := v1.Migrate(config.Root, graphDriver, d.layerStore, d.imageStore, referenceStore, distributionMetadataStore); err != nil {
-		return nil, err
+		logrus.Errorf("Graph migration failed: %q. Your old graph data was found to be too inconsistent for upgrading to content-addressable storage. Some of the old data was probably not upgraded. We recommend starting over with a clean storage directory if possible.", err)
 	}
 	}
 	logrus.Infof("Graph migration to content-addressability took %.2f seconds", time.Since(migrationStart).Seconds())
 	logrus.Infof("Graph migration to content-addressability took %.2f seconds", time.Since(migrationStart).Seconds())
 
 

+ 1 - 1
layer/migration.go

@@ -32,7 +32,7 @@ func (ls *layerStore) CreateRWLayerByGraphID(name string, graphID string, parent
 	}
 	}
 
 
 	if !ls.driver.Exists(graphID) {
 	if !ls.driver.Exists(graphID) {
-		return errors.New("graph ID does not exist")
+		return fmt.Errorf("graph ID does not exist: %q", graphID)
 	}
 	}
 
 
 	var p *roLayer
 	var p *roLayer

+ 2 - 1
migrate/v1/migratev1.go

@@ -282,7 +282,8 @@ func migrateContainers(root string, ls graphIDMounter, is image.Store, imageMapp
 		}
 		}
 
 
 		if err := ls.CreateRWLayerByGraphID(id, id, img.RootFS.ChainID()); err != nil {
 		if err := ls.CreateRWLayerByGraphID(id, id, img.RootFS.ChainID()); err != nil {
-			return err
+			logrus.Errorf("migrate container error: %v", err)
+			continue
 		}
 		}
 
 
 		logrus.Infof("migrated container %s to point to %s", id, imageID)
 		logrus.Infof("migrated container %s to point to %s", id, imageID)