Skip to content
This repository has been archived by the owner on Feb 9, 2022. It is now read-only.

Commit

Permalink
Merge pull request #65 from oVirt/rename_ovirt_vms_to_ovirt_vm
Browse files Browse the repository at this point in the history
- remove ovirt_vms.py module
- remove plural naming to support Ansible 2.7.2
- New release 1.1.4
  • Loading branch information
shenitzky authored Jan 14, 2019
2 parents b7399c1 + 0ac9621 commit 9c83184
Show file tree
Hide file tree
Showing 28 changed files with 38 additions and 2,172 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The `oVirt.disaster-recovery` role responsible to manage the disaster recovery s
Requirements
------------

* Ansible version 2.5 or higher
* Ansible version 2.7.2 or higher
* Python SDK version 4.2.4 or higher

Role Variables
Expand Down
4 changes: 2 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash

VERSION="1.1.4"
MILESTONE=master
RPM_RELEASE="1.1.$MILESTONE.$(date -u +%Y%m%d%H%M%S)"
MILESTONE=
RPM_RELEASE="1"

ROLE_NAME="oVirt.disaster-recovery"
PACKAGE_NAME="ovirt-ansible-disaster-recovery"
Expand Down
9 changes: 0 additions & 9 deletions library/README.md

This file was deleted.

2,131 changes: 0 additions & 2,131 deletions library/ovirt_vms.py

This file was deleted.

2 changes: 1 addition & 1 deletion meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ galaxy_info:
description: "Disaster recovery for oVirt engine"
company: Red Hat, Inc.
license: Apache License 2.0
min_ansible_version: 2.5
min_ansible_version: 2.7.2
platforms:
- name: EL
versions:
Expand Down
7 changes: 6 additions & 1 deletion ovirt-ansible-disaster-recovery.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Group: Virtualization/Management
BuildArch: noarch
Url: http://www.ovirt.org

Requires: ansible >= 2.5
Requires: ansible >= 2.7.2

%description
This Ansible role provide funtionality to perform disaster recovery for oVirt engine.
Expand All @@ -37,6 +37,11 @@ sh build.sh install
%license LICENSE

%changelog
* Thu Jan 10 2019 Eyal Shenitzky <[email protected]> - 1.1.4-1
- Rename all tasks module calls from plural to singular
- Use ovirt_vm.py module from Ansible lib instead local lib ovirt_vms.py module
- Required Ansible >= 2.7.2

* Thu Oct 31 2018 Maor Lipchuk <[email protected]> - 1.1.3-1
- rhbz#1640155 - Use vars instead of inline variables for include_tasks

Expand Down
2 changes: 1 addition & 1 deletion tasks/clean/remove_domain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# If we get the exception "Cannot deactivate Master Data Domain while there are running tasks on its Data Center."
# We should wait for some time and try again
- name: Remove storage domain
ovirt_storage_domains:
ovirt_storage_domain:
state: absent
id: "{{ sd.id }}"
name: "{{ sd.name }}"
Expand Down
4 changes: 2 additions & 2 deletions tasks/clean/remove_domain_process.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
when: sd.data_centers is not defined

- name: Detached storage domain - Fetch active host for remove
ovirt_hosts_facts:
ovirt_host_facts:
pattern: "status=up"
auth: "{{ ovirt_auth }}"
when: sd.data_centers is not defined

- name: Attached storage domain - Fetch active host for remove
ovirt_hosts_facts:
ovirt_host_facts:
pattern: "status=up and storage={{ sd.name }}"
auth: "{{ ovirt_auth }}"
when: sd.data_centers is defined
Expand Down
2 changes: 1 addition & 1 deletion tasks/clean/remove_invalid_filtered_master_domains.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- block:
- name: Fetch invalid storage domain for remove
ovirt_storage_domains_facts:
ovirt_storage_domain_facts:
pattern: name={{ storage['dr_' + dr_source_map + '_name'] }} and {{ dr_inactive_domain_search }}
auth: "{{ ovirt_auth }}"

Expand Down
2 changes: 1 addition & 1 deletion tasks/clean/remove_valid_filtered_master_domains.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- block:
- name: Fetch active/maintenance/detached storage domain for remove
ovirt_storage_domains_facts:
ovirt_storage_domain_facts:
pattern: name={{ storage['dr_' + dr_source_map + '_name'] }} and datacenter={{ storage['dr_' + dr_source_map + '_dc_name'] }} and {{ dr_active_domain_search }} or
name={{ storage['dr_' + dr_source_map + '_name'] }} and datacenter={{ storage['dr_' + dr_source_map + '_dc_name'] }} and {{ dr_maintenance_domain_search }} or
name={{ storage['dr_' + dr_source_map + '_name'] }} and {{ dr_unattached_domain_search }}
Expand Down
2 changes: 1 addition & 1 deletion tasks/clean/remove_vms.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- block:
- name: Remove diskless VMs
ovirt_vms:
ovirt_vm:
state: absent
name: "{{ vm.name }}"
auth: "{{ ovirt_auth }}"
Expand Down
2 changes: 1 addition & 1 deletion tasks/clean/shutdown_vm.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- block:
- name: Shutdown VM
ovirt_vms:
ovirt_vm:
state: stopped
name: "{{ vms.name }}"
force: True
Expand Down
2 changes: 1 addition & 1 deletion tasks/clean/shutdown_vms.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
- block:
# Get all the running VMs related to a storage domain and shut them down
- name: Fetch VMs in the storage domain
ovirt_vms_facts:
ovirt_vm_facts:
pattern: status != down and storage.name={{ storage['dr_' + dr_source_map + '_name'] }} and datacenter={{ storage['dr_' + dr_source_map + '_dc_name'] }}
auth: "{{ ovirt_auth }}"

Expand Down
4 changes: 2 additions & 2 deletions tasks/clean/update_ovf_store.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
- block:
- name: Fetch storage domain only if active
ovirt_storage_domains_facts:
ovirt_storage_domain_facts:
pattern: status = active and storage.name={{ storage['dr_' + dr_source_map + '_name'] }}
auth: "{{ ovirt_auth }}"

- name: Update OVF store for active storage domain
ovirt_storage_domains:
ovirt_storage_domain:
state: update_ovf_store
name: "{{ iscsi_storage['dr_' + dr_source_map + '_name'] }}"
auth: "{{ ovirt_auth }}"
Expand Down
4 changes: 2 additions & 2 deletions tasks/clean_engine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,14 @@
loop_var: storage

- name: Fetch leftover storage domains
ovirt_storage_domains_facts:
ovirt_storage_domain_facts:
pattern: type != glance
auth: "{{ ovirt_auth }}"

# TODO: Document that behavior
# Remove VMs only if there are no data storage domains left in the setup
- name: Fetch leftover VMs in the setup
ovirt_vms_facts:
ovirt_vm_facts:
pattern: status = down
auth: "{{ ovirt_auth }}"
when: dr_clean_orphaned_vms and ovirt_storage_domains | length == 0
Expand Down
2 changes: 1 addition & 1 deletion tasks/recover/add_domain.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- block:
- name: Fetch available hosts in data center
ovirt_hosts_facts:
ovirt_host_facts:
pattern: "status=up and datacenter={{ storage['dr_' + dr_target_host + '_dc_name'] }}"
auth: "{{ ovirt_auth }}"
- block:
Expand Down
2 changes: 1 addition & 1 deletion tasks/recover/add_fcp_domain.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- block:
- name: Import FCP storage domain
ovirt_storage_domains:
ovirt_storage_domain:
state: imported
id: "{{ fcp_storage['dr_domain_id'] }}"
name: "{{ fcp_storage['dr_' + dr_target_host + '_name']|default('') }}"
Expand Down
2 changes: 1 addition & 1 deletion tasks/recover/add_glusterfs_domain.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- block:
- name: Add Gluster storage domain
ovirt_storage_domains:
ovirt_storage_domain:
name: "{{ gluster_storage['dr_' + dr_target_host + '_name'] }}"
critical_space_action_blocker: "{{ gluster_storage['dr_critical_space_action_blocker'] }}"
domain_function: "{{ gluster_storage['dr_storage_domain_type'] }}"
Expand Down
6 changes: 3 additions & 3 deletions tasks/recover/add_iscsi_domain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Every connect should be done using a different ip
- block:
- name: Login to iSCSI targets
ovirt_hosts:
ovirt_host:
state: iscsilogin
name: "{{ ovirt_hosts[0].name }}"
auth: "{{ ovirt_auth }}"
Expand All @@ -20,7 +20,7 @@
loop_var: dr_target

- name: Import iSCSI storage domain
ovirt_storage_domains:
ovirt_storage_domain:
state: imported
id: "{{ iscsi_storage['dr_domain_id'] }}"
name: "{{ iscsi_storage['dr_' + dr_target_host + '_name']|default('') }}"
Expand All @@ -37,7 +37,7 @@
username: "{{ iscsi_storage['dr_' + dr_target_host + '_username']|default('') }}"
password: "{{ iscsi_storage['dr_' + dr_target_host + '_password']|default('') }}"
address: "{{ iscsi_storage['dr_' + dr_target_host + '_address'] }}"
# We use target since state imported in ovirt_storage_domains.py creates a storage domain
# We use target since state imported in ovirt_storage_domain.py creates a storage domain
# which calls login, therfore we must have a target althout the targets were already connected before.
# Therefore passing the first target in the list as a transient target.
target: "{{ dr_target }}"
Expand Down
2 changes: 1 addition & 1 deletion tasks/recover/add_nfs_domain.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- block:
- name: Add NFS storage domain
ovirt_storage_domains:
ovirt_storage_domain:
name: "{{ nfs_storage['dr_' + dr_target_host + '_name'] }}"
domain_function: "{{ nfs_storage['dr_storage_domain_type'] }}"
critical_space_action_blocker: "{{ nfs_storage['dr_critical_space_action_blocker'] }}"
Expand Down
2 changes: 1 addition & 1 deletion tasks/recover/add_posixfs_domain.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- block:
- name: Add posix storage domain
ovirt_storage_domains:
ovirt_storage_domain:
name: "{{ posix_storage['dr_' + dr_target_host + '_name'] }}"
critical_space_action_blocker: "{{ posix_storage['dr_critical_space_action_blocker'] }}"
domain_function: "{{ posix_storage['dr_storage_domain_type'] }}"
Expand Down
2 changes: 1 addition & 1 deletion tasks/recover/register_template.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- block:
- name: Register unregistered Template
ovirt_templates:
ovirt_template:
state: registered
storage_domain: "{{ storage.name }}"
id: "{{ unreg_template.id }}"
Expand Down
2 changes: 1 addition & 1 deletion tasks/recover/register_templates.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- block:
- name: Fetch unregistered Templates from storage domain
ovirt_storage_templates_facts:
ovirt_storage_template_facts:
nested_attributes: "id"
unregistered: True
storage_domain: "{{ storage.name }}"
Expand Down
2 changes: 1 addition & 1 deletion tasks/recover/register_vm.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- block:
- name: Register VMs
ovirt_vms:
ovirt_vm:
state: registered
storage_domain: "{{ storage.name }}"
id: "{{ unreg_vm.id }}"
Expand Down
3 changes: 2 additions & 1 deletion tasks/recover/register_vms.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- block:
- name: Fetch unregistered VMs from storage domain
ovirt_storage_vms_facts:
ovirt_storage_vm_facts:
nested_attributes: "id"
unregistered: True
storage_domain: "{{ storage.name }}"
Expand All @@ -16,6 +16,7 @@
with_items: "{{ ovirt_storage_vms }}"
# We use loop_control so storage.name will not be overriden by the nested loop.
loop_control:

loop_var: unreg_vm
ignore_errors: "{{ dr_ignore_error_recover }}"
tags:
Expand Down
2 changes: 1 addition & 1 deletion tasks/recover/run_vms.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- block:
- name: Run VMs
ovirt_vms:
ovirt_vm:
state: running
name: "{{ vms.name }}"
wait: False
Expand Down
2 changes: 1 addition & 1 deletion tasks/recover_engine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
# Get all the active storage domains in the setup to register
# all the templates/VMs/Disks
- name: Fetching active storage domains
ovirt_storage_domains_facts:
ovirt_storage_domain_facts:
pattern: "status=active"
auth: "{{ ovirt_auth }}"

Expand Down
2 changes: 1 addition & 1 deletion tasks/unregister_entities.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

# Get all the running VMs and shut them down
- name: Fetch running VMs in the setup
ovirt_vms_facts:
ovirt_vm_facts:
pattern: status = up
auth: "{{ ovirt_auth }}"

Expand Down

0 comments on commit 9c83184

Please sign in to comment.