Пример #1
0
            if snapshot_name_prefix:
                backup.set_snapshot_name_prefix(snapshot_name_prefix)
            else:
                backup.set_snapshot_name_prefix(config['global']['snapshot_name_prefix'])

            lock_file = open('/tmp/proxmox-rbd-backup.lock', 'w')
            lock_file.write(str(os.getpid()))
            lock_file.close()

            if not vms_uuid and not vm_name_match and not vms_id:
                backup.run_backup(allow_using_any_existing_snapshot=allow_using_any_existing_snapshot)
                os.remove('/tmp/proxmox-rbd-backup.lock')
                exit(0)

            existing_vms = backup.get_vms_proxmox()
            tmp_vms = []

            if vms_uuid and len(vms_uuid) > 0:
                for vm_uuid in vms_uuid:
                    for vm in existing_vms:
                        if vm.uuid == vm_uuid:
                            tmp_vms.append(vm)
                            break

            if vms_id and len(vms_id) > 0:
                for vm_id in vms_id:
                    for vm in existing_vms:
                        if vm.id == vm_id:
                            tmp_vms.append(vm)
                            break