Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 595383

Summary: Provide fence-rhev agent that uses the RHEV REST API
Product: Red Hat Enterprise Linux 6 Reporter: Perry Myers <pmyers>
Component: fence-agentsAssignee: Marek Grac <mgrac>
Status: CLOSED ERRATA QA Contact: Brandon Perkins <bperkins>
Severity: medium Docs Contact:
Priority: urgent    
Version: 6.0CC: acathrow, apevec, cluster-maint, degts, djansa, djuran, eglynn, gjansen, jlabocki, jwest, liko, markmc, ssaha, tao
Target Milestone: rcKeywords: ZStream
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: fence-agents-3.0.12-9.el6 Doc Type: Bug Fix
Doc Text:
The package has been updated to provide a fencing agent that is able to communicate with Red Hat Enterprise Virtualization Manager, allowing virtual machines to be fenced.
Story Points: ---
Clone Of:
: 595385 (view as bug list) Environment:
Last Closed: 2011-05-19 14:21:16 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 618705, 681669, 681674, 688267, 731161, 731166    
Bug Blocks: 595385, 595456, 607640, 642695, 681652, 688396, 688400    

Description Perry Myers 2010-05-24 13:59:05 UTC
Description of problem:
fence_dcloud implementation might be a longer term target since it involves getting dcloud support formally into RHEL.  In addition, dcloud packages won't be in RHEL5.  So we need a fence_rhev agent that uses the RHEV REST API instead of relying on the generic dcloud support.  Eventually in RHEL6 fence_rhev can be replaced by fence_dcloud.  But we need a shorter term solution and a REST based fence agent should be simple to develop and test.

This bug is dependent on full support for the RHEV REST API.  Once a bug has been filed on that the dependency should be set.

Comment 1 Mark McLoughlin 2010-07-02 08:22:43 UTC
Simple example of using the REST API to stop a VM:

---
#!/bin/bash

VM_STOP_URI="vms/9/stop"

HOST="localhost"
PORT="8099"
BASE="/rhevm-api-mock/"
USER="Aladdin"
PASSWD="open sesame"

b64()
{
    u="$1"; shift
    p="$1"; shift
    t=$(mktemp)
    echo -n "$u:$p" > $t
    base64 $t
    rm -f $t
}

AUTH=$(b64 "$USER" "$PASSWD")

nc $HOST $PORT <<EOF
POST $BASE$VM_STOP_URI HTTP/1.1
Host: $HOST
Authorization: Basic $AUTH
Content-type: application/xml
Content-length: 9

<action/>
EOF
---

or if you use wget:

---
wget --header=Accept:application/xml --header=Content-Type:application/xml --http-user=$USER --http-password=$PASSWD --post-data="<action/>" http://$HOST:$PORT/$BASE$VM_STOP_URI
---

Comment 2 Alan Pevec 2010-07-02 08:59:03 UTC
(In reply to comment #1)
> Simple example of using the REST API to stop a VM:

Fence agent needs to ensure machine is really down, would successful execution (200 response code I assume?) of this service guarantee that VM is really killed?

Comment 3 Perry Myers 2010-07-02 11:16:51 UTC
Fence agents are only as reliable/good as the devices they connect to.  We have the same issue for example with power fence devices.  i.e. you connect to a power fence device and tell it to shut down the host.  You have to trust that when the hardware device returns success that it told the truth.

Now that being said, we usually do a combination of 'device off' and then 'status' to verify that the device did turn off.  So we'll do the same for fence_rhev, calling 'power off vm' and waiting for status 200.  And then calling 'status vm' to double check that the vm turned off.

If the API lies to us... well, let's just make sure the API is functionally correct :)

Comment 5 Brandon Perkins 2010-07-14 16:14:20 UTC
qa_ack+

Comment 12 Jaromir Hradilek 2010-10-20 12:23:18 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
The package has been updated to provide a fencing agent that is able to communicate with Red Hat Enterprise Virtualization Manager, allowing virtual machines to be fenced.

Comment 13 Perry Myers 2010-11-27 13:33:40 UTC
*** Bug 548595 has been marked as a duplicate of this bug. ***

Comment 18 errata-xmlrpc 2011-05-19 14:21:16 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-0745.html