Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1360)

Side by Side Diff: worker/provisioner/kvm-broker.go

Issue 77930043: Container Manager Interface
Patch Set: Created 10 years ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « provider/local/environ.go ('k') | worker/provisioner/lxc-broker.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 Canonical Ltd. 1 // Copyright 2013 Canonical Ltd.
2 // Licensed under the AGPLv3, see LICENCE file for details. 2 // Licensed under the AGPLv3, see LICENCE file for details.
3 3
4 package provisioner 4 package provisioner
5 5
6 import ( 6 import (
7 "github.com/juju/loggo" 7 "github.com/juju/loggo"
8 8
9 "launchpad.net/juju-core/agent" 9 "launchpad.net/juju-core/agent"
10 "launchpad.net/juju-core/container" 10 "launchpad.net/juju-core/container"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 config.ProviderType, 78 config.ProviderType,
79 config.AuthorizedKeys, 79 config.AuthorizedKeys,
80 config.SSLHostnameVerification, 80 config.SSLHostnameVerification,
81 config.Proxy, 81 config.Proxy,
82 config.AptProxy, 82 config.AptProxy,
83 ); err != nil { 83 ); err != nil {
84 kvmLogger.Errorf("failed to populate machine config: %v", err) 84 kvmLogger.Errorf("failed to populate machine config: %v", err)
85 return nil, nil, err 85 return nil, nil, err
86 } 86 }
87 87
88 » inst, hardware, err := broker.manager.StartContainer(args.MachineConfig, series, network) 88 » inst, hardware, err := broker.manager.CreateContainer(args.MachineConfig , series, network)
89 if err != nil { 89 if err != nil {
90 kvmLogger.Errorf("failed to start container: %v", err) 90 kvmLogger.Errorf("failed to start container: %v", err)
91 return nil, nil, err 91 return nil, nil, err
92 } 92 }
93 kvmLogger.Infof("started kvm container for machineId: %s, %s, %s", machi neId, inst.Id(), hardware.String()) 93 kvmLogger.Infof("started kvm container for machineId: %s, %s, %s", machi neId, inst.Id(), hardware.String())
94 return inst, hardware, nil 94 return inst, hardware, nil
95 } 95 }
96 96
97 // StopInstances shuts down the given instances. 97 // StopInstances shuts down the given instances.
98 func (broker *kvmBroker) StopInstances(instances []instance.Instance) error { 98 func (broker *kvmBroker) StopInstances(instances []instance.Instance) error {
99 // TODO: potentially parallelise. 99 // TODO: potentially parallelise.
100 for _, instance := range instances { 100 for _, instance := range instances {
101 kvmLogger.Infof("stopping kvm container for instance: %s", insta nce.Id()) 101 kvmLogger.Infof("stopping kvm container for instance: %s", insta nce.Id())
102 » » if err := broker.manager.StopContainer(instance); err != nil { 102 » » if err := broker.manager.DestroyContainer(instance); err != nil {
103 kvmLogger.Errorf("container did not stop: %v", err) 103 kvmLogger.Errorf("container did not stop: %v", err)
104 return err 104 return err
105 } 105 }
106 } 106 }
107 return nil 107 return nil
108 } 108 }
109 109
110 // AllInstances only returns running containers. 110 // AllInstances only returns running containers.
111 func (broker *kvmBroker) AllInstances() (result []instance.Instance, err error) { 111 func (broker *kvmBroker) AllInstances() (result []instance.Instance, err error) {
112 return broker.manager.ListContainers() 112 return broker.manager.ListContainers()
113 } 113 }
OLDNEW
« no previous file with comments | « provider/local/environ.go ('k') | worker/provisioner/lxc-broker.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b