public inbox for cluster-cvs@sourceware.org help / color / mirror / Atom feed
From: Lon Hohberger <lon@fedoraproject.org> To: cluster-cvs-relay@redhat.com Subject: cluster: RHEL5 - fence: Make fence_xvmd detect Xen or KVM Date: Thu, 09 Apr 2009 20:42:00 -0000 [thread overview] Message-ID: <20090409204128.AB3A112020E@lists.fedorahosted.org> (raw) Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=f4c13e8e1bb1c58d03f2cda7380a5173dea025f8 Commit: f4c13e8e1bb1c58d03f2cda7380a5173dea025f8 Parent: a72a13f8acd9747fc63299ffd265e3176fb95b52 Author: Lon Hohberger <lhh@redhat.com> AuthorDate: Thu Apr 9 16:17:29 2009 -0400 Committer: Lon Hohberger <lhh@redhat.com> CommitterDate: Thu Apr 9 16:17:29 2009 -0400 fence: Make fence_xvmd detect Xen or KVM Signed-off-by: Lon Hohberger <lhh@redhat.com> --- fence/agents/xvm/fence_xvmd.c | 36 ++++++++++++++++++++++++++++++++++-- fence/agents/xvm/options.c | 2 +- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/fence/agents/xvm/fence_xvmd.c b/fence/agents/xvm/fence_xvmd.c index 1ca9e53..3cba111 100644 --- a/fence/agents/xvm/fence_xvmd.c +++ b/fence/agents/xvm/fence_xvmd.c @@ -60,6 +60,38 @@ static int reload_key; int cleanup_xml(char *xmldesc, char **ret, size_t *retsz); + +static char *hypervisor_uris[] = { + "xen:///", + "qemu:///system", + NULL +}; + + +virConnectPtr +find_hypervisor(fence_xvm_args_t *args) +{ + virConnectPtr vp; + int x; + + if (args->uri) + return virConnectOpen(args->uri); + + for (x = 0; hypervisor_uris[x]; x++) { + vp = virConnectOpen(hypervisor_uris[x]); + if (vp) + break; + } + + if (!vp) + return NULL; + + args->uri = strdup(hypervisor_uris[x]); + + return vp; +} + + int connect_tcp(fence_req_t *req, fence_auth_type_t auth, void *key, size_t key_len) @@ -598,7 +630,7 @@ xvmd_loop(cman_handle_t ch, void *h, int fd, fence_xvm_args_t *args, virt_list_t *vl = NULL; virt_state_t *dom = NULL; - vp = virConnectOpen(args->uri); + vp = find_hypervisor(args); if (!vp) perror("virConnectOpen"); @@ -655,7 +687,7 @@ xvmd_loop(cman_handle_t ch, void *h, int fd, fence_xvm_args_t *args, continue; /* Request and/or timeout: open connection */ - vp = virConnectOpen(args->uri); + vp = find_hypervisor(args); if (!vp) { printf("NOTICE: virConnectOpen(): %s; cannot fence!\n", strerror(errno)); diff --git a/fence/agents/xvm/options.c b/fence/agents/xvm/options.c index 2c1b5be..0ba422d 100644 --- a/fence/agents/xvm/options.c +++ b/fence/agents/xvm/options.c @@ -422,7 +422,7 @@ args_init(fence_xvm_args_t *args) args->addr = NULL; args->domain = NULL; args->key_file = strdup(DEFAULT_KEY_FILE); - args->uri = strdup(DEFAULT_HYPERVISOR_URI); + args->uri = NULL; args->op = FENCE_REBOOT; args->hash = DEFAULT_HASH; args->auth = DEFAULT_AUTH;
reply other threads:[~2009-04-09 20:42 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20090409204128.AB3A112020E@lists.fedorahosted.org \ --to=lon@fedoraproject.org \ --cc=cluster-cvs-relay@redhat.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).