示例#1
0
func getProvisioningInfo(m *state.Machine) (*params.ProvisioningInfo, error) {
	cons, err := m.Constraints()
	if err != nil {
		return nil, err
	}
	// TODO(dimitern) For now, since network names and
	// provider ids are the same, we return what we got
	// from state. In the future, when networks can be
	// added before provisioning, we should convert both
	// slices from juju network names to provider-specific
	// ids before returning them.
	includeNetworks, excludeNetworks, err := m.RequestedNetworks()
	if err != nil {
		return nil, err
	}
	return &params.ProvisioningInfo{
		Constraints:     cons,
		Series:          m.Series(),
		Placement:       m.Placement(),
		IncludeNetworks: includeNetworks,
		ExcludeNetworks: excludeNetworks,
	}, nil
}