Esempio n. 1
0
File: client.go Progetto: bac/juju
// MinionReports returns details of the reports made by migration
// minions to the controller for the current migration phase.
func (c *Client) MinionReports() (migration.MinionReports, error) {
	var in params.MinionReports
	var out migration.MinionReports

	err := c.caller.FacadeCall("MinionReports", nil, &in)
	if err != nil {
		return out, errors.Trace(err)
	}

	out.MigrationId = in.MigrationId

	phase, ok := migration.ParsePhase(in.Phase)
	if !ok {
		return out, errors.Errorf("invalid phase: %q", in.Phase)
	}
	out.Phase = phase

	out.SuccessCount = in.SuccessCount
	out.UnknownCount = in.UnknownCount

	out.SomeUnknownMachines, out.SomeUnknownUnits, err = groupTagIds(in.UnknownSample)
	if err != nil {
		return out, errors.Annotate(err, "processing unknown agents")
	}

	out.FailedMachines, out.FailedUnits, err = groupTagIds(in.Failed)
	if err != nil {
		return out, errors.Annotate(err, "processing failed agents")
	}

	return out, nil
}
Esempio n. 2
0
func (s *MinionReportsSuite) TestIsZeroIdSet(c *gc.C) {
	reports := migration.MinionReports{
		MigrationId: "foo",
	}
	c.Check(reports.IsZero(), jc.IsFalse)
}
Esempio n. 3
0
func (s *MinionReportsSuite) TestIsZeroPhaseSet(c *gc.C) {
	reports := migration.MinionReports{
		Phase: migration.QUIESCE,
	}
	c.Check(reports.IsZero(), jc.IsFalse)
}
Esempio n. 4
0
func (s *MinionReportsSuite) TestIsZero(c *gc.C) {
	reports := migration.MinionReports{}
	c.Check(reports.IsZero(), jc.IsTrue)
}