Browse code

Don’t stop daemon on migration hard failure

Also changes missing storage layer for container
RWLayer to a soft failure.

Fixes #20147

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
(cherry picked from commit 2798d7a6a681aee8995e87c9b68128e54876d2b5)

Tonis Tiigi authored on 2016/02/10 02:44:33
Showing 3 changed files
... ...
@@ -760,7 +760,7 @@ func NewDaemon(config *Config, registryService *registry.Service) (daemon *Daemo
760 760
 
761 761
 	migrationStart := time.Now()
762 762
 	if err := v1.Migrate(config.Root, graphDriver, d.layerStore, d.imageStore, referenceStore, distributionMetadataStore); err != nil {
763
-		return nil, err
763
+		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)
764 764
 	}
765 765
 	logrus.Infof("Graph migration to content-addressability took %.2f seconds", time.Since(migrationStart).Seconds())
766 766
 
... ...
@@ -32,7 +32,7 @@ func (ls *layerStore) CreateRWLayerByGraphID(name string, graphID string, parent
32 32
 	}
33 33
 
34 34
 	if !ls.driver.Exists(graphID) {
35
-		return errors.New("graph ID does not exist")
35
+		return fmt.Errorf("graph ID does not exist: %q", graphID)
36 36
 	}
37 37
 
38 38
 	var p *roLayer
... ...
@@ -282,7 +282,8 @@ func migrateContainers(root string, ls graphIDMounter, is image.Store, imageMapp
282 282
 		}
283 283
 
284 284
 		if err := ls.CreateRWLayerByGraphID(id, id, img.RootFS.ChainID()); err != nil {
285
-			return err
285
+			logrus.Errorf("migrate container error: %v", err)
286
+			continue
286 287
 		}
287 288
 
288 289
 		logrus.Infof("migrated container %s to point to %s", id, imageID)