From d8e94a47be9931deb5b32ac71737f8469bd891ad Mon Sep 17 00:00:00 2001 From: yanxuean Date: Wed, 17 Feb 2016 17:35:34 +0800 Subject: [PATCH] reclaim storageVolume when CreateStorageVol fail Signed-off-by: yanxuean --- pkg/libvirttools/libvirt_storage.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/libvirttools/libvirt_storage.go b/pkg/libvirttools/libvirt_storage.go index 30c0af9ca..daf676f74 100644 --- a/pkg/libvirttools/libvirt_storage.go +++ b/pkg/libvirttools/libvirt_storage.go @@ -111,6 +111,7 @@ func (pool *libvirtStoragePool) CreateStorageVol(def *libvirtxml.StorageVolume) // Here we work around this problem by refreshing the pool // which invokes acquiring volume info. if err := pool.p.Refresh(0); err != nil { + v.Delete(0) return nil, fmt.Errorf("failed to refresh the storage pool: %v", err) } return &libvirtStorageVolume{Mutex: pool.Mutex, name: def.Name, v: v}, nil