...
|
...
|
@@ -84,13 +84,13 @@ func (srv *Server) ContainerKill(name string, sig int) error {
|
84
|
84
|
// If no signal is passed, perform regular Kill (SIGKILL + wait())
|
85
|
85
|
if sig == 0 {
|
86
|
86
|
if err := container.Kill(); err != nil {
|
87
|
|
- return fmt.Errorf("Error killing container %s: %s", name, err)
|
|
87
|
+ return fmt.Errorf("Cannot kill container %s: %s", name, err)
|
88
|
88
|
}
|
89
|
89
|
srv.LogEvent("kill", container.ShortID(), srv.runtime.repositories.ImageName(container.Image))
|
90
|
90
|
} else {
|
91
|
91
|
// Otherwise, just send the requested signal
|
92
|
92
|
if err := container.kill(sig); err != nil {
|
93
|
|
- return fmt.Errorf("Error killing container %s: %s", name, err)
|
|
93
|
+ return fmt.Errorf("Cannot kil container %s: %s", name, err)
|
94
|
94
|
}
|
95
|
95
|
// FIXME: Add event for signals
|
96
|
96
|
}
|
...
|
...
|
@@ -187,7 +187,7 @@ func (srv *Server) ImagesViz(out io.Writer) error {
|
187
|
187
|
for _, image := range images {
|
188
|
188
|
parentImage, err = image.GetParent()
|
189
|
189
|
if err != nil {
|
190
|
|
- return fmt.Errorf("Error while getting parent image: %v", err)
|
|
190
|
+ return err
|
191
|
191
|
}
|
192
|
192
|
if parentImage != nil {
|
193
|
193
|
out.Write([]byte(" \"" + parentImage.ShortID() + "\" -> \"" + image.ShortID() + "\"\n"))
|
...
|
...
|
@@ -335,7 +335,7 @@ func (srv *Server) ContainerTop(name, ps_args string) (*APITop, error) {
|
335
|
335
|
if container := srv.runtime.Get(name); container != nil {
|
336
|
336
|
output, err := exec.Command("lxc-ps", "--name", container.ID, "--", ps_args).CombinedOutput()
|
337
|
337
|
if err != nil {
|
338
|
|
- return nil, fmt.Errorf("Error trying to use lxc-ps: %s (%s)", err, output)
|
|
338
|
+ return nil, fmt.Errorf("lxc-ps: %s (%s)", err, output)
|
339
|
339
|
}
|
340
|
340
|
procs := APITop{}
|
341
|
341
|
for i, line := range strings.Split(string(output), "\n") {
|
...
|
...
|
@@ -346,7 +346,7 @@ func (srv *Server) ContainerTop(name, ps_args string) (*APITop, error) {
|
346
|
346
|
scanner := bufio.NewScanner(strings.NewReader(line))
|
347
|
347
|
scanner.Split(bufio.ScanWords)
|
348
|
348
|
if !scanner.Scan() {
|
349
|
|
- return nil, fmt.Errorf("Error trying to use lxc-ps")
|
|
349
|
+ return nil, fmt.Errorf("Wrong output using lxc-ps")
|
350
|
350
|
}
|
351
|
351
|
// no scanner.Text because we skip container id
|
352
|
352
|
for scanner.Scan() {
|
...
|
...
|
@@ -819,7 +819,7 @@ func (srv *Server) pushImage(r *registry.Registry, out io.Writer, remote, imgID,
|
819
|
819
|
out = utils.NewWriteFlusher(out)
|
820
|
820
|
jsonRaw, err := ioutil.ReadFile(path.Join(srv.runtime.graph.Root, imgID, "json"))
|
821
|
821
|
if err != nil {
|
822
|
|
- return "", fmt.Errorf("Error while retrieving the path for {%s}: %s", imgID, err)
|
|
822
|
+ return "", fmt.Errorf("Cannot retrieve the path for {%s}: %s", imgID, err)
|
823
|
823
|
}
|
824
|
824
|
out.Write(sf.FormatStatus("", "Pushing %s", imgID))
|
825
|
825
|
|
...
|
...
|
@@ -969,7 +969,7 @@ func (srv *Server) ContainerCreate(config *Config, name string) (string, []strin
|
969
|
969
|
func (srv *Server) ContainerRestart(name string, t int) error {
|
970
|
970
|
if container := srv.runtime.Get(name); container != nil {
|
971
|
971
|
if err := container.Restart(t); err != nil {
|
972
|
|
- return fmt.Errorf("Error restarting container %s: %s", name, err)
|
|
972
|
+ return fmt.Errorf("Cannot restart container %s: %s", name, err)
|
973
|
973
|
}
|
974
|
974
|
srv.LogEvent("restart", container.ShortID(), srv.runtime.repositories.ImageName(container.Image))
|
975
|
975
|
} else {
|
...
|
...
|
@@ -986,9 +986,10 @@ func (srv *Server) ContainerDestroy(name string, removeVolume, removeLink bool)
|
986
|
986
|
return fmt.Errorf("No such link: %s", name)
|
987
|
987
|
}
|
988
|
988
|
name = srv.runtime.getFullName(name)
|
989
|
|
-
|
990
|
989
|
parent, n := path.Split(name)
|
991
|
|
-
|
|
990
|
+ if parent == "/" {
|
|
991
|
+ return fmt.Errorf("Conflict, cannot remove the default name of the container")
|
|
992
|
+ }
|
992
|
993
|
pe := srv.runtime.containerGraph.Get(parent)
|
993
|
994
|
if pe == nil {
|
994
|
995
|
return fmt.Errorf("Cannot get parent %s for name %s", parent, name)
|
...
|
...
|
@@ -1021,7 +1022,7 @@ func (srv *Server) ContainerDestroy(name string, removeVolume, removeLink bool)
|
1021
|
1021
|
volumes[volumeId] = struct{}{}
|
1022
|
1022
|
}
|
1023
|
1023
|
if err := srv.runtime.Destroy(container); err != nil {
|
1024
|
|
- return fmt.Errorf("Error destroying container %s: %s", name, err)
|
|
1024
|
+ return fmt.Errorf("Cannot destroy container %s: %s", name, err)
|
1025
|
1025
|
}
|
1026
|
1026
|
srv.LogEvent("destroy", container.ShortID(), srv.runtime.repositories.ImageName(container.Image))
|
1027
|
1027
|
|
...
|
...
|
@@ -1165,7 +1166,7 @@ func (srv *Server) ImageDelete(name string, autoPrune bool) ([]APIRmi, error) {
|
1165
|
1165
|
}
|
1166
|
1166
|
if !autoPrune {
|
1167
|
1167
|
if err := srv.runtime.graph.Delete(img.ID); err != nil {
|
1168
|
|
- return nil, fmt.Errorf("Error deleting image %s: %s", name, err)
|
|
1168
|
+ return nil, fmt.Errorf("Cannot delete image %s: %s", name, err)
|
1169
|
1169
|
}
|
1170
|
1170
|
return nil, nil
|
1171
|
1171
|
}
|
...
|
...
|
@@ -1252,7 +1253,7 @@ func (srv *Server) ContainerStart(name string, hostConfig *HostConfig) error {
|
1252
|
1252
|
}
|
1253
|
1253
|
|
1254
|
1254
|
if err := container.Start(hostConfig); err != nil {
|
1255
|
|
- return fmt.Errorf("Error starting container %s: %s", name, err)
|
|
1255
|
+ return fmt.Errorf("Cannot start container %s: %s", name, err)
|
1256
|
1256
|
}
|
1257
|
1257
|
srv.LogEvent("start", container.ShortID(), runtime.repositories.ImageName(container.Image))
|
1258
|
1258
|
|
...
|
...
|
@@ -1262,7 +1263,7 @@ func (srv *Server) ContainerStart(name string, hostConfig *HostConfig) error {
|
1262
|
1262
|
func (srv *Server) ContainerStop(name string, t int) error {
|
1263
|
1263
|
if container := srv.runtime.Get(name); container != nil {
|
1264
|
1264
|
if err := container.Stop(t); err != nil {
|
1265
|
|
- return fmt.Errorf("Error stopping container %s: %s", name, err)
|
|
1265
|
+ return fmt.Errorf("Cannot stop container %s: %s", name, err)
|
1266
|
1266
|
}
|
1267
|
1267
|
srv.LogEvent("stop", container.ShortID(), srv.runtime.repositories.ImageName(container.Image))
|
1268
|
1268
|
} else {
|