[lxc-devel] [lxd/master] Bugfixes
stgraber on Github
lxc-bot at linuxcontainers.org
Sat Feb 25 06:51:47 UTC 2017
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 301 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170225/f0a62354/attachment.bin>
-------------- next part --------------
From 243d4e05b3df4127186e871e420f6ad6bdfc880d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Fri, 24 Feb 2017 18:20:11 -0500
Subject: [PATCH 1/5] Improve formatting in events API
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
lxd/events.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lxd/events.go b/lxd/events.go
index 46b7dc6..5778ae9 100644
--- a/lxd/events.go
+++ b/lxd/events.go
@@ -26,7 +26,7 @@ func logContextMap(ctx []interface{}) map[string]string {
if key == "" {
key = entry.(string)
} else {
- ctxMap[key] = fmt.Sprintf("%s", entry)
+ ctxMap[key] = fmt.Sprintf("%v", entry)
key = ""
}
}
From da64dac1ce7bdfe342bdb5c4925e5bfbca980bc3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Sat, 25 Feb 2017 01:04:18 -0500
Subject: [PATCH 2/5] storage: Don't spam the INFO loglevel
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
lxd/storage_btrfs.go | 84 ++++++++++++++++++++++++-------------------------
lxd/storage_dir.go | 46 +++++++++++++--------------
lxd/storage_lvm.go | 88 ++++++++++++++++++++++++++--------------------------
lxd/storage_mock.go | 4 +--
lxd/storage_zfs.go | 76 ++++++++++++++++++++++-----------------------
5 files changed, 149 insertions(+), 149 deletions(-)
diff --git a/lxd/storage_btrfs.go b/lxd/storage_btrfs.go
index 35c93ed..1f8a0d8 100644
--- a/lxd/storage_btrfs.go
+++ b/lxd/storage_btrfs.go
@@ -72,7 +72,7 @@ func (s *storageBtrfs) StorageCoreInit() (*storageCore, error) {
s.storageCore = sCore
- shared.LogInfof("Initializing a BTRFS driver.")
+ shared.LogDebugf("Initializing a BTRFS driver.")
return &sCore, nil
}
@@ -88,7 +88,7 @@ func (s *storageBtrfs) StoragePoolInit(config map[string]interface{}) (storage,
func (s *storageBtrfs) StoragePoolCheck() error {
// FIXEM(brauner): Think of something smart or useful (And then think
// again if it is worth implementing it. :)).
- shared.LogInfof("Checking BTRFS storage pool \"%s\".", s.pool.Name)
+ shared.LogDebugf("Checking BTRFS storage pool \"%s\".", s.pool.Name)
return nil
}
@@ -291,7 +291,7 @@ func (s *storageBtrfs) StoragePoolDelete() error {
}
func (s *storageBtrfs) StoragePoolMount() (bool, error) {
- shared.LogInfof("Mounting BTRFS storage pool \"%s\".", s.pool.Name)
+ shared.LogDebugf("Mounting BTRFS storage pool \"%s\".", s.pool.Name)
source := s.pool.Config["source"]
if source == "" {
@@ -375,12 +375,12 @@ func (s *storageBtrfs) StoragePoolMount() (bool, error) {
return false, err
}
- shared.LogInfof("Mounted BTRFS storage pool \"%s\".", s.pool.Name)
+ shared.LogDebugf("Mounted BTRFS storage pool \"%s\".", s.pool.Name)
return true, nil
}
func (s *storageBtrfs) StoragePoolUmount() (bool, error) {
- shared.LogInfof("Unmounting BTRFS storage pool \"%s\".", s.pool.Name)
+ shared.LogDebugf("Unmounting BTRFS storage pool \"%s\".", s.pool.Name)
poolMntPoint := getStoragePoolMountPoint(s.pool.Name)
@@ -417,7 +417,7 @@ func (s *storageBtrfs) StoragePoolUmount() (bool, error) {
}
}
- shared.LogInfof("Unmounted BTRFS storage pool \"%s\".", s.pool.Name)
+ shared.LogDebugf("Unmounted BTRFS storage pool \"%s\".", s.pool.Name)
return true, nil
}
@@ -498,7 +498,7 @@ func (s *storageBtrfs) StoragePoolVolumeDelete() error {
}
func (s *storageBtrfs) StoragePoolVolumeMount() (bool, error) {
- shared.LogInfof("Mounting BTRFS storage volume \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Mounting BTRFS storage volume \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
// The storage pool must be mounted.
_, err := s.StoragePoolMount()
@@ -506,7 +506,7 @@ func (s *storageBtrfs) StoragePoolVolumeMount() (bool, error) {
return false, err
}
- shared.LogInfof("Mounted BTRFS storage volume \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Mounted BTRFS storage volume \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
return true, nil
}
@@ -533,7 +533,7 @@ func (s *storageBtrfs) ContainerStorageReady(name string) bool {
}
func (s *storageBtrfs) ContainerCreate(container container) error {
- shared.LogInfof("Creating empty BTRFS storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Creating empty BTRFS storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
_, err := s.StoragePoolMount()
if err != nil {
@@ -568,13 +568,13 @@ func (s *storageBtrfs) ContainerCreate(container container) error {
return err
}
- shared.LogInfof("Created empty BTRFS storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Created empty BTRFS storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
return container.TemplateApply("create")
}
// And this function is why I started hating on btrfs...
func (s *storageBtrfs) ContainerCreateFromImage(container container, fingerprint string) error {
- shared.LogInfof("Creating BTRFS storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Creating BTRFS storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
source := s.pool.Config["source"]
if source == "" {
@@ -655,7 +655,7 @@ func (s *storageBtrfs) ContainerCreateFromImage(container container, fingerprint
}
}
- shared.LogInfof("Created BTRFS storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Created BTRFS storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
return container.TemplateApply("create")
}
@@ -664,7 +664,7 @@ func (s *storageBtrfs) ContainerCanRestore(container container, sourceContainer
}
func (s *storageBtrfs) ContainerDelete(container container) error {
- shared.LogInfof("Deleting BTRFS storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Deleting BTRFS storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
// The storage pool needs to be mounted.
_, err := s.StoragePoolMount()
@@ -704,12 +704,12 @@ func (s *storageBtrfs) ContainerDelete(container container) error {
}
}
- shared.LogInfof("Deleted BTRFS storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Deleted BTRFS storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
return nil
}
func (s *storageBtrfs) ContainerCopy(container container, sourceContainer container) error {
- shared.LogInfof("Copying BTRFS container storage %s -> %s.", sourceContainer.Name(), container.Name())
+ shared.LogDebugf("Copying BTRFS container storage %s -> %s.", sourceContainer.Name(), container.Name())
// The storage pool needs to be mounted.
_, err := s.StoragePoolMount()
@@ -792,12 +792,12 @@ func (s *storageBtrfs) ContainerCopy(container container, sourceContainer contai
return err
}
- shared.LogInfof("Copied BTRFS container storage %s -> %s.", sourceContainer.Name(), container.Name())
+ shared.LogDebugf("Copied BTRFS container storage %s -> %s.", sourceContainer.Name(), container.Name())
return container.TemplateApply("copy")
}
func (s *storageBtrfs) ContainerMount(name string, path string) (bool, error) {
- shared.LogInfof("Mounting BTRFS storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Mounting BTRFS storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
// The storage pool must be mounted.
_, err := s.StoragePoolMount()
@@ -805,7 +805,7 @@ func (s *storageBtrfs) ContainerMount(name string, path string) (bool, error) {
return false, err
}
- shared.LogInfof("Mounted BTRFS storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Mounted BTRFS storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
return true, nil
}
@@ -814,7 +814,7 @@ func (s *storageBtrfs) ContainerUmount(name string, path string) (bool, error) {
}
func (s *storageBtrfs) ContainerRename(container container, newName string) error {
- shared.LogInfof("Renaming BTRFS storage volume for container \"%s\" from %s -> %s.", s.volume.Name, s.volume.Name, newName)
+ shared.LogDebugf("Renaming BTRFS storage volume for container \"%s\" from %s -> %s.", s.volume.Name, s.volume.Name, newName)
// The storage pool must be mounted.
_, err := s.StoragePoolMount()
@@ -858,12 +858,12 @@ func (s *storageBtrfs) ContainerRename(container container, newName string) erro
}
}
- shared.LogInfof("Renamed BTRFS storage volume for container \"%s\" from %s -> %s.", s.volume.Name, s.volume.Name, newName)
+ shared.LogDebugf("Renamed BTRFS storage volume for container \"%s\" from %s -> %s.", s.volume.Name, s.volume.Name, newName)
return nil
}
func (s *storageBtrfs) ContainerRestore(container container, sourceContainer container) error {
- shared.LogInfof("Restoring BTRFS storage volume for container \"%s\" from %s -> %s.", s.volume.Name, sourceContainer.Name(), container.Name())
+ shared.LogDebugf("Restoring BTRFS storage volume for container \"%s\" from %s -> %s.", s.volume.Name, sourceContainer.Name(), container.Name())
// The storage pool must be mounted.
_, err := s.StoragePoolMount()
@@ -940,12 +940,12 @@ func (s *storageBtrfs) ContainerRestore(container container, sourceContainer con
os.RemoveAll(backupTargetContainerSubvolumeName)
}
- shared.LogInfof("Restored BTRFS storage volume for container \"%s\" from %s -> %s.", s.volume.Name, sourceContainer.Name(), container.Name())
+ shared.LogDebugf("Restored BTRFS storage volume for container \"%s\" from %s -> %s.", s.volume.Name, sourceContainer.Name(), container.Name())
return failure
}
func (s *storageBtrfs) ContainerSetQuota(container container, size int64) error {
- shared.LogInfof("Setting BTRFS quota for container \"%s\".", container.Name())
+ shared.LogDebugf("Setting BTRFS quota for container \"%s\".", container.Name())
subvol := container.Path()
@@ -965,7 +965,7 @@ func (s *storageBtrfs) ContainerSetQuota(container container, size int64) error
return fmt.Errorf("Failed to set btrfs quota: %s", output)
}
- shared.LogInfof("Set BTRFS quota for container \"%s\".", container.Name())
+ shared.LogDebugf("Set BTRFS quota for container \"%s\".", container.Name())
return nil
}
@@ -974,7 +974,7 @@ func (s *storageBtrfs) ContainerGetUsage(container container) (int64, error) {
}
func (s *storageBtrfs) ContainerSnapshotCreate(snapshotContainer container, sourceContainer container) error {
- shared.LogInfof("Creating BTRFS storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Creating BTRFS storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
_, err := s.StoragePoolMount()
if err != nil {
@@ -1011,12 +1011,12 @@ func (s *storageBtrfs) ContainerSnapshotCreate(snapshotContainer container, sour
return err
}
- shared.LogInfof("Created BTRFS storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Created BTRFS storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
return nil
}
func (s *storageBtrfs) ContainerSnapshotDelete(snapshotContainer container) error {
- shared.LogInfof("Deleting BTRFS storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Deleting BTRFS storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
_, err := s.StoragePoolMount()
if err != nil {
@@ -1042,12 +1042,12 @@ func (s *storageBtrfs) ContainerSnapshotDelete(snapshotContainer container) erro
os.Remove(snapshotMntPointSymlink)
}
- shared.LogInfof("Deleted BTRFS storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Deleted BTRFS storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
return nil
}
func (s *storageBtrfs) ContainerSnapshotStart(container container) error {
- shared.LogInfof("Initializing BTRFS storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Initializing BTRFS storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
_, err := s.StoragePoolMount()
if err != nil {
@@ -1070,12 +1070,12 @@ func (s *storageBtrfs) ContainerSnapshotStart(container container) error {
return err
}
- shared.LogInfof("Initialized BTRFS storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Initialized BTRFS storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
return nil
}
func (s *storageBtrfs) ContainerSnapshotStop(container container) error {
- shared.LogInfof("Stopping BTRFS storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Stopping BTRFS storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
_, err := s.StoragePoolMount()
if err != nil {
@@ -1098,13 +1098,13 @@ func (s *storageBtrfs) ContainerSnapshotStop(container container) error {
return err
}
- shared.LogInfof("Stopped BTRFS storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Stopped BTRFS storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
return nil
}
// ContainerSnapshotRename renames a snapshot of a container.
func (s *storageBtrfs) ContainerSnapshotRename(snapshotContainer container, newName string) error {
- shared.LogInfof("Renaming BTRFS storage volume for snapshot \"%s\" from %s -> %s.", s.volume.Name, s.volume.Name, newName)
+ shared.LogDebugf("Renaming BTRFS storage volume for snapshot \"%s\" from %s -> %s.", s.volume.Name, s.volume.Name, newName)
// The storage pool must be mounted.
_, err := s.StoragePoolMount()
@@ -1121,14 +1121,14 @@ func (s *storageBtrfs) ContainerSnapshotRename(snapshotContainer container, newN
return err
}
- shared.LogInfof("Renamed BTRFS storage volume for snapshot \"%s\" from %s -> %s.", s.volume.Name, s.volume.Name, newName)
+ shared.LogDebugf("Renamed BTRFS storage volume for snapshot \"%s\" from %s -> %s.", s.volume.Name, s.volume.Name, newName)
return nil
}
// Needed for live migration where an empty snapshot needs to be created before
// rsyncing into it.
func (s *storageBtrfs) ContainerSnapshotCreateEmpty(snapshotContainer container) error {
- shared.LogInfof("Creating empty BTRFS storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Creating empty BTRFS storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
// Mount the storage pool.
_, err := s.StoragePoolMount()
@@ -1162,12 +1162,12 @@ func (s *storageBtrfs) ContainerSnapshotCreateEmpty(snapshotContainer container)
}
}
- shared.LogInfof("Created empty BTRFS storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Created empty BTRFS storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
return nil
}
func (s *storageBtrfs) ImageCreate(fingerprint string) error {
- shared.LogInfof("Creating BTRFS storage volume for image \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Creating BTRFS storage volume for image \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
// Create the subvolume.
source := s.pool.Config["source"]
@@ -1244,12 +1244,12 @@ func (s *storageBtrfs) ImageCreate(fingerprint string) error {
undo = false
- shared.LogInfof("Created BTRFS storage volume for image \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Created BTRFS storage volume for image \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
return nil
}
func (s *storageBtrfs) ImageDelete(fingerprint string) error {
- shared.LogInfof("Deleting BTRFS storage volume for image \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Deleting BTRFS storage volume for image \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
_, err := s.StoragePoolMount()
if err != nil {
@@ -1278,12 +1278,12 @@ func (s *storageBtrfs) ImageDelete(fingerprint string) error {
}
}
- shared.LogInfof("Deleted BTRFS storage volume for image \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Deleted BTRFS storage volume for image \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
return nil
}
func (s *storageBtrfs) ImageMount(fingerprint string) (bool, error) {
- shared.LogInfof("Mounting BTRFS storage volume for image \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Mounting BTRFS storage volume for image \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
// The storage pool must be mounted.
_, err := s.StoragePoolMount()
@@ -1291,7 +1291,7 @@ func (s *storageBtrfs) ImageMount(fingerprint string) (bool, error) {
return false, err
}
- shared.LogInfof("Mounted BTRFS storage volume for image \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Mounted BTRFS storage volume for image \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
return true, nil
}
diff --git a/lxd/storage_dir.go b/lxd/storage_dir.go
index a6fec42..9703b82 100644
--- a/lxd/storage_dir.go
+++ b/lxd/storage_dir.go
@@ -30,7 +30,7 @@ func (s *storageDir) StorageCoreInit() (*storageCore, error) {
s.storageCore = sCore
- shared.LogInfof("Initializing a DIR driver.")
+ shared.LogDebugf("Initializing a DIR driver.")
return &sCore, nil
}
@@ -46,7 +46,7 @@ func (s *storageDir) StoragePoolInit(config map[string]interface{}) (storage, er
// Initialize a full storage interface.
func (s *storageDir) StoragePoolCheck() error {
- shared.LogInfof("Checking DIR storage pool \"%s\".", s.pool.Name)
+ shared.LogDebugf("Checking DIR storage pool \"%s\".", s.pool.Name)
return nil
}
@@ -215,7 +215,7 @@ func (s *storageDir) ContainerStorageReady(name string) bool {
}
func (s *storageDir) ContainerCreate(container container) error {
- shared.LogInfof("Creating empty DIR storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Creating empty DIR storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
source := s.pool.Config["source"]
if source == "" {
@@ -242,12 +242,12 @@ func (s *storageDir) ContainerCreate(container container) error {
revert = false
- shared.LogInfof("Created empty DIR storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Created empty DIR storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
return nil
}
func (s *storageDir) ContainerCreateFromImage(container container, imageFingerprint string) error {
- shared.LogInfof("Creating DIR storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Creating DIR storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
source := s.pool.Config["source"]
if source == "" {
@@ -289,7 +289,7 @@ func (s *storageDir) ContainerCreateFromImage(container container, imageFingerpr
revert = false
- shared.LogInfof("Created DIR storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Created DIR storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
return nil
}
@@ -298,7 +298,7 @@ func (s *storageDir) ContainerCanRestore(container container, sourceContainer co
}
func (s *storageDir) ContainerDelete(container container) error {
- shared.LogInfof("Deleting DIR storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Deleting DIR storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
source := s.pool.Config["source"]
if source == "" {
@@ -344,12 +344,12 @@ func (s *storageDir) ContainerDelete(container container) error {
}
}
- shared.LogInfof("Deleted DIR storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Deleted DIR storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
return nil
}
func (s *storageDir) ContainerCopy(container container, sourceContainer container) error {
- shared.LogInfof("Copying DIR container storage %s -> %s.", sourceContainer.Name(), container.Name())
+ shared.LogDebugf("Copying DIR container storage %s -> %s.", sourceContainer.Name(), container.Name())
err := sourceContainer.StorageStart()
if err != nil {
@@ -409,7 +409,7 @@ func (s *storageDir) ContainerCopy(container container, sourceContainer containe
revert = false
- shared.LogInfof("Copied DIR container storage %s -> %s.", sourceContainer.Name(), container.Name())
+ shared.LogDebugf("Copied DIR container storage %s -> %s.", sourceContainer.Name(), container.Name())
return nil
}
@@ -422,7 +422,7 @@ func (s *storageDir) ContainerUmount(name string, path string) (bool, error) {
}
func (s *storageDir) ContainerRename(container container, newName string) error {
- shared.LogInfof("Renaming DIR storage volume for container \"%s\" from %s -> %s.", s.volume.Name, s.volume.Name, newName)
+ shared.LogDebugf("Renaming DIR storage volume for container \"%s\" from %s -> %s.", s.volume.Name, s.volume.Name, newName)
source := s.pool.Config["source"]
if source == "" {
@@ -467,12 +467,12 @@ func (s *storageDir) ContainerRename(container container, newName string) error
}
}
- shared.LogInfof("Renamed DIR storage volume for container \"%s\" from %s -> %s.", s.volume.Name, s.volume.Name, newName)
+ shared.LogDebugf("Renamed DIR storage volume for container \"%s\" from %s -> %s.", s.volume.Name, s.volume.Name, newName)
return nil
}
func (s *storageDir) ContainerRestore(container container, sourceContainer container) error {
- shared.LogInfof("Restoring DIR storage volume for container \"%s\" from %s -> %s.", s.volume.Name, sourceContainer.Name(), container.Name())
+ shared.LogDebugf("Restoring DIR storage volume for container \"%s\" from %s -> %s.", s.volume.Name, sourceContainer.Name(), container.Name())
targetPath := container.Path()
sourcePath := sourceContainer.Path()
@@ -488,7 +488,7 @@ func (s *storageDir) ContainerRestore(container container, sourceContainer conta
return err
}
- shared.LogInfof("Restored DIR storage volume for container \"%s\" from %s -> %s.", s.volume.Name, sourceContainer.Name(), container.Name())
+ shared.LogDebugf("Restored DIR storage volume for container \"%s\" from %s -> %s.", s.volume.Name, sourceContainer.Name(), container.Name())
return nil
}
@@ -501,7 +501,7 @@ func (s *storageDir) ContainerGetUsage(container container) (int64, error) {
}
func (s *storageDir) ContainerSnapshotCreate(snapshotContainer container, sourceContainer container) error {
- shared.LogInfof("Creating DIR storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Creating DIR storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
// Create the path for the snapshot.
targetContainerName := snapshotContainer.Name()
@@ -540,7 +540,7 @@ func (s *storageDir) ContainerSnapshotCreate(snapshotContainer container, source
err := sourceContainer.Freeze()
if err != nil {
- shared.LogWarnf("Trying to freeze and rsync again failed.")
+ shared.LogErrorf("Trying to freeze and rsync again failed.")
return nil
}
@@ -564,12 +564,12 @@ func (s *storageDir) ContainerSnapshotCreate(snapshotContainer container, source
}
}
- shared.LogInfof("Created DIR storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Created DIR storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
return nil
}
func (s *storageDir) ContainerSnapshotCreateEmpty(snapshotContainer container) error {
- shared.LogInfof("Creating empty DIR storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Creating empty DIR storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
// Create the path for the snapshot.
targetContainerName := snapshotContainer.Name()
@@ -602,12 +602,12 @@ func (s *storageDir) ContainerSnapshotCreateEmpty(snapshotContainer container) e
revert = false
- shared.LogInfof("Created empty DIR storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Created empty DIR storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
return nil
}
func (s *storageDir) ContainerSnapshotDelete(snapshotContainer container) error {
- shared.LogInfof("Deleting DIR storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Deleting DIR storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
source := s.pool.Config["source"]
if source == "" {
@@ -649,12 +649,12 @@ func (s *storageDir) ContainerSnapshotDelete(snapshotContainer container) error
}
}
- shared.LogInfof("Deleted DIR storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Deleted DIR storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
return nil
}
func (s *storageDir) ContainerSnapshotRename(snapshotContainer container, newName string) error {
- shared.LogInfof("Renaming DIR storage volume for snapshot \"%s\" from %s -> %s.", s.volume.Name, s.volume.Name, newName)
+ shared.LogDebugf("Renaming DIR storage volume for snapshot \"%s\" from %s -> %s.", s.volume.Name, s.volume.Name, newName)
// Rename the mountpoint for the snapshot:
// ${POOL}/snapshots/<old_snapshot_name> to ${POOL}/snapshots/<new_snapshot_name>
@@ -665,7 +665,7 @@ func (s *storageDir) ContainerSnapshotRename(snapshotContainer container, newNam
return err
}
- shared.LogInfof("Renamed DIR storage volume for snapshot \"%s\" from %s -> %s.", s.volume.Name, s.volume.Name, newName)
+ shared.LogDebugf("Renamed DIR storage volume for snapshot \"%s\" from %s -> %s.", s.volume.Name, s.volume.Name, newName)
return nil
}
diff --git a/lxd/storage_lvm.go b/lxd/storage_lvm.go
index d54a39b..78f43c8 100644
--- a/lxd/storage_lvm.go
+++ b/lxd/storage_lvm.go
@@ -261,7 +261,7 @@ func (s *storageLvm) StorageCoreInit() (*storageCore, error) {
s.storageCore = sCore
- shared.LogInfof("Initializing an LVM driver.")
+ shared.LogDebugf("Initializing an LVM driver.")
return &sCore, nil
}
@@ -301,7 +301,7 @@ func (s *storageLvm) StoragePoolInit(config map[string]interface{}) (storage, er
}
func (s *storageLvm) StoragePoolCheck() error {
- shared.LogInfof("Checking LVM storage pool \"%s\".", s.pool.Name)
+ shared.LogDebugf("Checking LVM storage pool \"%s\".", s.pool.Name)
return nil
}
@@ -544,7 +544,7 @@ func (s *storageLvm) StoragePoolVolumeDelete() error {
}
func (s *storageLvm) StoragePoolVolumeMount() (bool, error) {
- shared.LogInfof("Mounting LVM storage volume \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Mounting LVM storage volume \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
customPoolVolumeMntPoint := getStoragePoolVolumeMountPoint(s.pool.Name, s.volume.Name)
poolName := s.getOnDiskPoolName()
@@ -589,12 +589,12 @@ func (s *storageLvm) StoragePoolVolumeMount() (bool, error) {
return false, customerr
}
- shared.LogInfof("Mounted LVM storage volume \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Mounted LVM storage volume \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
return ourMount, nil
}
func (s *storageLvm) StoragePoolVolumeUmount() (bool, error) {
- shared.LogInfof("Unmounting LVM storage volume \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Unmounting LVM storage volume \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
customPoolVolumeMntPoint := getStoragePoolVolumeMountPoint(s.pool.Name, s.volume.Name)
@@ -631,7 +631,7 @@ func (s *storageLvm) StoragePoolVolumeUmount() (bool, error) {
return false, customerr
}
- shared.LogInfof("Unmounted LVM storage volume \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Unmounted LVM storage volume \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
return ourUmount, nil
}
@@ -728,7 +728,7 @@ func (s *storageLvm) ContainerStorageReady(name string) bool {
}
func (s *storageLvm) ContainerCreate(container container) error {
- shared.LogInfof("Creating empty LVM storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Creating empty LVM storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
tryUndo := true
@@ -781,12 +781,12 @@ func (s *storageLvm) ContainerCreate(container container) error {
tryUndo = false
- shared.LogInfof("Created empty LVM storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Created empty LVM storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
return nil
}
func (s *storageLvm) ContainerCreateFromImage(container container, fingerprint string) error {
- shared.LogInfof("Creating LVM storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Creating LVM storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
tryUndo := true
@@ -888,7 +888,7 @@ func (s *storageLvm) ContainerCreateFromImage(container container, fingerprint s
tryUndo = false
- shared.LogInfof("Created LVM storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Created LVM storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
return nil
}
@@ -897,7 +897,7 @@ func (s *storageLvm) ContainerCanRestore(container container, sourceContainer co
}
func (s *storageLvm) ContainerDelete(container container) error {
- shared.LogInfof("Deleting LVM storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Deleting LVM storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
containerName := container.Name()
containerLvmName := containerNameToLVName(containerName)
@@ -940,12 +940,12 @@ func (s *storageLvm) ContainerDelete(container container) error {
}
}
- shared.LogInfof("Deleted LVM storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Deleted LVM storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
return nil
}
func (s *storageLvm) ContainerCopy(container container, sourceContainer container) error {
- shared.LogInfof("Copying LVM container storage %s -> %s.", sourceContainer.Name(), container.Name())
+ shared.LogDebugf("Copying LVM container storage %s -> %s.", sourceContainer.Name(), container.Name())
tryUndo := true
@@ -964,7 +964,7 @@ func (s *storageLvm) ContainerCopy(container container, sourceContainer containe
} else {
sourceContainerName := sourceContainer.Name()
targetContainerName := container.Name()
- shared.LogInfof("Copy from Non-LVM container: %s -> %s.", sourceContainerName, targetContainerName)
+ shared.LogDebugf("Copy from Non-LVM container: %s -> %s.", sourceContainerName, targetContainerName)
err := s.ContainerCreate(container)
if err != nil {
shared.LogErrorf("Error creating empty container: %s.", err)
@@ -1013,12 +1013,12 @@ func (s *storageLvm) ContainerCopy(container container, sourceContainer containe
tryUndo = false
- shared.LogInfof("Copied LVM container storage %s -> %s.", sourceContainer.Name(), container.Name())
+ shared.LogDebugf("Copied LVM container storage %s -> %s.", sourceContainer.Name(), container.Name())
return nil
}
func (s *storageLvm) ContainerMount(name string, path string) (bool, error) {
- shared.LogInfof("Mounting LVM storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Mounting LVM storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
containerLvmName := containerNameToLVName(name)
lvFsType := s.getLvmFilesystem()
@@ -1060,12 +1060,12 @@ func (s *storageLvm) ContainerMount(name string, path string) (bool, error) {
return false, imgerr
}
- shared.LogInfof("Mounted LVM storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Mounted LVM storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
return ourMount, nil
}
func (s *storageLvm) ContainerUmount(name string, path string) (bool, error) {
- shared.LogInfof("Unmounting LVM storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Unmounting LVM storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
containerMntPoint := getContainerMountPoint(s.pool.Name, name)
@@ -1102,12 +1102,12 @@ func (s *storageLvm) ContainerUmount(name string, path string) (bool, error) {
return false, imgerr
}
- shared.LogInfof("Unmounted LVM storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Unmounted LVM storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
return ourUmount, nil
}
func (s *storageLvm) ContainerRename(container container, newContainerName string) error {
- shared.LogInfof("Renaming LVM storage volume for container \"%s\" from %s -> %s.", s.volume.Name, s.volume.Name, newContainerName)
+ shared.LogDebugf("Renaming LVM storage volume for container \"%s\" from %s -> %s.", s.volume.Name, s.volume.Name, newContainerName)
tryUndo := true
@@ -1184,12 +1184,12 @@ func (s *storageLvm) ContainerRename(container container, newContainerName strin
tryUndo = false
- shared.LogInfof("Renamed LVM storage volume for container \"%s\" from %s -> %s.", s.volume.Name, s.volume.Name, newContainerName)
+ shared.LogDebugf("Renamed LVM storage volume for container \"%s\" from %s -> %s.", s.volume.Name, s.volume.Name, newContainerName)
return nil
}
func (s *storageLvm) ContainerRestore(container container, sourceContainer container) error {
- shared.LogInfof("Restoring LVM storage volume for container \"%s\" from %s -> %s.", s.volume.Name, sourceContainer.Name(), container.Name())
+ shared.LogDebugf("Restoring LVM storage volume for container \"%s\" from %s -> %s.", s.volume.Name, sourceContainer.Name(), container.Name())
err := sourceContainer.StorageStart()
if err != nil {
@@ -1226,7 +1226,7 @@ func (s *storageLvm) ContainerRestore(container container, sourceContainer conta
return fmt.Errorf("Error creating snapshot LV: %v", err)
}
- shared.LogInfof("Restored LVM storage volume for container \"%s\" from %s -> %s.", s.volume.Name, sourceContainer.Name(), container.Name())
+ shared.LogDebugf("Restored LVM storage volume for container \"%s\" from %s -> %s.", s.volume.Name, sourceContainer.Name(), container.Name())
return nil
}
@@ -1239,14 +1239,14 @@ func (s *storageLvm) ContainerGetUsage(container container) (int64, error) {
}
func (s *storageLvm) ContainerSnapshotCreate(snapshotContainer container, sourceContainer container) error {
- shared.LogInfof("Creating LVM storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Creating LVM storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
err := s.createSnapshotContainer(snapshotContainer, sourceContainer, true)
if err != nil {
return err
}
- shared.LogInfof("Created LVM storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Created LVM storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
return nil
}
@@ -1295,19 +1295,19 @@ func (s *storageLvm) createSnapshotContainer(snapshotContainer container, source
}
func (s *storageLvm) ContainerSnapshotDelete(snapshotContainer container) error {
- shared.LogInfof("Deleting LVM storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Deleting LVM storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
err := s.ContainerDelete(snapshotContainer)
if err != nil {
return fmt.Errorf("Error deleting snapshot %s: %s", snapshotContainer.Name(), err)
}
- shared.LogInfof("Deleted LVM storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Deleted LVM storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
return nil
}
func (s *storageLvm) ContainerSnapshotRename(snapshotContainer container, newContainerName string) error {
- shared.LogInfof("Renaming LVM storage volume for snapshot \"%s\" from %s -> %s.", s.volume.Name, s.volume.Name, newContainerName)
+ shared.LogDebugf("Renaming LVM storage volume for snapshot \"%s\" from %s -> %s.", s.volume.Name, s.volume.Name, newContainerName)
tryUndo := true
@@ -1335,12 +1335,12 @@ func (s *storageLvm) ContainerSnapshotRename(snapshotContainer container, newCon
tryUndo = false
- shared.LogInfof("Renamed LVM storage volume for snapshot \"%s\" from %s -> %s.", s.volume.Name, s.volume.Name, newContainerName)
+ shared.LogDebugf("Renamed LVM storage volume for snapshot \"%s\" from %s -> %s.", s.volume.Name, s.volume.Name, newContainerName)
return nil
}
func (s *storageLvm) ContainerSnapshotStart(container container) error {
- shared.LogInfof("Initializing LVM storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Initializing LVM storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
tryUndo := true
@@ -1386,12 +1386,12 @@ func (s *storageLvm) ContainerSnapshotStart(container container) error {
tryUndo = false
- shared.LogInfof("Initialized LVM storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Initialized LVM storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
return nil
}
func (s *storageLvm) ContainerSnapshotStop(container container) error {
- shared.LogInfof("Stopping LVM storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Stopping LVM storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
name := container.Name()
snapshotMntPoint := getSnapshotMountPoint(s.pool.Name, name)
@@ -1411,24 +1411,24 @@ func (s *storageLvm) ContainerSnapshotStop(container container) error {
return err
}
- shared.LogInfof("Stopped LVM storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Stopped LVM storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
return nil
}
func (s *storageLvm) ContainerSnapshotCreateEmpty(snapshotContainer container) error {
- shared.LogInfof("Creating empty LVM storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Creating empty LVM storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
err := s.ContainerCreate(snapshotContainer)
if err != nil {
return err
}
- shared.LogInfof("Created empty LVM storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Created empty LVM storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
return nil
}
func (s *storageLvm) ImageCreate(fingerprint string) error {
- shared.LogInfof("Creating LVM storage volume for image \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Creating LVM storage volume for image \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
tryUndo := true
@@ -1480,12 +1480,12 @@ func (s *storageLvm) ImageCreate(fingerprint string) error {
tryUndo = false
- shared.LogInfof("Created LVM storage volume for image \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Created LVM storage volume for image \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
return nil
}
func (s *storageLvm) ImageDelete(fingerprint string) error {
- shared.LogInfof("Deleting LVM storage volume for image \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Deleting LVM storage volume for image \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
_, err := s.ImageUmount(fingerprint)
if err != nil {
@@ -1511,12 +1511,12 @@ func (s *storageLvm) ImageDelete(fingerprint string) error {
}
}
- shared.LogInfof("Deleted LVM storage volume for image \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Deleted LVM storage volume for image \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
return nil
}
func (s *storageLvm) ImageMount(fingerprint string) (bool, error) {
- shared.LogInfof("Mounting LVM storage volume for image \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Mounting LVM storage volume for image \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
imageMntPoint := getImageMountPoint(s.pool.Name, fingerprint)
if shared.IsMountPoint(imageMntPoint) {
@@ -1535,16 +1535,16 @@ func (s *storageLvm) ImageMount(fingerprint string) (bool, error) {
err := tryMount(lvmVolumePath, imageMntPoint, lvmFstype, 0, lvmMountOptions)
if err != nil {
- shared.LogInfof(fmt.Sprintf("Error mounting image LV for unpacking: %s", err))
+ shared.LogErrorf(fmt.Sprintf("Error mounting image LV for unpacking: %s", err))
return false, fmt.Errorf("Error mounting image LV: %v", err)
}
- shared.LogInfof("Mounted LVM storage volume for image \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Mounted LVM storage volume for image \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
return true, nil
}
func (s *storageLvm) ImageUmount(fingerprint string) (bool, error) {
- shared.LogInfof("Unmounting LVM storage volume for image \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Unmounting LVM storage volume for image \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
imageMntPoint := getImageMountPoint(s.pool.Name, fingerprint)
if !shared.IsMountPoint(imageMntPoint) {
@@ -1556,7 +1556,7 @@ func (s *storageLvm) ImageUmount(fingerprint string) (bool, error) {
return false, err
}
- shared.LogInfof("Unmounted LVM storage volume for image \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Unmounted LVM storage volume for image \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
return true, nil
}
diff --git a/lxd/storage_mock.go b/lxd/storage_mock.go
index de637a7..d46ab9f 100644
--- a/lxd/storage_mock.go
+++ b/lxd/storage_mock.go
@@ -24,7 +24,7 @@ func (s *storageMock) StorageCoreInit() (*storageCore, error) {
s.storageCore = sCore
- shared.LogInfof("Initializing a MOCK driver.")
+ shared.LogDebugf("Initializing a MOCK driver.")
return &sCore, nil
}
@@ -38,7 +38,7 @@ func (s *storageMock) StoragePoolInit(config map[string]interface{}) (storage, e
}
func (s *storageMock) StoragePoolCheck() error {
- shared.LogInfof("Checking MOCK storage pool \"%s\".", s.pool.Name)
+ shared.LogDebugf("Checking MOCK storage pool \"%s\".", s.pool.Name)
return nil
}
diff --git a/lxd/storage_zfs.go b/lxd/storage_zfs.go
index c51f711..3fa9ed8 100644
--- a/lxd/storage_zfs.go
+++ b/lxd/storage_zfs.go
@@ -75,7 +75,7 @@ func (s *storageZfs) StorageCoreInit() (*storageCore, error) {
s.storageCore = sCore
- shared.LogInfof("Initializing a ZFS driver.")
+ shared.LogDebugf("Initializing a ZFS driver.")
return &sCore, nil
}
@@ -98,7 +98,7 @@ func (s *storageZfs) StoragePoolCheck() error {
// Make noop for now until we figure out something useful to do for all
// supported use cases.
- shared.LogInfof("Checking ZFS storage pool \"%s\".", s.pool.Name)
+ shared.LogDebugf("Checking ZFS storage pool \"%s\".", s.pool.Name)
return nil
}
@@ -213,7 +213,7 @@ func (s *storageZfs) StoragePoolVolumeDelete() error {
}
func (s *storageZfs) StoragePoolVolumeMount() (bool, error) {
- shared.LogInfof("Mounting ZFS storage volume \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Mounting ZFS storage volume \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
fs := fmt.Sprintf("custom/%s", s.volume.Name)
customPoolVolumeMntPoint := getStoragePoolVolumeMountPoint(s.pool.Name, s.volume.Name)
@@ -251,12 +251,12 @@ func (s *storageZfs) StoragePoolVolumeMount() (bool, error) {
return false, customerr
}
- shared.LogInfof("Mounted ZFS storage volume \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Mounted ZFS storage volume \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
return ourMount, nil
}
func (s *storageZfs) StoragePoolVolumeUmount() (bool, error) {
- shared.LogInfof("Unmounting ZFS storage volume \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Unmounting ZFS storage volume \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
fs := fmt.Sprintf("custom/%s", s.volume.Name)
customPoolVolumeMntPoint := getStoragePoolVolumeMountPoint(s.pool.Name, s.volume.Name)
@@ -294,7 +294,7 @@ func (s *storageZfs) StoragePoolVolumeUmount() (bool, error) {
return false, customerr
}
- shared.LogInfof("Unmounted ZFS storage volume \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Unmounted ZFS storage volume \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
return ourUmount, nil
}
@@ -382,7 +382,7 @@ func (s *storageZfs) StoragePoolVolumeUpdate(changedConfig []string) error {
// Things we don't need to care about
func (s *storageZfs) ContainerMount(name string, path string) (bool, error) {
- shared.LogInfof("Mounting ZFS storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Mounting ZFS storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
fs := fmt.Sprintf("containers/%s", name)
containerPoolVolumeMntPoint := getContainerMountPoint(s.pool.Name, name)
@@ -420,12 +420,12 @@ func (s *storageZfs) ContainerMount(name string, path string) (bool, error) {
return false, imgerr
}
- shared.LogInfof("Mounted ZFS storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Mounted ZFS storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
return ourMount, nil
}
func (s *storageZfs) ContainerUmount(name string, path string) (bool, error) {
- shared.LogInfof("Unmounting ZFS storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Unmounting ZFS storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
fs := fmt.Sprintf("containers/%s", name)
containerPoolVolumeMntPoint := getContainerMountPoint(s.pool.Name, name)
@@ -463,7 +463,7 @@ func (s *storageZfs) ContainerUmount(name string, path string) (bool, error) {
return false, imgerr
}
- shared.LogInfof("Unmounted ZFS storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Unmounted ZFS storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
return ourUmount, nil
}
@@ -475,7 +475,7 @@ func (s *storageZfs) ContainerStorageReady(name string) bool {
}
func (s *storageZfs) ContainerCreate(container container) error {
- shared.LogInfof("Creating empty ZFS storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Creating empty ZFS storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
containerPath := container.Path()
containerName := container.Name()
@@ -513,12 +513,12 @@ func (s *storageZfs) ContainerCreate(container container) error {
revert = false
- shared.LogInfof("Created empty ZFS storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Created empty ZFS storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
return nil
}
func (s *storageZfs) ContainerCreateFromImage(container container, fingerprint string) error {
- shared.LogInfof("Creating ZFS storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Creating ZFS storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
containerPath := container.Path()
containerName := container.Name()
@@ -587,7 +587,7 @@ func (s *storageZfs) ContainerCreateFromImage(container container, fingerprint s
revert = false
- shared.LogInfof("Created ZFS storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Created ZFS storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
return nil
}
@@ -615,7 +615,7 @@ func (s *storageZfs) ContainerCanRestore(container container, sourceContainer co
}
func (s *storageZfs) ContainerDelete(container container) error {
- shared.LogInfof("Deleting ZFS storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Deleting ZFS storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
containerName := container.Name()
fs := fmt.Sprintf("containers/%s", containerName)
@@ -697,12 +697,12 @@ func (s *storageZfs) ContainerDelete(container container) error {
}
}
- shared.LogInfof("Deleted ZFS storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Deleted ZFS storage volume for container \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
return nil
}
func (s *storageZfs) ContainerCopy(container container, sourceContainer container) error {
- shared.LogInfof("Copying ZFS container storage %s -> %s.", sourceContainer.Name(), container.Name())
+ shared.LogDebugf("Copying ZFS container storage %s -> %s.", sourceContainer.Name(), container.Name())
sourceContainerName := sourceContainer.Name()
sourceContainerPath := sourceContainer.Path()
@@ -800,12 +800,12 @@ func (s *storageZfs) ContainerCopy(container container, sourceContainer containe
revert = false
- shared.LogInfof("Copied ZFS container storage %s -> %s.", sourceContainer.Name(), container.Name())
+ shared.LogDebugf("Copied ZFS container storage %s -> %s.", sourceContainer.Name(), container.Name())
return nil
}
func (s *storageZfs) ContainerRename(container container, newName string) error {
- shared.LogInfof("Renaming ZFS storage volume for container \"%s\" from %s -> %s.", s.volume.Name, s.volume.Name, newName)
+ shared.LogDebugf("Renaming ZFS storage volume for container \"%s\" from %s -> %s.", s.volume.Name, s.volume.Name, newName)
oldName := container.Name()
@@ -882,12 +882,12 @@ func (s *storageZfs) ContainerRename(container container, newName string) error
revert = false
- shared.LogInfof("Renamed ZFS storage volume for container \"%s\" from %s -> %s.", s.volume.Name, s.volume.Name, newName)
+ shared.LogDebugf("Renamed ZFS storage volume for container \"%s\" from %s -> %s.", s.volume.Name, s.volume.Name, newName)
return nil
}
func (s *storageZfs) ContainerRestore(container container, sourceContainer container) error {
- shared.LogInfof("Restoring ZFS storage volume for container \"%s\" from %s -> %s.", s.volume.Name, sourceContainer.Name(), container.Name())
+ shared.LogDebugf("Restoring ZFS storage volume for container \"%s\" from %s -> %s.", s.volume.Name, sourceContainer.Name(), container.Name())
// Remove any needed snapshot
snaps, err := container.Snapshots()
@@ -916,12 +916,12 @@ func (s *storageZfs) ContainerRestore(container container, sourceContainer conta
return err
}
- shared.LogInfof("Restored ZFS storage volume for container \"%s\" from %s -> %s.", s.volume.Name, sourceContainer.Name(), container.Name())
+ shared.LogDebugf("Restored ZFS storage volume for container \"%s\" from %s -> %s.", s.volume.Name, sourceContainer.Name(), container.Name())
return nil
}
func (s *storageZfs) ContainerSetQuota(container container, size int64) error {
- shared.LogInfof("Setting ZFS quota for container \"%s\".", container.Name())
+ shared.LogDebugf("Setting ZFS quota for container \"%s\".", container.Name())
var err error
@@ -950,7 +950,7 @@ func (s *storageZfs) ContainerSetQuota(container container, size int64) error {
return err
}
- shared.LogInfof("Set ZFS quota for container \"%s\".", container.Name())
+ shared.LogDebugf("Set ZFS quota for container \"%s\".", container.Name())
return nil
}
@@ -986,7 +986,7 @@ func (s *storageZfs) ContainerGetUsage(container container) (int64, error) {
}
func (s *storageZfs) ContainerSnapshotCreate(snapshotContainer container, sourceContainer container) error {
- shared.LogInfof("Creating ZFS storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Creating ZFS storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
snapshotContainerName := snapshotContainer.Name()
sourceContainerName := sourceContainer.Name()
@@ -1027,12 +1027,12 @@ func (s *storageZfs) ContainerSnapshotCreate(snapshotContainer container, source
revert = false
- shared.LogInfof("Created ZFS storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Created ZFS storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
return nil
}
func (s *storageZfs) ContainerSnapshotDelete(snapshotContainer container) error {
- shared.LogInfof("Deleting ZFS storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Deleting ZFS storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
fields := strings.SplitN(snapshotContainer.Name(), shared.SnapshotDelimiter, 2)
sourceContainerName := fields[0]
@@ -1104,12 +1104,12 @@ func (s *storageZfs) ContainerSnapshotDelete(snapshotContainer container) error
}
}
- shared.LogInfof("Deleted ZFS storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Deleted ZFS storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
return nil
}
func (s *storageZfs) ContainerSnapshotRename(snapshotContainer container, newName string) error {
- shared.LogInfof("Renaming ZFS storage volume for snapshot \"%s\" from %s -> %s.", s.volume.Name, s.volume.Name, newName)
+ shared.LogDebugf("Renaming ZFS storage volume for snapshot \"%s\" from %s -> %s.", s.volume.Name, s.volume.Name, newName)
oldName := snapshotContainer.Name()
@@ -1169,12 +1169,12 @@ func (s *storageZfs) ContainerSnapshotRename(snapshotContainer container, newNam
revert = false
- shared.LogInfof("Renamed ZFS storage volume for snapshot \"%s\" from %s -> %s.", s.volume.Name, s.volume.Name, newName)
+ shared.LogDebugf("Renamed ZFS storage volume for snapshot \"%s\" from %s -> %s.", s.volume.Name, s.volume.Name, newName)
return nil
}
func (s *storageZfs) ContainerSnapshotStart(container container) error {
- shared.LogInfof("Initializing ZFS storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Initializing ZFS storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
fields := strings.SplitN(container.Name(), shared.SnapshotDelimiter, 2)
if len(fields) < 2 {
@@ -1193,12 +1193,12 @@ func (s *storageZfs) ContainerSnapshotStart(container container) error {
return err
}
- shared.LogInfof("Initialized ZFS storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Initialized ZFS storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
return nil
}
func (s *storageZfs) ContainerSnapshotStop(container container) error {
- shared.LogInfof("Stopping ZFS storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Stopping ZFS storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
fields := strings.SplitN(container.Name(), shared.SnapshotDelimiter, 2)
if len(fields) < 2 {
@@ -1215,7 +1215,7 @@ func (s *storageZfs) ContainerSnapshotStop(container container) error {
/* zfs creates this directory on clone (start), so we need to clean it
* up on stop */
- shared.LogInfof("Stopped ZFS storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Stopped ZFS storage volume for snapshot \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
err = os.RemoveAll(container.Path())
if err != nil {
return err
@@ -1237,7 +1237,7 @@ func (s *storageZfs) ContainerSnapshotCreateEmpty(snapshotContainer container) e
// - remove mountpoint property from zfs volume images/<fingerprint>
// - create read-write snapshot from zfs volume images/<fingerprint>
func (s *storageZfs) ImageCreate(fingerprint string) error {
- shared.LogInfof("Creating ZFS storage volume for image \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Creating ZFS storage volume for image \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
imageMntPoint := getImageMountPoint(s.pool.Name, fingerprint)
fs := fmt.Sprintf("images/%s", fingerprint)
@@ -1357,12 +1357,12 @@ func (s *storageZfs) ImageCreate(fingerprint string) error {
revert = false
- shared.LogInfof("Created ZFS storage volume for image \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Created ZFS storage volume for image \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
return nil
}
func (s *storageZfs) ImageDelete(fingerprint string) error {
- shared.LogInfof("Deleting ZFS storage volume for image \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Deleting ZFS storage volume for image \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
fs := fmt.Sprintf("images/%s", fingerprint)
@@ -1410,7 +1410,7 @@ func (s *storageZfs) ImageDelete(fingerprint string) error {
}
}
- shared.LogInfof("Deleted ZFS storage volume for image \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
+ shared.LogDebugf("Deleted ZFS storage volume for image \"%s\" on storage pool \"%s\".", s.volume.Name, s.pool.Name)
return nil
}
From 297c795ecd7828d83d2a2ba47c11041bb9c555a6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Sat, 25 Feb 2017 01:15:55 -0500
Subject: [PATCH 3/5] Fix some race conditions
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- /dev/lxd should be functional by the time we spawn containers
- Mixed log messages during REST API initialization
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
lxd/daemon.go | 34 +++++++++++++++++-----------------
1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/lxd/daemon.go b/lxd/daemon.go
index 0cf27ab..9c77fce 100644
--- a/lxd/daemon.go
+++ b/lxd/daemon.go
@@ -910,6 +910,11 @@ func (d *Daemon) Init() error {
return err
}
+ d.tomb.Go(func() error {
+ server := devLxdServer(d)
+ return server.Serve(d.devlxd)
+ })
+
if !d.MockMode {
/* Start the scheduler */
go deviceEventListener(d)
@@ -980,6 +985,7 @@ func (d *Daemon) Init() error {
NotFound.Render(w)
})
+ // Prepare the list of listeners
listeners := d.GetListeners()
if len(listeners) > 0 {
shared.LogInfof("LXD is socket activated")
@@ -1064,25 +1070,19 @@ func (d *Daemon) Init() error {
}
}
- d.tomb.Go(func() error {
- shared.LogInfof("REST API daemon:")
- if d.UnixSocket != nil {
- shared.LogInfo(" - binding Unix socket", log.Ctx{"socket": d.UnixSocket.Socket.Addr()})
- d.tomb.Go(func() error { return http.Serve(d.UnixSocket.Socket, &lxdHttpServer{d.mux, d}) })
- }
-
- if d.TCPSocket != nil {
- shared.LogInfo(" - binding TCP socket", log.Ctx{"socket": d.TCPSocket.Socket.Addr()})
- d.tomb.Go(func() error { return http.Serve(d.TCPSocket.Socket, &lxdHttpServer{d.mux, d}) })
- }
+ // Bind the REST API
+ shared.LogInfof("REST API daemon:")
+ if d.UnixSocket != nil {
+ shared.LogInfo(" - binding Unix socket", log.Ctx{"socket": d.UnixSocket.Socket.Addr()})
+ d.tomb.Go(func() error { return http.Serve(d.UnixSocket.Socket, &lxdHttpServer{d.mux, d}) })
+ }
- d.tomb.Go(func() error {
- server := devLxdServer(d)
- return server.Serve(d.devlxd)
- })
- return nil
- })
+ if d.TCPSocket != nil {
+ shared.LogInfo(" - binding TCP socket", log.Ctx{"socket": d.TCPSocket.Socket.Addr()})
+ d.tomb.Go(func() error { return http.Serve(d.TCPSocket.Socket, &lxdHttpServer{d.mux, d}) })
+ }
+ // Run the post initialization actions
if !d.MockMode && !d.SetupMode {
err := d.Ready()
if err != nil {
From 50a485d1eb6a01ed8f2766aa0c35d0f6b11be30e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Sat, 25 Feb 2017 01:18:44 -0500
Subject: [PATCH 4/5] Fix override of Devices during copy
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Closes #2872
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
doc/rest-api.md | 7 ++++++-
lxd/containers_post.go | 18 +++++++++++++++++-
2 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/doc/rest-api.md b/doc/rest-api.md
index 2826dc8..b76097b 100644
--- a/doc/rest-api.md
+++ b/doc/rest-api.md
@@ -553,10 +553,15 @@ Input (using a local container):
{
"name": "my-new-container", # 64 chars max, ASCII, no slash, no colon and no comma
- "architecture": "x86_64",
"profiles": ["default"], # List of profiles
"ephemeral": true, # Whether to destroy the container on shutdown
"config": {"limits.cpu": "2"}, # Config override.
+ "devices": { # optional list of devices the container should have
+ "kvm": {
+ "path": "/dev/kvm",
+ "type": "unix-char"
+ },
+ },
"source": {"type": "copy", # Can be: "image", "migration", "copy" or "none"
"source": "my-old-container"} # Name of the source container
}
diff --git a/lxd/containers_post.go b/lxd/containers_post.go
index 689ccc7..7042634 100644
--- a/lxd/containers_post.go
+++ b/lxd/containers_post.go
@@ -441,6 +441,22 @@ func createFromCopy(d *Daemon, req *api.ContainersPost) Response {
req.Config[key] = value
}
+ // Devices override
+ sourceDevices := source.LocalDevices()
+
+ if req.Devices == nil {
+ req.Devices = make(map[string]map[string]string)
+ }
+
+ for key, value := range sourceDevices {
+ _, exists := req.Devices[key]
+ if exists {
+ continue
+ }
+
+ req.Devices[key] = value
+ }
+
// Profiles override
if req.Profiles == nil {
req.Profiles = source.Profiles()
@@ -451,7 +467,7 @@ func createFromCopy(d *Daemon, req *api.ContainersPost) Response {
BaseImage: req.Source.BaseImage,
Config: req.Config,
Ctype: cTypeRegular,
- Devices: source.LocalDevices(),
+ Devices: req.Devices,
Ephemeral: req.Ephemeral,
Name: req.Name,
Profiles: req.Profiles,
From cc829595745ad805d567ede24de13798ebd1025c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Sat, 25 Feb 2017 01:49:40 -0500
Subject: [PATCH 5/5] doc: Fix badly named example device
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
doc/rest-api.md | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/doc/rest-api.md b/doc/rest-api.md
index b76097b..349b7b3 100644
--- a/doc/rest-api.md
+++ b/doc/rest-api.md
@@ -415,7 +415,7 @@ Input (container based on a local image with the "ubuntu/devel" alias):
"ephemeral": true, # Whether to destroy the container on shutdown
"config": {"limits.cpu": "2"}, # Config override.
"devices": { # optional list of devices the container should have
- "rootfs": {
+ "kvm": {
"path": "/dev/kvm",
"type": "unix-char"
},
@@ -433,7 +433,7 @@ Input (container based on a local image identified by its fingerprint):
"ephemeral": true, # Whether to destroy the container on shutdown
"config": {"limits.cpu": "2"}, # Config override.
"devices": { # optional list of devices the container should have
- "rootfs": {
+ "kvm": {
"path": "/dev/kvm",
"type": "unix-char"
},
@@ -451,7 +451,7 @@ Input (container based on most recent match based on image properties):
"ephemeral": true, # Whether to destroy the container on shutdown
"config": {"limits.cpu": "2"}, # Config override.
"devices": { # optional list of devices the container should have
- "rootfs": {
+ "kvm": {
"path": "/dev/kvm",
"type": "unix-char"
},
@@ -473,7 +473,7 @@ Input (container without a pre-populated rootfs, useful when attaching to an exi
"ephemeral": true, # Whether to destroy the container on shutdown
"config": {"limits.cpu": "2"}, # Config override.
"devices": { # optional list of devices the container should have
- "rootfs": {
+ "kvm": {
"path": "/dev/kvm",
"type": "unix-char"
},
@@ -490,7 +490,7 @@ Input (using a public remote image):
"ephemeral": true, # Whether to destroy the container on shutdown
"config": {"limits.cpu": "2"}, # Config override.
"devices": { # optional list of devices the container should have
- "rootfs": {
+ "kvm": {
"path": "/dev/kvm",
"type": "unix-char"
},
@@ -512,7 +512,7 @@ Input (using a private remote image after having obtained a secret for that imag
"ephemeral": true, # Whether to destroy the container on shutdown
"config": {"limits.cpu": "2"}, # Config override.
"devices": { # optional list of devices the container should have
- "rootfs": {
+ "kvm": {
"path": "/dev/kvm",
"type": "unix-char"
},
@@ -534,7 +534,7 @@ Input (using a remote container, sent over the migration websocket):
"ephemeral": true, # Whether to destroy the container on shutdown
"config": {"limits.cpu": "2"}, # Config override.
"devices": { # optional list of devices the container should have
- "rootfs": {
+ "kvm": {
"path": "/dev/kvm",
"type": "unix-char"
},
@@ -575,7 +575,7 @@ Input (using a remote container, in push mode sent over the migration websocket
"ephemeral": true, # Whether to destroy the container on shutdown
"config": {"limits.cpu": "2"}, # Config override.
"devices": { # optional list of devices the container should have
- "rootfs": {
+ "kvm": {
"path": "/dev/kvm",
"type": "unix-char"
},
More information about the lxc-devel
mailing list