github.com/altoros/juju-vmware@v0.0.0-20150312064031-f19ae857ccca/upgrades/steps121.go (about)

     1  // Copyright 2014 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package upgrades
     5  
     6  import (
     7  	"github.com/juju/juju/state"
     8  )
     9  
    10  // stateStepsFor121 returns upgrade steps form Juju 1.21 that manipulate state directly.
    11  func stateStepsFor121() []Step {
    12  	return []Step{
    13  		&upgradeStep{
    14  			description: "add environment uuid to state server doc",
    15  			targets:     []Target{DatabaseMaster},
    16  			run: func(context Context) error {
    17  				return state.AddEnvironmentUUIDToStateServerDoc(context.State())
    18  			},
    19  		},
    20  		&upgradeStep{
    21  			description: "set environment owner and server uuid",
    22  			targets:     []Target{DatabaseMaster},
    23  			run: func(context Context) error {
    24  				return state.SetOwnerAndServerUUIDForEnvironment(context.State())
    25  			},
    26  		},
    27  
    28  		&upgradeStep{
    29  			description: "migrate machine instanceId into instanceData",
    30  			targets:     []Target{DatabaseMaster},
    31  			run: func(context Context) error {
    32  				return state.MigrateMachineInstanceIdToInstanceData(context.State())
    33  			},
    34  		},
    35  		&upgradeStep{
    36  			description: "prepend the environment UUID to the ID of all machine docs",
    37  			targets:     []Target{DatabaseMaster},
    38  			run: func(context Context) error {
    39  				return state.AddEnvUUIDToMachines(context.State())
    40  			},
    41  		},
    42  		&upgradeStep{
    43  			description: "prepend the environment UUID to the ID of all instanceData docs",
    44  			targets:     []Target{DatabaseMaster},
    45  			run: func(context Context) error {
    46  				return state.AddEnvUUIDToInstanceData(context.State())
    47  			},
    48  		},
    49  		&upgradeStep{
    50  			description: "prepend the environment UUID to the ID of all containerRef docs",
    51  			targets:     []Target{DatabaseMaster},
    52  			run: func(context Context) error {
    53  				return state.AddEnvUUIDToContainerRefs(context.State())
    54  			},
    55  		},
    56  		&upgradeStep{
    57  			description: "prepend the environment UUID to the ID of all service docs",
    58  			targets:     []Target{DatabaseMaster},
    59  			run: func(context Context) error {
    60  				return state.AddEnvUUIDToServices(context.State())
    61  			},
    62  		},
    63  		&upgradeStep{
    64  			description: "prepend the environment UUID to the ID of all unit docs",
    65  			targets:     []Target{DatabaseMaster},
    66  			run: func(context Context) error {
    67  				return state.AddEnvUUIDToUnits(context.State())
    68  			},
    69  		},
    70  		&upgradeStep{
    71  			description: "prepend the environment UUID to the ID of all reboot docs",
    72  			targets:     []Target{DatabaseMaster},
    73  			run: func(context Context) error {
    74  				return state.AddEnvUUIDToReboots(context.State())
    75  			},
    76  		},
    77  		&upgradeStep{
    78  			description: "prepend the environment UUID to the ID of all relations docs",
    79  			targets:     []Target{DatabaseMaster},
    80  			run: func(context Context) error {
    81  				return state.AddEnvUUIDToRelations(context.State())
    82  			},
    83  		},
    84  		&upgradeStep{
    85  			description: "prepend the environment UUID to the ID of all relationscopes docs",
    86  			targets:     []Target{DatabaseMaster},
    87  			run: func(context Context) error {
    88  				return state.AddEnvUUIDToRelationScopes(context.State())
    89  			},
    90  		},
    91  		&upgradeStep{
    92  			description: "prepend the environment UUID to the ID of all charm docs",
    93  			targets:     []Target{DatabaseMaster},
    94  			run: func(context Context) error {
    95  				return state.AddEnvUUIDToCharms(context.State())
    96  			},
    97  		},
    98  		&upgradeStep{
    99  			description: "prepend the environment UUID to the ID of all minUnit docs",
   100  			targets:     []Target{DatabaseMaster},
   101  			run: func(context Context) error {
   102  				return state.AddEnvUUIDToMinUnits(context.State())
   103  			},
   104  		},
   105  		&upgradeStep{
   106  			description: "prepend the environment UUID to the ID of all cleanup docs",
   107  			targets:     []Target{DatabaseMaster},
   108  			run: func(context Context) error {
   109  				return state.AddEnvUUIDToCleanups(context.State())
   110  			},
   111  		},
   112  		&upgradeStep{
   113  			description: "prepend the environment UUID to the ID of all sequence docs",
   114  			targets:     []Target{DatabaseMaster},
   115  			run: func(context Context) error {
   116  				return state.AddEnvUUIDToSequences(context.State())
   117  			},
   118  		},
   119  
   120  		&upgradeStep{
   121  			description: "rename the user LastConnection field to LastLogin",
   122  			targets:     []Target{DatabaseMaster},
   123  			run: func(context Context) error {
   124  				return state.MigrateUserLastConnectionToLastLogin(context.State())
   125  			},
   126  		},
   127  		&upgradeStep{
   128  			description: "add all users in state as environment users",
   129  			targets:     []Target{DatabaseMaster},
   130  			run: func(context Context) error {
   131  				return state.AddStateUsersAsEnvironUsers(context.State())
   132  			},
   133  		},
   134  		&upgradeStep{
   135  			description: "migrate charm archives into environment storage",
   136  			targets:     []Target{DatabaseMaster},
   137  			run: func(context Context) error {
   138  				return migrateCharmStorage(context.State(), context.AgentConfig())
   139  			},
   140  		},
   141  		&upgradeStep{
   142  			description: "migrate custom image metadata into environment storage",
   143  			targets:     []Target{DatabaseMaster},
   144  			run: func(context Context) error {
   145  				return migrateCustomImageMetadata(context.State(), context.AgentConfig())
   146  			},
   147  		},
   148  		&upgradeStep{
   149  			description: "migrate tools into environment storage",
   150  			targets:     []Target{DatabaseMaster},
   151  			run: func(context Context) error {
   152  				return migrateToolsStorage(context.State(), context.AgentConfig())
   153  			},
   154  		},
   155  		&upgradeStep{
   156  			description: "migrate individual unit ports to openedPorts collection",
   157  			targets:     []Target{DatabaseMaster},
   158  			run: func(context Context) error {
   159  				return state.MigrateUnitPortsToOpenedPorts(context.State())
   160  			},
   161  		},
   162  		&upgradeStep{
   163  			description: "create entries in meter status collection for existing units",
   164  			targets:     []Target{DatabaseMaster},
   165  			run: func(context Context) error {
   166  				return state.CreateUnitMeterStatus(context.State())
   167  			},
   168  		},
   169  		&upgradeStep{
   170  			description: "migrate machine jobs into ones with JobManageNetworking based on rules",
   171  			targets:     []Target{DatabaseMaster},
   172  			run: func(context Context) error {
   173  				return state.MigrateJobManageNetworking(context.State())
   174  			},
   175  		},
   176  	}
   177  }