resolve minor race conditions

This commit is contained in:
2026-07-10 21:29:51 +00:00
parent 027ed2dce6
commit f3defe4157
3 changed files with 10 additions and 4 deletions
+5
View File
@@ -140,7 +140,9 @@ func (pve ProxmoxClient) Node(host *Node, nodeName string) error {
if err != nil {
return err
}
host.storageLock.Lock()
host.storage[storage.Name] = content
host.storageLock.Unlock()
}
return nil
})
@@ -260,7 +262,10 @@ func GetVolumeInfo(host *Node, volume string) (*Volume, error) {
volumeFile := volumeObj[""]
volumeStorage := strings.Split(volumeFile, ":")[0]
host.storageLock.Lock()
storage, ok := host.storage[volumeStorage]
host.storageLock.Unlock()
if !ok {
return &volumeData, fmt.Errorf("volume %s claims to be in storage %s but storage was not found", volume, volumeStorage)
}