The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/6255
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === Signed-off-by: Thomas Parrott <thomas.parr...@canonical.com>
From 814aa032683c4e500c1e17e9d271db5c04f2f146 Mon Sep 17 00:00:00 2001 From: Thomas Parrott <thomas.parr...@canonical.com> Date: Fri, 27 Sep 2019 14:18:40 +0100 Subject: [PATCH] lxd: Changes URL in events.SendLifecycle to "/1.0/instances/..." Signed-off-by: Thomas Parrott <thomas.parr...@canonical.com> --- lxd/container.go | 2 +- lxd/container_lxc.go | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lxd/container.go b/lxd/container.go index 698aa7acf0..3307f00d94 100644 --- a/lxd/container.go +++ b/lxd/container.go @@ -683,7 +683,7 @@ func containerCreateAsSnapshot(s *state.State, args db.InstanceArgs, sourceInsta } events.SendLifecycle(sourceInstance.Project(), "container-snapshot-created", - fmt.Sprintf("/1.0/containers/%s", sourceInstance.Name()), + fmt.Sprintf("/1.0/instances/%s", sourceInstance.Name()), map[string]interface{}{ "snapshot_name": args.Name, }) diff --git a/lxd/container_lxc.go b/lxd/container_lxc.go index 1c79181408..f21eab09a1 100644 --- a/lxd/container_lxc.go +++ b/lxd/container_lxc.go @@ -497,7 +497,7 @@ func containerLXCCreate(s *state.State, args db.InstanceArgs) (container, error) logger.Info("Created container", ctxMap) events.SendLifecycle(c.project, "container-created", - fmt.Sprintf("/1.0/containers/%s", c.name), nil) + fmt.Sprintf("/1.0/instances/%s", c.name), nil) return c, nil } @@ -2668,7 +2668,7 @@ func (c *containerLXC) Start(stateful bool) error { logger.Info("Started container", ctxMap) events.SendLifecycle(c.project, "container-started", - fmt.Sprintf("/1.0/containers/%s", c.name), nil) + fmt.Sprintf("/1.0/instances/%s", c.name), nil) return nil } @@ -2836,7 +2836,7 @@ func (c *containerLXC) Stop(stateful bool) error { op.Done(nil) logger.Info("Stopped container", ctxMap) events.SendLifecycle(c.project, "container-stopped", - fmt.Sprintf("/1.0/containers/%s", c.name), nil) + fmt.Sprintf("/1.0/instances/%s", c.name), nil) return nil } else if shared.PathExists(c.StatePath()) { os.RemoveAll(c.StatePath()) @@ -2892,7 +2892,7 @@ func (c *containerLXC) Stop(stateful bool) error { logger.Info("Stopped container", ctxMap) events.SendLifecycle(c.project, "container-stopped", - fmt.Sprintf("/1.0/containers/%s", c.name), nil) + fmt.Sprintf("/1.0/instances/%s", c.name), nil) return nil } @@ -2953,7 +2953,7 @@ func (c *containerLXC) Shutdown(timeout time.Duration) error { logger.Info("Shut down container", ctxMap) events.SendLifecycle(c.project, "container-shutdown", - fmt.Sprintf("/1.0/containers/%s", c.name), nil) + fmt.Sprintf("/1.0/instances/%s", c.name), nil) return nil } @@ -3146,7 +3146,7 @@ func (c *containerLXC) Freeze() error { logger.Info("Froze container", ctxMap) events.SendLifecycle(c.project, "container-paused", - fmt.Sprintf("/1.0/containers/%s", c.name), nil) + fmt.Sprintf("/1.0/instances/%s", c.name), nil) return err } @@ -3191,7 +3191,7 @@ func (c *containerLXC) Unfreeze() error { logger.Info("Unfroze container", ctxMap) events.SendLifecycle(c.project, "container-resumed", - fmt.Sprintf("/1.0/containers/%s", c.name), nil) + fmt.Sprintf("/1.0/instances/%s", c.name), nil) return err } @@ -3585,7 +3585,7 @@ func (c *containerLXC) Restore(sourceContainer Instance, stateful bool) error { } events.SendLifecycle(c.project, "container-snapshot-restored", - fmt.Sprintf("/1.0/containers/%s", c.name), map[string]interface{}{ + fmt.Sprintf("/1.0/instances/%s", c.name), map[string]interface{}{ "snapshot_name": c.name, }) @@ -3742,12 +3742,12 @@ func (c *containerLXC) Delete() error { if c.IsSnapshot() { events.SendLifecycle(c.project, "container-snapshot-deleted", - fmt.Sprintf("/1.0/containers/%s", c.name), map[string]interface{}{ + fmt.Sprintf("/1.0/instances/%s", c.name), map[string]interface{}{ "snapshot_name": c.name, }) } else { events.SendLifecycle(c.project, "container-deleted", - fmt.Sprintf("/1.0/containers/%s", c.name), nil) + fmt.Sprintf("/1.0/instances/%s", c.name), nil) } return nil @@ -3908,13 +3908,13 @@ func (c *containerLXC) Rename(newName string) error { if c.IsSnapshot() { events.SendLifecycle(c.project, "container-snapshot-renamed", - fmt.Sprintf("/1.0/containers/%s", oldName), map[string]interface{}{ + fmt.Sprintf("/1.0/instances/%s", oldName), map[string]interface{}{ "new_name": newName, "snapshot_name": oldName, }) } else { events.SendLifecycle(c.project, "container-renamed", - fmt.Sprintf("/1.0/containers/%s", oldName), map[string]interface{}{ + fmt.Sprintf("/1.0/instances/%s", oldName), map[string]interface{}{ "new_name": newName, }) } @@ -4806,9 +4806,9 @@ func (c *containerLXC) Update(args db.InstanceArgs, userRequested bool) error { if c.IsSnapshot() { cName, sName, _ := shared.ContainerGetParentAndSnapshotName(c.name) - endpoint = fmt.Sprintf("/1.0/containers/%s/snapshots/%s", cName, sName) + endpoint = fmt.Sprintf("/1.0/instances/%s/snapshots/%s", cName, sName) } else { - endpoint = fmt.Sprintf("/1.0/containers/%s", c.name) + endpoint = fmt.Sprintf("/1.0/instances/%s", c.name) } events.SendLifecycle(c.project, "container-updated", endpoint, nil)
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel