[lxc-devel] [lxd/master] Improve error logging upon daemon shutdown

freeekanayaka on Github lxc-bot at linuxcontainers.org
Fri May 15 10:12:28 UTC 2020


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/20200515/f4d9ea8a/attachment.bin>
-------------- next part --------------
From 713cc22bbf4a4ece49d3fedc4bd7159f54842747 Mon Sep 17 00:00:00 2001
From: Free Ekanayaka <free.ekanayaka at canonical.com>
Date: Thu, 14 May 2020 13:44:44 +0100
Subject: [PATCH 1/2] disable tests

Signed-off-by: Free Ekanayaka <free.ekanayaka at canonical.com>
---
 test/main.sh | 218 +++++++++++++++++++++++++--------------------------
 1 file changed, 109 insertions(+), 109 deletions(-)

diff --git a/test/main.sh b/test/main.sh
index 8219df0990..80897bb401 100755
--- a/test/main.sh
+++ b/test/main.sh
@@ -154,117 +154,117 @@ if [ "$#" -gt 0 ]; then
   exit
 fi
 
-run_test test_check_deps "checking dependencies"
-run_test test_static_analysis "static analysis"
-run_test test_database_update "database schema updates"
-run_test test_database_restore "database restore"
-run_test test_database_no_disk_space "database out of disk space"
-run_test test_sql "lxd sql"
-run_test test_basic_usage "basic usage"
-run_test test_remote_url "remote url handling"
-run_test test_remote_admin "remote administration"
-run_test test_remote_usage "remote usage"
-run_test test_clustering_enable "clustering enable"
-run_test test_clustering_membership "clustering membership"
-run_test test_clustering_containers "clustering containers"
-run_test test_clustering_storage "clustering storage"
-run_test test_clustering_storage_single_node "clustering storage single node"
-run_test test_clustering_network "clustering network"
-run_test test_clustering_publish "clustering publish"
-run_test test_clustering_profiles "clustering profiles"
-run_test test_clustering_join_api "clustering join api"
-run_test test_clustering_shutdown_nodes "clustering shutdown"
-run_test test_clustering_projects "clustering projects"
-run_test test_clustering_address "clustering address"
-run_test test_clustering_image_replication "clustering image replication"
-run_test test_clustering_dns "clustering DNS"
-run_test test_clustering_recover "clustering recovery"
+# run_test test_check_deps "checking dependencies"
+# run_test test_static_analysis "static analysis"
+# run_test test_database_update "database schema updates"
+# run_test test_database_restore "database restore"
+# run_test test_database_no_disk_space "database out of disk space"
+# run_test test_sql "lxd sql"
+# run_test test_basic_usage "basic usage"
+# run_test test_remote_url "remote url handling"
+# run_test test_remote_admin "remote administration"
+# run_test test_remote_usage "remote usage"
+# run_test test_clustering_enable "clustering enable"
+# run_test test_clustering_membership "clustering membership"
+# run_test test_clustering_containers "clustering containers"
+# run_test test_clustering_storage "clustering storage"
+# run_test test_clustering_storage_single_node "clustering storage single node"
+# run_test test_clustering_network "clustering network"
+# run_test test_clustering_publish "clustering publish"
+# run_test test_clustering_profiles "clustering profiles"
+# run_test test_clustering_join_api "clustering join api"
+# run_test test_clustering_shutdown_nodes "clustering shutdown"
+# run_test test_clustering_projects "clustering projects"
+# run_test test_clustering_address "clustering address"
+# run_test test_clustering_image_replication "clustering image replication"
+# run_test test_clustering_dns "clustering DNS"
+# run_test test_clustering_recover "clustering recovery"
 run_test test_clustering_handover "clustering handover"
-run_test test_clustering_rebalance "clustering rebalance"
-run_test test_clustering_remove_raft_node "custering remove raft node"
+# run_test test_clustering_rebalance "clustering rebalance"
+# run_test test_clustering_remove_raft_node "custering remove raft node"
 # run_test test_clustering_upgrade "clustering upgrade"
-run_test test_projects_default "default project"
-run_test test_projects_crud "projects CRUD operations"
-run_test test_projects_containers "containers inside projects"
-run_test test_projects_snapshots "snapshots inside projects"
-run_test test_projects_backups "backups inside projects"
-run_test test_projects_profiles "profiles inside projects"
-run_test test_projects_profiles_default "profiles from the global default project"
-run_test test_projects_images "images inside projects"
-run_test test_projects_images_default "images from the global default project"
-run_test test_projects_storage "projects and storage pools"
-run_test test_projects_network "projects and networks"
-run_test test_projects_limits "projects limits"
-run_test test_projects_restrictions "projects restrictions"
-run_test test_container_devices_disk "container devices - disk"
-run_test test_container_devices_nic_p2p "container devices - nic - p2p"
-run_test test_container_devices_nic_bridged "container devices - nic - bridged"
-run_test test_container_devices_nic_bridged_filtering "container devices - nic - bridged - filtering"
-run_test test_container_devices_nic_physical "container devices - nic - physical"
-run_test test_container_devices_nic_macvlan "container devices - nic - macvlan"
-run_test test_container_devices_nic_ipvlan "container devices - nic - ipvlan"
-run_test test_container_devices_nic_sriov "container devices - nic - sriov"
-run_test test_container_devices_nic_routed "container devices - nic - routed"
-run_test test_container_devices_infiniband_physical "container devices - infiniband - physical"
-run_test test_container_devices_infiniband_sriov "container devices - infiniband - sriov"
-run_test test_container_devices_proxy "container devices - proxy"
-run_test test_container_devices_gpu "container devices - gpu"
-run_test test_container_devices_unix_char "container devices - unix-char"
-run_test test_container_devices_unix_block "container devices - unix-block"
-run_test test_security "security features"
-run_test test_security_protection "container protection"
-run_test test_image_expiry "image expiry"
-run_test test_image_list_all_aliases "image list all aliases"
-run_test test_image_auto_update "image auto-update"
-run_test test_image_prefer_cached "image prefer cached"
-run_test test_image_import_dir "import image from directory"
-run_test test_concurrent_exec "concurrent exec"
-run_test test_concurrent "concurrent startup"
-run_test test_snapshots "container snapshots"
-run_test test_snap_restore "snapshot restores"
-run_test test_snap_expiry "snapshot expiry"
-run_test test_config_profiles "profiles and configuration"
-run_test test_config_edit "container configuration edit"
-run_test test_config_edit_container_snapshot_pool_config "container and snapshot volume configuration edit"
-run_test test_container_metadata "manage container metadata and templates"
-run_test test_container_snapshot_config "container snapshot configuration"
-run_test test_server_config "server configuration"
-run_test test_filemanip "file manipulations"
-run_test test_network "network management"
-run_test test_idmap "id mapping"
-run_test test_template "file templating"
-run_test test_pki "PKI mode"
-run_test test_devlxd "/dev/lxd"
-run_test test_fuidshift "fuidshift"
-run_test test_migration "migration"
-run_test test_fdleak "fd leak"
-run_test test_storage "storage"
-run_test test_storage_volume_snapshots "storage volume snapshots"
-run_test test_init_auto "lxd init auto"
-run_test test_init_interactive "lxd init interactive"
-run_test test_init_preseed "lxd init preseed"
-run_test test_storage_profiles "storage profiles"
-run_test test_container_import "container import"
-run_test test_storage_volume_attach "attaching storage volumes"
-run_test test_storage_driver_btrfs "btrfs storage driver"
-run_test test_storage_driver_ceph "ceph storage driver"
-run_test test_storage_driver_cephfs "cephfs storage driver"
-run_test test_resources "resources"
-run_test test_kernel_limits "kernel limits"
-run_test test_macaroon_auth "macaroon authentication"
-run_test test_console "console"
-run_test test_query "query"
-run_test test_storage_local_volume_handling "storage local volume handling"
-run_test test_backup_import "backup import"
-run_test test_backup_export "backup export"
-run_test test_backup_rename "backup rename"
-run_test test_container_local_cross_pool_handling "container local cross pool handling"
-run_test test_incremental_copy "incremental container copy"
-run_test test_profiles_project_default "profiles in default project"
-run_test test_profiles_project_images_profiles "profiles in project with images and profiles enabled"
-run_test test_profiles_project_images "profiles in project with images enabled and profiles disabled"
-run_test test_profiles_project_profiles "profiles in project with images disabled and profiles enabled"
-run_test test_filtering "API filtering"
+# run_test test_projects_default "default project"
+# run_test test_projects_crud "projects CRUD operations"
+# run_test test_projects_containers "containers inside projects"
+# run_test test_projects_snapshots "snapshots inside projects"
+# run_test test_projects_backups "backups inside projects"
+# run_test test_projects_profiles "profiles inside projects"
+# run_test test_projects_profiles_default "profiles from the global default project"
+# run_test test_projects_images "images inside projects"
+# run_test test_projects_images_default "images from the global default project"
+# run_test test_projects_storage "projects and storage pools"
+# run_test test_projects_network "projects and networks"
+# run_test test_projects_limits "projects limits"
+# run_test test_projects_restrictions "projects restrictions"
+# run_test test_container_devices_disk "container devices - disk"
+# run_test test_container_devices_nic_p2p "container devices - nic - p2p"
+# run_test test_container_devices_nic_bridged "container devices - nic - bridged"
+# run_test test_container_devices_nic_bridged_filtering "container devices - nic - bridged - filtering"
+# run_test test_container_devices_nic_physical "container devices - nic - physical"
+# run_test test_container_devices_nic_macvlan "container devices - nic - macvlan"
+# run_test test_container_devices_nic_ipvlan "container devices - nic - ipvlan"
+# run_test test_container_devices_nic_sriov "container devices - nic - sriov"
+# run_test test_container_devices_nic_routed "container devices - nic - routed"
+# run_test test_container_devices_infiniband_physical "container devices - infiniband - physical"
+# run_test test_container_devices_infiniband_sriov "container devices - infiniband - sriov"
+# run_test test_container_devices_proxy "container devices - proxy"
+# run_test test_container_devices_gpu "container devices - gpu"
+# run_test test_container_devices_unix_char "container devices - unix-char"
+# run_test test_container_devices_unix_block "container devices - unix-block"
+# run_test test_security "security features"
+# run_test test_security_protection "container protection"
+# run_test test_image_expiry "image expiry"
+# run_test test_image_list_all_aliases "image list all aliases"
+# run_test test_image_auto_update "image auto-update"
+# run_test test_image_prefer_cached "image prefer cached"
+# run_test test_image_import_dir "import image from directory"
+# run_test test_concurrent_exec "concurrent exec"
+# run_test test_concurrent "concurrent startup"
+# run_test test_snapshots "container snapshots"
+# run_test test_snap_restore "snapshot restores"
+# run_test test_snap_expiry "snapshot expiry"
+# run_test test_config_profiles "profiles and configuration"
+# run_test test_config_edit "container configuration edit"
+# run_test test_config_edit_container_snapshot_pool_config "container and snapshot volume configuration edit"
+# run_test test_container_metadata "manage container metadata and templates"
+# run_test test_container_snapshot_config "container snapshot configuration"
+# run_test test_server_config "server configuration"
+# run_test test_filemanip "file manipulations"
+# run_test test_network "network management"
+# run_test test_idmap "id mapping"
+# run_test test_template "file templating"
+# run_test test_pki "PKI mode"
+# run_test test_devlxd "/dev/lxd"
+# run_test test_fuidshift "fuidshift"
+# run_test test_migration "migration"
+# run_test test_fdleak "fd leak"
+# run_test test_storage "storage"
+# run_test test_storage_volume_snapshots "storage volume snapshots"
+# run_test test_init_auto "lxd init auto"
+# run_test test_init_interactive "lxd init interactive"
+# run_test test_init_preseed "lxd init preseed"
+# run_test test_storage_profiles "storage profiles"
+# run_test test_container_import "container import"
+# run_test test_storage_volume_attach "attaching storage volumes"
+# run_test test_storage_driver_btrfs "btrfs storage driver"
+# run_test test_storage_driver_ceph "ceph storage driver"
+# run_test test_storage_driver_cephfs "cephfs storage driver"
+# run_test test_resources "resources"
+# run_test test_kernel_limits "kernel limits"
+# run_test test_macaroon_auth "macaroon authentication"
+# run_test test_console "console"
+# run_test test_query "query"
+# run_test test_storage_local_volume_handling "storage local volume handling"
+# run_test test_backup_import "backup import"
+# run_test test_backup_export "backup export"
+# run_test test_backup_rename "backup rename"
+# run_test test_container_local_cross_pool_handling "container local cross pool handling"
+# run_test test_incremental_copy "incremental container copy"
+# run_test test_profiles_project_default "profiles in default project"
+# run_test test_profiles_project_images_profiles "profiles in project with images and profiles enabled"
+# run_test test_profiles_project_images "profiles in project with images enabled and profiles disabled"
+# run_test test_profiles_project_profiles "profiles in project with images disabled and profiles enabled"
+# run_test test_filtering "API filtering"
 
 # shellcheck disable=SC2034
 TEST_RESULT=success

From 03dcd4919f71b8d9800bb900737b89dc984c769c Mon Sep 17 00:00:00 2001
From: Free Ekanayaka <free.ekanayaka at canonical.com>
Date: Thu, 14 May 2020 14:43:10 +0100
Subject: [PATCH 2/2] lxd: Improve logging of shutdown errors

Signed-off-by: Free Ekanayaka <free.ekanayaka at canonical.com>
---
 lxd/daemon.go | 22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/lxd/daemon.go b/lxd/daemon.go
index 08d2996ac4..c29585c195 100644
--- a/lxd/daemon.go
+++ b/lxd/daemon.go
@@ -1124,18 +1124,18 @@ func (d *Daemon) Kill() {
 func (d *Daemon) Stop() error {
 	logger.Info("Starting shutdown sequence")
 	errs := []error{}
-	trackError := func(err error) {
+	trackError := func(err error, desc string) {
 		if err != nil {
-			errs = append(errs, err)
+			errs = append(errs, errors.Wrap(err, desc))
 		}
 	}
 
 	if d.endpoints != nil {
-		trackError(d.endpoints.Down())
+		trackError(d.endpoints.Down(), "Shutdown endpoints")
 	}
 
-	trackError(d.tasks.Stop(3 * time.Second))        // Give tasks a bit of time to cleanup.
-	trackError(d.clusterTasks.Stop(3 * time.Second)) // Give tasks a bit of time to cleanup.
+	trackError(d.tasks.Stop(3*time.Second), "Stop tasks")                // Give tasks a bit of time to cleanup.
+	trackError(d.clusterTasks.Stop(3*time.Second), "Stop cluster tasks") // Give tasks a bit of time to cleanup.
 
 	shouldUnmount := false
 	if d.cluster != nil {
@@ -1163,19 +1163,15 @@ func (d *Daemon) Stop() error {
 		if errors.Cause(err) == sqldriver.ErrBadConn {
 			logger.Debugf("Could not close remote database cleanly: %v", err)
 		} else {
-			trackError(err)
+			trackError(err, "Close cluster database")
 		}
 	}
 	if d.db != nil {
-		trackError(d.db.Close())
+		trackError(d.db.Close(), "Close local database")
 	}
 
 	if d.gateway != nil {
-		trackError(d.gateway.Shutdown())
-	}
-
-	if d.endpoints != nil {
-		trackError(d.endpoints.Down())
+		trackError(d.gateway.Shutdown(), "Shutdown dqlite")
 	}
 
 	if shouldUnmount {
@@ -1191,7 +1187,7 @@ func (d *Daemon) Stop() error {
 	}
 
 	if d.seccomp != nil {
-		trackError(d.seccomp.Stop())
+		trackError(d.seccomp.Stop(), "Stop seccomp")
 	}
 
 	var err error


More information about the lxc-devel mailing list