Browse Source

Drivers: hv: utils: Check VSS daemon is listening before a hot backup

Hyper-V host will send a VSS_OP_HOT_BACKUP request to check if guest is
ready for a live backup/snapshot. The driver should respond to the check
only if the daemon is running and listening to requests. This allows the
host to fallback to standard snapshots in case the VSS daemon is not
running.

Signed-off-by: Alex Ng <alexng@messages.microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Alex Ng 9 years ago
parent
commit
db886e4d24
2 changed files with 9 additions and 3 deletions
  1. 6 3
      drivers/hv/hv_snapshot.c
  2. 3 0
      tools/hv/hv_vss_daemon.c

+ 6 - 3
drivers/hv/hv_snapshot.c

@@ -142,6 +142,11 @@ static int vss_on_msg(void *msg, int len)
 		return vss_handle_handshake(vss_msg);
 		return vss_handle_handshake(vss_msg);
 	} else if (vss_transaction.state == HVUTIL_USERSPACE_REQ) {
 	} else if (vss_transaction.state == HVUTIL_USERSPACE_REQ) {
 		vss_transaction.state = HVUTIL_USERSPACE_RECV;
 		vss_transaction.state = HVUTIL_USERSPACE_RECV;
+
+		if (vss_msg->vss_hdr.operation == VSS_OP_HOT_BACKUP)
+			vss_transaction.msg->vss_cf.flags =
+				VSS_HBU_NO_AUTO_RECOVERY;
+
 		if (cancel_delayed_work_sync(&vss_timeout_work)) {
 		if (cancel_delayed_work_sync(&vss_timeout_work)) {
 			vss_respond_to_host(vss_msg->error);
 			vss_respond_to_host(vss_msg->error);
 			/* Transaction is finished, reset the state. */
 			/* Transaction is finished, reset the state. */
@@ -202,6 +207,7 @@ static void vss_handle_request(struct work_struct *dummy)
 	 */
 	 */
 	case VSS_OP_THAW:
 	case VSS_OP_THAW:
 	case VSS_OP_FREEZE:
 	case VSS_OP_FREEZE:
+	case VSS_OP_HOT_BACKUP:
 		if (vss_transaction.state < HVUTIL_READY) {
 		if (vss_transaction.state < HVUTIL_READY) {
 			/* Userspace is not registered yet */
 			/* Userspace is not registered yet */
 			vss_respond_to_host(HV_E_FAIL);
 			vss_respond_to_host(HV_E_FAIL);
@@ -210,9 +216,6 @@ static void vss_handle_request(struct work_struct *dummy)
 		vss_transaction.state = HVUTIL_HOSTMSG_RECEIVED;
 		vss_transaction.state = HVUTIL_HOSTMSG_RECEIVED;
 		vss_send_op();
 		vss_send_op();
 		return;
 		return;
-	case VSS_OP_HOT_BACKUP:
-		vss_transaction.msg->vss_cf.flags = VSS_HBU_NO_AUTO_RECOVERY;
-		break;
 	case VSS_OP_GET_DM_INFO:
 	case VSS_OP_GET_DM_INFO:
 		vss_transaction.msg->dm_info.flags = 0;
 		vss_transaction.msg->dm_info.flags = 0;
 		break;
 		break;

+ 3 - 0
tools/hv/hv_vss_daemon.c

@@ -250,6 +250,9 @@ int main(int argc, char *argv[])
 				syslog(LOG_ERR, "/etc/fstab and /proc/mounts");
 				syslog(LOG_ERR, "/etc/fstab and /proc/mounts");
 			}
 			}
 			break;
 			break;
+		case VSS_OP_HOT_BACKUP:
+			syslog(LOG_INFO, "VSS: op=CHECK HOT BACKUP\n");
+			break;
 		default:
 		default:
 			syslog(LOG_ERR, "Illegal op:%d\n", op);
 			syslog(LOG_ERR, "Illegal op:%d\n", op);
 		}
 		}