Skip to content

Commit

Permalink
check if vms have snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Rodrigues authored and pstorz committed Dec 16, 2019
1 parent 8f2f347 commit 7dcaaa9
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions core/src/plugins/filed/BareosFdPluginOvirt.py
Expand Up @@ -33,7 +33,7 @@
# sent to the audit log:
APPLICATION_NAME = 'BareOS Ovirt plugin'

# Find the disks section:
# OVF Namespaces
OVF_NAMESPACES = {
'ovf': 'http://schemas.dmtf.org/ovf/envelope/1/',
'xsi': 'http://www.w3.org/2001/XMLSchema-instance'
Expand Down Expand Up @@ -484,6 +484,18 @@ def prepare_vm_backup(self, context, options):

return bRCs['bRC_Error']
else:
# Locate the service that manages the virtual machine:
self.vm_service = self.vms_service.vm_service(self.vm.id)

# check if vm have snapshosts
snaps_service = self.vm_service.snapshots_service()
if len(snaps_service.list()) > 1:
bareosfd.JobMessage(
context, bJobMessageType['M_FATAL'],
"Error '%s' already have snapshosts. This is not supported\n" %
(self.vm.name))
return bRCs['bRC_Error']

bareosfd.DebugMessage(
context, 100, "Start the backup of VM %s\n" %
(self.vm.name))
Expand All @@ -507,9 +519,6 @@ def prepare_vm_backup(self, context, options):
}
})

# Locate the service that manages the virtual machine:
self.vm_service = self.vms_service.vm_service(self.vm.id)

# create vm snapshots
self.create_vm_snapshot(context)

Expand Down

0 comments on commit 7dcaaa9

Please sign in to comment.