2 * V3 checkpoint send (live-migration) utility
11 #include <sys/types.h>
17 #include <linux/unistd.h>
24 #define MAX_STORE_LEN 128
25 #define MAX_URL_LEN 256
28 struct v3_chkpt_info chkpt;
30 int main(int argc, char* argv[]) {
35 printf("Usage: ./v3_receive <vm_device> <store> <url> [optionmask]\n");
36 printf(" optionmask consists of the sum of any of the following\n");
38 printf(" 1 skip memory\n");
39 printf(" 2 skip devices\n");
40 printf(" 4 skip cores\n");
41 printf(" 8 skip architecture-specific core state\n");
47 if (strlen(argv[2]) >= MAX_STORE_LEN) {
48 printf("ERROR: Checkpoint store name longer than maximum size (%d)\n", MAX_STORE_LEN);
52 strncpy(chkpt.store, argv[2], MAX_STORE_LEN);
55 if (strlen(argv[3]) >= MAX_URL_LEN) {
56 printf("ERROR: Checkpoint URL longer than maximum size (%d)\n", MAX_URL_LEN);
60 strncpy(chkpt.url, argv[3], MAX_URL_LEN);
63 chkpt.opts = atoll(argv[4]);
65 chkpt.opts = V3_CHKPT_OPT_NONE;
68 vm_fd = open(vm_dev, O_RDONLY);
70 printf("Error opening VM device: %s\n", vm_dev);
74 if (ioctl(vm_fd, V3_VM_RECEIVE, &chkpt)<0) {
75 printf("VM reception failed\n");
79 /* Close the file descriptor. */