コード例 #1
0
func (f *fixedMigratedFrom) sameStaticIps(job bftinput.Job, previousJob bftinput.Job, input bftinput.Input) []staticIPInfo {
	ips := []staticIPInfo{}
	for _, network := range job.Networks {
		previousNetwork, networkFound := previousJob.FindNetworkByName(network.Name)
		if networkFound {
			for _, currentIP := range network.StaticIps {
				for _, prevIP := range previousNetwork.StaticIps {
					if prevIP == currentIP {
						cloudNetwork, cloudNetworkFound := input.FindNetworkByName(network.Name)
						if cloudNetworkFound {
							ip := staticIPInfo{
								IP:      currentIP,
								Network: cloudNetwork,
							}
							ips = append(ips, ip)
						}
					}
				}
			}
		}
	}
	return ips
}
コード例 #2
0
func (f *fixedMigratedFrom) assignMigratedFromBasedOnIp(ip staticIPInfo, jobToUpdate *bftinput.Job) {
	for _, subnet := range ip.Network.Subnets {
		if subnet.IpPool.Contains(ip.IP) {
			jobToUpdate.MigratedFrom = []bftinput.MigratedFromConfig{
				{
					Name:             jobToUpdate.Name,
					AvailabilityZone: subnet.AvailabilityZones[0],
				},
			}

			return
		}
	}
}