The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/6210

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) ===
- Adds `Instance` interface in main package.
- Modifies `Snapshots()` and `Restore()` definitions to accept/return Interface type.
- Embeds `Instance` interface into `container` interface (and removes duplicated definitions).
- Updates Storage API to use `Instance` rather than `container` to support the `Snapshots()` and `Restore()` change.
From e125cd950eb3d2b3356c7e7a80a1ca41228812ee Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parr...@canonical.com>
Date: Mon, 16 Sep 2019 12:49:26 +0100
Subject: [PATCH 1/3] lxd: Adds instance interface

Signed-off-by: Thomas Parrott <thomas.parr...@canonical.com>
---
 lxd/instance_interface.go | 118 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 118 insertions(+)
 create mode 100644 lxd/instance_interface.go

diff --git a/lxd/instance_interface.go b/lxd/instance_interface.go
new file mode 100644
index 0000000000..dcdc4c2198
--- /dev/null
+++ b/lxd/instance_interface.go
@@ -0,0 +1,118 @@
+package main
+
+import (
+       "io"
+       "os"
+       "os/exec"
+       "time"
+
+       "github.com/lxc/lxd/lxd/db"
+       "github.com/lxc/lxd/lxd/device"
+       "github.com/lxc/lxd/lxd/device/config"
+       "github.com/lxc/lxd/lxd/instance"
+       "github.com/lxc/lxd/lxd/state"
+       "github.com/lxc/lxd/shared/api"
+)
+
+// The Instance interface
+type Instance interface {
+       // Instance actions
+       Freeze() error
+       Shutdown(timeout time.Duration) error
+       Start(stateful bool) error
+       Stop(stateful bool) error
+       Unfreeze() error
+
+       IsPrivileged() bool
+
+       // Snapshots & migration & backups
+       Restore(source Instance, stateful bool) error
+       Snapshots() ([]Instance, error)
+       Backups() ([]backup, error)
+
+       // Config handling
+       Rename(newName string) error
+
+       // TODO rename db.ContainerArgs to db.InstanceArgs.
+       Update(newConfig db.ContainerArgs, userRequested bool) error
+
+       Delete() error
+       Export(w io.Writer, properties map[string]string) error
+
+       // Live configuration
+       CGroupGet(key string) (string, error)
+       CGroupSet(key string, value string) error
+       VolatileSet(changes map[string]string) error
+
+       // File handling
+       FileExists(path string) error
+       FilePull(srcpath string, dstpath string) (int64, int64, os.FileMode, 
string, []string, error)
+       FilePush(type_ string, srcpath string, dstpath string, uid int64, gid 
int64, mode int, write string) error
+       FileRemove(path string) error
+
+       // Console - Allocate and run a console tty.
+       //
+       // terminal  - Bidirectional file descriptor.
+       //
+       // This function will not return until the console has been exited by
+       // the user.
+       Console(terminal *os.File) *exec.Cmd
+       Exec(command []string, env map[string]string, stdin *os.File, stdout 
*os.File, stderr *os.File, wait bool, cwd string, uid uint32, gid uint32) 
(*exec.Cmd, int, int, error)
+
+       // Status
+       Render() (interface{}, interface{}, error)
+       RenderFull() (*api.InstanceFull, interface{}, error)
+       RenderState() (*api.InstanceState, error)
+       IsRunning() bool
+       IsFrozen() bool
+       IsEphemeral() bool
+       IsSnapshot() bool
+       IsStateful() bool
+
+       // Hooks
+       DeviceEventHandler(*device.RunConfig) error
+
+       // Properties
+       Id() int
+       Location() string
+       Project() string
+       Name() string
+       Type() instance.Type
+       Description() string
+       Architecture() int
+       CreationDate() time.Time
+       LastUsedDate() time.Time
+       ExpandedConfig() map[string]string
+       ExpandedDevices() config.Devices
+       LocalConfig() map[string]string
+       LocalDevices() config.Devices
+       Profiles() []string
+       InitPID() int
+       State() string
+       ExpiryDate() time.Time
+
+       // Paths
+       Path() string
+       RootfsPath() string
+       TemplatesPath() string
+       StatePath() string
+       LogFilePath() string
+       ConsoleBufferLogPath() string
+       LogPath() string
+       DevicesPath() string
+
+       // Storage
+       StoragePool() (string, error)
+
+       // Progress reporting
+
+       SetOperation(op *operation)
+
+       // FIXME: Those should be internal functions
+       // Needed for migration for now.
+       StorageStart() (bool, error)
+       StorageStop() (bool, error)
+       Storage() storage
+       TemplateApply(trigger string) error
+       DaemonState() *state.State
+}

From 31e214f05da08a32c92128ac2ed6b4815f0d655f Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parr...@canonical.com>
Date: Mon, 16 Sep 2019 12:50:50 +0100
Subject: [PATCH 2/3] lxd/container: Embeds the Instance interface into the
 container interface

Signed-off-by: Thomas Parrott <thomas.parr...@canonical.com>
---
 lxd/container.go | 107 ++---------------------------------------------
 1 file changed, 4 insertions(+), 103 deletions(-)

diff --git a/lxd/container.go b/lxd/container.go
index dc97c5686c..e9b317c313 100644
--- a/lxd/container.go
+++ b/lxd/container.go
@@ -214,122 +214,23 @@ func containerValidDevices(state *state.State, cluster 
*db.Cluster, instanceName
 
 // The container interface
 type container interface {
-       // Container actions
-       Freeze() error
-       Shutdown(timeout time.Duration) error
-       Start(stateful bool) error
-       Stop(stateful bool) error
-       Unfreeze() error
-
-       // Snapshots & migration & backups
-       Restore(sourceContainer container, stateful bool) error
+       Instance
+
        /* actionScript here is a script called action.sh in the stateDir, to
         * be passed to CRIU as --action-script
         */
        Migrate(args *CriuMigrationArgs) error
-       Snapshots() ([]container, error)
-       Backups() ([]backup, error)
-
-       // Config handling
-       Rename(newName string) error
-       Update(newConfig db.ContainerArgs, userRequested bool) error
-
-       Delete() error
-       Export(w io.Writer, properties map[string]string) error
-
-       // Live configuration
-       CGroupGet(key string) (string, error)
-       CGroupSet(key string, value string) error
-       VolatileSet(changes map[string]string) error
-
-       // File handling
-       FileExists(path string) error
-       FilePull(srcpath string, dstpath string) (int64, int64, os.FileMode, 
string, []string, error)
-       FilePush(type_ string, srcpath string, dstpath string, uid int64, gid 
int64, mode int, write string) error
-       FileRemove(path string) error
-
-       // Console - Allocate and run a console tty.
-       //
-       // terminal  - Bidirectional file descriptor.
-       //
-       // This function will not return until the console has been exited by
-       // the user.
-       Console(terminal *os.File) *exec.Cmd
+
        ConsoleLog(opts lxc.ConsoleLogOptions) (string, error)
-       /* Command execution:
-                * 1. passing in false for wait
-                *    - equivalent to calling cmd.Run()
-                * 2. passing in true for wait
-                *    - start the command and return its PID in the first return
-                *      argument and the PID of the attached process in the 
second
-                *      argument. It's the callers responsibility to wait on the
-                *      command. (Note. The returned PID of the attached 
process can not
-                *      be waited upon since it's a child of the lxd forkexec 
command
-                *      (the PID returned in the first return argument). It can 
however
-                *      be used to e.g. forward signals.)
-       */
-       Exec(command []string, env map[string]string, stdin *os.File, stdout 
*os.File, stderr *os.File, wait bool, cwd string, uid uint32, gid uint32) 
(*exec.Cmd, int, int, error)
 
        // Status
-       Render() (interface{}, interface{}, error)
-       RenderFull() (*api.InstanceFull, interface{}, error)
-       RenderState() (*api.InstanceState, error)
-       IsPrivileged() bool
-       IsRunning() bool
-       IsFrozen() bool
-       IsEphemeral() bool
-       IsSnapshot() bool
-       IsStateful() bool
        IsNesting() bool
 
        // Hooks
        OnStart() error
        OnStopNS(target string, netns string) error
        OnStop(target string) error
-       DeviceEventHandler(*device.RunConfig) error
-
-       // Properties
-       Id() int
-       Location() string
-       Project() string
-       Name() string
-       Type() instance.Type
-       Description() string
-       Architecture() int
-       CreationDate() time.Time
-       LastUsedDate() time.Time
-       ExpandedConfig() map[string]string
-       ExpandedDevices() config.Devices
-       LocalConfig() map[string]string
-       LocalDevices() config.Devices
-       Profiles() []string
-       InitPID() int
-       State() string
-       ExpiryDate() time.Time
-
-       // Paths
-       Path() string
-       RootfsPath() string
-       TemplatesPath() string
-       StatePath() string
-       LogFilePath() string
-       ConsoleBufferLogPath() string
-       LogPath() string
-       DevicesPath() string
-
-       // Storage
-       StoragePool() (string, error)
-
-       // Progress reporting
-       SetOperation(op *operation)
-
-       // FIXME: Those should be internal functions
-       // Needed for migration for now.
-       StorageStart() (bool, error)
-       StorageStop() (bool, error)
-       Storage() storage
-       TemplateApply(trigger string) error
-       DaemonState() *state.State
+
        InsertSeccompUnixDevice(prefix string, m config.Device, pid int) error
 
        CurrentIdmap() (*idmap.IdmapSet, error)

From 836276715d0d3d5b64d841aa53211b410d4871fd Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parr...@canonical.com>
Date: Mon, 16 Sep 2019 12:58:17 +0100
Subject: [PATCH 3/3] lxd: Migrates storage references to container interface
 to instance interface

Signed-off-by: Thomas Parrott <thomas.parr...@canonical.com>
---
 lxd/container.go               | 12 ++++----
 lxd/container_lxc.go           | 13 ++++++---
 lxd/migrate_container.go       |  6 ++--
 lxd/storage.go                 | 36 +++++++++++------------
 lxd/storage_btrfs.go           | 48 +++++++++++++++----------------
 lxd/storage_ceph.go            | 41 +++++++++++++--------------
 lxd/storage_ceph_utils.go      |  8 ++----
 lxd/storage_cephfs.go          | 38 ++++++++++++-------------
 lxd/storage_dir.go             | 44 ++++++++++++++--------------
 lxd/storage_lvm.go             | 40 +++++++++++++-------------
 lxd/storage_lvm_utils.go       | 12 ++++----
 lxd/storage_migration.go       |  8 +++---
 lxd/storage_migration_btrfs.go |  4 +--
 lxd/storage_mock.go            | 50 ++++++++++++--------------------
 lxd/storage_zfs.go             | 52 +++++++++++++++++-----------------
 15 files changed, 200 insertions(+), 212 deletions(-)

diff --git a/lxd/container.go b/lxd/container.go
index e9b317c313..ecae6c8ce4 100644
--- a/lxd/container.go
+++ b/lxd/container.go
@@ -463,7 +463,7 @@ func containerCreateAsCopy(s *state.State, args 
db.ContainerArgs, sourceContaine
        }
 
        csList := []*container{}
-       var snapshots []container
+       var snapshots []Instance
 
        if !containerOnly {
                if refresh {
@@ -1133,7 +1133,7 @@ func containerLoadAllInternal(cts []db.Instance, s 
*state.State) ([]container, e
        return containers, nil
 }
 
-func containerCompareSnapshots(source container, target container) 
([]container, []container, error) {
+func containerCompareSnapshots(source Instance, target container) ([]Instance, 
[]Instance, error) {
        // Get the source snapshots
        sourceSnapshots, err := source.Snapshots()
        if err != nil {
@@ -1150,8 +1150,8 @@ func containerCompareSnapshots(source container, target 
container) ([]container,
        sourceSnapshotsTime := map[string]time.Time{}
        targetSnapshotsTime := map[string]time.Time{}
 
-       toDelete := []container{}
-       toSync := []container{}
+       toDelete := []Instance{}
+       toSync := []Instance{}
 
        for _, snap := range sourceSnapshots {
                _, snapName, _ := 
shared.ContainerGetParentAndSnapshotName(snap.Name())
@@ -1336,7 +1336,7 @@ func pruneExpiredContainerSnapshotsTask(d *Daemon) 
(task.Func, task.Schedule) {
                }
 
                // Figure out which need snapshotting (if any)
-               expiredSnapshots := []container{}
+               expiredSnapshots := []Instance{}
                for _, c := range allContainers {
                        snapshots, err := c.Snapshots()
                        if err != nil {
@@ -1395,7 +1395,7 @@ func pruneExpiredContainerSnapshotsTask(d *Daemon) 
(task.Func, task.Schedule) {
        return f, schedule
 }
 
-func pruneExpiredContainerSnapshots(ctx context.Context, d *Daemon, snapshots 
[]container) error {
+func pruneExpiredContainerSnapshots(ctx context.Context, d *Daemon, snapshots 
[]Instance) error {
        // Find snapshots to delete
        for _, snapshot := range snapshots {
                err := snapshot.Delete()
diff --git a/lxd/container_lxc.go b/lxd/container_lxc.go
index 140b735cd6..a93d3b6504 100644
--- a/lxd/container_lxc.go
+++ b/lxd/container_lxc.go
@@ -3369,11 +3369,11 @@ func (c *containerLXC) RenderState() 
(*api.InstanceState, error) {
        return &status, nil
 }
 
-func (c *containerLXC) Snapshots() ([]container, error) {
+func (c *containerLXC) Snapshots() ([]Instance, error) {
        var snaps []db.Instance
 
        if c.IsSnapshot() {
-               return []container{}, nil
+               return []Instance{}, nil
        }
 
        // Get all the snapshots
@@ -3396,7 +3396,12 @@ func (c *containerLXC) Snapshots() ([]container, error) {
                return nil, err
        }
 
-       return containers, nil
+       instances := make([]Instance, len(containers))
+       for k, v := range containers {
+               instances[k] = Instance(v)
+       }
+
+       return instances, nil
 }
 
 func (c *containerLXC) Backups() ([]backup, error) {
@@ -3420,7 +3425,7 @@ func (c *containerLXC) Backups() ([]backup, error) {
        return backups, nil
 }
 
-func (c *containerLXC) Restore(sourceContainer container, stateful bool) error 
{
+func (c *containerLXC) Restore(sourceContainer Instance, stateful bool) error {
        var ctxMap log.Ctx
 
        // Initialize storage interface for the container.
diff --git a/lxd/migrate_container.go b/lxd/migrate_container.go
index 850d761e63..188612b98e 100644
--- a/lxd/migrate_container.go
+++ b/lxd/migrate_container.go
@@ -77,7 +77,7 @@ fi
        return err
 }
 
-func snapshotToProtobuf(c container) *migration.Snapshot {
+func snapshotToProtobuf(c Instance) *migration.Snapshot {
        config := []*migration.Config{}
        for k, v := range c.LocalConfig() {
                kCopy := string(k)
@@ -1137,12 +1137,12 @@ func (s *migrationSourceWs) 
ConnectContainerTarget(target api.InstancePostTarget
        return s.ConnectTarget(target.Certificate, target.Operation, 
target.Websockets)
 }
 
-func migrationCompareSnapshots(sourceSnapshots []*migration.Snapshot, 
targetSnapshots []container) ([]*migration.Snapshot, []container) {
+func migrationCompareSnapshots(sourceSnapshots []*migration.Snapshot, 
targetSnapshots []Instance) ([]*migration.Snapshot, []Instance) {
        // Compare source and target
        sourceSnapshotsTime := map[string]int64{}
        targetSnapshotsTime := map[string]int64{}
 
-       toDelete := []container{}
+       toDelete := []Instance{}
        toSync := []*migration.Snapshot{}
 
        for _, snap := range sourceSnapshots {
diff --git a/lxd/storage.go b/lxd/storage.go
index 266216c127..9db3c4f91b 100644
--- a/lxd/storage.go
+++ b/lxd/storage.go
@@ -189,32 +189,32 @@ type storage interface {
 
        // Functions dealing with container storage volumes.
        // ContainerCreate creates an empty container (no rootfs/metadata.yaml)
-       ContainerCreate(container container) error
+       ContainerCreate(container Instance) error
 
        // ContainerCreateFromImage creates a container from a image.
-       ContainerCreateFromImage(c container, fingerprint string, tracker 
*ioprogress.ProgressTracker) error
-       ContainerDelete(c container) error
-       ContainerCopy(target container, source container, containerOnly bool) 
error
-       ContainerRefresh(target container, source container, snapshots 
[]container) error
-       ContainerMount(c container) (bool, error)
-       ContainerUmount(c container, path string) (bool, error)
-       ContainerRename(container container, newName string) error
-       ContainerRestore(container container, sourceContainer container) error
-       ContainerGetUsage(container container) (int64, error)
+       ContainerCreateFromImage(c Instance, fingerprint string, tracker 
*ioprogress.ProgressTracker) error
+       ContainerDelete(c Instance) error
+       ContainerCopy(target Instance, source Instance, containerOnly bool) 
error
+       ContainerRefresh(target Instance, source Instance, snapshots 
[]Instance) error
+       ContainerMount(c Instance) (bool, error)
+       ContainerUmount(c Instance, path string) (bool, error)
+       ContainerRename(container Instance, newName string) error
+       ContainerRestore(container Instance, sourceContainer Instance) error
+       ContainerGetUsage(container Instance) (int64, error)
        GetContainerPoolInfo() (int64, string, string)
-       ContainerStorageReady(container container) bool
+       ContainerStorageReady(container Instance) bool
 
-       ContainerSnapshotCreate(target container, source container) error
-       ContainerSnapshotDelete(c container) error
-       ContainerSnapshotRename(c container, newName string) error
-       ContainerSnapshotStart(c container) (bool, error)
-       ContainerSnapshotStop(c container) (bool, error)
+       ContainerSnapshotCreate(target Instance, source Instance) error
+       ContainerSnapshotDelete(c Instance) error
+       ContainerSnapshotRename(c Instance, newName string) error
+       ContainerSnapshotStart(c Instance) (bool, error)
+       ContainerSnapshotStop(c Instance) (bool, error)
 
-       ContainerBackupCreate(backup backup, sourceContainer container) error
+       ContainerBackupCreate(backup backup, sourceContainer Instance) error
        ContainerBackupLoad(info backupInfo, data io.ReadSeeker, tarArgs 
[]string) error
 
        // For use in migrating snapshots.
-       ContainerSnapshotCreateEmpty(c container) error
+       ContainerSnapshotCreateEmpty(c Instance) error
 
        // Functions dealing with image storage volumes.
        ImageCreate(fingerprint string, tracker *ioprogress.ProgressTracker) 
error
diff --git a/lxd/storage_btrfs.go b/lxd/storage_btrfs.go
index 7aad51d7fb..7d93d29d80 100644
--- a/lxd/storage_btrfs.go
+++ b/lxd/storage_btrfs.go
@@ -800,7 +800,7 @@ func (s *storageBtrfs) StoragePoolVolumeRename(newName 
string) error {
 }
 
 // Functions dealing with container storage.
-func (s *storageBtrfs) ContainerStorageReady(container container) bool {
+func (s *storageBtrfs) ContainerStorageReady(container Instance) bool {
        containerMntPoint := driver.GetContainerMountPoint(container.Project(), 
s.pool.Name, container.Name())
        return isBtrfsSubVolume(containerMntPoint)
 }
@@ -845,7 +845,7 @@ func (s *storageBtrfs) doContainerCreate(projectName, name 
string, privileged bo
        return nil
 }
 
-func (s *storageBtrfs) ContainerCreate(container container) error {
+func (s *storageBtrfs) ContainerCreate(container Instance) error {
        err := s.doContainerCreate(container.Project(), container.Name(), 
container.IsPrivileged())
        if err != nil {
                return err
@@ -855,7 +855,7 @@ func (s *storageBtrfs) ContainerCreate(container container) 
error {
 }
 
 // And this function is why I started hating on btrfs...
-func (s *storageBtrfs) ContainerCreateFromImage(container container, 
fingerprint string, tracker *ioprogress.ProgressTracker) error {
+func (s *storageBtrfs) ContainerCreateFromImage(container Instance, 
fingerprint string, tracker *ioprogress.ProgressTracker) error {
        logger.Debugf("Creating BTRFS storage volume for container \"%s\" on 
storage pool \"%s\"", s.volume.Name, s.pool.Name)
 
        source := s.pool.Config["source"]
@@ -938,7 +938,7 @@ func (s *storageBtrfs) ContainerCreateFromImage(container 
container, fingerprint
        return nil
 }
 
-func (s *storageBtrfs) ContainerDelete(container container) error {
+func (s *storageBtrfs) ContainerDelete(container Instance) error {
        logger.Debugf("Deleting BTRFS storage volume for container \"%s\" on 
storage pool \"%s\"", s.volume.Name, s.pool.Name)
 
        // The storage pool needs to be mounted.
@@ -985,7 +985,7 @@ func (s *storageBtrfs) ContainerDelete(container container) 
error {
        return nil
 }
 
-func (s *storageBtrfs) copyContainer(target container, source container) error 
{
+func (s *storageBtrfs) copyContainer(target Instance, source Instance) error {
        sourceContainerSubvolumeName := 
driver.GetContainerMountPoint(source.Project(), s.pool.Name, source.Name())
        if source.IsSnapshot() {
                sourceContainerSubvolumeName = 
driver.GetSnapshotMountPoint(source.Project(), s.pool.Name, source.Name())
@@ -1050,7 +1050,7 @@ func (s *storageBtrfs) copySnapshot(target container, 
source container) error {
        return nil
 }
 
-func (s *storageBtrfs) doCrossPoolContainerCopy(target container, source 
container, containerOnly bool, refresh bool, refreshSnapshots []container) 
error {
+func (s *storageBtrfs) doCrossPoolContainerCopy(target Instance, source 
Instance, containerOnly bool, refresh bool, refreshSnapshots []Instance) error {
        sourcePool, err := source.StoragePool()
        if err != nil {
                return err
@@ -1075,7 +1075,7 @@ func (s *storageBtrfs) doCrossPoolContainerCopy(target 
container, source contain
                return err
        }
 
-       var snapshots []container
+       var snapshots []Instance
 
        if refresh {
                snapshots = refreshSnapshots
@@ -1122,7 +1122,7 @@ func (s *storageBtrfs) doCrossPoolContainerCopy(target 
container, source contain
        return nil
 }
 
-func (s *storageBtrfs) ContainerCopy(target container, source container, 
containerOnly bool) error {
+func (s *storageBtrfs) ContainerCopy(target Instance, source Instance, 
containerOnly bool) error {
        logger.Debugf("Copying BTRFS container storage %s to %s", 
source.Name(), target.Name())
 
        // The storage pool needs to be mounted.
@@ -1188,7 +1188,7 @@ func (s *storageBtrfs) ContainerCopy(target container, 
source container, contain
        return nil
 }
 
-func (s *storageBtrfs) ContainerRefresh(target container, source container, 
snapshots []container) error {
+func (s *storageBtrfs) ContainerRefresh(target Instance, source Instance, 
snapshots []Instance) error {
        logger.Debugf("Refreshing BTRFS container storage for %s from %s", 
target.Name(), source.Name())
 
        // The storage pool needs to be mounted.
@@ -1208,7 +1208,7 @@ func (s *storageBtrfs) ContainerRefresh(target container, 
source container, snap
        return s.doCrossPoolContainerCopy(target, source, len(snapshots) == 0, 
true, snapshots)
 }
 
-func (s *storageBtrfs) ContainerMount(c container) (bool, error) {
+func (s *storageBtrfs) ContainerMount(c Instance) (bool, error) {
        logger.Debugf("Mounting BTRFS storage volume for container \"%s\" on 
storage pool \"%s\"", s.volume.Name, s.pool.Name)
 
        // The storage pool must be mounted.
@@ -1221,11 +1221,11 @@ func (s *storageBtrfs) ContainerMount(c container) 
(bool, error) {
        return true, nil
 }
 
-func (s *storageBtrfs) ContainerUmount(c container, path string) (bool, error) 
{
+func (s *storageBtrfs) ContainerUmount(c Instance, path string) (bool, error) {
        return true, nil
 }
 
-func (s *storageBtrfs) ContainerRename(container container, newName string) 
error {
+func (s *storageBtrfs) ContainerRename(container Instance, newName string) 
error {
        logger.Debugf("Renaming BTRFS storage volume for container \"%s\" from 
%s to %s", s.volume.Name, s.volume.Name, newName)
 
        // The storage pool must be mounted.
@@ -1274,7 +1274,7 @@ func (s *storageBtrfs) ContainerRename(container 
container, newName string) erro
        return nil
 }
 
-func (s *storageBtrfs) ContainerRestore(container container, sourceContainer 
container) error {
+func (s *storageBtrfs) ContainerRestore(container Instance, sourceContainer 
Instance) error {
        logger.Debugf("Restoring BTRFS storage volume for container \"%s\" from 
%s to %s", s.volume.Name, sourceContainer.Name(), container.Name())
 
        // The storage pool must be mounted.
@@ -1359,7 +1359,7 @@ func (s *storageBtrfs) ContainerRestore(container 
container, sourceContainer con
        return failure
 }
 
-func (s *storageBtrfs) ContainerGetUsage(container container) (int64, error) {
+func (s *storageBtrfs) ContainerGetUsage(container Instance) (int64, error) {
        return s.btrfsPoolVolumeQGroupUsage(container.Path())
 }
 
@@ -1412,7 +1412,7 @@ func (s *storageBtrfs) 
doContainerSnapshotCreate(projectName string, targetName
        return nil
 }
 
-func (s *storageBtrfs) ContainerSnapshotCreate(snapshotContainer container, 
sourceContainer container) error {
+func (s *storageBtrfs) ContainerSnapshotCreate(snapshotContainer Instance, 
sourceContainer Instance) error {
        err := s.doContainerSnapshotCreate(sourceContainer.Project(), 
snapshotContainer.Name(), sourceContainer.Name())
        if err != nil {
                s.ContainerSnapshotDelete(snapshotContainer)
@@ -1451,7 +1451,7 @@ func btrfsSnapshotDeleteInternal(projectName, poolName 
string, snapshotName stri
        return nil
 }
 
-func (s *storageBtrfs) ContainerSnapshotDelete(snapshotContainer container) 
error {
+func (s *storageBtrfs) ContainerSnapshotDelete(snapshotContainer Instance) 
error {
        logger.Debugf("Deleting BTRFS storage volume for snapshot \"%s\" on 
storage pool \"%s\"", s.volume.Name, s.pool.Name)
 
        _, err := s.StoragePoolMount()
@@ -1468,7 +1468,7 @@ func (s *storageBtrfs) 
ContainerSnapshotDelete(snapshotContainer container) erro
        return nil
 }
 
-func (s *storageBtrfs) ContainerSnapshotStart(container container) (bool, 
error) {
+func (s *storageBtrfs) ContainerSnapshotStart(container Instance) (bool, 
error) {
        logger.Debugf("Initializing BTRFS storage volume for snapshot \"%s\" on 
storage pool \"%s\"", s.volume.Name, s.pool.Name)
 
        _, err := s.StoragePoolMount()
@@ -1497,7 +1497,7 @@ func (s *storageBtrfs) ContainerSnapshotStart(container 
container) (bool, error)
        return true, nil
 }
 
-func (s *storageBtrfs) ContainerSnapshotStop(container container) (bool, 
error) {
+func (s *storageBtrfs) ContainerSnapshotStop(container Instance) (bool, error) 
{
        logger.Debugf("Stopping BTRFS storage volume for snapshot \"%s\" on 
storage pool \"%s\"", s.volume.Name, s.pool.Name)
 
        _, err := s.StoragePoolMount()
@@ -1529,7 +1529,7 @@ func (s *storageBtrfs) ContainerSnapshotStop(container 
container) (bool, error)
 }
 
 // ContainerSnapshotRename renames a snapshot of a container.
-func (s *storageBtrfs) ContainerSnapshotRename(snapshotContainer container, 
newName string) error {
+func (s *storageBtrfs) ContainerSnapshotRename(snapshotContainer Instance, 
newName string) error {
        logger.Debugf("Renaming BTRFS storage volume for snapshot \"%s\" from 
%s to %s", s.volume.Name, s.volume.Name, newName)
 
        // The storage pool must be mounted.
@@ -1553,7 +1553,7 @@ func (s *storageBtrfs) 
ContainerSnapshotRename(snapshotContainer container, newN
 
 // Needed for live migration where an empty snapshot needs to be created before
 // rsyncing into it.
-func (s *storageBtrfs) ContainerSnapshotCreateEmpty(snapshotContainer 
container) error {
+func (s *storageBtrfs) ContainerSnapshotCreateEmpty(snapshotContainer 
Instance) error {
        logger.Debugf("Creating empty BTRFS storage volume for snapshot \"%s\" 
on storage pool \"%s\"", s.volume.Name, s.pool.Name)
 
        // Mount the storage pool.
@@ -1615,7 +1615,7 @@ func (s *storageBtrfs) doBtrfsBackup(cur string, prev 
string, target string) err
        return err
 }
 
-func (s *storageBtrfs) doContainerBackupCreateOptimized(tmpPath string, backup 
backup, source container) error {
+func (s *storageBtrfs) doContainerBackupCreateOptimized(tmpPath string, backup 
backup, source Instance) error {
        // Handle snapshots
        finalParent := ""
        if !backup.instanceOnly {
@@ -1688,7 +1688,7 @@ func (s *storageBtrfs) 
doContainerBackupCreateOptimized(tmpPath string, backup b
        return nil
 }
 
-func (s *storageBtrfs) doContainerBackupCreateVanilla(tmpPath string, backup 
backup, source container) error {
+func (s *storageBtrfs) doContainerBackupCreateVanilla(tmpPath string, backup 
backup, source Instance) error {
        // Prepare for rsync
        rsync := func(oldPath string, newPath string, bwlimit string) error {
                output, err := rsyncLocalCopy(oldPath, newPath, bwlimit, true)
@@ -1771,7 +1771,7 @@ func (s *storageBtrfs) 
doContainerBackupCreateVanilla(tmpPath string, backup bac
        return nil
 }
 
-func (s *storageBtrfs) ContainerBackupCreate(backup backup, source container) 
error {
+func (s *storageBtrfs) ContainerBackupCreate(backup backup, source Instance) 
error {
        // Start storage
        ourStart, err := source.StorageStart()
        if err != nil {
@@ -2456,7 +2456,7 @@ func (s *storageBtrfs) MigrationSource(args 
MigrationSourceArgs) (MigrationStora
         * xfer costs. Then, after all that, we send the container itself.
         */
        var err error
-       var snapshots = []container{}
+       var snapshots = []Instance{}
        if !args.InstanceOnly {
                snapshots, err = args.Container.Snapshots()
                if err != nil {
diff --git a/lxd/storage_ceph.go b/lxd/storage_ceph.go
index 7085688140..c76a3741fe 100644
--- a/lxd/storage_ceph.go
+++ b/lxd/storage_ceph.go
@@ -758,7 +758,7 @@ func (s *storageCeph) StoragePoolUpdate(writable 
*api.StoragePoolPut, changedCon
        return nil
 }
 
-func (s *storageCeph) ContainerStorageReady(container container) bool {
+func (s *storageCeph) ContainerStorageReady(container Instance) bool {
        name := container.Name()
        logger.Debugf(`Checking if RBD storage volume for container "%s" on 
storage pool "%s" is ready`, name, s.pool.Name)
 
@@ -773,7 +773,7 @@ func (s *storageCeph) ContainerStorageReady(container 
container) bool {
        return true
 }
 
-func (s *storageCeph) ContainerCreate(container container) error {
+func (s *storageCeph) ContainerCreate(container Instance) error {
        containerName := container.Name()
        err := s.doContainerCreate(container.Project(), containerName, 
container.IsPrivileged())
        if err != nil {
@@ -792,7 +792,7 @@ func (s *storageCeph) ContainerCreate(container container) 
error {
        return nil
 }
 
-func (s *storageCeph) ContainerCreateFromImage(container container, 
fingerprint string, tracker *ioprogress.ProgressTracker) error {
+func (s *storageCeph) ContainerCreateFromImage(container Instance, fingerprint 
string, tracker *ioprogress.ProgressTracker) error {
        logger.Debugf(`Creating RBD storage volume for container "%s" on 
storage pool "%s"`, s.volume.Name, s.pool.Name)
 
        revert := true
@@ -944,7 +944,7 @@ func (s *storageCeph) ContainerCreateFromImage(container 
container, fingerprint
        return nil
 }
 
-func (s *storageCeph) ContainerDelete(container container) error {
+func (s *storageCeph) ContainerDelete(container Instance) error {
        containerName := container.Name()
        logger.Debugf(`Deleting RBD storage volume for container "%s" on 
storage pool "%s"`, containerName, s.pool.Name)
 
@@ -993,7 +993,7 @@ func (s *storageCeph) ContainerDelete(container container) 
error {
 // - for each snapshot dump the contents into the empty storage volume and
 //   after each dump take a snapshot of the rbd storage volume
 // - dump the container contents into the rbd storage volume.
-func (s *storageCeph) doCrossPoolContainerCopy(target container, source 
container, containerOnly bool, refresh bool, refreshSnapshots []container) 
error {
+func (s *storageCeph) doCrossPoolContainerCopy(target Instance, source 
Instance, containerOnly bool, refresh bool, refreshSnapshots []Instance) error {
        sourcePool, err := source.StoragePool()
        if err != nil {
                return err
@@ -1018,7 +1018,7 @@ func (s *storageCeph) doCrossPoolContainerCopy(target 
container, source containe
                return err
        }
 
-       var snapshots []container
+       var snapshots []Instance
 
        if refresh {
                snapshots = refreshSnapshots
@@ -1088,8 +1088,7 @@ func (s *storageCeph) doCrossPoolContainerCopy(target 
container, source containe
        return nil
 }
 
-func (s *storageCeph) ContainerCopy(target container, source container,
-       containerOnly bool) error {
+func (s *storageCeph) ContainerCopy(target Instance, source Instance, 
containerOnly bool) error {
        sourceContainerName := source.Name()
        logger.Debugf(`Copying RBD container storage %s to %s`, 
sourceContainerName, target.Name())
 
@@ -1322,13 +1321,13 @@ func (s *storageCeph) ContainerCopy(target container, 
source container,
        return nil
 }
 
-func (s *storageCeph) ContainerRefresh(target container, source container, 
snapshots []container) error {
+func (s *storageCeph) ContainerRefresh(target Instance, source Instance, 
snapshots []Instance) error {
        logger.Debugf(`Refreshing RBD container storage for %s from %s`, 
target.Name(), source.Name())
 
        return s.doCrossPoolContainerCopy(target, source, len(snapshots) == 0, 
true, snapshots)
 }
 
-func (s *storageCeph) ContainerMount(c container) (bool, error) {
+func (s *storageCeph) ContainerMount(c Instance) (bool, error) {
        logger.Debugf("Mounting RBD storage volume for container \"%s\" on 
storage pool \"%s\"", s.volume.Name, s.pool.Name)
 
        ourMount, err := s.doContainerMount(c.Project(), c.Name())
@@ -1340,7 +1339,7 @@ func (s *storageCeph) ContainerMount(c container) (bool, 
error) {
        return ourMount, nil
 }
 
-func (s *storageCeph) ContainerUmount(c container, path string) (bool, error) {
+func (s *storageCeph) ContainerUmount(c Instance, path string) (bool, error) {
        logger.Debugf("Unmounting RBD storage volume for container \"%s\" on 
storage pool \"%s\"", s.volume.Name, s.pool.Name)
        name := c.Name()
 
@@ -1389,7 +1388,7 @@ func (s *storageCeph) ContainerUmount(c container, path 
string) (bool, error) {
        return ourUmount, nil
 }
 
-func (s *storageCeph) ContainerRename(c container, newName string) error {
+func (s *storageCeph) ContainerRename(c Instance, newName string) error {
        oldName := c.Name()
        containerPath := c.Path()
 
@@ -1541,7 +1540,7 @@ func (s *storageCeph) ContainerRename(c container, 
newName string) error {
        return nil
 }
 
-func (s *storageCeph) ContainerRestore(target container, source container) 
error {
+func (s *storageCeph) ContainerRestore(target Instance, source Instance) error 
{
        sourceName := source.Name()
        targetName := target.Name()
 
@@ -1583,11 +1582,11 @@ func (s *storageCeph) ContainerRestore(target 
container, source container) error
        return nil
 }
 
-func (s *storageCeph) ContainerGetUsage(container container) (int64, error) {
+func (s *storageCeph) ContainerGetUsage(container Instance) (int64, error) {
        return -1, fmt.Errorf("RBD quotas are currently not supported")
 }
 
-func (s *storageCeph) ContainerSnapshotCreate(snapshotContainer container, 
sourceContainer container) error {
+func (s *storageCeph) ContainerSnapshotCreate(snapshotContainer Instance, 
sourceContainer Instance) error {
        containerMntPoint := 
driver.GetContainerMountPoint(sourceContainer.Project(), s.pool.Name, 
sourceContainer.Name())
        if shared.IsMountPoint(containerMntPoint) {
                // This is costly but we need to ensure that all cached data has
@@ -1606,7 +1605,7 @@ func (s *storageCeph) 
ContainerSnapshotCreate(snapshotContainer container, sourc
        return s.doContainerSnapshotCreate(sourceContainer.Project(), 
snapshotContainer.Name(), sourceContainer.Name())
 }
 
-func (s *storageCeph) ContainerSnapshotDelete(snapshotContainer container) 
error {
+func (s *storageCeph) ContainerSnapshotDelete(snapshotContainer Instance) 
error {
        logger.Debugf(`Deleting RBD storage volume for snapshot "%s" on storage 
pool "%s"`, s.volume.Name, s.pool.Name)
 
        snapshotContainerName := snapshotContainer.Name()
@@ -1672,7 +1671,7 @@ func (s *storageCeph) 
ContainerSnapshotDelete(snapshotContainer container) error
        return nil
 }
 
-func (s *storageCeph) ContainerSnapshotRename(c container, newName string) 
error {
+func (s *storageCeph) ContainerSnapshotRename(c Instance, newName string) 
error {
        oldName := c.Name()
        logger.Debugf(`Renaming RBD storage volume for snapshot "%s" from "%s" 
to "%s"`, oldName, oldName, newName)
 
@@ -1720,7 +1719,7 @@ func (s *storageCeph) ContainerSnapshotRename(c 
container, newName string) error
        return nil
 }
 
-func (s *storageCeph) ContainerSnapshotStart(c container) (bool, error) {
+func (s *storageCeph) ContainerSnapshotStart(c Instance) (bool, error) {
        containerName := c.Name()
        logger.Debugf(`Initializing RBD storage volume for snapshot "%s" on 
storage pool "%s"`, containerName, s.pool.Name)
 
@@ -1836,7 +1835,7 @@ func (s *storageCeph) ContainerSnapshotStart(c container) 
(bool, error) {
        return true, nil
 }
 
-func (s *storageCeph) ContainerSnapshotStop(c container) (bool, error) {
+func (s *storageCeph) ContainerSnapshotStop(c Instance) (bool, error) {
        logger.Debugf(`Stopping RBD storage volume for snapshot "%s" on storage 
pool "%s"`, c.Name(), s.pool.Name)
 
        containerName := c.Name()
@@ -1883,14 +1882,14 @@ func (s *storageCeph) ContainerSnapshotStop(c 
container) (bool, error) {
        return true, nil
 }
 
-func (s *storageCeph) ContainerSnapshotCreateEmpty(c container) error {
+func (s *storageCeph) ContainerSnapshotCreateEmpty(c Instance) error {
        logger.Debugf(`Creating empty RBD storage volume for snapshot "%s" on 
storage pool "%s" (noop)`, c.Name(), s.pool.Name)
 
        logger.Debugf(`Created empty RBD storage volume for snapshot "%s" on 
storage pool "%s" (noop)`, c.Name(), s.pool.Name)
        return nil
 }
 
-func (s *storageCeph) ContainerBackupCreate(backup backup, source container) 
error {
+func (s *storageCeph) ContainerBackupCreate(backup backup, source Instance) 
error {
        // Start storage
        ourStart, err := source.StorageStart()
        if err != nil {
diff --git a/lxd/storage_ceph_utils.go b/lxd/storage_ceph_utils.go
index 1a82a510f6..4d5c20222e 100644
--- a/lxd/storage_ceph_utils.go
+++ b/lxd/storage_ceph_utils.go
@@ -727,8 +727,7 @@ func (s *storageCeph) getRBDMountOptions() string {
 // copyWithoutSnapshotsFull creates a non-sparse copy of a container
 // This does not introduce a dependency relation between the source RBD storage
 // volume and the target RBD storage volume.
-func (s *storageCeph) copyWithoutSnapshotsFull(target container,
-       source container) error {
+func (s *storageCeph) copyWithoutSnapshotsFull(target Instance, source 
Instance) error {
        logger.Debugf(`Creating non-sparse copy of RBD storage volume for 
container "%s" to "%s" without snapshots`, source.Name(), target.Name())
 
        sourceIsSnapshot := source.IsSnapshot()
@@ -796,8 +795,7 @@ func (s *storageCeph) copyWithoutSnapshotsFull(target 
container,
 // copyWithoutSnapshotsFull creates a sparse copy of a container
 // This introduces a dependency relation between the source RBD storage volume
 // and the target RBD storage volume.
-func (s *storageCeph) copyWithoutSnapshotsSparse(target container,
-       source container) error {
+func (s *storageCeph) copyWithoutSnapshotsSparse(target Instance, source 
Instance) error {
        logger.Debugf(`Creating sparse copy of RBD storage volume for container 
"%s" to "%s" without snapshots`, source.Name(),
                target.Name())
 
@@ -1586,7 +1584,7 @@ func (s *storageCeph) 
cephRBDVolumeDumpToFile(sourceVolumeName string, file stri
 }
 
 // cephRBDVolumeBackupCreate creates a backup of a container or snapshot.
-func (s *storageCeph) cephRBDVolumeBackupCreate(tmpPath string, backup backup, 
source container) error {
+func (s *storageCeph) cephRBDVolumeBackupCreate(tmpPath string, backup backup, 
source Instance) error {
        sourceIsSnapshot := source.IsSnapshot()
        sourceContainerName := source.Name()
        sourceContainerOnlyName := project.Prefix(source.Project(), 
sourceContainerName)
diff --git a/lxd/storage_cephfs.go b/lxd/storage_cephfs.go
index 305de37498..0c3f8b9aa3 100644
--- a/lxd/storage_cephfs.go
+++ b/lxd/storage_cephfs.go
@@ -618,81 +618,81 @@ func (s *storageCephFs) StoragePoolVolumeRename(newName 
string) error {
        return nil
 }
 
-func (s *storageCephFs) ContainerStorageReady(container container) bool {
+func (s *storageCephFs) ContainerStorageReady(container Instance) bool {
        containerMntPoint := driver.GetContainerMountPoint(container.Project(), 
s.pool.Name, container.Name())
        ok, _ := shared.PathIsEmpty(containerMntPoint)
        return !ok
 }
 
-func (s *storageCephFs) ContainerCreate(container container) error {
+func (s *storageCephFs) ContainerCreate(container Instance) error {
        return fmt.Errorf("CEPHFS cannot be used for containers")
 }
 
-func (s *storageCephFs) ContainerCreateFromImage(container container, 
imageFingerprint string, tracker *ioprogress.ProgressTracker) error {
+func (s *storageCephFs) ContainerCreateFromImage(container Instance, 
imageFingerprint string, tracker *ioprogress.ProgressTracker) error {
        return fmt.Errorf("CEPHFS cannot be used for containers")
 }
 
-func (s *storageCephFs) ContainerCanRestore(container container, 
sourceContainer container) error {
+func (s *storageCephFs) ContainerCanRestore(container Instance, 
sourceContainer Instance) error {
        return fmt.Errorf("CEPHFS cannot be used for containers")
 }
 
-func (s *storageCephFs) ContainerDelete(container container) error {
+func (s *storageCephFs) ContainerDelete(container Instance) error {
        return fmt.Errorf("CEPHFS cannot be used for containers")
 }
 
-func (s *storageCephFs) ContainerCopy(target container, source container, 
containerOnly bool) error {
+func (s *storageCephFs) ContainerCopy(target Instance, source Instance, 
containerOnly bool) error {
        return fmt.Errorf("CEPHFS cannot be used for containers")
 }
 
-func (s *storageCephFs) ContainerRefresh(target container, source container, 
snapshots []container) error {
+func (s *storageCephFs) ContainerRefresh(target Instance, source Instance, 
snapshots []Instance) error {
        return fmt.Errorf("CEPHFS cannot be used for containers")
 }
 
-func (s *storageCephFs) ContainerMount(c container) (bool, error) {
+func (s *storageCephFs) ContainerMount(c Instance) (bool, error) {
        return false, fmt.Errorf("CEPHFS cannot be used for containers")
 }
 
-func (s *storageCephFs) ContainerUmount(c container, path string) (bool, 
error) {
+func (s *storageCephFs) ContainerUmount(c Instance, path string) (bool, error) 
{
        return false, fmt.Errorf("CEPHFS cannot be used for containers")
 }
 
-func (s *storageCephFs) ContainerRename(container container, newName string) 
error {
+func (s *storageCephFs) ContainerRename(container Instance, newName string) 
error {
        return fmt.Errorf("CEPHFS cannot be used for containers")
 }
 
-func (s *storageCephFs) ContainerRestore(container container, sourceContainer 
container) error {
+func (s *storageCephFs) ContainerRestore(container Instance, sourceContainer 
Instance) error {
        return fmt.Errorf("CEPHFS cannot be used for containers")
 }
 
-func (s *storageCephFs) ContainerGetUsage(c container) (int64, error) {
+func (s *storageCephFs) ContainerGetUsage(c Instance) (int64, error) {
        return -1, fmt.Errorf("CEPHFS cannot be used for containers")
 }
 
-func (s *storageCephFs) ContainerSnapshotCreate(snapshotContainer container, 
sourceContainer container) error {
+func (s *storageCephFs) ContainerSnapshotCreate(snapshotContainer Instance, 
sourceContainer Instance) error {
        return fmt.Errorf("CEPHFS cannot be used for containers")
 }
 
-func (s *storageCephFs) ContainerSnapshotCreateEmpty(snapshotContainer 
container) error {
+func (s *storageCephFs) ContainerSnapshotCreateEmpty(snapshotContainer 
Instance) error {
        return fmt.Errorf("CEPHFS cannot be used for containers")
 }
 
-func (s *storageCephFs) ContainerSnapshotDelete(snapshotContainer container) 
error {
+func (s *storageCephFs) ContainerSnapshotDelete(snapshotContainer Instance) 
error {
        return fmt.Errorf("CEPHFS cannot be used for containers")
 }
 
-func (s *storageCephFs) ContainerSnapshotRename(snapshotContainer container, 
newName string) error {
+func (s *storageCephFs) ContainerSnapshotRename(snapshotContainer Instance, 
newName string) error {
        return fmt.Errorf("CEPHFS cannot be used for containers")
 }
 
-func (s *storageCephFs) ContainerSnapshotStart(container container) (bool, 
error) {
+func (s *storageCephFs) ContainerSnapshotStart(container Instance) (bool, 
error) {
        return false, fmt.Errorf("CEPHFS cannot be used for containers")
 }
 
-func (s *storageCephFs) ContainerSnapshotStop(container container) (bool, 
error) {
+func (s *storageCephFs) ContainerSnapshotStop(container Instance) (bool, 
error) {
        return false, fmt.Errorf("CEPHFS cannot be used for containers")
 }
 
-func (s *storageCephFs) ContainerBackupCreate(backup backup, source container) 
error {
+func (s *storageCephFs) ContainerBackupCreate(backup backup, source Instance) 
error {
        return fmt.Errorf("CEPHFS cannot be used for containers")
 }
 
diff --git a/lxd/storage_dir.go b/lxd/storage_dir.go
index 3c0d464b1a..ee04ffad0b 100644
--- a/lxd/storage_dir.go
+++ b/lxd/storage_dir.go
@@ -488,13 +488,13 @@ func (s *storageDir) StoragePoolVolumeRename(newName 
string) error {
                storagePoolVolumeTypeCustom, s.poolID)
 }
 
-func (s *storageDir) ContainerStorageReady(container container) bool {
+func (s *storageDir) ContainerStorageReady(container Instance) bool {
        containerMntPoint := driver.GetContainerMountPoint(container.Project(), 
s.pool.Name, container.Name())
        ok, _ := shared.PathIsEmpty(containerMntPoint)
        return !ok
 }
 
-func (s *storageDir) ContainerCreate(container container) error {
+func (s *storageDir) ContainerCreate(container Instance) error {
        logger.Debugf("Creating empty DIR storage volume for container \"%s\" 
on storage pool \"%s\"", s.volume.Name, s.pool.Name)
 
        _, err := s.StoragePoolMount()
@@ -536,7 +536,7 @@ func (s *storageDir) ContainerCreate(container container) 
error {
        return nil
 }
 
-func (s *storageDir) ContainerCreateFromImage(container container, 
imageFingerprint string, tracker *ioprogress.ProgressTracker) error {
+func (s *storageDir) ContainerCreateFromImage(container Instance, 
imageFingerprint string, tracker *ioprogress.ProgressTracker) error {
        logger.Debugf("Creating DIR storage volume for container \"%s\" on 
storage pool \"%s\"", s.volume.Name, s.pool.Name)
 
        _, err := s.StoragePoolMount()
@@ -586,7 +586,7 @@ func (s *storageDir) ContainerCreateFromImage(container 
container, imageFingerpr
        return nil
 }
 
-func (s *storageDir) ContainerDelete(container container) error {
+func (s *storageDir) ContainerDelete(container Instance) error {
        logger.Debugf("Deleting DIR storage volume for container \"%s\" on 
storage pool \"%s\"", s.volume.Name, s.pool.Name)
 
        source := s.pool.Config["source"]
@@ -648,7 +648,7 @@ func (s *storageDir) ContainerDelete(container container) 
error {
        return nil
 }
 
-func (s *storageDir) copyContainer(target container, source container) error {
+func (s *storageDir) copyContainer(target Instance, source Instance) error {
        _, sourcePool, _ := source.Storage().GetContainerPoolInfo()
        _, targetPool, _ := target.Storage().GetContainerPoolInfo()
        sourceContainerMntPoint := 
driver.GetContainerMountPoint(source.Project(), sourcePool, source.Name())
@@ -705,7 +705,7 @@ func (s *storageDir) copySnapshot(target container, 
targetPool string, source co
        return nil
 }
 
-func (s *storageDir) ContainerCopy(target container, source container, 
containerOnly bool) error {
+func (s *storageDir) ContainerCopy(target Instance, source Instance, 
containerOnly bool) error {
        logger.Debugf("Copying DIR container storage %s to %s", source.Name(), 
target.Name())
 
        err := s.doContainerCopy(target, source, containerOnly, false, nil)
@@ -717,7 +717,7 @@ func (s *storageDir) ContainerCopy(target container, source 
container, container
        return nil
 }
 
-func (s *storageDir) doContainerCopy(target container, source container, 
containerOnly bool, refresh bool, refreshSnapshots []container) error {
+func (s *storageDir) doContainerCopy(target Instance, source Instance, 
containerOnly bool, refresh bool, refreshSnapshots []Instance) error {
        _, err := s.StoragePoolMount()
        if err != nil {
                return err
@@ -767,7 +767,7 @@ func (s *storageDir) doContainerCopy(target container, 
source container, contain
                return nil
        }
 
-       var snapshots []container
+       var snapshots []Instance
 
        if refresh {
                snapshots = refreshSnapshots
@@ -804,7 +804,7 @@ func (s *storageDir) doContainerCopy(target container, 
source container, contain
        return nil
 }
 
-func (s *storageDir) ContainerRefresh(target container, source container, 
snapshots []container) error {
+func (s *storageDir) ContainerRefresh(target Instance, source Instance, 
snapshots []Instance) error {
        logger.Debugf("Refreshing DIR container storage for %s from %s", 
target.Name(), source.Name())
 
        err := s.doContainerCopy(target, source, len(snapshots) == 0, true, 
snapshots)
@@ -816,15 +816,15 @@ func (s *storageDir) ContainerRefresh(target container, 
source container, snapsh
        return nil
 }
 
-func (s *storageDir) ContainerMount(c container) (bool, error) {
+func (s *storageDir) ContainerMount(c Instance) (bool, error) {
        return s.StoragePoolMount()
 }
 
-func (s *storageDir) ContainerUmount(c container, path string) (bool, error) {
+func (s *storageDir) ContainerUmount(c Instance, path string) (bool, error) {
        return true, nil
 }
 
-func (s *storageDir) ContainerRename(container container, newName string) 
error {
+func (s *storageDir) ContainerRename(container Instance, newName string) error 
{
        logger.Debugf("Renaming DIR storage volume for container \"%s\" from %s 
to %s", s.volume.Name, s.volume.Name, newName)
 
        _, err := s.StoragePoolMount()
@@ -879,7 +879,7 @@ func (s *storageDir) ContainerRename(container container, 
newName string) error
        return nil
 }
 
-func (s *storageDir) ContainerRestore(container container, sourceContainer 
container) error {
+func (s *storageDir) ContainerRestore(container Instance, sourceContainer 
Instance) error {
        logger.Debugf("Restoring DIR storage volume for container \"%s\" from 
%s to %s", s.volume.Name, sourceContainer.Name(), container.Name())
 
        _, err := s.StoragePoolMount()
@@ -901,7 +901,7 @@ func (s *storageDir) ContainerRestore(container container, 
sourceContainer conta
        return nil
 }
 
-func (s *storageDir) ContainerGetUsage(c container) (int64, error) {
+func (s *storageDir) ContainerGetUsage(c Instance) (int64, error) {
        path := driver.GetContainerMountPoint(c.Project(), s.pool.Name, 
c.Name())
 
        ok, err := quota.Supported(path)
@@ -918,7 +918,7 @@ func (s *storageDir) ContainerGetUsage(c container) (int64, 
error) {
        return size, nil
 }
 
-func (s *storageDir) ContainerSnapshotCreate(snapshotContainer container, 
sourceContainer container) error {
+func (s *storageDir) ContainerSnapshotCreate(snapshotContainer Instance, 
sourceContainer Instance) error {
        logger.Debugf("Creating DIR storage volume for snapshot \"%s\" on 
storage pool \"%s\"", s.volume.Name, s.pool.Name)
 
        _, err := s.StoragePoolMount()
@@ -934,7 +934,7 @@ func (s *storageDir) 
ContainerSnapshotCreate(snapshotContainer container, source
                return err
        }
 
-       rsync := func(snapshotContainer container, oldPath string, newPath 
string, bwlimit string) error {
+       rsync := func(snapshotContainer Instance, oldPath string, newPath 
string, bwlimit string) error {
                output, err := rsyncLocalCopy(oldPath, newPath, bwlimit, true)
                if err != nil {
                        s.ContainerDelete(snapshotContainer)
@@ -995,7 +995,7 @@ onSuccess:
        return nil
 }
 
-func (s *storageDir) ContainerSnapshotCreateEmpty(snapshotContainer container) 
error {
+func (s *storageDir) ContainerSnapshotCreateEmpty(snapshotContainer Instance) 
error {
        logger.Debugf("Creating empty DIR storage volume for snapshot \"%s\" on 
storage pool \"%s\"", s.volume.Name, s.pool.Name)
 
        _, err := s.StoragePoolMount()
@@ -1069,7 +1069,7 @@ func dirSnapshotDeleteInternal(projectName, poolName 
string, snapshotName string
        return nil
 }
 
-func (s *storageDir) ContainerSnapshotDelete(snapshotContainer container) 
error {
+func (s *storageDir) ContainerSnapshotDelete(snapshotContainer Instance) error 
{
        logger.Debugf("Deleting DIR storage volume for snapshot \"%s\" on 
storage pool \"%s\"", s.volume.Name, s.pool.Name)
 
        _, err := s.StoragePoolMount()
@@ -1092,7 +1092,7 @@ func (s *storageDir) 
ContainerSnapshotDelete(snapshotContainer container) error
        return nil
 }
 
-func (s *storageDir) ContainerSnapshotRename(snapshotContainer container, 
newName string) error {
+func (s *storageDir) ContainerSnapshotRename(snapshotContainer Instance, 
newName string) error {
        logger.Debugf("Renaming DIR storage volume for snapshot \"%s\" from %s 
to %s", s.volume.Name, s.volume.Name, newName)
 
        _, err := s.StoragePoolMount()
@@ -1113,15 +1113,15 @@ func (s *storageDir) 
ContainerSnapshotRename(snapshotContainer container, newNam
        return nil
 }
 
-func (s *storageDir) ContainerSnapshotStart(container container) (bool, error) 
{
+func (s *storageDir) ContainerSnapshotStart(container Instance) (bool, error) {
        return s.StoragePoolMount()
 }
 
-func (s *storageDir) ContainerSnapshotStop(container container) (bool, error) {
+func (s *storageDir) ContainerSnapshotStop(container Instance) (bool, error) {
        return true, nil
 }
 
-func (s *storageDir) ContainerBackupCreate(backup backup, source container) 
error {
+func (s *storageDir) ContainerBackupCreate(backup backup, source Instance) 
error {
        // Start storage
        ourStart, err := source.StorageStart()
        if err != nil {
diff --git a/lxd/storage_lvm.go b/lxd/storage_lvm.go
index 87be1a097f..b764dc9f59 100644
--- a/lxd/storage_lvm.go
+++ b/lxd/storage_lvm.go
@@ -916,7 +916,7 @@ func (s *storageLvm) StoragePoolVolumeRename(newName 
string) error {
                storagePoolVolumeTypeCustom, s.poolID)
 }
 
-func (s *storageLvm) ContainerStorageReady(container container) bool {
+func (s *storageLvm) ContainerStorageReady(container Instance) bool {
        containerLvmName := containerNameToLVName(container.Name())
        poolName := s.getOnDiskPoolName()
        containerLvmPath := getLvmDevPath(container.Project(), poolName, 
storagePoolVolumeAPIEndpointContainers, containerLvmName)
@@ -924,7 +924,7 @@ func (s *storageLvm) ContainerStorageReady(container 
container) bool {
        return ok
 }
 
-func (s *storageLvm) ContainerCreate(container container) error {
+func (s *storageLvm) ContainerCreate(container Instance) error {
        logger.Debugf("Creating empty LVM storage volume for container \"%s\" 
on storage pool \"%s\"", s.volume.Name, s.pool.Name)
 
        tryUndo := true
@@ -988,7 +988,7 @@ func (s *storageLvm) ContainerCreate(container container) 
error {
        return nil
 }
 
-func (s *storageLvm) ContainerCreateFromImage(container container, fingerprint 
string, tracker *ioprogress.ProgressTracker) error {
+func (s *storageLvm) ContainerCreateFromImage(container Instance, fingerprint 
string, tracker *ioprogress.ProgressTracker) error {
        logger.Debugf("Creating LVM storage volume for container \"%s\" on 
storage pool \"%s\"", s.volume.Name, s.pool.Name)
 
        tryUndo := true
@@ -1107,7 +1107,7 @@ func lvmContainerDeleteInternal(projectName, poolName 
string, ctName string, isS
        return nil
 }
 
-func (s *storageLvm) ContainerDelete(container container) error {
+func (s *storageLvm) ContainerDelete(container Instance) error {
        logger.Debugf("Deleting LVM storage volume for container \"%s\" on 
storage pool \"%s\"", s.volume.Name, s.pool.Name)
 
        containerName := container.Name()
@@ -1121,7 +1121,7 @@ func (s *storageLvm) ContainerDelete(container container) 
error {
        return nil
 }
 
-func (s *storageLvm) ContainerCopy(target container, source container, 
containerOnly bool) error {
+func (s *storageLvm) ContainerCopy(target Instance, source Instance, 
containerOnly bool) error {
        logger.Debugf("Copying LVM container storage for container %s to %s", 
source.Name(), target.Name())
 
        err := s.doContainerCopy(target, source, containerOnly, false, nil)
@@ -1133,7 +1133,7 @@ func (s *storageLvm) ContainerCopy(target container, 
source container, container
        return nil
 }
 
-func (s *storageLvm) doContainerCopy(target container, source container, 
containerOnly bool, refresh bool, refreshSnapshots []container) error {
+func (s *storageLvm) doContainerCopy(target Instance, source Instance, 
containerOnly bool, refresh bool, refreshSnapshots []Instance) error {
        ourStart, err := source.StorageStart()
        if err != nil {
                return err
@@ -1177,7 +1177,7 @@ func (s *storageLvm) doContainerCopy(target container, 
source container, contain
                return nil
        }
 
-       var snapshots []container
+       var snapshots []Instance
 
        if refresh {
                snapshots = refreshSnapshots
@@ -1219,7 +1219,7 @@ func (s *storageLvm) doContainerCopy(target container, 
source container, contain
        return nil
 }
 
-func (s *storageLvm) ContainerRefresh(target container, source container, 
snapshots []container) error {
+func (s *storageLvm) ContainerRefresh(target Instance, source Instance, 
snapshots []Instance) error {
        logger.Debugf("Refreshing LVM container storage for %s from %s", 
target.Name(), source.Name())
 
        err := s.doContainerCopy(target, source, len(snapshots) == 0, true, 
snapshots)
@@ -1231,7 +1231,7 @@ func (s *storageLvm) ContainerRefresh(target container, 
source container, snapsh
        return nil
 }
 
-func (s *storageLvm) ContainerMount(c container) (bool, error) {
+func (s *storageLvm) ContainerMount(c Instance) (bool, error) {
        return s.doContainerMount(c.Project(), c.Name(), false)
 }
 
@@ -1292,7 +1292,7 @@ func (s *storageLvm) doContainerMount(project, name 
string, snap bool) (bool, er
        return ourMount, nil
 }
 
-func (s *storageLvm) ContainerUmount(c container, path string) (bool, error) {
+func (s *storageLvm) ContainerUmount(c Instance, path string) (bool, error) {
        return s.umount(c.Project(), c.Name(), path)
 }
 
@@ -1340,7 +1340,7 @@ func (s *storageLvm) umount(project, name string, path 
string) (bool, error) {
        return ourUmount, nil
 }
 
-func (s *storageLvm) ContainerRename(container container, newContainerName 
string) error {
+func (s *storageLvm) ContainerRename(container Instance, newContainerName 
string) error {
        logger.Debugf("Renaming LVM storage volume for container \"%s\" from %s 
to %s", s.volume.Name, s.volume.Name, newContainerName)
 
        tryUndo := true
@@ -1421,7 +1421,7 @@ func (s *storageLvm) ContainerRename(container container, 
newContainerName strin
        return nil
 }
 
-func (s *storageLvm) ContainerRestore(target container, source container) 
error {
+func (s *storageLvm) ContainerRestore(target Instance, source Instance) error {
        logger.Debugf("Restoring LVM storage volume for container \"%s\" from 
%s to %s", s.volume.Name, source.Name(), target.Name())
 
        _, sourcePool, _ := source.Storage().GetContainerPoolInfo()
@@ -1500,11 +1500,11 @@ func (s *storageLvm) ContainerRestore(target container, 
source container) error
        return nil
 }
 
-func (s *storageLvm) ContainerGetUsage(container container) (int64, error) {
+func (s *storageLvm) ContainerGetUsage(container Instance) (int64, error) {
        return -1, fmt.Errorf("the LVM container backend doesn't support 
quotas")
 }
 
-func (s *storageLvm) ContainerSnapshotCreate(snapshotContainer container, 
sourceContainer container) error {
+func (s *storageLvm) ContainerSnapshotCreate(snapshotContainer Instance, 
sourceContainer Instance) error {
        logger.Debugf("Creating LVM storage volume for snapshot \"%s\" on 
storage pool \"%s\"", s.volume.Name, s.pool.Name)
 
        err := s.createSnapshotContainer(snapshotContainer, sourceContainer, 
true)
@@ -1516,7 +1516,7 @@ func (s *storageLvm) 
ContainerSnapshotCreate(snapshotContainer container, source
        return nil
 }
 
-func (s *storageLvm) ContainerSnapshotDelete(snapshotContainer container) 
error {
+func (s *storageLvm) ContainerSnapshotDelete(snapshotContainer Instance) error 
{
        logger.Debugf("Deleting LVM storage volume for snapshot \"%s\" on 
storage pool \"%s\"", s.volume.Name, s.pool.Name)
 
        err := s.ContainerDelete(snapshotContainer)
@@ -1528,7 +1528,7 @@ func (s *storageLvm) 
ContainerSnapshotDelete(snapshotContainer container) error
        return nil
 }
 
-func (s *storageLvm) ContainerSnapshotRename(snapshotContainer container, 
newContainerName string) error {
+func (s *storageLvm) ContainerSnapshotRename(snapshotContainer Instance, 
newContainerName string) error {
        logger.Debugf("Renaming LVM storage volume for snapshot \"%s\" from %s 
to %s", s.volume.Name, s.volume.Name, newContainerName)
 
        tryUndo := true
@@ -1560,7 +1560,7 @@ func (s *storageLvm) 
ContainerSnapshotRename(snapshotContainer container, newCon
        return nil
 }
 
-func (s *storageLvm) ContainerSnapshotStart(container container) (bool, error) 
{
+func (s *storageLvm) ContainerSnapshotStart(container Instance) (bool, error) {
        logger.Debugf(`Initializing LVM storage volume for snapshot "%s" on 
storage pool "%s"`, s.volume.Name, s.pool.Name)
 
        poolName := s.getOnDiskPoolName()
@@ -1610,7 +1610,7 @@ func (s *storageLvm) ContainerSnapshotStart(container 
container) (bool, error) {
        return true, nil
 }
 
-func (s *storageLvm) ContainerSnapshotStop(container container) (bool, error) {
+func (s *storageLvm) ContainerSnapshotStop(container Instance) (bool, error) {
        logger.Debugf("Stopping LVM storage volume for snapshot \"%s\" on 
storage pool \"%s\"", s.volume.Name, s.pool.Name)
 
        containerName := container.Name()
@@ -1649,7 +1649,7 @@ func (s *storageLvm) ContainerSnapshotStop(container 
container) (bool, error) {
        return true, nil
 }
 
-func (s *storageLvm) ContainerSnapshotCreateEmpty(snapshotContainer container) 
error {
+func (s *storageLvm) ContainerSnapshotCreateEmpty(snapshotContainer Instance) 
error {
        logger.Debugf("Creating empty LVM storage volume for snapshot \"%s\" on 
storage pool \"%s\"", s.volume.Name, s.pool.Name)
 
        err := s.ContainerCreate(snapshotContainer)
@@ -1661,7 +1661,7 @@ func (s *storageLvm) 
ContainerSnapshotCreateEmpty(snapshotContainer container) e
        return nil
 }
 
-func (s *storageLvm) ContainerBackupCreate(backup backup, source container) 
error {
+func (s *storageLvm) ContainerBackupCreate(backup backup, source Instance) 
error {
        poolName := s.getOnDiskPoolName()
 
        // Start storage
diff --git a/lxd/storage_lvm_utils.go b/lxd/storage_lvm_utils.go
index 7ea61f13f2..14d627c447 100644
--- a/lxd/storage_lvm_utils.go
+++ b/lxd/storage_lvm_utils.go
@@ -257,7 +257,7 @@ func (s *storageLvm) createSnapshotLV(project, vgName 
string, origLvName string,
        return targetLvmVolumePath, nil
 }
 
-func (s *storageLvm) createSnapshotContainer(snapshotContainer container, 
sourceContainer container, readonly bool) error {
+func (s *storageLvm) createSnapshotContainer(snapshotContainer Instance, 
sourceContainer Instance, readonly bool) error {
        tryUndo := true
 
        sourceContainerName := sourceContainer.Name()
@@ -304,7 +304,7 @@ func (s *storageLvm) 
createSnapshotContainer(snapshotContainer container, source
 }
 
 // Copy a container on a storage pool that does use a thinpool.
-func (s *storageLvm) copyContainerThinpool(target container, source container, 
readonly bool) error {
+func (s *storageLvm) copyContainerThinpool(target Instance, source Instance, 
readonly bool) error {
        err := s.createSnapshotContainer(target, source, readonly)
        if err != nil {
                logger.Errorf("Error creating snapshot LV for copy: %s", err)
@@ -371,7 +371,7 @@ func (s *storageLvm) copySnapshot(target container, source 
container, refresh bo
 }
 
 // Copy a container on a storage pool that does not use a thinpool.
-func (s *storageLvm) copyContainerLv(target container, source container, 
readonly bool, refresh bool) error {
+func (s *storageLvm) copyContainerLv(target Instance, source Instance, 
readonly bool, refresh bool) error {
        exists, err := storageLVExists(getLvmDevPath(target.Project(), 
s.getOnDiskPoolName(),
                storagePoolVolumeAPIEndpointContainers, 
containerNameToLVName(target.Name())))
        if err != nil {
@@ -446,7 +446,7 @@ func (s *storageLvm) copyContainerLv(target container, 
source container, readonl
 }
 
 // Copy an lvm container.
-func (s *storageLvm) copyContainer(target container, source container, refresh 
bool) error {
+func (s *storageLvm) copyContainer(target Instance, source Instance, refresh 
bool) error {
        targetPool, err := target.StoragePool()
        if err != nil {
                return err
@@ -484,7 +484,7 @@ func (s *storageLvm) copyContainer(target container, source 
container, refresh b
        return nil
 }
 
-func (s *storageLvm) containerCreateFromImageLv(c container, fp string) error {
+func (s *storageLvm) containerCreateFromImageLv(c Instance, fp string) error {
        containerName := c.Name()
 
        err := s.ContainerCreate(c)
@@ -516,7 +516,7 @@ func (s *storageLvm) containerCreateFromImageLv(c 
container, fp string) error {
        return nil
 }
 
-func (s *storageLvm) containerCreateFromImageThinLv(c container, fp string) 
error {
+func (s *storageLvm) containerCreateFromImageThinLv(c Instance, fp string) 
error {
        poolName := s.getOnDiskPoolName()
        // Check if the image already exists.
        imageLvmDevPath := getLvmDevPath("default", poolName, 
storagePoolVolumeAPIEndpointImages, fp)
diff --git a/lxd/storage_migration.go b/lxd/storage_migration.go
index 218458d118..2453fd5f9f 100644
--- a/lxd/storage_migration.go
+++ b/lxd/storage_migration.go
@@ -41,8 +41,8 @@ type MigrationStorageSourceDriver interface {
 }
 
 type rsyncStorageSourceDriver struct {
-       container     container
-       snapshots     []container
+       container     Instance
+       snapshots     []Instance
        rsyncFeatures []string
 }
 
@@ -145,7 +145,7 @@ func rsyncStorageMigrationSource(args MigrationSourceArgs) 
(MigrationStorageSour
 }
 
 func rsyncRefreshSource(refreshSnapshots []string, args MigrationSourceArgs) 
(MigrationStorageSourceDriver, error) {
-       var snapshots = []container{}
+       var snapshots = []Instance{}
        if !args.InstanceOnly {
                allSnapshots, err := args.Container.Snapshots()
                if err != nil {
@@ -167,7 +167,7 @@ func rsyncRefreshSource(refreshSnapshots []string, args 
MigrationSourceArgs) (Mi
 
 func rsyncMigrationSource(args MigrationSourceArgs) 
(MigrationStorageSourceDriver, error) {
        var err error
-       var snapshots = []container{}
+       var snapshots = []Instance{}
        if !args.InstanceOnly {
                snapshots, err = args.Container.Snapshots()
                if err != nil {
diff --git a/lxd/storage_migration_btrfs.go b/lxd/storage_migration_btrfs.go
index 2f58187467..166fd8599c 100644
--- a/lxd/storage_migration_btrfs.go
+++ b/lxd/storage_migration_btrfs.go
@@ -15,8 +15,8 @@ import (
 )
 
 type btrfsMigrationSourceDriver struct {
-       container          container
-       snapshots          []container
+       container          Instance
+       snapshots          []Instance
        btrfsSnapshotNames []string
        btrfs              *storageBtrfs
        runningSnapName    string
diff --git a/lxd/storage_mock.go b/lxd/storage_mock.go
index 950aa4d215..3b9520928e 100644
--- a/lxd/storage_mock.go
+++ b/lxd/storage_mock.go
@@ -109,87 +109,73 @@ func (s *storageMock) StoragePoolUpdate(writable 
*api.StoragePoolPut, changedCon
        return nil
 }
 
-func (s *storageMock) ContainerStorageReady(container container) bool {
+func (s *storageMock) ContainerStorageReady(container Instance) bool {
        return true
 }
 
-func (s *storageMock) ContainerCreate(container container) error {
+func (s *storageMock) ContainerCreate(container Instance) error {
        return nil
 }
 
-func (s *storageMock) ContainerCreateFromImage(
-       container container, imageFingerprint string, tracker 
*ioprogress.ProgressTracker) error {
-
+func (s *storageMock) ContainerCreateFromImage(container Instance, 
imageFingerprint string, tracker *ioprogress.ProgressTracker) error {
        return nil
 }
 
-func (s *storageMock) ContainerDelete(container container) error {
+func (s *storageMock) ContainerDelete(container Instance) error {
        return nil
 }
 
-func (s *storageMock) ContainerCopy(target container, source container, 
containerOnly bool) error {
+func (s *storageMock) ContainerCopy(target Instance, source Instance, 
containerOnly bool) error {
        return nil
 }
 
-func (s *storageMock) ContainerRefresh(target container, source container, 
snapshots []container) error {
+func (s *storageMock) ContainerRefresh(target Instance, source Instance, 
snapshots []Instance) error {
        return nil
 }
 
-func (s *storageMock) ContainerMount(c container) (bool, error) {
+func (s *storageMock) ContainerMount(c Instance) (bool, error) {
        return true, nil
 }
 
-func (s *storageMock) ContainerUmount(c container, path string) (bool, error) {
+func (s *storageMock) ContainerUmount(c Instance, path string) (bool, error) {
        return true, nil
 }
 
-func (s *storageMock) ContainerRename(
-       container container, newName string) error {
-
+func (s *storageMock) ContainerRename(container Instance, newName string) 
error {
        return nil
 }
 
-func (s *storageMock) ContainerRestore(
-       container container, sourceContainer container) error {
-
+func (s *storageMock) ContainerRestore(container Instance, sourceContainer 
Instance) error {
        return nil
 }
 
-func (s *storageMock) ContainerGetUsage(
-       container container) (int64, error) {
-
+func (s *storageMock) ContainerGetUsage(container Instance) (int64, error) {
        return 0, nil
 }
-func (s *storageMock) ContainerSnapshotCreate(
-       snapshotContainer container, sourceContainer container) error {
-
+func (s *storageMock) ContainerSnapshotCreate(snapshotContainer Instance, 
sourceContainer Instance) error {
        return nil
 }
-func (s *storageMock) ContainerSnapshotDelete(
-       snapshotContainer container) error {
-
+func (s *storageMock) ContainerSnapshotDelete(snapshotContainer Instance) 
error {
        return nil
 }
 
-func (s *storageMock) ContainerSnapshotRename(
-       snapshotContainer container, newName string) error {
-
+func (s *storageMock) ContainerSnapshotRename(snapshotContainer Instance, 
newName string) error {
        return nil
 }
 
-func (s *storageMock) ContainerSnapshotStart(container container) (bool, 
error) {
+func (s *storageMock) ContainerSnapshotStart(container Instance) (bool, error) 
{
        return true, nil
 }
 
-func (s *storageMock) ContainerSnapshotStop(container container) (bool, error) 
{
+func (s *storageMock) ContainerSnapshotStop(container Instance) (bool, error) {
        return true, nil
 }
 
-func (s *storageMock) ContainerSnapshotCreateEmpty(snapshotContainer 
container) error {
+func (s *storageMock) ContainerSnapshotCreateEmpty(snapshotContainer Instance) 
error {
        return nil
 }
 
-func (s *storageMock) ContainerBackupCreate(backup backup, sourceContainer 
container) error {
+func (s *storageMock) ContainerBackupCreate(backup backup, sourceContainer 
Instance) error {
        return nil
 }
 
diff --git a/lxd/storage_zfs.go b/lxd/storage_zfs.go
index be35447063..9c75819e96 100644
--- a/lxd/storage_zfs.go
+++ b/lxd/storage_zfs.go
@@ -760,11 +760,11 @@ func (s *storageZfs) StoragePoolVolumeRename(newName 
string) error {
 }
 
 // Things we don't need to care about
-func (s *storageZfs) ContainerMount(c container) (bool, error) {
+func (s *storageZfs) ContainerMount(c Instance) (bool, error) {
        return s.doContainerMount(c.Project(), c.Name(), c.IsPrivileged())
 }
 
-func (s *storageZfs) ContainerUmount(c container, path string) (bool, error) {
+func (s *storageZfs) ContainerUmount(c Instance, path string) (bool, error) {
        logger.Debugf("Unmounting ZFS storage volume for container \"%s\" on 
storage pool \"%s\"", s.volume.Name, s.pool.Name)
        name := c.Name()
 
@@ -809,13 +809,13 @@ func (s *storageZfs) ContainerUmount(c container, path 
string) (bool, error) {
 }
 
 // Things we do have to care about
-func (s *storageZfs) ContainerStorageReady(container container) bool {
+func (s *storageZfs) ContainerStorageReady(container Instance) bool {
        volumeName := project.Prefix(container.Project(), container.Name())
        fs := fmt.Sprintf("containers/%s", volumeName)
        return zfsFilesystemEntityExists(s.getOnDiskPoolName(), fs)
 }
 
-func (s *storageZfs) ContainerCreate(container container) error {
+func (s *storageZfs) ContainerCreate(container Instance) error {
        err := s.doContainerCreate(container.Project(), container.Name(), 
container.IsPrivileged())
        if err != nil {
                s.doContainerDelete(container.Project(), container.Name())
@@ -838,7 +838,7 @@ func (s *storageZfs) ContainerCreate(container container) 
error {
        return nil
 }
 
-func (s *storageZfs) ContainerCreateFromImage(container container, fingerprint 
string, tracker *ioprogress.ProgressTracker) error {
+func (s *storageZfs) ContainerCreateFromImage(container Instance, fingerprint 
string, tracker *ioprogress.ProgressTracker) error {
        logger.Debugf("Creating ZFS storage volume for container \"%s\" on 
storage pool \"%s\"", s.volume.Name, s.pool.Name)
 
        containerPath := container.Path()
@@ -916,7 +916,7 @@ func (s *storageZfs) ContainerCreateFromImage(container 
container, fingerprint s
        return nil
 }
 
-func (s *storageZfs) ContainerDelete(container container) error {
+func (s *storageZfs) ContainerDelete(container Instance) error {
        err := s.doContainerDelete(container.Project(), container.Name())
        if err != nil {
                return err
@@ -925,7 +925,7 @@ func (s *storageZfs) ContainerDelete(container container) 
error {
        return nil
 }
 
-func (s *storageZfs) copyWithoutSnapshotsSparse(target container, source 
container) error {
+func (s *storageZfs) copyWithoutSnapshotsSparse(target Instance, source 
Instance) error {
        poolName := s.getOnDiskPoolName()
 
        sourceContainerName := source.Name()
@@ -1027,7 +1027,7 @@ func (s *storageZfs) copyWithoutSnapshotsSparse(target 
container, source contain
        return nil
 }
 
-func (s *storageZfs) copyWithoutSnapshotFull(target container, source 
container) error {
+func (s *storageZfs) copyWithoutSnapshotFull(target Instance, source Instance) 
error {
        logger.Debugf("Creating full ZFS copy \"%s\" to \"%s\"", source.Name(), 
target.Name())
 
        sourceIsSnapshot := source.IsSnapshot()
@@ -1128,7 +1128,7 @@ func (s *storageZfs) copyWithoutSnapshotFull(target 
container, source container)
        return nil
 }
 
-func (s *storageZfs) copyWithSnapshots(target container, source container, 
parentSnapshot string) error {
+func (s *storageZfs) copyWithSnapshots(target Instance, source Instance, 
parentSnapshot string) error {
        sourceName := source.Name()
        targetParentName, targetSnapOnlyName, _ := 
shared.ContainerGetParentAndSnapshotName(target.Name())
        containersPath := driver.GetSnapshotMountPoint(target.Project(), 
s.pool.Name, targetParentName)
@@ -1175,7 +1175,7 @@ func (s *storageZfs) copyWithSnapshots(target container, 
source container, paren
        return nil
 }
 
-func (s *storageZfs) doCrossPoolContainerCopy(target container, source 
container, containerOnly bool, refresh bool, refreshSnapshots []container) 
error {
+func (s *storageZfs) doCrossPoolContainerCopy(target Instance, source 
Instance, containerOnly bool, refresh bool, refreshSnapshots []Instance) error {
        sourcePool, err := source.StoragePool()
        if err != nil {
                return err
@@ -1200,7 +1200,7 @@ func (s *storageZfs) doCrossPoolContainerCopy(target 
container, source container
                return err
        }
 
-       var snapshots []container
+       var snapshots []Instance
 
        if refresh {
                snapshots = refreshSnapshots
@@ -1253,7 +1253,7 @@ func (s *storageZfs) doCrossPoolContainerCopy(target 
container, source container
        return nil
 }
 
-func (s *storageZfs) ContainerCopy(target container, source container, 
containerOnly bool) error {
+func (s *storageZfs) ContainerCopy(target Instance, source Instance, 
containerOnly bool) error {
        logger.Debugf("Copying ZFS container storage %s to %s", source.Name(), 
target.Name())
 
        ourStart, err := source.StorageStart()
@@ -1380,7 +1380,7 @@ func (s *storageZfs) ContainerCopy(target container, 
source container, container
        return nil
 }
 
-func (s *storageZfs) ContainerRefresh(target container, source container, 
snapshots []container) error {
+func (s *storageZfs) ContainerRefresh(target Instance, source Instance, 
snapshots []Instance) error {
        logger.Debugf("Refreshing ZFS container storage for %s from %s", 
target.Name(), source.Name())
 
        ourStart, err := source.StorageStart()
@@ -1394,7 +1394,7 @@ func (s *storageZfs) ContainerRefresh(target container, 
source container, snapsh
        return s.doCrossPoolContainerCopy(target, source, len(snapshots) == 0, 
true, snapshots)
 }
 
-func (s *storageZfs) ContainerRename(container container, newName string) 
error {
+func (s *storageZfs) ContainerRename(container Instance, newName string) error 
{
        logger.Debugf("Renaming ZFS storage volume for container \"%s\" from %s 
to %s", s.volume.Name, s.volume.Name, newName)
 
        poolName := s.getOnDiskPoolName()
@@ -1478,7 +1478,7 @@ func (s *storageZfs) ContainerRename(container container, 
newName string) error
        return nil
 }
 
-func (s *storageZfs) ContainerRestore(target container, source container) 
error {
+func (s *storageZfs) ContainerRestore(target Instance, source Instance) error {
        logger.Debugf("Restoring ZFS storage volume for container \"%s\" from 
%s to %s", s.volume.Name, source.Name(), target.Name())
 
        snaps, err := target.Snapshots()
@@ -1542,7 +1542,7 @@ func (s *storageZfs) ContainerRestore(target container, 
source container) error
        return nil
 }
 
-func (s *storageZfs) ContainerGetUsage(container container) (int64, error) {
+func (s *storageZfs) ContainerGetUsage(container Instance) (int64, error) {
        var err error
 
        fs := fmt.Sprintf("containers/%s", project.Prefix(container.Project(), 
container.Name()))
@@ -1621,7 +1621,7 @@ func (s *storageZfs) 
doContainerSnapshotCreate(projectName, targetName string, s
        return nil
 }
 
-func (s *storageZfs) ContainerSnapshotCreate(snapshotContainer container, 
sourceContainer container) error {
+func (s *storageZfs) ContainerSnapshotCreate(snapshotContainer Instance, 
sourceContainer Instance) error {
        err := s.doContainerSnapshotCreate(sourceContainer.Project(), 
snapshotContainer.Name(), sourceContainer.Name())
        if err != nil {
                s.ContainerSnapshotDelete(snapshotContainer)
@@ -1715,7 +1715,7 @@ func zfsSnapshotDeleteInternal(projectName, poolName 
string, ctName string, onDi
        return nil
 }
 
-func (s *storageZfs) ContainerSnapshotDelete(snapshotContainer container) 
error {
+func (s *storageZfs) ContainerSnapshotDelete(snapshotContainer Instance) error 
{
        logger.Debugf("Deleting ZFS storage volume for snapshot \"%s\" on 
storage pool \"%s\"", s.volume.Name, s.pool.Name)
 
        poolName := s.getOnDiskPoolName()
@@ -1729,7 +1729,7 @@ func (s *storageZfs) 
ContainerSnapshotDelete(snapshotContainer container) error
        return nil
 }
 
-func (s *storageZfs) ContainerSnapshotRename(snapshotContainer container, 
newName string) error {
+func (s *storageZfs) ContainerSnapshotRename(snapshotContainer Instance, 
newName string) error {
        logger.Debugf("Renaming ZFS storage volume for snapshot \"%s\" from %s 
to %s", s.volume.Name, s.volume.Name, newName)
 
        oldName := snapshotContainer.Name()
@@ -1794,7 +1794,7 @@ func (s *storageZfs) 
ContainerSnapshotRename(snapshotContainer container, newNam
        return nil
 }
 
-func (s *storageZfs) ContainerSnapshotStart(container container) (bool, error) 
{
+func (s *storageZfs) ContainerSnapshotStart(container Instance) (bool, error) {
        logger.Debugf("Initializing ZFS storage volume for snapshot \"%s\" on 
storage pool \"%s\"", s.volume.Name, s.pool.Name)
 
        cName, sName, _ := 
shared.ContainerGetParentAndSnapshotName(container.Name())
@@ -1818,7 +1818,7 @@ func (s *storageZfs) ContainerSnapshotStart(container 
container) (bool, error) {
        return true, nil
 }
 
-func (s *storageZfs) ContainerSnapshotStop(container container) (bool, error) {
+func (s *storageZfs) ContainerSnapshotStop(container Instance) (bool, error) {
        logger.Debugf("Stopping ZFS storage volume for snapshot \"%s\" on 
storage pool \"%s\"", s.volume.Name, s.pool.Name)
 
        cName, sName, _ := 
shared.ContainerGetParentAndSnapshotName(container.Name())
@@ -1833,12 +1833,12 @@ func (s *storageZfs) ContainerSnapshotStop(container 
container) (bool, error) {
        return true, nil
 }
 
-func (s *storageZfs) ContainerSnapshotCreateEmpty(snapshotContainer container) 
error {
+func (s *storageZfs) ContainerSnapshotCreateEmpty(snapshotContainer Instance) 
error {
        /* don't touch the fs yet, as migration will do that for us */
        return nil
 }
 
-func (s *storageZfs) doContainerOnlyBackup(tmpPath string, backup backup, 
source container) error {
+func (s *storageZfs) doContainerOnlyBackup(tmpPath string, backup backup, 
source Instance) error {
        sourceIsSnapshot := source.IsSnapshot()
        poolName := s.getOnDiskPoolName()
 
@@ -1918,7 +1918,7 @@ func (s *storageZfs) doSnapshotBackup(tmpPath string, 
backup backup, source cont
        return zfsSendCmd.Run()
 }
 
-func (s *storageZfs) doContainerBackupCreateOptimized(tmpPath string, backup 
backup, source container) error {
+func (s *storageZfs) doContainerBackupCreateOptimized(tmpPath string, backup 
backup, source Instance) error {
        // Handle snapshots
        snapshots, err := source.Snapshots()
        if err != nil {
@@ -1987,7 +1987,7 @@ func (s *storageZfs) 
doContainerBackupCreateOptimized(tmpPath string, backup bac
        return nil
 }
 
-func (s *storageZfs) doContainerBackupCreateVanilla(tmpPath string, backup 
backup, source container) error {
+func (s *storageZfs) doContainerBackupCreateVanilla(tmpPath string, backup 
backup, source Instance) error {
        // Prepare for rsync
        rsync := func(oldPath string, newPath string, bwlimit string) error {
                output, err := rsyncLocalCopy(oldPath, newPath, bwlimit, true)
@@ -2090,7 +2090,7 @@ func (s *storageZfs) 
doContainerBackupCreateVanilla(tmpPath string, backup backu
        return nil
 }
 
-func (s *storageZfs) ContainerBackupCreate(backup backup, source container) 
error {
+func (s *storageZfs) ContainerBackupCreate(backup backup, source Instance) 
error {
        // Start storage
        ourStart, err := source.StorageStart()
        if err != nil {
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to