void do_migrate(Monitor *mon, const QDict *qdict, QObject **ret_data) { MigrationState *s = NULL; const char *p; int detach = qdict_get_int(qdict, "detach"); const char *uri = qdict_get_str(qdict, "uri"); if (strstart(uri, "tcp:", &p)) s = tcp_start_outgoing_migration(p, max_throttle, detach); #if !defined(WIN32) else if (strstart(uri, "exec:", &p)) s = exec_start_outgoing_migration(p, max_throttle, detach); else if (strstart(uri, "unix:", &p)) s = unix_start_outgoing_migration(p, max_throttle, detach); else if (strstart(uri, "fd:", &p)) s = fd_start_outgoing_migration(mon, p, max_throttle, detach); #endif else monitor_printf(mon, "unknown migration protocol: %s\n", uri); if (s == NULL) monitor_printf(mon, "migration failed\n"); else { if (current_migration) current_migration->release(current_migration); current_migration = s; } }
void qmp_migrate(const char *uri, bool has_blk, bool blk, bool has_inc, bool inc, bool has_detach, bool detach, Error **errp) { Error *local_err = NULL; MigrationState *s = migrate_get_current(); MigrationParams params; const char *p; params.blk = has_blk && blk; params.shared = has_inc && inc; if (s->state == MIG_STATE_ACTIVE || s->state == MIG_STATE_SETUP || s->state == MIG_STATE_CANCELLING) { error_set(errp, QERR_MIGRATION_ACTIVE); return; } if (runstate_check(RUN_STATE_INMIGRATE)) { error_setg(errp, "Guest is waiting for an incoming migration"); return; } if (qemu_savevm_state_blocked(errp)) { return; } if (migration_blockers) { *errp = error_copy(migration_blockers->data); return; } s = migrate_init(¶ms); if (strstart(uri, "tcp:", &p)) { tcp_start_outgoing_migration(s, p, &local_err); #ifdef CONFIG_RDMA } else if (strstart(uri, "rdma:", &p)) { rdma_start_outgoing_migration(s, p, &local_err); #endif #if !defined(WIN32) } else if (strstart(uri, "exec:", &p)) { exec_start_outgoing_migration(s, p, &local_err); } else if (strstart(uri, "unix:", &p)) { unix_start_outgoing_migration(s, p, &local_err); } else if (strstart(uri, "fd:", &p)) { fd_start_outgoing_migration(s, p, &local_err); #endif } else { error_set(errp, QERR_INVALID_PARAMETER_VALUE, "uri", "a valid migration protocol"); s->state = MIG_STATE_ERROR; return; } if (local_err) { migrate_fd_error(s); error_propagate(errp, local_err); return; } }
int do_migrate(Monitor *mon, const QDict *qdict, QObject **ret_data) { MigrationState *s = NULL; const char *p; int detach = qdict_get_try_bool(qdict, "detach", 0); int blk = qdict_get_try_bool(qdict, "blk", 0); int inc = qdict_get_try_bool(qdict, "inc", 0); const char *uri = qdict_get_str(qdict, "uri"); if (current_migration && current_migration->get_status(current_migration) == MIG_STATE_ACTIVE) { monitor_printf(mon, "migration already in progress\n"); return -1; } if (qemu_savevm_state_blocked(mon)) { return -1; } /* check ft_mode (Kemari protocol) */ if (strstart(uri, "kemari:", &p)) { ft_mode = FT_INIT; uri = p; } if (strstart(uri, "tcp:", &p)) { s = tcp_start_outgoing_migration(mon, p, max_throttle, detach, blk, inc); #if !defined(WIN32) } else if (strstart(uri, "exec:", &p)) { s = exec_start_outgoing_migration(mon, p, max_throttle, detach, blk, inc); } else if (strstart(uri, "unix:", &p)) { s = unix_start_outgoing_migration(mon, p, max_throttle, detach, blk, inc); } else if (strstart(uri, "fd:", &p)) { s = fd_start_outgoing_migration(mon, p, max_throttle, detach, blk, inc); #endif } else { monitor_printf(mon, "unknown migration protocol: %s\n", uri); return -1; } if (s == NULL) { monitor_printf(mon, "migration failed\n"); return -1; } if (current_migration) { current_migration->release(current_migration); } current_migration = s; notifier_list_notify(&migration_state_notifiers); return 0; }
int do_migrate(Monitor *mon, const QDict *qdict, QObject **ret_data) { MigrationState *s = migrate_get_current(); const char *p; int detach = qdict_get_try_bool(qdict, "detach", 0); int blk = qdict_get_try_bool(qdict, "blk", 0); int inc = qdict_get_try_bool(qdict, "inc", 0); const char *uri = qdict_get_str(qdict, "uri"); int ret; if (s->state == MIG_STATE_ACTIVE) { monitor_printf(mon, "migration already in progress\n"); return -1; } if (qemu_savevm_state_blocked(mon)) { return -1; } if (migration_blockers) { Error *err = migration_blockers->data; qerror_report_err(err); return -1; } s = migrate_init(mon, detach, blk, inc); if (strstart(uri, "tcp:", &p)) { ret = tcp_start_outgoing_migration(s, p); #if !defined(WIN32) } else if (strstart(uri, "exec:", &p)) { ret = exec_start_outgoing_migration(s, p); } else if (strstart(uri, "unix:", &p)) { ret = unix_start_outgoing_migration(s, p); } else if (strstart(uri, "fd:", &p)) { ret = fd_start_outgoing_migration(s, p); #endif } else { monitor_printf(mon, "unknown migration protocol: %s\n", uri); ret = -EINVAL; } if (ret < 0) { monitor_printf(mon, "migration failed: %s\n", strerror(-ret)); return ret; } if (detach) { s->mon = NULL; } notifier_list_notify(&migration_state_notifiers, s); return 0; }
void qmp_migrate(const char *uri, bool has_blk, bool blk, bool has_inc, bool inc, bool has_detach, bool detach, Error **errp) { Error *local_err = NULL; MigrationState *s = migrate_get_current(); MigrationParams params; const char *p; params.blk = blk; params.shared = inc; if (s->state == MIG_STATE_ACTIVE) { error_set(errp, QERR_MIGRATION_ACTIVE); return; } if (qemu_savevm_state_blocked(errp)) { return; } if (migration_blockers) { *errp = error_copy(migration_blockers->data); return; } s = migrate_init(¶ms); if (strstart(uri, "tcp:", &p)) { tcp_start_outgoing_migration(s, p, &local_err); #if !defined(WIN32) } else if (strstart(uri, "exec:", &p)) { exec_start_outgoing_migration(s, p, &local_err); } else if (strstart(uri, "unix:", &p)) { unix_start_outgoing_migration(s, p, &local_err); } else if (strstart(uri, "fd:", &p)) { fd_start_outgoing_migration(s, p, &local_err); #endif } else { error_set(errp, QERR_INVALID_PARAMETER_VALUE, "uri", "a valid migration protocol"); return; } if (local_err) { migrate_fd_error(s); error_propagate(errp, local_err); return; } notifier_list_notify(&migration_state_notifiers, s); }
int do_migrate(Monitor *mon, const QDict *qdict, QObject **ret_data) { MigrationState *s = NULL; const char *p; int detach = qdict_get_int(qdict, "detach"); const char *uri = qdict_get_str(qdict, "uri"); if (current_migration && current_migration->get_status(current_migration) == MIG_STATE_ACTIVE) { monitor_printf(mon, "migration already in progress\n"); return -1; } if (strstart(uri, "tcp:", &p)) { s = tcp_start_outgoing_migration(mon, p, max_throttle, detach, (int)qdict_get_int(qdict, "blk"), (int)qdict_get_int(qdict, "inc")); #if !defined(WIN32) } else if (strstart(uri, "exec:", &p)) { s = exec_start_outgoing_migration(mon, p, max_throttle, detach, (int)qdict_get_int(qdict, "blk"), (int)qdict_get_int(qdict, "inc")); } else if (strstart(uri, "unix:", &p)) { s = unix_start_outgoing_migration(mon, p, max_throttle, detach, (int)qdict_get_int(qdict, "blk"), (int)qdict_get_int(qdict, "inc")); } else if (strstart(uri, "fd:", &p)) { s = fd_start_outgoing_migration(mon, p, max_throttle, detach, (int)qdict_get_int(qdict, "blk"), (int)qdict_get_int(qdict, "inc")); #endif } else { monitor_printf(mon, "unknown migration protocol: %s\n", uri); return -1; } if (s == NULL) { monitor_printf(mon, "migration failed\n"); return -1; } if (current_migration) { current_migration->release(current_migration); } current_migration = s; return 0; }
int do_migrate(Monitor *mon, const QDict *qdict, QObject **ret_data) { // printf("migrate thread %lu\n",(unsigned long int)pthread_self()); MigrationState *s = NULL; const char *p; int detach = qdict_get_int(qdict, "detach"); const char *uri = qdict_get_str(qdict, "uri"); if (current_migration && current_migration->get_status(current_migration) == MIG_STATE_ACTIVE) { monitor_printf(mon, "migration already in progress\n"); return -1; } /* Pacer modification: computing estimate migration speed */ int has_mig_time = qdict_haskey(qdict, "mig_time"); int mig_time=500; if(has_mig_time) mig_time=qdict_get_int(qdict,"mig_time"); printf("migration requried time %d\n",mig_time); int metricopt=(int)qdict_get_int(qdict,"throughputrequired"); int metricvalue=0; if(metricopt==1) { int has_throughput = qdict_haskey(qdict,"required"); if(has_throughput) metricvalue=qdict_get_int(qdict,"required"); if(metricvalue!=0) printf("throughput required %d\n",metricvalue); }else{ int has_latency = qdict_haskey(qdict,"required"); if(has_latency) metricvalue=qdict_get_int(qdict,"required"); if(metricvalue!=0) printf("latency required %d\n",metricvalue); } if(metricvalue==0){ printf("no requirement\n"); metricopt=2; } uint64_t memsize=ram_bytes_remaining(); uint64_t disksize=bdrv_get_totallength(); uint64_t speed; printf("ram size %"PRId64"\n",ram_bytes_remaining()); printf("disk size %"PRId64"\n",bdrv_get_totallength()); if(mig_time!=0){ speed=(disksize+memsize)/mig_time; max_throttle=speed; printf("migration speed0 %"PRId64"\n",speed); } //end if (strstart(uri, "tcp:", &p)) { s = tcp_start_outgoing_migration(mon, p, max_throttle, detach, (int)qdict_get_int(qdict, "blk"), (int)qdict_get_int(qdict, "inc"), (int)qdict_get_int(qdict, "sparse"), mig_time, metricopt, metricvalue, (int)qdict_get_int(qdict,"compression"), (int)qdict_get_int(qdict,"scheduling"), (int)qdict_get_int(qdict,"dscheduling"), (int)qdict_get_int(qdict,"throttling")); #if !defined(WIN32) } else if (strstart(uri, "exec:", &p)) { s = exec_start_outgoing_migration(mon, p, max_throttle, detach, (int)qdict_get_int(qdict, "blk"), (int)qdict_get_int(qdict, "inc"), (int)qdict_get_int(qdict, "sparse"), mig_time, metricopt, metricvalue, (int)qdict_get_int(qdict,"compression"), (int)qdict_get_int(qdict, "scheduling"), (int)qdict_get_int(qdict,"dscheduling"), (int)qdict_get_int(qdict,"throttling")); } else if (strstart(uri, "unix:", &p)) { s = unix_start_outgoing_migration(mon, p, max_throttle, detach, (int)qdict_get_int(qdict, "blk"), (int)qdict_get_int(qdict, "inc"), (int)qdict_get_int(qdict, "sparse"), mig_time, metricopt, metricvalue, (int)qdict_get_int(qdict,"compression"), (int)qdict_get_int(qdict, "scheduling"), (int)qdict_get_int(qdict, "dscheduling"), (int)qdict_get_int(qdict, "throttling")); } else if (strstart(uri, "fd:", &p)) { s = fd_start_outgoing_migration(mon, p, max_throttle, detach, (int)qdict_get_int(qdict, "blk"), (int)qdict_get_int(qdict, "inc"), (int)qdict_get_int(qdict, "sparse"), mig_time, metricopt, metricvalue, (int)qdict_get_int(qdict,"compression"), (int)qdict_get_int(qdict, "scheduling"), (int)qdict_get_int(qdict, "dscheduling"), (int)qdict_get_int(qdict, "throttling")); #endif } else { monitor_printf(mon, "unknown migration protocol: %s\n", uri); return -1; } if (s == NULL) { monitor_printf(mon, "migration failed\n"); return -1; } if (current_migration) { current_migration->release(current_migration); } current_migration = s; return 0; }