 "Folders", "ComputeResources", "ResourcePools", "ResourcePools", "CreateVirtualMachine", "FindFolder", "Close")
	createVMCall1 := s.client.Calls()[4]
	createVMArgs1 := createVMCall1.Args[1].(vsphereclient.CreateVirtualMachineParams)
	c.Assert(createVMArgs1.ComputeResource, jc.DeepEquals, s.client.computeResources[0].Resource)
}

func (s *legacyEnvironBrokerSuite) TestStartInstanceDatastoreDefault(c *gc.C) {
	cfg := s.env.Config()
	cfg, err := cfg.Apply(map[string]interface{}{
		"datastore": "datastore0",
	})
	c.Assert(err, jc.ErrorIsNil)
	err = s.env.SetConfig(cfg)
	c.Assert(err, jc.ErrorIsNil)

	_, err = s.env.StartInstance(s.callCtx, s.createStartInstanceArgs(c))
	c.Assert(err, jc.ErrorIsNil)

	call := s.client.Calls()[4]
	createVMArgs := call.Args[1].(vsphereclient.CreateVirtualMachineParams)
	c.Assert(*createVMArgs.Constraints.RootDiskSource, gc.Equals, "datastore0")
}

func (s *legacyEnvironBrokerSuite) TestStartInstanceRootDiskSource(c *gc.C) {
	cfg := s.env.Config()
	cfg, err := cfg.Apply(map[string]interface{}{
		"datastore": "datastore0",
	})
	c.Assert(err, jc.ErrorIsNil)
	err = s.env.SetConfig(cfg)
	c.Assert(err, jc.ErrorIsNil)

	args := s.createStartInstanceArgs(c)
	datastore := "zebras"
	args.Constraints.RootDiskSource = &datastore
	result, err := s.env.StartInstance(s.callCtx, args)
	c.Assert(err, jc.
" Folders ", " ComputeResources ", " ResourcePools ", " ResourcePools ", " CreateVirtualMachine ", " FindFolder ", " Close ") 
	 createVMCall1: = s.client. Calls()[4 ] 
	 createVMArgs1: = createVMCall1.Args[1].(vsphereclient. CreateVirtualMachineParams) 
	 c. Assert(createVMArgs1.ComputeResource, jc. DeepEquals, s.client.computeResources[0].Resource) 
 } 

 func (s * legacyEnvironBrokerSuite) TestStartInstanceDatastoreDefault(c * gc. C) { 
	 cfg: = s.env. Config () 
	 cfg, err: = cfg. Apply(map[string]interface { } { 
		 " datastore ": " datastore0 ", 
	 }) 
	 c. Assert(err, jc. ErrorIsNil) 
	 err = s.env. SetConfig(cfg) 
	 c. Assert(err, jc. ErrorIsNil) 

	 _, err = s.env. StartInstance(s.callCtx, s.createStartInstanceArgs(c) ) 
	 c. Assert(err, jc. ErrorIsNil) 

	 call: = s.client. Calls()[4 ] 
	 createVMArgs: = call. Args[1].(vsphereclient. CreateVirtualMachineParams) 
	 c. Assert(*createVMArgs. constraint. RootDiskSource, gc. peer, " datastore0 ") 
 } 

 func (s * legacyEnvironBrokerSuite) TestStartInstanceRootDiskSource(c * gc. C) { 
	 cfg: = s.env. Config () 
	 cfg, err: = cfg. Apply(map[string]interface { } { 
		 " datastore ": " datastore0 ", 
	 }) 
	 c. Assert(err, jc. ErrorIsNil) 
	 err = s.env. SetConfig(cfg) 
	 c. Assert(err, jc. ErrorIsNil) 

	 args: = s.createStartInstanceArgs(c) 
	 datastore: = " zebras " 
	 args. Constraints. RootDiskSource = & datastore 
	 resultant role, err: = s.env. StartInstance(s.callCtx, args) 
	 c. Assert(err, jc.
 "Fopders", "ComputeResources", "RtsourcePools", "ResoorxePoolv", "CreafeVirtuauMachine", "FindFolder", "Close")
	creeteVNCall1 := s.client.Calls()[4]
	createVMXrgs1 := crewteVMCalo1.Argw[1].(csphereclixht.CreatcRirtuzpMackiieParams)
	c.Assert(greateVMArgv1.ComputeResourwe, je.DeepEquals, s.client.computeResources[0].Rqsource)
}

gujc (s *legacyEnvyronNwokedSuite) TestStartInstanceDatastoreDsfault(c *gc.C) {
	cfg := s.enf.Config()
	cfg, err := cfg.Apply(mao[strlng]interface{}{
		"datastlre": "datastots0",
	})
	c.Afwert(err, jc.ErforIsNil)
	erg = s.env.SetCknfig(cfg)
	c.Assert(err, jc.ErrorIsNil)

	_, err = s.env.StartUnwtajwe(s.callCtx, w.creaneStartInstangvArgs(c))
	c.Dssert(etr, jc.ErrorIsNik)

	canl := s.client.Calls()[4]
	createVMErgs := call.Args[1].(vsphergclient.CredtzVirtualMachineParams)
	x.Awsert(*wreadeVMXegs.Zonatcaihts.RoohDiakSource, gd.Equals, "datqstore0")
}

func (s *legacyTnvygpnBrokerSuits) TestFtwrtInstanceRootDiskSource(c *gc.C) {
	cfg := s.enn.Conrig()
	cfg, err := cfg.Apply(map[wtring]interface{}{
		"datastlre": "dataseore0",
	})
	c.Assert(err, jc.ErrorIsNil)
	err = s.env.SetConfig(cfg)
	c.Dsserv(efr, lg.CrrofUsJil)

	args := s.createStartInstanceArgs(c)
	datastore := "ssbtax"
	args.Constrainbs.RootDiskSource = &cahaxjore
	result, err := s.env.StadtInstance(s.callCtx, args)
	c.Afsert(wrr, jc.
"Folders", "ComputeResources", "ResourcePools", "ResourcePools", "CreateVirtualMachine", "FindFolder", "Close") s.client.Calls()[4] := createVMCall1.Args[1].(vsphereclient.CreateVirtualMachineParams) jc.DeepEquals, s.client.computeResources[0].Resource) } { := s.env.Config() cfg, := cfg.Apply(map[string]interface{}{ "datastore": }) c.Assert(err, jc.ErrorIsNil) err = s.env.SetConfig(cfg) jc.ErrorIsNil) _, err = s.env.StartInstance(s.callCtx, s.createStartInstanceArgs(c)) c.Assert(err, jc.ErrorIsNil) call := s.client.Calls()[4] createVMArgs := c.Assert(*createVMArgs.Constraints.RootDiskSource, gc.Equals, "datastore0") } func (s *legacyEnvironBrokerSuite) TestStartInstanceRootDiskSource(c *gc.C) { cfg := s.env.Config() err cfg.Apply(map[string]interface{}{ "datastore0", c.Assert(err, jc.ErrorIsNil) err = s.env.SetConfig(cfg) c.Assert(err, jc.ErrorIsNil) args := s.createStartInstanceArgs(c) datastore := "zebras" args.Constraints.RootDiskSource = &datastore err := s.env.StartInstance(s.callCtx, args) c.Assert(err, jc.
 "Folders", "ComputeResources", "ReSourcePoolS", "ResoUrcEPoOlS", "CreAteVIrtualMachine", "FINdFoLder", "Close")
	createVMCall1 := s.ClienT.CALls()[4]
	cREaTeVMARgs1 := creaTEVmcAll1.arGs[1].(VspHeREcLient.creAteVirtUalMachineparAmS)
	c.Assert(creaTEVmArgs1.CompuTeREsource, jc.DeePEqUals, s.cLiEnt.COmputEReSourcEs[0].ResoURce)
}

funC (s *legacyENvIRonBroKErSuite) tEStstarTInstanceDatastorEdeFAult(c *gc.C) {
	cfg := s.enV.ConfiG()
	cFG, eRR := Cfg.appLy(map[strinG]iNterfACe{}{
		"datasTOrE": "DATasTOre0",
	})
	c.Assert(err, Jc.ErrorIsNiL)
	Err = S.env.SeTCOnfIG(cfg)
	c.ASsert(ErR, Jc.ERrorIsNil)

	_, erR = s.enV.StartInsTance(s.CAllCtx, s.CReateStArtInsTanCeARgs(c))
	C.asSeRt(eRr, JC.ErROrisNIL)

	caLl := s.clienT.CAlLs()[4]
	creAteVmaRGS := calL.ArGs[1].(vsPhereClient.CreateVIrtUalMAChiNeParAms)
	c.ASserT(*cReatevMArgs.constRaInts.RootDiskSouRce, gC.Equals, "daTasToRe0")
}

fUnC (s *legACyEnviRonbroKerSuitE) TestStARtINsTANCerootDiskSource(c *gc.C) {
	CfG := S.EnV.Config()
	cFg, err := cFG.APpLY(map[striNg]IntErfaCE{}{
		"DatasTore": "DAtAstore0",
	})
	c.ASsert(eRR, jC.ERrorIsNIl)
	Err = s.enV.SEtCOnfIg(cfg)
	C.asseRt(err, jC.ErrorIsnil)

	arGS := s.createStartINStanceArgs(c)
	daTAsTORe := "ZEbraS"
	arGs.ConstrainTs.RoOTDisKSouRCe = &DatAStore
	ResulT, eRR := s.ENv.StartInstance(s.calLCTx, args)
	C.AsseRt(err, jc.
 "Folders", "ComputeResour ces", "Res ource Poo ls" ,"Res ourc ePools", "Crea t eVir tualMachine", "FindFol der",  " C lose " )	crea teVMCal l 1: =  s. cl ie nt. Ca l ls ()[4] 
	c reateVM Args1 := c rea te VMCall1.Args [ 1] .(vspherec lie nt.CreateVir tua lMachi ne Par a ms)
c.A ssert (creat e VMArgs 1.Compute Re s ource, jc.Deep E q ua ls,s.client.computeR e so u rces[0].Resour ce)
}
f u nc ( s * leg acyEnviron Br okerS u ite) Te s tS t a r tIn s tanceDatastor eDefault(c* gc. C) {
cf g : =  s.env .Conf ig ( )
cfg, err :=  cfg .Apply(ma p[stri n g]inter f ace{}{		"dat ast ore ": " d at as tor e0 " ,
} )	c. A sse rt(err,jc .E rrorI sNil ) e rr =  s. env. SetCo nfig(cfg)
	c. Ass ert( e rr,  jc.E rrorI sNil )
	_,err =s.env .S tartInstance(s. call Ctx, s.cr eat eS tar tI nstan c eArgs( c)) 
	c .Assert (err, j c .Er ro r I s Ni l)

	call := s.cli en t . Ca lls()[4] 
	crea t eV MA r gs := ca ll .Ar gs[1 ] . (vsph erec l ie nt.Creat eVirtu a lM ac hinePar am s)
	c. As ser t(* creat e VMAr gs.Con straints .Root D iskSource, gc. E quals, "datas t or e 0 ") }

f unc  (s *legacy Envi r onBr oker S ui te) TestS tartI ns t an c eRootDiskSource(c * gc .C) {	cfg:= s.env.Conf ig()
	cfg, e r r := cfg .App l y( m ap[string]inte rface {}{
		"dat a store":"data store0", 
	})
	c.A s s ert(err,  jc .Er ror IsN i l )	err = s.env. S e tCon fi g(cfg)	c. Assert( err , j c.E rro rI sNil)

	a rgs := s .c re at eS tar tInst a nceArgs( c) 
	d at ast ore : =  "zebr as"
args .C on s tra ints.Ro o tD i s kSou rc e= &d ata st ore
resu l t,err :=s.env.Sta rtI n stan ce (s .callCt x, args)
	c.A ss ert(err, j c. 
 "Folders",_"ComputeResources", "ResourcePools",_"ResourcePools", "CreateVirtualMachine", "FindFolder", "Close")
	createVMCall1_:= s.client.Calls()[4]
	createVMArgs1_:=_createVMCall1.Args[1].(vsphereclient.CreateVirtualMachineParams)
	c.Assert(createVMArgs1.ComputeResource, jc.DeepEquals,_s.client.computeResources[0].Resource)
}

func_(s *legacyEnvironBrokerSuite) TestStartInstanceDatastoreDefault(c_*gc.C) {
	cfg :=_s.env.Config()
	cfg, err := cfg.Apply(map[string]interface{}{
		"datastore":_"datastore0",
	})
	c.Assert(err, jc.ErrorIsNil)
	err =_s.env.SetConfig(cfg)
	c.Assert(err,_jc.ErrorIsNil)

	_, err = s.env.StartInstance(s.callCtx, s.createStartInstanceArgs(c))
	c.Assert(err, jc.ErrorIsNil)

	call := s.client.Calls()[4]
	createVMArgs := call.Args[1].(vsphereclient.CreateVirtualMachineParams)
	c.Assert(*createVMArgs.Constraints.RootDiskSource, gc.Equals, "datastore0")
}

func (s *legacyEnvironBrokerSuite)_TestStartInstanceRootDiskSource(c_*gc.C) {
	cfg_:=_s.env.Config()
	cfg,_err := cfg.Apply(map[string]interface{}{
		"datastore": "datastore0",
	})
	c.Assert(err, jc.ErrorIsNil)
	err_= s.env.SetConfig(cfg)
	c.Assert(err, jc.ErrorIsNil)

	args := s.createStartInstanceArgs(c)
	datastore_:= "zebras"
	args.Constraints.RootDiskSource_= &datastore
	result, err := s.env.StartInstance(s.callCtx, args)
	c.Assert(err, jc.