lxd/container_post.go
func containerPostCreateContainerMountPoint(d *Daemon, project, containerName string) error {
	c, err := containerLoadByProjectAndName(d.State(), project, containerName)
	if err != nil {
		return errors.Wrap(err, "Failed to load moved container on target node")
	}
	poolName, err := c.StoragePool()
	if err != nil {
		return errors.Wrap(err, "Failed get pool name of moved container on target node")
	}
	snapshotNames, err := d.cluster.ContainerGetSnapshots(project, containerName)
	if err != nil {
		return errors.Wrap(err, "Failed to create container snapshot names")
	}

	containerMntPoint := getContainerMountPoint(c.Project(), poolName, containerName)
	err = createContainerMountpoint(containerMntPoint, c.Path(), c.IsPrivileged())
	if err != nil {
		return errors.Wrap(err, "Failed to create container mount point on target node")
	}

	for _, snapshotName := range snapshotNames {
		mntPoint := getSnapshotMountPoint(project, poolName, snapshotName)
		snapshotsSymlinkTarget := shared.VarPath("storage-pools",
			poolName, "containers-snapshots", containerName)
		snapshotMntPointSymlink := shared.VarPath("snapshots", containerName)
		err := createSnapshotMountpoint(mntPoint, snapshotsSymlinkTarget, snapshotMntPointSymlink)
		if err != nil {
			return errors.Wrap(err, "Failed to create snapshot mount point on target node")
		}
	}

	return nil
}
func containerPostCreateContainerMountPoint(d *Daemon, project, containerName string) error {
	c, err := containerLoadByProjectAndName(d.State(), project, containerName)
	if err != nil {
		return errors.Wrap(err, "Failed to load moved container on target node")
	}
	poolName, err := c.StoragePool()
	if err != nil {
		return errors.Wrap(err, "Failed get pool name of moved container on target node")
	}
	snapshotNames, err := d.cluster.ContainerGetSnapshots(project, containerName)
	if err != nil {
		return errors.Wrap(err, "Failed to create container snapshot names")
	}

	containerMntPoint := getContainerMountPoint(c.Project(), poolName, containerName)
	err = createContainerMountpoint(containerMntPoint, c.Path(), c.IsPrivileged())
	if err != nil {
		return errors.Wrap(err, "Failed to create container mount point on target node")
	}

	for _, snapshotName := range snapshotNames {
		mntPoint := getSnapshotMountPoint(project, poolName, snapshotName)
		snapshotsSymlinkTarget := shared.VarPath("storage-pools",
			poolName, "containers-snapshots", containerName)
		snapshotMntPointSymlink := shared.VarPath("snapshots", containerName)
		err := createSnapshotMountpoint(mntPoint, snapshotsSymlinkTarget, snapshotMntPointSymlink)
		if err != nil {
			return errors.Wrap(err, "Failed to create snapshot mount point on target node")
		}
	}

	return nil
}
func containerPostCreateContainerMountPoint ( d * Daemon , project , containerName string ) error { c , err := containerLoadByProjectAndName ( d . State ( ) , project , containerName ) if err != nil { return errors . Wrap ( err , " " ) } poolName , err := c . StoragePool ( ) if err != nil { return errors . Wrap ( err , " " ) } snapshotNames , err := d . cluster . ContainerGetSnapshots ( project , containerName ) if err != nil { return errors . Wrap ( err , " " ) } containerMntPoint := getContainerMountPoint ( c . Project ( ) , poolName , containerName ) err = createContainerMountpoint ( containerMntPoint , c . Path ( ) , c . IsPrivileged ( ) ) if err != nil { return errors . Wrap ( err , " " ) } for _ , snapshotName := range snapshotNames { mntPoint := getSnapshotMountPoint ( project , poolName , snapshotName ) snapshotsSymlinkTarget := shared . VarPath ( " " , poolName , " " , containerName ) snapshotMntPointSymlink := shared . VarPath ( " " , containerName ) err := createSnapshotMountpoint ( mntPoint , snapshotsSymlinkTarget , snapshotMntPointSymlink ) if err != nil { return errors . Wrap ( err , " " ) } } return nil }
// Used after to create the appropriate mounts point after a container has been
// moved.
Used after to create the appropriate mounts point after a container has been moved .