Merge lp:~hduran-8/juju-core/add_network_check_on_specified_machine into lp:~go-bot/juju-core/trunk

Proposed by Horacio Durán
Status: Work in progress
Proposed branch: lp:~hduran-8/juju-core/add_network_check_on_specified_machine
Merge into: lp:~go-bot/juju-core/trunk
Diff against target: 301 lines (+147/-2)
13 files modified
cmd/juju/deploy.go (+2/-1)
environs/interface.go (+4/-0)
juju/deploy.go (+21/-0)
provider/azure/environ.go (+5/-0)
provider/dummy/environs.go (+5/-0)
provider/ec2/ec2.go (+5/-0)
provider/joyent/environ.go (+5/-0)
provider/local/environ.go (+5/-0)
provider/maas/environ.go (+44/-1)
provider/maas/environ_whitebox_test.go (+21/-0)
provider/manual/environ.go (+5/-0)
provider/openstack/provider.go (+5/-0)
state/apiserver/client/client.go (+20/-0)
To merge this branch: bzr merge lp:~hduran-8/juju-core/add_network_check_on_specified_machine
Reviewer Review Type Date Requested Status
Juju Engineering Pending
Review via email: mp+214463@code.launchpad.net

Description of the change

Added --not/network compat verification for --to

I added ValidateNetworksForInstance to Environ
This method checks if te requested networks are
available in the instance selected with --to
and if the excluded networks are not in conflict
with already existing ones.
I added this to the Environ interface and mocked
the method in all the available providers.
This method is only required when SupportNetworks
from EnvironCapability is true

https://codereview.appspot.com/84880045/

To post a comment you must log in.
Revision history for this message
Horacio Durán (hduran-8) wrote :

Reviewers: mp+214463_code.launchpad.net,

Message:
Please take a look.

Description:
Added --not/network compat verification for --to

I added ValidateNetworksForInstance to Environ
This method checks if te requested networks are
available in the instance selected with --to
and if the excluded networks are not in conflict
with already existing ones.
I added this to the Environ interface and mocked
the method in all the available providers.
This method is only required when SupportNetworks
from EnvironCapability is true

https://code.launchpad.net/~hduran-8/juju-core/add_network_check_on_specified_machine/+merge/214463

(do not edit description out of merge proposal)

Please review this at https://codereview.appspot.com/84880045/

Affected files (+149, -2 lines):
   A [revision details]
   M cmd/juju/deploy.go
   M environs/interface.go
   M juju/deploy.go
   M provider/azure/environ.go
   M provider/dummy/environs.go
   M provider/ec2/ec2.go
   M provider/joyent/environ.go
   M provider/local/environ.go
   M provider/maas/environ.go
   M provider/maas/environ_whitebox_test.go
   M provider/manual/environ.go
   M provider/openstack/provider.go
   M state/apiserver/client/client.go

Revision history for this message
Dimiter Naydenov (dimitern) wrote :
Download full text (4.1 KiB)

Good direction, but I have some concerns and suggestions to make it
better.

https://codereview.appspot.com/84880045/diff/1/cmd/juju/deploy.go
File cmd/juju/deploy.go (right):

https://codereview.appspot.com/84880045/diff/1/cmd/juju/deploy.go#newcode195
cmd/juju/deploy.go:195:
d

https://codereview.appspot.com/84880045/diff/1/environs/interface.go
File environs/interface.go (right):

https://codereview.appspot.com/84880045/diff/1/environs/interface.go#newcode168
environs/interface.go:168: // ValidateNetworksForInstance returns nil if
the networks are
// ValidateNetworksForInstance returns and error if the given networks
// are not compatible for the given instance id.

s/instance_id string/instanceId instance.Id/

https://codereview.appspot.com/84880045/diff/1/juju/deploy.go
File juju/deploy.go (right):

https://codereview.appspot.com/84880045/diff/1/juju/deploy.go#newcode37
juju/deploy.go:37: func (parms *DeployServiceParams) ClearMachineSpecs()
(string, instance.ContainerType) {
s/parms/args/ ?

https://codereview.appspot.com/84880045/diff/1/juju/deploy.go#newcode38
juju/deploy.go:38: // TODO: Add this to AddUnit and replace wherever
required
// TODO(hduran-8) ...

https://codereview.appspot.com/84880045/diff/1/provider/maas/environ.go
File provider/maas/environ.go (right):

https://codereview.appspot.com/84880045/diff/1/provider/maas/environ.go#newcode568
provider/maas/environ.go:568: maasObj_list, err :=
e.instances([]instance.Id{instance.Id(instance_id)})
s/maasObj_list/maasObjList/ (no underscores please)

https://codereview.appspot.com/84880045/diff/1/provider/maas/environ.go#newcode574
provider/maas/environ.go:574: return fmt.Errorf("Found unexpected amunt
of instances with the given id")
return fmt.Errorf("expected one result, got %d", len(maasObjList)) ?

https://codereview.appspot.com/84880045/diff/1/provider/maas/environ.go#newcode580
provider/maas/environ.go:580: fmt.Print(networks)
logger.Debugf("got networks from MAAS: %v", networks) ?

https://codereview.appspot.com/84880045/diff/1/provider/maas/environ.go#newcode586
provider/maas/environ.go:586: for _, i_network := range includedNetworks
{
s/i_network/network/

https://codereview.appspot.com/84880045/diff/1/provider/maas/environ.go#newcode588
provider/maas/environ.go:588: fmt.Print(netmap)
logger.Debugf("got networks map from MAAS: %v", netmap)

https://codereview.appspot.com/84880045/diff/1/provider/maas/environ.go#newcode589
provider/maas/environ.go:589: return fmt.Errorf("Ip %q is not present in
the requested unit", i_network)
Why IP ? We're getting network names in the command and we should check
for that in maas result list, not IPs.

return fmt.Errorf("network %q not found for instance %q in MAAS",
network, instanceId)

https://codereview.appspot.com/84880045/diff/1/provider/maas/environ.go#newcode595
provider/maas/environ.go:595: return fmt.Errorf("Ip %q is set up in the
requested unit and can not be excluded", i_network)
Similarly, return fmt.Errorf("network %q is required for instance %q and
cannot be excluded", network, instanceId)

https://codereview.appspot.com/84880045/diff/1/provider/maas/environ_whitebox_test.go
File provider/maas/environ_whitebox_test.go (rig...

Read more...

Revision history for this message
Dimiter Naydenov (dimitern) wrote :

Also, the kanban card mentioned deploy and add-unit for --to, and I
can't see the changes to the latter (add --(exclude)-networks args and
check them if --to is given, otherwise return an error if networks are
specified I think). Finally, we need to make sure if the user specifies
networks for both commands, all given networks must be in
include/excludeNetworks for the service itself (i.e. you cannot
add/remove networks from the service when deploying new units, just
restrict what networks will be enabled out of the initially given
networks for the service).

https://codereview.appspot.com/84880045/

Revision history for this message
William Reade (fwereade) wrote :

As it stands, this does not lgtm. I think this needs to happen inside
state, based on the contents of state, at unit assignment time, and in a
txn that checks against the current service networks -- doing it that
way should make it possible to correctly handle both deploy and
add-unit.

https://codereview.appspot.com/84880045/diff/1/environs/interface.go
File environs/interface.go (right):

https://codereview.appspot.com/84880045/diff/1/environs/interface.go#newcode170
environs/interface.go:170: ValidateNetworksForInstance(includedNetworks,
excludedNetworks []string, instance_id string) error
Not 100%sure about this direction -- I'd rather not talk to the provider
if we have the info available in state. Dimitern, what's the status of
the pipeline that sets actual networks on machines?

https://codereview.appspot.com/84880045/diff/1/juju/deploy.go
File juju/deploy.go (right):

https://codereview.appspot.com/84880045/diff/1/juju/deploy.go#newcode37
juju/deploy.go:37: func (parms *DeployServiceParams) ClearMachineSpecs()
(string, instance.ContainerType) {
Needs documentation, intent is not clear from the name IMO.

https://codereview.appspot.com/84880045/diff/1/juju/deploy.go#newcode49
juju/deploy.go:49: if containerType, err =
instance.ParseContainerType(firstPart); err == nil {
You surely didn't have the context to know this, but this is *not* a
container type -- the stuff in --to is a "placement directive", of which
the only one implemented is "lxc".

Haven't looked further; so, if this is consolidating the couple of bits
of code that already do this sort of thing, +1, because it reduces the
number of places we need to fix as we do placement directives properly;
if it's further duplication, -1.

https://codereview.appspot.com/84880045/diff/1/provider/maas/environ.go
File provider/maas/environ.go (right):

https://codereview.appspot.com/84880045/diff/1/provider/maas/environ.go#newcode85
provider/maas/environ.go:85: return nil
This needs to return an error; but I have a pretty serious problem with
the existence of this exported method in the first place. We really
shouldn't be casting Environs like this...

https://codereview.appspot.com/84880045/diff/1/provider/maas/environ.go#newcode572
provider/maas/environ.go:572: if len(maasObj_list) == 0 {
!= 1?

but... again, I don't think this should be an environ method anyway.

https://codereview.appspot.com/84880045/diff/1/state/apiserver/client/client.go
File state/apiserver/client/client.go (right):

https://codereview.appspot.com/84880045/diff/1/state/apiserver/client/client.go#newcode315
state/apiserver/client/client.go:315: err =
env.ValidateNetworksForInstance(args.IncludeNetworks,
args.ExcludeNetworks, mid)
If I were happy with the environ method, I'd still rather keep this
check inside state, so we can keep ensuring db integrity as networks
become dynamic -- not directly relevant for *deploy*, I guess, but
trying to do the same job in different layers at different times should
generally be avoided ;).

https://codereview.appspot.com/84880045/

Revision history for this message
Dimiter Naydenov (dimitern) wrote :

https://codereview.appspot.com/84880045/diff/1/environs/interface.go
File environs/interface.go (right):

https://codereview.appspot.com/84880045/diff/1/environs/interface.go#newcode170
environs/interface.go:170: ValidateNetworksForInstance(includedNetworks,
excludedNetworks []string, instance_id string) error
On 2014/04/07 09:29:40, fwereade wrote:
> Not 100%sure about this direction -- I'd rather not talk to the
provider if we
> have the info available in state. Dimitern, what's the status of the
pipeline
> that sets actual networks on machines?

We can set networks and NICs on machines in state, but the provisioner
does not do it yet - it will some time later today I hope.

https://codereview.appspot.com/84880045/

Unmerged revisions

2549. By Horacio Durán

Ran GoFmt on files

2548. By Horacio Durán

Fixed ValidateNetworksForInstance after testing and added tests

2547. By Horacio Durán

Finished implementing ValidateNetworksForInstance in environs, still missing tests

2546. By Horacio Durán

Added most of the required methods to check if requested methods are possible
on the requierd environ

2545. By Horacio Durán

Did a base implementtion for checking netowrk compatibility on --to

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'cmd/juju/deploy.go'
--- cmd/juju/deploy.go 2014-04-03 04:46:51 +0000
+++ cmd/juju/deploy.go 2014-04-07 02:15:57 +0000
@@ -76,7 +76,7 @@
76 juju deploy mysql --to 23 (Deploy to machine 23)76 juju deploy mysql --to 23 (Deploy to machine 23)
77 juju deploy mysql --to 24/lxc/3 (Deploy to lxc container 3 on host machine 24)77 juju deploy mysql --to 24/lxc/3 (Deploy to lxc container 3 on host machine 24)
78 juju deploy mysql --to lxc:25 (Deploy to a new lxc container on host machine 25)78 juju deploy mysql --to lxc:25 (Deploy to a new lxc container on host machine 25)
79 79
80 juju deploy mysql -n 5 --constraints mem=8G (deploy 5 instances of mysql with at least 8 GB of RAM each)80 juju deploy mysql -n 5 --constraints mem=8G (deploy 5 instances of mysql with at least 8 GB of RAM each)
8181
82 juju deploy mysql --networks=storage,mynet --exclude-networks=logging82 juju deploy mysql --networks=storage,mynet --exclude-networks=logging
@@ -194,6 +194,7 @@
194 if !env.SupportNetworks() {194 if !env.SupportNetworks() {
195 return errors.New("cannot use --networks/--exclude-networks: not supported by the environment")195 return errors.New("cannot use --networks/--exclude-networks: not supported by the environment")
196 }196 }
197
197 }198 }
198199
199 charmInfo, err := client.CharmInfo(curl.String())200 charmInfo, err := client.CharmInfo(curl.String())
200201
=== modified file 'environs/interface.go'
--- environs/interface.go 2014-04-03 03:37:45 +0000
+++ environs/interface.go 2014-04-07 02:15:57 +0000
@@ -153,6 +153,10 @@
153 // FwGlobal firewall mode.153 // FwGlobal firewall mode.
154 Ports() ([]instance.Port, error)154 Ports() ([]instance.Port, error)
155155
156 // ValidateNetworksForInstance returns nil if the networks are
157 // compatible with the given insance or error in case they arent
158 ValidateNetworksForInstance(includedNetworks, excludedNetworks []string, instance_id string) error
159
156 // Provider returns the EnvironProvider that created this Environ.160 // Provider returns the EnvironProvider that created this Environ.
157 Provider() EnvironProvider161 Provider() EnvironProvider
158162
159163
=== modified file 'juju/deploy.go'
--- juju/deploy.go 2014-04-03 09:10:10 +0000
+++ juju/deploy.go 2014-04-07 02:15:57 +0000
@@ -34,6 +34,27 @@
34 ExcludeNetworks []string34 ExcludeNetworks []string
35}35}
3636
37func (parms *DeployServiceParams) ClearMachineSpecs() (string, instance.ContainerType) {
38 // TODO: Add this to AddUnit and replace wherever required
39 // machineIdSpec may be an existing machine or container, eg 3/lxc/2
40 // or a new container on a machine, eg lxc:3
41
42 mid := parms.ToMachineSpec
43 var containerType instance.ContainerType
44 specParts := strings.SplitN(mid, ":", 2)
45 if len(specParts) > 1 {
46 firstPart := specParts[0]
47 var err error
48 // If the type is present in the first part, the seccond is the id
49 if containerType, err = instance.ParseContainerType(firstPart); err == nil {
50 mid = specParts[1]
51 } else {
52 mid = parms.ToMachineSpec
53 }
54 }
55 return mid, containerType
56}
57
37// DeployService takes a charm and various parameters and deploys it.58// DeployService takes a charm and various parameters and deploys it.
38func DeployService(st *state.State, args DeployServiceParams) (*state.Service, error) {59func DeployService(st *state.State, args DeployServiceParams) (*state.Service, error) {
39 if args.NumUnits > 1 && args.ToMachineSpec != "" {60 if args.NumUnits > 1 && args.ToMachineSpec != "" {
4061
=== modified file 'provider/azure/environ.go'
--- provider/azure/environ.go 2014-04-03 09:07:57 +0000
+++ provider/azure/environ.go 2014-04-07 02:15:57 +0000
@@ -387,6 +387,11 @@
387 return env.supportedArchitectures, err387 return env.supportedArchitectures, err
388}388}
389389
390func (e *azureEnviron) ValidateNetworksForInstance(includedNetworks, excludedNetworks []string, instance_id string) error {
391 // If SupportNetworks is true, this should be implemented
392 return nil
393}
394
390// SupportNetworks is specified on the EnvironCapability interface.395// SupportNetworks is specified on the EnvironCapability interface.
391func (env *azureEnviron) SupportNetworks() bool {396func (env *azureEnviron) SupportNetworks() bool {
392 return false397 return false
393398
=== modified file 'provider/dummy/environs.go'
--- provider/dummy/environs.go 2014-04-04 16:52:41 +0000
+++ provider/dummy/environs.go 2014-04-07 02:15:57 +0000
@@ -536,6 +536,11 @@
536 return []string{arch.AMD64, arch.PPC64}, nil536 return []string{arch.AMD64, arch.PPC64}, nil
537}537}
538538
539func (e *environ) ValidateNetworksForInstance(includedNetworks, excludedNetworks []string, instance_id string) error {
540 // TODO: Actually check if networks are compatible with the instace
541 return nil
542}
543
539// SupportNetworks is specified on the EnvironCapability interface.544// SupportNetworks is specified on the EnvironCapability interface.
540func (*environ) SupportNetworks() bool {545func (*environ) SupportNetworks() bool {
541 return true546 return true
542547
=== modified file 'provider/ec2/ec2.go'
--- provider/ec2/ec2.go 2014-04-03 04:46:51 +0000
+++ provider/ec2/ec2.go 2014-04-07 02:15:57 +0000
@@ -350,6 +350,11 @@
350 return e.supportedArchitectures, err350 return e.supportedArchitectures, err
351}351}
352352
353func (e *environ) ValidateNetworksForInstance(includedNetworks, excludedNetworks []string, instance_id string) error {
354 // If SupportNetworks is true, this should be implemented
355 return nil
356}
357
353// SupportNetworks is specified on the EnvironCapability interface.358// SupportNetworks is specified on the EnvironCapability interface.
354func (e *environ) SupportNetworks() bool {359func (e *environ) SupportNetworks() bool {
355 // TODO(dimitern) Once we have support for VPCs and advanced360 // TODO(dimitern) Once we have support for VPCs and advanced
356361
=== modified file 'provider/joyent/environ.go'
--- provider/joyent/environ.go 2014-04-03 20:05:38 +0000
+++ provider/joyent/environ.go 2014-04-07 02:15:57 +0000
@@ -96,6 +96,11 @@
96 return env.supportedArchitectures, err96 return env.supportedArchitectures, err
97}97}
9898
99func (e *joyentEnviron) ValidateNetworksForInstance(includedNetworks, excludedNetworks []string, instance_id string) error {
100 // If SupportNetworks is true, this should be implemented
101 return nil
102}
103
99// SupportNetworks is specified on the EnvironCapability interface.104// SupportNetworks is specified on the EnvironCapability interface.
100func (e *joyentEnviron) SupportNetworks() bool {105func (e *joyentEnviron) SupportNetworks() bool {
101 return false106 return false
102107
=== modified file 'provider/local/environ.go'
--- provider/local/environ.go 2014-04-03 03:37:45 +0000
+++ provider/local/environ.go 2014-04-07 02:15:57 +0000
@@ -81,6 +81,11 @@
81 return []string{localArch}, nil81 return []string{localArch}, nil
82}82}
8383
84func (e *localEnviron) ValidateNetworksForInstance(includedNetworks, excludedNetworks []string, instance_id string) error {
85 // If SupportNetworks is true, this should be implemented
86 return nil
87}
88
84// SupportNetworks is specified on the EnvironCapability interface.89// SupportNetworks is specified on the EnvironCapability interface.
85func (*localEnviron) SupportNetworks() bool {90func (*localEnviron) SupportNetworks() bool {
86 return false91 return false
8792
=== modified file 'provider/maas/environ.go'
--- provider/maas/environ.go 2014-04-03 03:37:45 +0000
+++ provider/maas/environ.go 2014-04-07 02:15:57 +0000
@@ -81,6 +81,15 @@
81 return env, nil81 return env, nil
82}82}
8383
84func GetFromEnvironInterface(interfaceEnv environs.Environ) *maasEnviron {
85 maasEnv, ok := interfaceEnv.(*maasEnviron)
86
87 if !ok {
88 return nil
89 }
90 return maasEnv
91}
92
84// Name is specified in the Environ interface.93// Name is specified in the Environ interface.
85func (env *maasEnviron) Name() string {94func (env *maasEnviron) Name() string {
86 return env.name95 return env.name
@@ -558,7 +567,41 @@
558 Description string567 Description string
559}568}
560569
561// GetNetworksList returns a list of strings which contain networks for a gien maas node instance.570func (e *maasEnviron) ValidateNetworksForInstance(includedNetworks, ExcludeNetworks []string, instance_id string) error {
571 maasObj_list, err := e.instances([]instance.Id{instance.Id(instance_id)})
572 if err != nil {
573 return err
574 }
575 if len(maasObj_list) == 0 {
576 //XXX: I am not sure this can actually happen
577 return fmt.Errorf("Found unexpected amunt of instances with the given id")
578 }
579 maasObj := maasObj_list[0]
580
581 networks, _ := e.GetNetworksList(maasObj)
582 netmap := make(map[string]string)
583 fmt.Print(networks)
584
585 for _, value := range networks {
586 netmap[value.Ip] = ""
587 }
588
589 for _, i_network := range includedNetworks {
590 if _, ok := netmap[i_network]; !ok {
591 fmt.Print(netmap)
592 return fmt.Errorf("Ip %q is not present in the requested unit", i_network)
593 }
594 }
595
596 for _, i_network := range ExcludeNetworks {
597 if _, ok := netmap[i_network]; ok {
598 return fmt.Errorf("Ip %q is set up in the requested unit and can not be excluded", i_network)
599 }
600 }
601 return nil
602}
603
604// GetNetworksList returns a list of strings which contain networks for a given maas node instance.
562func (e *maasEnviron) GetNetworksList(inst instance.Instance) ([]MAASNetworkDetails, error) {605func (e *maasEnviron) GetNetworksList(inst instance.Instance) ([]MAASNetworkDetails, error) {
563 maasInst := inst.(*maasInstance)606 maasInst := inst.(*maasInstance)
564 maasObj := maasInst.maasObject607 maasObj := maasInst.maasObject
565608
=== modified file 'provider/maas/environ_whitebox_test.go'
--- provider/maas/environ_whitebox_test.go 2014-04-02 07:50:15 +0000
+++ provider/maas/environ_whitebox_test.go 2014-04-07 02:15:57 +0000
@@ -542,3 +542,24 @@
542 // once gomaasapi testing server supports networks.542 // once gomaasapi testing server supports networks.
543 c.Assert(env.SupportNetworks(), jc.IsFalse)543 c.Assert(env.SupportNetworks(), jc.IsFalse)
544}544}
545
546func (suite *environSuite) TestValidateNetworksForNode(c *gc.C) {
547 test_environ := suite.makeEnviron()
548 suite.getNetwork("test_network")
549 suite.getInstance("instance_for_network")
550 suite.testMAASObject.TestServer.ConnectNodeToNetwork("instance_for_network", "test_network")
551
552 err := test_environ.ValidateNetworksForInstance([]string{"127.0.0.1"}, []string{}, "instance_for_network")
553 c.Assert(err, gc.IsNil)
554
555 err = test_environ.ValidateNetworksForInstance([]string{}, []string{"127.0.0.2"}, "instance_for_network")
556 c.Assert(err, gc.IsNil)
557
558 expected_err := fmt.Errorf("Ip %q is set up in the requested unit and can not be excluded", "127.0.0.1")
559 err = test_environ.ValidateNetworksForInstance([]string{}, []string{"127.0.0.1"}, "instance_for_network")
560 c.Check(err, gc.DeepEquals, expected_err)
561
562 expected_err = fmt.Errorf("Ip %q is not present in the requested unit", "127.0.0.2")
563 err = test_environ.ValidateNetworksForInstance([]string{"127.0.0.2"}, []string{}, "instance_for_network")
564 c.Check(err, gc.DeepEquals, expected_err)
565}
545566
=== modified file 'provider/manual/environ.go'
--- provider/manual/environ.go 2014-04-03 04:03:00 +0000
+++ provider/manual/environ.go 2014-04-07 02:15:57 +0000
@@ -96,6 +96,11 @@
96 return arch.AllSupportedArches, nil96 return arch.AllSupportedArches, nil
97}97}
9898
99func (e *manualEnviron) ValidateNetworksForInstance(includedNetworks, excludedNetworks []string, instance_id string) error {
100 // If SupportNetworks is true, this should be implemented
101 return nil
102}
103
99// SupportNetworks is specified on the EnvironCapability interface.104// SupportNetworks is specified on the EnvironCapability interface.
100func (e *manualEnviron) SupportNetworks() bool {105func (e *manualEnviron) SupportNetworks() bool {
101 return false106 return false
102107
=== modified file 'provider/openstack/provider.go'
--- provider/openstack/provider.go 2014-04-03 04:46:51 +0000
+++ provider/openstack/provider.go 2014-04-07 02:15:57 +0000
@@ -515,6 +515,11 @@
515 return e.supportedArchitectures, err515 return e.supportedArchitectures, err
516}516}
517517
518func (e *environ) ValidateNetworksForInstance(includedNetworks, excludedNetworks []string, instance_id string) error {
519 // If SupportNetworks is true, this should be implemented
520 return nil
521}
522
518// SupportNetworks is specified on the EnvironCapability interface.523// SupportNetworks is specified on the EnvironCapability interface.
519func (e *environ) SupportNetworks() bool {524func (e *environ) SupportNetworks() bool {
520 // TODO(dimitern) Once we have support for networking, inquire525 // TODO(dimitern) Once we have support for networking, inquire
521526
=== modified file 'state/apiserver/client/client.go'
--- state/apiserver/client/client.go 2014-04-04 10:00:45 +0000
+++ state/apiserver/client/client.go 2014-04-07 02:15:57 +0000
@@ -298,6 +298,26 @@
298// allows specifying networks to include or exclude on the machine298// allows specifying networks to include or exclude on the machine
299// where the charm gets deployed.299// where the charm gets deployed.
300func (c *Client) ServiceDeployWithNetworks(args params.ServiceDeploy) error {300func (c *Client) ServiceDeployWithNetworks(args params.ServiceDeploy) error {
301 // XXX Get the actual node
302 parms := juju.DeployServiceParams{
303 ToMachineSpec: args.ToMachineSpec,
304 IncludeNetworks: args.IncludeNetworks,
305 ExcludeNetworks: args.ExcludeNetworks}
306
307 mid, _ := parms.ClearMachineSpecs()
308
309 conn, err := juju.NewConnFromState(c.api.state)
310 env := conn.Environ
311 if env == nil {
312 return err
313 }
314
315 err = env.ValidateNetworksForInstance(args.IncludeNetworks, args.ExcludeNetworks, mid)
316
317 if err != nil {
318 return err
319 }
320
301 return c.ServiceDeploy(args)321 return c.ServiceDeploy(args)
302}322}
303323

Subscribers

People subscribed via source and target branches

to status/vote changes: