File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -746,13 +746,13 @@ func (d *disk) UpdatableFields(oldDevice Type) []string {
746
746
func (d * disk ) Register () error {
747
747
d .logger .Debug ("Initialising mounted disk ref counter" )
748
748
749
- // Load the pool.
750
- pool , err := storagePools .LoadByInstance (d .state , d .inst )
751
- if err != nil {
752
- return err
753
- }
754
-
755
749
if d .config ["path" ] == "/" {
750
+ // Load the pool.
751
+ pool , err := storagePools .LoadByInstance (d .state , d .inst )
752
+ if err != nil {
753
+ return err
754
+ }
755
+
756
756
// Try to mount the volume that should already be mounted to reinitialize the ref counter.
757
757
_ , err = pool .MountInstance (d .inst , nil )
758
758
if err != nil {
@@ -764,6 +764,12 @@ func (d *disk) Register() error {
764
764
return err
765
765
}
766
766
767
+ // Load the pool.
768
+ pool , err := storagePools .LoadByName (d .state , d .config ["pool" ])
769
+ if err != nil {
770
+ return fmt .Errorf ("Failed to get storage pool %q: %w" , d .config ["pool" ], err )
771
+ }
772
+
767
773
// Parse the volume name and path.
768
774
volFields := strings .SplitN (d .config ["source" ], "/" , 2 )
769
775
volName := volFields [0 ]
You can’t perform that action at this time.
0 commit comments