Пример #1
0
            vms_id = args.vm_id
            vm_name_match = args.vm_name
            snapshot_name_prefix = args.snapshot_name_prefix
            allow_using_any_existing_snapshot = args.allow_using_any_existing_snapshot

            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: