示例#1
0
// stateStepsFor118 returns upgrade steps form Juju 1.18 that manipulate state directly.
func stateStepsFor118() []Step {
	return []Step{
		&upgradeStep{
			description: "add the version field to all settings docs",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.MigrateSettingsSchema(context.State())
			},
		},
		&upgradeStep{
			description: "update rsyslog port",
			targets:     []Target{StateServer},
			run:         updateRsyslogPort,
		},
		&upgradeStep{
			description: "remove deprecated environment config settings",
			targets:     []Target{StateServer},
			run:         processDeprecatedEnvSettings,
		},
		&upgradeStep{
			description: "migrate local provider agent config",
			targets:     []Target{StateServer},
			run:         migrateLocalProviderAgentConfig,
		},
	}
}
示例#2
0
// stateStepsFor126 returns upgrade steps for Juju 1.26 that manipulate state directly.
func stateStepsFor126() []Step {
	return []Step{
		&upgradeStep{
			description: "add the version field to all settings docs",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.MigrateSettingsSchema(context.State())
			},
		},
		&upgradeStep{
			description: "add status to filesystem",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.AddFilesystemStatus(context.State())
			},
		},
		&upgradeStep{
			description: "upgrade environment config",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				// TODO(axw) updateEnvironConfig should be
				// called for all upgrades, to decouple this
				// package from provider-specific upgrades.
				st := context.State()
				return upgradeEnvironConfig(st, st, environs.GlobalProviderRegistry())
			},
		},
	}
}
示例#3
0
// stateStepsFor126 returns upgrade steps for Juju 1.26 that manipulate state directly.
func stateStepsFor126() []Step {
	return []Step{
		&upgradeStep{
			description: "add the version field to all settings docs",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.MigrateSettingsSchema(context.State())
			},
		},
		&upgradeStep{
			description: "add status to filesystem",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.AddFilesystemStatus(context.State())
			},
		},
		&upgradeStep{
			description: "upgrade model config",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				// TODO(axw) updateModelConfig should be
				// called for all upgrades, to decouple this
				// package from provider-specific upgrades.
				st := context.State()
				return upgradeModelConfig(st, st, environs.GlobalProviderRegistry())
			},
		},
		//TODO(perrito666) make this an unconditional upgrade step.
		// it would be ideal not to have to modify this package whenever we add provider upgrade steps.
		&upgradeStep{
			description: "provider side upgrades",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				st := context.State()
				env, err := utils.GetEnviron(st)
				if err != nil {
					return errors.Annotate(err, "getting provider for upgrade")
				}
				return upgradeProviderChanges(env, st, version.Number{Major: 1, Minor: 26})
			},
		},
		&upgradeStep{
			description: "update machine preferred addresses",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.AddPreferredAddressesToMachines(context.State())
			},
		},
		&upgradeStep{
			description: "add default endpoint bindings to services",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.AddDefaultEndpointBindingsToServices(context.State())
			},
		},
	}
}
示例#4
0
// stateStepsFor121 returns upgrade steps form Juju 1.21 that manipulate state directly.
func stateStepsFor121() []Step {
	return []Step{
		&upgradeStep{
			description: "add the version field to all settings docs",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.MigrateSettingsSchema(context.State())
			},
		},

		&upgradeStep{
			description: "add environment uuid to state server doc",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.AddEnvironmentUUIDToStateServerDoc(context.State())
			},
		},
		&upgradeStep{
			description: "set environment owner and server uuid",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.SetOwnerAndServerUUIDForEnvironment(context.State())
			},
		},

		&upgradeStep{
			description: "migrate machine instanceId into instanceData",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.MigrateMachineInstanceIdToInstanceData(context.State())
			},
		},
		&upgradeStep{
			description: "prepend the environment UUID to the ID of all machine docs",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.AddEnvUUIDToMachines(context.State())
			},
		},
		&upgradeStep{
			description: "prepend the environment UUID to the ID of all instanceData docs",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.AddEnvUUIDToInstanceData(context.State())
			},
		},
		&upgradeStep{
			description: "prepend the environment UUID to the ID of all containerRef docs",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.AddEnvUUIDToContainerRefs(context.State())
			},
		},
		&upgradeStep{
			description: "prepend the environment UUID to the ID of all service docs",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.AddEnvUUIDToServices(context.State())
			},
		},
		&upgradeStep{
			description: "prepend the environment UUID to the ID of all unit docs",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.AddEnvUUIDToUnits(context.State())
			},
		},
		&upgradeStep{
			description: "prepend the environment UUID to the ID of all reboot docs",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.AddEnvUUIDToReboots(context.State())
			},
		},
		&upgradeStep{
			description: "prepend the environment UUID to the ID of all relations docs",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.AddEnvUUIDToRelations(context.State())
			},
		},
		&upgradeStep{
			description: "prepend the environment UUID to the ID of all relationscopes docs",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.AddEnvUUIDToRelationScopes(context.State())
			},
		},
		&upgradeStep{
			description: "prepend the environment UUID to the ID of all minUnit docs",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.AddEnvUUIDToMinUnits(context.State())
			},
		},
		&upgradeStep{
			description: "prepend the environment UUID to the ID of all cleanup docs",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.AddEnvUUIDToCleanups(context.State())
			},
		},
		&upgradeStep{
			description: "prepend the environment UUID to the ID of all sequence docs",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.AddEnvUUIDToSequences(context.State())
			},
		},

		&upgradeStep{
			description: "rename the user LastConnection field to LastLogin",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.MigrateUserLastConnectionToLastLogin(context.State())
			},
		},
		&upgradeStep{
			description: "add all users in state as environment users",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.AddStateUsersAsEnvironUsers(context.State())
			},
		},
		&upgradeStep{
			description: "migrate custom image metadata into environment storage",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return migrateCustomImageMetadata(context.State(), context.AgentConfig())
			},
		},
		&upgradeStep{
			description: "migrate tools into environment storage",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return migrateToolsStorage(context.State(), context.AgentConfig())
			},
		},
		&upgradeStep{
			description: "migrate individual unit ports to openedPorts collection",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.MigrateUnitPortsToOpenedPorts(context.State())
			},
		},
		&upgradeStep{
			description: "create entries in meter status collection for existing units",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.CreateUnitMeterStatus(context.State())
			},
		},
		&upgradeStep{
			description: "migrate machine jobs into ones with JobManageNetworking based on rules",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.MigrateJobManageNetworking(context.State())
			},
		},
	}
}
示例#5
0
// stateStepsFor125 returns upgrade steps for Juju 1.25 that manipulate state directly.
func stateStepsFor125() []Step {
	return []Step{
		&upgradeStep{
			description: "add the version field to all settings docs",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.MigrateSettingsSchema(context.State())
			},
		},
		&upgradeStep{
			description: "set hosted environment count to number of hosted environments",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.SetHostedEnvironCount(context.State())
			},
		},
		&upgradeStep{
			description: "tag machine instances",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				st := context.State()
				machines, err := st.AllMachines()
				if err != nil {
					return errors.Trace(err)
				}
				cfg, err := st.EnvironConfig()
				if err != nil {
					return errors.Trace(err)
				}
				env, err := environs.New(cfg)
				if err != nil {
					return errors.Trace(err)
				}
				return addInstanceTags(env, machines)
			},
		},
		&upgradeStep{
			description: "add missing env-uuid to statuses",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.AddMissingEnvUUIDOnStatuses(context.State())
			},
		},
		&upgradeStep{
			description: "add attachmentCount to volume",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.AddVolumeAttachmentCount(context.State())
			}},
		&upgradeStep{
			description: "add attachmentCount to filesystem",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.AddFilesystemsAttachmentCount(context.State())
			}},
		&upgradeStep{
			description: "add binding to volume",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.AddBindingToVolumes(context.State())
			}},
		&upgradeStep{
			description: "add binding to filesystem",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.AddBindingToFilesystems(context.State())
			}},
		&upgradeStep{
			description: "add status to volume",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.AddVolumeStatus(context.State())
			}},
		&upgradeStep{
			description: "move lastlogin and last connection to their own collections",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.MigrateLastLoginAndLastConnection(context.State())
			}},
		&upgradeStep{
			description: "add preferred addresses to machines",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.AddPreferredAddressesToMachines(context.State())
			},
		},
		&upgradeStep{
			description: "upgrade environment config",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				// TODO(axw) updateEnvironConfig should be
				// called for all upgrades, to decouple this
				// package from provider-specific upgrades.
				st := context.State()
				return upgradeEnvironConfig(st, st, environs.GlobalProviderRegistry())
			}},
	}
}
示例#6
0
// stateStepsFor123 returns upgrade steps for Juju 1.23 that manipulate state directly.
func stateStepsFor123() []Step {
	return []Step{
		&upgradeStep{
			description: "add the version field to all settings docs",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.MigrateSettingsSchema(context.State())
			},
		},
		&upgradeStep{
			description: "add default storage pools",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return addDefaultStoragePools(context.State())
			},
		},
		&upgradeStep{
			description: "drop old mongo indexes",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.DropOldIndexesv123(context.State())
			},
		}, &upgradeStep{
			description: "migrate envuuid to env-uuid in envUsersC",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.AddEnvUUIDToEnvUsersDoc(context.State())
			},
		},
		&upgradeStep{
			description: "move blocks from environment to state",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return moveBlocksFromEnvironToState(context)
			},
		}, &upgradeStep{
			description: "insert userenvnameC doc for each environment",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.AddUniqueOwnerEnvNameForEnvirons(context.State())
			},
		}, &upgradeStep{
			description: "add name field to users and lowercase _id field",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.AddNameFieldLowerCaseIdOfUsers(context.State())
			},
		}, &upgradeStep{
			description: "add life field to IP addresses",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.AddLifeFieldOfIPAddresses(context.State())
			},
		}, &upgradeStep{
			description: "add instance id field to IP addresses",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.AddInstanceIdFieldOfIPAddresses(context.State())
			},
		}, &upgradeStep{
			description: "lower case _id of envUsers",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.LowerCaseEnvUsersID(context.State())
			},
		}, &upgradeStep{
			description: "add leadership settings documents for all services",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.AddLeadershipSettingsDocs(context.State())
			},
		},
	}
}
示例#7
0
// stateStepsFor122 returns upgrade steps form Juju 1.22 that manipulate state directly.
func stateStepsFor122() []Step {
	return []Step{
		&upgradeStep{
			description: "add the version field to all settings docs",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.MigrateSettingsSchema(context.State())
			},
		},
		&upgradeStep{
			description: "prepend the environment UUID to the ID of all charm docs",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.AddEnvUUIDToCharms(context.State())
			},
		},
		&upgradeStep{
			description: "prepend the environment UUID to the ID of all settings docs",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.AddEnvUUIDToSettings(context.State())
			},
		},
		&upgradeStep{
			description: "prepend the environment UUID to the ID of all settingsRefs docs",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.AddEnvUUIDToSettingsRefs(context.State())
			},
		},
		&upgradeStep{
			description: "prepend the environment UUID to the ID of all networks docs",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.AddEnvUUIDToNetworks(context.State())
			},
		},
		&upgradeStep{
			description: "prepend the environment UUID to the ID of all requestedNetworks docs",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.AddEnvUUIDToRequestedNetworks(context.State())
			},
		},
		&upgradeStep{
			description: "prepend the environment UUID to the ID of all networkInterfaces docs",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.AddEnvUUIDToNetworkInterfaces(context.State())
			},
		}, &upgradeStep{
			description: "prepend the environment UUID to the ID of all statuses docs",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.AddEnvUUIDToStatuses(context.State())
			},
		}, &upgradeStep{
			description: "prepend the environment UUID to the ID of all annotations docs",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.AddEnvUUIDToAnnotations(context.State())
			},
		}, &upgradeStep{
			description: "prepend the environment UUID to the ID of all constraints docs",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.AddEnvUUIDToConstraints(context.State())
			},
		}, &upgradeStep{
			description: "prepend the environment UUID to the ID of all meterStatus docs",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.AddEnvUUIDToMeterStatus(context.State())
			},
		}, &upgradeStep{
			description: "prepend the environment UUID to the ID of all openPorts docs",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.AddEnvUUIDToOpenPorts(context.State())
			},
		}, &upgradeStep{
			description: "fix environment UUID for minUnits docs",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.FixMinUnitsEnvUUID(context.State())
			},
		}, &upgradeStep{
			description: "fix sequence documents",
			targets:     []Target{DatabaseMaster},
			run: func(context Context) error {
				return state.FixSequenceFields(context.State())
			},
		}, &upgradeStep{
			description: "update system identity in state",
			targets:     []Target{DatabaseMaster},
			run:         ensureSystemSSHKeyRedux,
		},
		&upgradeStep{
			description: "set AvailZone in instanceData",
			targets:     []Target{DatabaseMaster},
			run:         addAvaililityZoneToInstanceData,
		},
	}
}