From 2635e075b9dc8625f3299cd07eeee875f2456a8d Mon Sep 17 00:00:00 2001 From: Lon Hohberger Date: Wed, 13 Jan 2010 13:52:55 -0500 Subject: [PATCH] Pass source VM UUID (if known) to backend Some backends (not yet implemented) which talk to management layers will have mappings for what VMs can control what other VMs. So, the source VM UUID of the original request needs to be sent along with the target VM UUID to the management layer for arbitration. Signed-off-by: Lon Hohberger --- include/server_plugin.h | 16 ++++++++-------- server/checkpoint.c | 9 ++++++--- server/libvirt-qpid.cpp | 10 +++++----- server/libvirt.c | 9 ++++++--- server/mcast.c | 6 +++--- server/null.c | 6 +++--- server/serial.c | 12 ++++++------ 7 files changed, 37 insertions(+), 31 deletions(-) diff --git a/include/server_plugin.h b/include/server_plugin.h index 834d5b9..38618eb 100644 --- a/include/server_plugin.h +++ b/include/server_plugin.h @@ -1,6 +1,6 @@ /* */ -#define PLUGIN_VERSION_LISTENER ((double)0.1) -#define PLUGIN_VERSION_BACKEND ((double)0.1) +#define PLUGIN_VERSION_LISTENER ((double)0.2) +#define PLUGIN_VERSION_BACKEND ((double)0.2) #define LISTENER_VER_SYM listener_plugin_version #define BACKEND_VER_SYM backend_plugin_version @@ -26,18 +26,18 @@ typedef int (*fence_null_callback)(const char *vm_name, /* Turn the VM 'off'. Returns 0 to caller if successful or nonzero if unsuccessful. */ -typedef int (*fence_off_callback)(const char *vm_name, uint32_t seqno, - void *priv); +typedef int (*fence_off_callback)(const char *vm_name, const char *src, + uint32_t seqno, void *priv); /* Turn the VM 'on'. Returns 0 to caller if successful or nonzero if unsuccessful. */ -typedef int (*fence_on_callback)(const char *vm_name, uint32_t seqno, - void *priv); +typedef int (*fence_on_callback)(const char *vm_name, const char *src, + uint32_t seqno, void *priv); /* Reboot a VM. Returns 0 to caller if successful or nonzero if unsuccessful. */ -typedef int (*fence_reboot_callback)(const char *vm_name, uint32_t seqno, - void *priv); +typedef int (*fence_reboot_callback)(const char *vm_name, const char *src, + uint32_t seqno, void *priv); /* Get status of a VM. Returns 0 to caller if VM is alive or nonzero if VM is not alive. */ diff --git a/server/checkpoint.c b/server/checkpoint.c index 9e6464d..47fbe0b 100644 --- a/server/checkpoint.c +++ b/server/checkpoint.c @@ -602,7 +602,8 @@ checkpoint_null(const char *vm_name, void *priv) static int -checkpoint_off(const char *vm_name, uint32_t seqno, void *priv) +checkpoint_off(const char *vm_name, const char *src, + uint32_t seqno, void *priv) { VALIDATE(priv); printf("[CKPT] OFF operation on %s seq %d\n", vm_name, seqno); @@ -612,7 +613,8 @@ checkpoint_off(const char *vm_name, uint32_t seqno, void *priv) static int -checkpoint_on(const char *vm_name, uint32_t seqno, void *priv) +checkpoint_on(const char *vm_name, const char *src, + uint32_t seqno, void *priv) { VALIDATE(priv); printf("[CKPT] ON operation on %s seq %d\n", vm_name, seqno); @@ -642,7 +644,8 @@ checkpoint_status(const char *vm_name, void *priv) static int -checkpoint_reboot(const char *vm_name, uint32_t seqno, void *priv) +checkpoint_reboot(const char *vm_name, const char *src, + uint32_t seqno, void *priv) { VALIDATE(priv); printf("[CKPT] REBOOT operation on %s seq %d\n", vm_name, seqno); diff --git a/server/libvirt-qpid.cpp b/server/libvirt-qpid.cpp index 7eea703..630600a 100644 --- a/server/libvirt-qpid.cpp +++ b/server/libvirt-qpid.cpp @@ -176,7 +176,7 @@ lq_null(const char *vm_name, void *priv) static int -lq_off(const char *vm_name, uint32_t seqno, void *priv) +lq_off(const char *vm_name, const char *src, uint32_t seqno, void *priv) { VALIDATE(priv); printf("[libvirt-qpid] OFF operation on %s\n", vm_name); @@ -188,7 +188,7 @@ lq_off(const char *vm_name, uint32_t seqno, void *priv) static int -lq_on(const char *vm_name, uint32_t seqno, void *priv) +lq_on(const char *vm_name, const char *src, uint32_t seqno, void *priv) { VALIDATE(priv); printf("[libvirt-qpid] ON operation on %s\n", vm_name); @@ -218,15 +218,15 @@ lq_status(const char *vm_name, void *priv) static int -lq_reboot(const char *vm_name, uint32_t seqno, void *priv) +lq_reboot(const char *vm_name, const char *src, uint32_t seqno, void *priv) { VALIDATE(priv); printf("[libvirt-qpid] REBOOT operation on %s\n", vm_name); - if (lq_off(vm_name, seqno, priv) != 0) + if (lq_off(vm_name, src, seqno, priv) != 0) return 1; sleep(1); - lq_on(vm_name, seqno, priv); + lq_on(vm_name, src, seqno, priv); return 1; } diff --git a/server/libvirt.c b/server/libvirt.c index 3415ed6..2b98b35 100644 --- a/server/libvirt.c +++ b/server/libvirt.c @@ -149,7 +149,8 @@ libvirt_null(const char *vm_name, void *priv) static int -libvirt_off(const char *vm_name, uint32_t seqno, void *priv) +libvirt_off(const char *vm_name, const char *src, + uint32_t seqno, void *priv) { struct libvirt_info *info = (struct libvirt_info *)priv; virDomainPtr vdp; @@ -198,7 +199,8 @@ libvirt_off(const char *vm_name, uint32_t seqno, void *priv) static int -libvirt_on(const char *vm_name, uint32_t seqno, void *priv) +libvirt_on(const char *vm_name, const char *src, + uint32_t seqno, void *priv) { struct libvirt_info *info = (struct libvirt_info *)priv; virDomainPtr vdp; @@ -288,7 +290,8 @@ libvirt_status(const char *vm_name, void *priv) static int -libvirt_reboot(const char *vm_name, uint32_t seqno, void *priv) +libvirt_reboot(const char *vm_name, const char *src, + uint32_t seqno, void *priv) { struct libvirt_info *info = (struct libvirt_info *)priv; virDomainPtr vdp, nvdp; diff --git a/server/mcast.c b/server/mcast.c index 5e2de84..cc59a99 100644 --- a/server/mcast.c +++ b/server/mcast.c @@ -250,15 +250,15 @@ do_fence_request_tcp(fence_req_t *req, mcast_info *info) response = info->cb->null((char *)req->domain, info->priv); break; case FENCE_ON: - response = info->cb->on((char *)req->domain, req->seqno, + response = info->cb->on((char *)req->domain, NULL, req->seqno, info->priv); break; case FENCE_OFF: - response = info->cb->off((char *)req->domain, req->seqno, + response = info->cb->off((char *)req->domain, NULL, req->seqno, info->priv); break; case FENCE_REBOOT: - response = info->cb->reboot((char *)req->domain, req->seqno, + response = info->cb->reboot((char *)req->domain, NULL, req->seqno, info->priv); break; case FENCE_STATUS: diff --git a/server/null.c b/server/null.c index 3fcd971..570700a 100644 --- a/server/null.c +++ b/server/null.c @@ -61,7 +61,7 @@ null_null(const char *vm_name, void *priv) static int -null_off(const char *vm_name, uint32_t seqno, void *priv) +null_off(const char *vm_name, const char *src, uint32_t seqno, void *priv) { VALIDATE(priv); printf("[Null] OFF operation on %s\n", vm_name); @@ -71,7 +71,7 @@ null_off(const char *vm_name, uint32_t seqno, void *priv) static int -null_on(const char *vm_name, uint32_t seqno, void *priv) +null_on(const char *vm_name, const char *src, uint32_t seqno, void *priv) { VALIDATE(priv); printf("[Null] ON operation on %s\n", vm_name); @@ -103,7 +103,7 @@ null_status(const char *vm_name, void *priv) static int -null_reboot(const char *vm_name, uint32_t seqno, void *priv) +null_reboot(const char *vm_name, const char *src, uint32_t seqno, void *priv) { VALIDATE(priv); printf("[Null] REBOOT operation on %s\n", vm_name); diff --git a/server/serial.c b/server/serial.c index d5396a6..b249e63 100644 --- a/server/serial.c +++ b/server/serial.c @@ -178,8 +178,8 @@ do_fence_request(int fd, const char *src, serial_req_t *req, serial_info *info) response = RESP_PERM; break; } - response = info->cb->on((char *)req->domain, req->seqno, - info->priv); + response = info->cb->on((char *)req->domain, src, + req->seqno, info->priv); break; case FENCE_OFF: if (static_map_check(info->maps, src, @@ -187,8 +187,8 @@ do_fence_request(int fd, const char *src, serial_req_t *req, serial_info *info) response = RESP_PERM; break; } - response = info->cb->off((char *)req->domain, req->seqno, - info->priv); + response = info->cb->off((char *)req->domain, src, + req->seqno, info->priv); break; case FENCE_REBOOT: if (static_map_check(info->maps, src, @@ -196,8 +196,8 @@ do_fence_request(int fd, const char *src, serial_req_t *req, serial_info *info) response = RESP_PERM; break; } - response = info->cb->reboot((char *)req->domain, req->seqno, - info->priv); + response = info->cb->reboot((char *)req->domain, src, + req->seqno, info->priv); break; case FENCE_STATUS: response = info->cb->status((char *)req->domain, info->priv);