[lxc-devel] [lxd/master] Storage: Adds storage node state to improve clustered to creation process
tomponline on Github
lxc-bot at linuxcontainers.org
Tue Dec 1 14:54:03 UTC 2020
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 1171 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20201201/35ab9424/attachment-0001.bin>
-------------- next part --------------
From 22b0b86a0507cbe1d961e540181c0ee5f77596c7 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Tue, 1 Dec 2020 10:18:28 +0000
Subject: [PATCH 01/16] lxd/db/cluster: Adds state column to
storage_pools_nodes table and set existing rows to state=1 (created)
Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
lxd/db/cluster/schema.go | 3 ++-
lxd/db/cluster/update.go | 11 +++++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/lxd/db/cluster/schema.go b/lxd/db/cluster/schema.go
index 4b110c8ada..00ce7ea8d3 100644
--- a/lxd/db/cluster/schema.go
+++ b/lxd/db/cluster/schema.go
@@ -490,6 +490,7 @@ CREATE TABLE storage_pools_nodes (
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
storage_pool_id INTEGER NOT NULL,
node_id INTEGER NOT NULL,
+ state INTEGER NOT NULL DEFAULT 0,
UNIQUE (storage_pool_id, node_id),
FOREIGN KEY (storage_pool_id) REFERENCES storage_pools (id) ON DELETE CASCADE,
FOREIGN KEY (node_id) REFERENCES nodes (id) ON DELETE CASCADE
@@ -590,5 +591,5 @@ CREATE TABLE storage_volumes_snapshots_config (
UNIQUE (storage_volume_snapshot_id, key)
);
-INSERT INTO schema (version, updated_at) VALUES (40, strftime("%s"))
+INSERT INTO schema (version, updated_at) VALUES (41, strftime("%s"))
`
diff --git a/lxd/db/cluster/update.go b/lxd/db/cluster/update.go
index 55ab9c7b8e..16efb06b34 100644
--- a/lxd/db/cluster/update.go
+++ b/lxd/db/cluster/update.go
@@ -77,6 +77,17 @@ var updates = map[int]schema.Update{
38: updateFromV37,
39: updateFromV38,
40: updateFromV39,
+ 41: updateFromV40,
+}
+
+// Add state column to storage_pools_nodes tables. Set existing row's state to 1 ("created").
+func updateFromV40(tx *sql.Tx) error {
+ stmt := `
+ ALTER TABLE storage_pools_nodes ADD COLUMN state INTEGER NOT NULL DEFAULT 0;
+ UPDATE storage_pools_nodes SET state = 1;
+ `
+ _, err := tx.Exec(stmt)
+ return err
}
// Add state column to networks_nodes tables. Set existing row's state to 1 ("created").
From f25eff38edd6d8b698ab2172884ec8a5e8353c96 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Tue, 1 Dec 2020 10:29:05 +0000
Subject: [PATCH 02/16] lxd/db/networks: Updates network state comments to
indicate node usage
Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
lxd/db/networks.go | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lxd/db/networks.go b/lxd/db/networks.go
index 34a75003a6..c1a1263a25 100644
--- a/lxd/db/networks.go
+++ b/lxd/db/networks.go
@@ -460,9 +460,9 @@ type NetworkState int
// Network state.
const (
- networkPending NetworkState = iota // Network defined but not yet created.
- networkCreated // Network created on all nodes.
- networkErrored // Network creation failed on some nodes
+ networkPending NetworkState = iota // Network defined but not yet created globally or on specific node.
+ networkCreated // Network created globally or on specific node.
+ networkErrored // Deprecated (should no longer occur).
)
// NetworkType indicates type of network.
From 01526037d71723c77129ce18ff8e2657bad0ee73 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Tue, 1 Dec 2020 10:29:30 +0000
Subject: [PATCH 03/16] lxd/db/storage/pools: Updates storage pool state
comments to indicate node usage
Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
lxd/db/storage_pools.go | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lxd/db/storage_pools.go b/lxd/db/storage_pools.go
index 76d12693d1..d676941c80 100644
--- a/lxd/db/storage_pools.go
+++ b/lxd/db/storage_pools.go
@@ -372,9 +372,9 @@ func (c *ClusterTx) CreateStoragePoolConfig(poolID, nodeID int64, config map[str
// Storage pools state.
const (
- storagePoolPending int = iota // Storage pool defined but not yet created.
- storagePoolCreated // Storage pool created on all nodes.
- storagePoolErrored // Storage pool creation failed on some nodes
+ storagePoolPending int = iota // Storage pool defined but not yet created globally or on specific node.
+ storagePoolCreated // Storage pool created globally or on specific node.
+ storagePoolErrored // Deprecated (should no longer occur).
)
// CreatePendingStoragePool creates a new pending storage pool on the node with
From 71ae26571c9b1876a700ab8892b5fd8aafe83ffd Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Tue, 1 Dec 2020 10:29:48 +0000
Subject: [PATCH 04/16] lxd/db/storage/pools: Replace use of networkCreated
with storagePoolCreated in getStoragePool
Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
lxd/db/storage_pools.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lxd/db/storage_pools.go b/lxd/db/storage_pools.go
index d676941c80..181c93013e 100644
--- a/lxd/db/storage_pools.go
+++ b/lxd/db/storage_pools.go
@@ -645,7 +645,7 @@ func (c *Cluster) getStoragePool(poolName string, onlyCreated bool) (int64, *api
outargs := []interface{}{&poolID, &poolDriver, &description, &state}
if onlyCreated {
query += " AND state=?"
- inargs = append(inargs, networkCreated)
+ inargs = append(inargs, storagePoolCreated)
}
err := dbQueryRowScan(c, query, inargs, outargs)
From d4e536e424244456694511681e4565fe93f50311 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Tue, 1 Dec 2020 10:32:31 +0000
Subject: [PATCH 05/16] lxd/db/networks: Removes unused NetworkErrored function
Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
lxd/db/networks.go | 5 -----
1 file changed, 5 deletions(-)
diff --git a/lxd/db/networks.go b/lxd/db/networks.go
index c1a1263a25..dece3638a6 100644
--- a/lxd/db/networks.go
+++ b/lxd/db/networks.go
@@ -323,11 +323,6 @@ func (c *ClusterTx) NetworkCreated(project string, name string) error {
return c.networkState(project, name, networkCreated)
}
-// NetworkErrored sets the state of the given network to networkErrored.
-func (c *ClusterTx) NetworkErrored(project string, name string) error {
- return c.networkState(project, name, networkErrored)
-}
-
func (c *ClusterTx) networkState(project string, name string, state NetworkState) error {
stmt := "UPDATE networks SET state=? WHERE project_id = (SELECT id FROM projects WHERE name = ?) AND name=?"
result, err := c.tx.Exec(stmt, state, project, name)
From 18b5d1af435d7b9fdfcd1ce72cf7da8afb558ee7 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Tue, 1 Dec 2020 11:34:07 +0000
Subject: [PATCH 06/16] lxd/db/storage/pools: Set storage pool node state to
created in UpdateStoragePoolAfterNodeJoin
Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
lxd/db/storage_pools.go | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lxd/db/storage_pools.go b/lxd/db/storage_pools.go
index 181c93013e..73e0472ce5 100644
--- a/lxd/db/storage_pools.go
+++ b/lxd/db/storage_pools.go
@@ -254,8 +254,9 @@ func (c *ClusterTx) GetNonPendingStoragePoolsNamesToIDs() (map[string]int64, err
// assume that the relevant pool has already been created on the joining node,
// and we just need to track it.
func (c *ClusterTx) UpdateStoragePoolAfterNodeJoin(poolID, nodeID int64) error {
- columns := []string{"storage_pool_id", "node_id"}
- values := []interface{}{poolID, nodeID}
+ columns := []string{"storage_pool_id", "node_id", "state"}
+ // Create storage pool node with storagePoolCreated state as we expect the pool to already be setup.
+ values := []interface{}{poolID, nodeID, storagePoolCreated}
_, err := query.UpsertObject(c.tx, "storage_pools_nodes", columns, values)
if err != nil {
return errors.Wrap(err, "failed to add storage pools node entry")
From 13f431cba26eb792e3e83e5a101849bee1aaff0f Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Tue, 1 Dec 2020 11:34:53 +0000
Subject: [PATCH 07/16] lxd/db/storage/pools: Set storage pool node state to
pending in CreatePendingStoragePool
Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
lxd/db/storage_pools.go | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lxd/db/storage_pools.go b/lxd/db/storage_pools.go
index 73e0472ce5..b25312a341 100644
--- a/lxd/db/storage_pools.go
+++ b/lxd/db/storage_pools.go
@@ -447,9 +447,9 @@ func (c *ClusterTx) CreatePendingStoragePool(node, name, driver string, conf map
return ErrAlreadyDefined
}
- // Insert the node-specific configuration.
- columns := []string{"storage_pool_id", "node_id"}
- values := []interface{}{poolID, nodeInfo.ID}
+ // Insert a node-specific entry pointing to ourselves with state storagePoolPending.
+ columns := []string{"storage_pool_id", "node_id", "state"}
+ values := []interface{}{poolID, nodeInfo.ID, storagePoolPending}
_, err = query.UpsertObject(c.tx, "storage_pools_nodes", columns, values)
if err != nil {
return err
From 43312c42639c9698074d381600cbb532483ff85d Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Tue, 1 Dec 2020 11:35:15 +0000
Subject: [PATCH 08/16] lxd/db/storage/pools: Adds StoragePoolNodeCreated and
storagePoolNodeState functions
Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
lxd/db/storage_pools.go | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/lxd/db/storage_pools.go b/lxd/db/storage_pools.go
index b25312a341..76fb8e0a2b 100644
--- a/lxd/db/storage_pools.go
+++ b/lxd/db/storage_pools.go
@@ -488,6 +488,29 @@ func (c *ClusterTx) storagePoolState(name string, state int) error {
return nil
}
+// StoragePoolNodeCreated sets the state of the given storage pool for the local member to storagePoolCreated.
+func (c *ClusterTx) StoragePoolNodeCreated(poolID int64) error {
+ return c.storagePoolNodeState(poolID, storagePoolCreated)
+}
+
+// storagePoolNodeState updates the storage pool member state for the local member and specified network ID.
+func (c *ClusterTx) storagePoolNodeState(poolID int64, state int) error {
+ stmt := "UPDATE storage_pools_nodes SET state=? WHERE storage_pool_id = ? and node_id = ?"
+ result, err := c.tx.Exec(stmt, state, poolID, c.nodeID)
+ if err != nil {
+ return err
+ }
+ n, err := result.RowsAffected()
+ if err != nil {
+ return err
+ }
+ if n != 1 {
+ return ErrNoSuchObject
+ }
+
+ return nil
+}
+
// GetStoragePoolNodeConfigs returns the node-specific configuration of all
// nodes grouped by node name, for the given poolID.
//
From e0f0805fad6c29a31b4ca2b9bcadb32fa815db7c Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Tue, 1 Dec 2020 11:35:35 +0000
Subject: [PATCH 09/16] lxd/db/storage/pools: Set storage pool node state to
pending in CreateStoragePool
Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
lxd/db/storage_pools.go | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lxd/db/storage_pools.go b/lxd/db/storage_pools.go
index 76fb8e0a2b..402bc10673 100644
--- a/lxd/db/storage_pools.go
+++ b/lxd/db/storage_pools.go
@@ -769,9 +769,9 @@ func (c *Cluster) CreateStoragePool(poolName string, poolDescription string, poo
return err
}
- // Insert a node-specific entry pointing to ourselves.
- columns := []string{"storage_pool_id", "node_id"}
- values := []interface{}{id, c.nodeID}
+ // Insert a node-specific entry pointing to ourselves with state storagePoolPending.
+ columns := []string{"storage_pool_id", "node_id", "state"}
+ values := []interface{}{id, c.nodeID, storagePoolPending}
_, err = query.UpsertObject(tx.tx, "storage_pools_nodes", columns, values)
if err != nil {
return err
From cbec16a3e6697a3937f6f9cb60aa7749a5dad5a4 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Tue, 1 Dec 2020 11:36:07 +0000
Subject: [PATCH 10/16] lxd/storage/pools/utils: Consistent commnent endings
Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
lxd/storage_pools_utils.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lxd/storage_pools_utils.go b/lxd/storage_pools_utils.go
index 6ea29eb5c2..9db47a5429 100644
--- a/lxd/storage_pools_utils.go
+++ b/lxd/storage_pools_utils.go
@@ -37,7 +37,7 @@ func storagePoolDBCreate(s *state.State, poolName, poolDescription string, drive
return -1, err
}
- // Fill in the defaults
+ // Fill in the defaults.
err = storagePoolFillDefault(poolName, driver, config)
if err != nil {
return -1, err
From 3b04335618599c3a66f62cf75e6859c51141e451 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Tue, 1 Dec 2020 11:41:06 +0000
Subject: [PATCH 11/16] lxd/storage/pools/utils: Fix comment in
storagePoolCreateLocal
Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
lxd/storage_pools_utils.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lxd/storage_pools_utils.go b/lxd/storage_pools_utils.go
index 9db47a5429..dc8430bb62 100644
--- a/lxd/storage_pools_utils.go
+++ b/lxd/storage_pools_utils.go
@@ -144,7 +144,7 @@ func storagePoolCreateLocal(state *state.State, id int64, req api.StoragePoolsPo
// happened.
configDiff, _ := storagePools.ConfigDiff(req.Config, updatedConfig)
if len(configDiff) > 0 {
- // Create the database entry for the storage pool.
+ // Update the database entry for the storage pool.
err = state.Cluster.UpdateStoragePool(req.Name, req.Description, updatedConfig)
if err != nil {
return nil, errors.Wrapf(err, "Error updating storage pool config after local create for %q", req.Name)
From 5ea161cee8acb410e276846ab35eb6a467b69152 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Tue, 1 Dec 2020 13:53:23 +0000
Subject: [PATCH 12/16] lxd/networks: golint fix
Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
lxd/networks.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lxd/networks.go b/lxd/networks.go
index ea12c70c4e..9caa6cc25a 100644
--- a/lxd/networks.go
+++ b/lxd/networks.go
@@ -12,7 +12,6 @@ import (
"sync"
"github.com/gorilla/mux"
- log "github.com/lxc/lxd/shared/log15"
"github.com/pkg/errors"
lxd "github.com/lxc/lxd/client"
@@ -30,6 +29,7 @@ import (
"github.com/lxc/lxd/lxd/util"
"github.com/lxc/lxd/shared"
"github.com/lxc/lxd/shared/api"
+ log "github.com/lxc/lxd/shared/log15"
"github.com/lxc/lxd/shared/logger"
"github.com/lxc/lxd/shared/version"
)
From 0f1f51698c69cfcfc7fc80aabccaac1308d44756 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Tue, 1 Dec 2020 13:54:52 +0000
Subject: [PATCH 13/16] lxd/storage/pools: Add logging for storage pool state
updates in storagePoolsPostCluster
- Also remove errored state (leave storage pool pending on partial error).
- Setup notifier earlier to catch any errors before local creation begins.
Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
lxd/storage_pools.go | 33 +++++++++++++++++++++------------
1 file changed, 21 insertions(+), 12 deletions(-)
diff --git a/lxd/storage_pools.go b/lxd/storage_pools.go
index 2e3631e676..69ce4708cc 100644
--- a/lxd/storage_pools.go
+++ b/lxd/storage_pools.go
@@ -18,6 +18,8 @@ import (
"github.com/lxc/lxd/lxd/util"
"github.com/lxc/lxd/shared"
"github.com/lxc/lxd/shared/api"
+ log "github.com/lxc/lxd/shared/log15"
+ "github.com/lxc/lxd/shared/logger"
"github.com/lxc/lxd/shared/version"
)
@@ -249,6 +251,12 @@ func storagePoolsPostCluster(d *Daemon, req api.StoragePoolsPost) error {
return err
}
+ // Create notifier for other nodes to create the storage pool.
+ notifier, err := cluster.NewNotifier(d.State(), d.endpoints.NetworkCert(), cluster.NotifyAll)
+ if err != nil {
+ return err
+ }
+
// Create the pool on this node.
nodeReq := req
for key, value := range configs[nodeName] {
@@ -272,11 +280,7 @@ func storagePoolsPostCluster(d *Daemon, req api.StoragePoolsPost) error {
}
// Notify all other nodes to create the pool.
- notifier, err := cluster.NewNotifier(d.State(), d.endpoints.NetworkCert(), cluster.NotifyAll)
- if err != nil {
- return err
- }
- notifyErr := notifier(func(client lxd.InstanceServer) error {
+ err = notifier(func(client lxd.InstanceServer) error {
server, _, err := client.GetServer()
if err != nil {
return err
@@ -287,23 +291,28 @@ func storagePoolsPostCluster(d *Daemon, req api.StoragePoolsPost) error {
nodeReq.Config[key] = value
}
- return client.CreateStoragePool(nodeReq)
- })
+ err = client.CreateStoragePool(nodeReq)
+ if err != nil {
+ return err
+ }
+ logger.Error("Created storage pool on cluster member", log.Ctx{"pool": req.Name, "member": server.Environment.ServerName})
- errored := notifyErr != nil
+ return nil
+ })
+ if err != nil {
+ return err
+ }
// Finally update the storage pool state.
err = d.cluster.Transaction(func(tx *db.ClusterTx) error {
- if errored {
- return tx.StoragePoolErrored(req.Name)
- }
return tx.StoragePoolCreated(req.Name)
})
if err != nil {
return err
}
+ logger.Debug("Marked storage pool global status as created", log.Ctx{"pool": req.Name})
- return notifyErr
+ return nil
}
// /1.0/storage-pools/{name}
From b5ed9619937616d54cac6b53faa6cf08f14d9d1f Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Tue, 1 Dec 2020 13:56:52 +0000
Subject: [PATCH 14/16] lxd/storage/pools/utils: Updates storagePoolCreateLocal
to mark local node state as created
- Also adds use of revert package and better logging.
Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
lxd/storage_pools_utils.go | 29 +++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)
diff --git a/lxd/storage_pools_utils.go b/lxd/storage_pools_utils.go
index dc8430bb62..1754b9ead3 100644
--- a/lxd/storage_pools_utils.go
+++ b/lxd/storage_pools_utils.go
@@ -5,10 +5,14 @@ import (
"github.com/pkg/errors"
+ "github.com/lxc/lxd/lxd/db"
+ "github.com/lxc/lxd/lxd/revert"
"github.com/lxc/lxd/lxd/state"
storagePools "github.com/lxc/lxd/lxd/storage"
"github.com/lxc/lxd/shared"
"github.com/lxc/lxd/shared/api"
+ log "github.com/lxc/lxd/shared/log15"
+ "github.com/lxc/lxd/shared/logger"
)
func storagePoolUpdate(state *state.State, name, newDescription string, newConfig map[string]string, withDB bool) error {
@@ -99,7 +103,9 @@ func storagePoolCreateGlobal(state *state.State, req api.StoragePoolsPost) error
// This performs local pool setup and updates DB record if config was changed during pool setup.
func storagePoolCreateLocal(state *state.State, id int64, req api.StoragePoolsPost, isNotification bool) (map[string]string, error) {
- tryUndo := true
+ // Setup revert.
+ revert := revert.New()
+ defer revert.Fail()
// Make a copy of the req for later diff.
var updatedConfig map[string]string
@@ -117,6 +123,7 @@ func storagePoolCreateLocal(state *state.State, id int64, req api.StoragePoolsPo
if err != nil {
return nil, err
}
+ revert.Add(func() { pool.Delete(isNotification, nil) })
// Mount the pool.
_, err = pool.Mount()
@@ -127,15 +134,6 @@ func storagePoolCreateLocal(state *state.State, id int64, req api.StoragePoolsPo
// Record the updated config.
updatedConfig = updatedReq.Config
- // Setup revert function.
- defer func() {
- if !tryUndo {
- return
- }
-
- pool.Delete(isNotification, nil)
- }()
-
// In case the storage pool config was changed during the pool creation,
// we need to update the database to reflect this change. This can e.g.
// happen, when we create a loop file image. This means we append ".img"
@@ -151,9 +149,16 @@ func storagePoolCreateLocal(state *state.State, id int64, req api.StoragePoolsPo
}
}
- // Success, update the closure to mark that the changes should be kept.
- tryUndo = false
+ // Set storage pool node to storagePoolCreated.
+ err = state.Cluster.Transaction(func(tx *db.ClusterTx) error {
+ return tx.StoragePoolNodeCreated(id)
+ })
+ if err != nil {
+ return nil, err
+ }
+ logger.Debug("Marked storage pool local status as created", log.Ctx{"pool": req.Name})
+ revert.Success()
return updatedConfig, nil
}
From 6aede4c05f537a80645f43531baa3bd784dbc660 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Tue, 1 Dec 2020 13:59:16 +0000
Subject: [PATCH 15/16] lxd/db/storage/pools: Removes unused function
StoragePoolErrored
Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
lxd/db/storage_pools.go | 5 -----
1 file changed, 5 deletions(-)
diff --git a/lxd/db/storage_pools.go b/lxd/db/storage_pools.go
index 402bc10673..8f3b880588 100644
--- a/lxd/db/storage_pools.go
+++ b/lxd/db/storage_pools.go
@@ -467,11 +467,6 @@ func (c *ClusterTx) StoragePoolCreated(name string) error {
return c.storagePoolState(name, storagePoolCreated)
}
-// StoragePoolErrored sets the state of the given pool to "Errored".
-func (c *ClusterTx) StoragePoolErrored(name string) error {
- return c.storagePoolState(name, storagePoolErrored)
-}
-
func (c *ClusterTx) storagePoolState(name string, state int) error {
stmt := "UPDATE storage_pools SET state=? WHERE name=?"
result, err := c.tx.Exec(stmt, state, name)
From b7041bd2ea41de773da9c793573c8e682eebb301 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Tue, 1 Dec 2020 14:01:00 +0000
Subject: [PATCH 16/16] lxd/db/storage/pools: Updates comment on
StoragePoolCreated
Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
lxd/db/storage_pools.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lxd/db/storage_pools.go b/lxd/db/storage_pools.go
index 8f3b880588..57f180bc0f 100644
--- a/lxd/db/storage_pools.go
+++ b/lxd/db/storage_pools.go
@@ -462,7 +462,7 @@ func (c *ClusterTx) CreatePendingStoragePool(node, name, driver string, conf map
return nil
}
-// StoragePoolCreated sets the state of the given pool to "Created".
+// StoragePoolCreated sets the state of the given pool to storagePoolCreated.
func (c *ClusterTx) StoragePoolCreated(name string) error {
return c.storagePoolState(name, storagePoolCreated)
}
More information about the lxc-devel
mailing list