|
|
|
|
@ -7,6 +7,7 @@ import (
|
|
|
|
|
"errors"
|
|
|
|
|
"fmt"
|
|
|
|
|
"path/filepath"
|
|
|
|
|
"reflect"
|
|
|
|
|
"strings"
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
@ -234,9 +235,12 @@ func validateLiveBackupDefinition(definition *libvirtxml.Domain, managedRootPath
|
|
|
|
|
func domainBackingChainPresent(store *libvirtxml.DomainDiskBackingStore) bool {
|
|
|
|
|
for store != nil {
|
|
|
|
|
// libvirt commonly serializes an empty <backingStore/> sentinel for a
|
|
|
|
|
// standalone qcow2 disk. Only a described source/format is an actual
|
|
|
|
|
// backing layer which makes the portable snapshot unsafe.
|
|
|
|
|
if store.Source != nil || store.Format != nil {
|
|
|
|
|
// standalone qcow2 disk. libvirtxml materializes that sentinel with a
|
|
|
|
|
// non-nil, zero-valued Source, so pointer presence alone is not evidence
|
|
|
|
|
// of a backing layer. Any actual source content, format or index remains
|
|
|
|
|
// fail-closed because it makes the portable snapshot unsafe.
|
|
|
|
|
if store.Index != 0 || store.Format != nil ||
|
|
|
|
|
domainDiskSourcePresent(store.Source) {
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
store = store.BackingStore
|
|
|
|
|
@ -244,6 +248,10 @@ func domainBackingChainPresent(store *libvirtxml.DomainDiskBackingStore) bool {
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func domainDiskSourcePresent(source *libvirtxml.DomainDiskSource) bool {
|
|
|
|
|
return source != nil && !reflect.ValueOf(*source).IsZero()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func validateStandaloneQCOW2Volume(volume qcow2VolumeInspector, expectedCapacity uint64) (*libvirt.StorageVolInfo, error) {
|
|
|
|
|
info, err := validateQCOW2Volume(volume, expectedCapacity)
|
|
|
|
|
if err != nil {
|
|
|
|
|
|