Git Product home page Git Product logo

Comments (14)

Aleksey-Maksimov avatar Aleksey-Maksimov commented on July 22, 2024

Any news?

from ovirtbackup.

adiazc87 avatar adiazc87 commented on July 22, 2024

Work with oVirt 4.0?

Thanks @wefixit-AT

from ovirtbackup.

Aleksey-Maksimov avatar Aleksey-Maksimov commented on July 22, 2024

Yes. Works.
https://blog.it-kb.ru/2016/10/07/install-ovirt-4-0-part-12-backup-and-restore-vm-in-ovirt-cluster-with-ovirtbackup-scripts/

from ovirtbackup.

wefixit-AT avatar wefixit-AT commented on July 22, 2024

Hi, yes it works with oVirt 4.0 but not with the latest ovirt sdk4. I started working on it but it's not so easy because there are zero documentation and all information's have to gather from the python ovirt library or trough the engine java source.

from ovirtbackup.

adiazc87 avatar adiazc87 commented on July 22, 2024

It works correctly, thanks for everything

from ovirtbackup.

mykaul avatar mykaul commented on July 22, 2024

@wefixit-AT - there are many examples @ https://github.com/oVirt/ovirt-engine-sdk/tree/master/sdk/examples (and we'll add more).
Also, the oVirt Ansible module uses it and can be used as a good reference.

from ovirtbackup.

wefixit-AT avatar wefixit-AT commented on July 22, 2024

Hi, examples are good but a documentation is much better. It's hard for software engineers to learn by try and error or copy/paste from examples :-(
On the other hand I work in my one-man company currently 14-16 hours from monday to sunday. When I find a reliable employee I will finish all the work for my open source and research projects.

from ovirtbackup.

KKoukiou avatar KKoukiou commented on July 22, 2024

Hi, I am opening discussion for this issue since I am willing to implement the support for the new api, though before starting to implement anything I would like some feedback.

There are two main approaches that I can see right now:

My first thought was that we should have both ovirt-engine-sdk-python packages installed on the system (although they have the same name it can be done by installing the packages with -I option in pip), and support both APIs in the same file. This should be done by importing the default module or if only one available, the existing module, and then having some common interface for the API calls that we need, which will map us to the right API function call.

The other approach that we could follow, is completely separate the support for the new API into different branch, however this is not preferable in my opinion, since it will results it double effort to maintain the project.

Please let me know your thoughts on these.

from ovirtbackup.

mykaul avatar mykaul commented on July 22, 2024

Here are my thoughts on moving from SDK to SDK4:

  • There is an advantage of coexistence - it allows to migrate function by function, module by module, while keeping functionality working. This is what ovirt-system-tests has done successfully.
  • If going with a clean sheet approach, I'd consider doing it using the oVirt Ansible modules, creating roles and then playbacks for backup and restore. It is based on the the Python SDK4, it is more integrated with anything else you'd like to automate (using Ansible) and I'd reckon roles can be re-used in other playbooks. I feel a lot of boilerplate code would be spared this way as well, which otherwise you'd have to implement (or copy-paste from the oVirt Ansible modules - also a reasonable idea).
    We also have an implementation of ovirt-system-tests which is using only the Ansible modules.

from ovirtbackup.

wefixit-AT avatar wefixit-AT commented on July 22, 2024

Does anybody has ideas, or worked on moving to sdk4 or to ansible?

from ovirtbackup.

zyxobo avatar zyxobo commented on July 22, 2024

I managed to make Ansible role with tasks like this:

---
# tasks file for ovbackup
- name: Backup VMs via oVirt engine
  block:
  - name: Return current time
    local_action:
      module: command
      cmd: 'date +%Y%m%dT%H%M%S'
    register: current_time
    changed_when: false
  - name: Obtain SSO token
    local_action:
      module: ovirt_auth
      url: "{{ovirt_url}}"
      username: "{{ovirt_user}}"
      ca_file: "{{ovirt_ca}}"
      password: "{{ovirt_pass}}"
    run_once: True
  - name: "Create snapshots of virtual machines"
    local_action:
      module: ovirt_snapshot
      auth: "{{ovirt_auth}}"
      vm_name: "{{vm_name}}"
      description: "{{snapshot_name}}"
      use_memory: false
      timeout: 600
    register: snapshot
  - name: "Gather info for snapshots of virtual machines"
    local_action:
      module: ovirt_snapshot_info
      auth: "{{ovirt_auth}}"
      vm: "{{vm_name}}"
      description: "{{snapshot_name}}"
    register: result
  - name: "Snapshots statuses"
    debug:
      msg: "{{snapshot_name}}: {{ result.ovirt_snapshots[0].snapshot_status }}"
  - name: "Pause for 1 minute to settle down"
    pause:
      minutes: 1
  - name: "Create clones of virtual machines"
    local_action:
      module: ovirt_vm
      auth: "{{ovirt_auth}}"
      snapshot_vm: "{{vm_name}}"
      snapshot_name: "{{snapshot_name}}"
      name: "{{vm_clone_name}}"
      state: present
      timeout: 3600
  - name: "Delete snapshots of virtual machines"
    local_action:
      module: ovirt_snapshot
      auth: "{{ovirt_auth}}"
      vm_name: "{{vm_name}}"
      state: absent
      snapshot_id: "{{ snapshot.id }}"
      timeout: 600
  - name: "Export images of virtual machines"
    local_action:
      module: ovirt_vm
      auth: "{{ovirt_auth}}"
      name: "{{vm_clone_name}}"
      state: exported
      cluster: "{{cluster}}"
      export_domain: "{{export_domain}}"
      timeout: 3600
  - name: "Remove clones of virtual machines"
    local_action:
      module: ovirt_vm
      auth: "{{ovirt_auth}}"
      state: absent
      name: "{{vm_clone_name}}"
      timeout: 600
  always:
  - name: Revoke the SSO token
    local_action:
      module: ovirt_auth
      state: absent
      ovirt_auth: "{{ovirt_auth}}"

Unfortunately I couldn't find a way for housekeeping backups in export domain.

from ovirtbackup.

wefixit-AT avatar wefixit-AT commented on July 22, 2024

Thanks I try it on my environment.
I played the last weeks with snapshots and duplicity to find a backup solution which does not need the SDK. The disadvantage is that you have to mount the raw image files and identify the main files an snapshots of the VM's but in case of a disaster recovery it's okay for me.

from ovirtbackup.

zyxobo avatar zyxobo commented on July 22, 2024

Be aware, you need to reduce parallel tasks. I do this by setting serial = 2:

---
- hosts: backup_vms
  gather_facts: no
  serial: 2
  roles:
    - role: ovbackup

If you need, my defaults for role look like this:

---
# defaults file for ovbackup

ovirt_url: https://ovirt.engine.host/ovirt-engine/api
ovirt_ca: /path/to/ovirt/ca.crt
ovirt_user: ovirtuser@internal
ovirt_pass: ovirtpass

cluster: ovirt_cluster
snapshot_name: ovbackup_playbook
export_domain: export
vm_name: "{{ inventory_hostname | regex_replace('^([a-z0-9-]+)\\..*$', '\\1') }}"
vm_clone_name: "{{vm_name}}_BCK_{{current_time.stdout}}"

I think it would be quite neat solution if I manage somehow to delete old backups from export domain.

from ovirtbackup.

wefixit-AT avatar wefixit-AT commented on July 22, 2024

Done with the latest pull request

from ovirtbackup.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.