Permalink
Browse files

Changed MigrateInstance to MigrateInstances

  • Loading branch information...
1 parent 5442ffb commit ca223b8e26ec3bba4bad46a92c52ff1fcc9111c9 @vasiliykochergin vasiliykochergin committed Feb 8, 2013
View
@@ -892,12 +892,13 @@ int ncClientCall(ncMetadata * pMeta, int timeout, int ncLock, char *ncURL, char
} else if (!strcmp(ncOp, "ncModifyNode")) {
char *stateName = va_arg(al, char *);
rc = ncModifyNodeStub(ncs, localmeta, stateName);
- } else if (!strcmp(ncOp, "ncMigrateInstance")) {
+ } else if (!strcmp(ncOp, "ncMigrateInstances")) {
+ //TODO:do we have an array of instances here?
ncInstance *instance = va_arg(al, ncInstance *);
char *sourceNodeName = va_arg(al, char *);
char *destNodeName = va_arg(al, char *);
char *credentials = va_arg(al, char *);
- rc = ncMigrateInstanceStub(ncs, localmeta, instance, sourceNodeName, destNodeName, credentials);
+ rc = ncMigrateInstancesStub(ncs, localmeta, instance, sourceNodeName, destNodeName, credentials);
} else {
LOGWARN("\tncOps=%s ppid=%d operation '%s' not found\n", ncOp, getppid(), ncOp);
rc = 1;
@@ -3972,7 +3973,7 @@ int doModifyNode(ncMetadata * pMeta, char *nodeName, char *stateName)
// notify the destination
timeout = ncGetTimeout(time(NULL), OP_TIMEOUT, 1, 0);
- rc = ncClientCall(pMeta, timeout, resourceCacheLocal.resources[dst_index].lockidx, resourceCacheLocal.resources[dst_index].ncURL, "ncMigrateInstance",
+ rc = ncClientCall(pMeta, timeout, resourceCacheLocal.resources[dst_index].lockidx, resourceCacheLocal.resources[dst_index].ncURL, "ncMigrateInstances",
&nc_instance, resourceCacheLocal.resources[src_index].hostname, resourceCacheLocal.resources[dst_index].hostname, NULL);
if (rc) {
LOGERROR("failed to request migration on destination\n");
@@ -3982,7 +3983,7 @@ int doModifyNode(ncMetadata * pMeta, char *nodeName, char *stateName)
// notify source
timeout = ncGetTimeout(time(NULL), OP_TIMEOUT, 1, 0);
- rc = ncClientCall(pMeta, timeout, resourceCacheLocal.resources[src_index].lockidx, resourceCacheLocal.resources[src_index].ncURL, "ncMigrateInstance",
+ rc = ncClientCall(pMeta, timeout, resourceCacheLocal.resources[src_index].lockidx, resourceCacheLocal.resources[src_index].ncURL, "ncMigrateInstances",
&nc_instance, resourceCacheLocal.resources[src_index].hostname, resourceCacheLocal.resources[dst_index].hostname, NULL);
if (rc) {
LOGERROR("failed to request migration on source\n");
@@ -4084,7 +4085,7 @@ int doMigrateInstances(ncMetadata * pMeta, char *nodeName)
SP(nc_instance.instanceId),
SP(resourceCacheLocal.resources[dst_index].hostname));
timeout = ncGetTimeout(time(NULL), OP_TIMEOUT, 1, 0);
- rc = ncClientCall(pMeta, timeout, resourceCacheLocal.resources[dst_index].lockidx, resourceCacheLocal.resources[dst_index].ncURL, "ncMigrateInstance",
+ rc = ncClientCall(pMeta, timeout, resourceCacheLocal.resources[dst_index].lockidx, resourceCacheLocal.resources[dst_index].ncURL, "ncMigrateInstances",
&nc_instance, resourceCacheLocal.resources[src_index].hostname, resourceCacheLocal.resources[dst_index].hostname, NULL);
if (rc) {
LOGERROR("failed to request migration on destination\n");
@@ -4097,7 +4098,7 @@ int doMigrateInstances(ncMetadata * pMeta, char *nodeName)
SP(nc_instance.instanceId),
SP(resourceCacheLocal.resources[src_index].hostname));
timeout = ncGetTimeout(time(NULL), OP_TIMEOUT, 1, 0);
- rc = ncClientCall(pMeta, timeout, resourceCacheLocal.resources[src_index].lockidx, resourceCacheLocal.resources[src_index].ncURL, "ncMigrateInstance",
+ rc = ncClientCall(pMeta, timeout, resourceCacheLocal.resources[src_index].lockidx, resourceCacheLocal.resources[src_index].ncURL, "ncMigrateInstances",
&nc_instance, resourceCacheLocal.resources[src_index].hostname, resourceCacheLocal.resources[dst_index].hostname, NULL);
LOGINFO("[%s] started migration from %s to %s\n",
SP(nc_instance.instanceId),
View
@@ -770,7 +770,7 @@ int main(int argc, char **argv)
}
/***********************************************************/
- } else if (!strcmp(command, "migrateInstance")) {
+ } else if (!strcmp(command, "migrateInstances")) {
CHECK_PARAM(instance_id, "instance ID");
CHECK_PARAM(src_node_name, "source node name");
CHECK_PARAM(dst_node_name, "destination node name");
@@ -782,9 +782,9 @@ int main(int argc, char **argv)
strncpy(instance.instanceId, instance_id, sizeof(instance.instanceId));
strncpy(instance.migration_src, src_node_name, sizeof(instance.migration_src));
strncpy(instance.migration_dst, dst_node_name, sizeof(instance.migration_dst));
- rc = ncMigrateInstanceStub(stub, &meta, &instances, 1, "prepare", migration_creds);
+ rc = ncMigrateInstancesStub(stub, &meta, &instances, 1, "prepare", migration_creds);
if (rc != 0) {
- printf("ncMigrateInstance() failed: error=%d\n", rc);
+ printf("ncMigrateInstances() failed: error=%d\n", rc);
exit(1);
}
View
@@ -1441,48 +1441,48 @@ int ncModifyNodeStub (ncStub *pStub, ncMetadata *pMeta, char *stateName)
//!
//! @return 0 for success, non-zero for error
//!
-//! @see ncMigrateInstance()
+//! @see ncMigrateInstances()
//!
-int ncMigrateInstanceStub (ncStub *pStub, ncMetadata *pMeta, ncInstance ** instances, int instancesLen, char * action, char * credentials)
+int ncMigrateInstancesStub (ncStub *pStub, ncMetadata *pMeta, ncInstance ** instances, int instancesLen, char * action, char * credentials)
{
int status = 0;
axutil_env_t *env = NULL;
axis2_stub_t *stub = NULL;
- adb_ncMigrateInstance_t *input = NULL;
- adb_ncMigrateInstanceType_t *request = NULL;
- adb_ncMigrateInstanceResponse_t *output = NULL;
- adb_ncMigrateInstanceResponseType_t *response = NULL;
+ adb_ncMigrateInstances_t *input = NULL;
+ adb_ncMigrateInstancesType_t *request = NULL;
+ adb_ncMigrateInstancesResponse_t *output = NULL;
+ adb_ncMigrateInstancesResponseType_t *response = NULL;
env = pStub->env;
stub = pStub->stub;
- input = adb_ncMigrateInstance_create (env);
- request = adb_ncMigrateInstanceType_create (env);
+ input = adb_ncMigrateInstances_create (env);
+ request = adb_ncMigrateInstancesType_create (env);
// set standard input fields
- adb_ncMigrateInstanceType_set_nodeName(request, env, pStub->node_name);
+ adb_ncMigrateInstancesType_set_nodeName(request, env, pStub->node_name);
if (pMeta) {
if (pMeta->correlationId) { pMeta->correlationId = NULL; }
- EUCA_MESSAGE_MARSHAL(ncMigrateInstanceType, request, pMeta);
+ EUCA_MESSAGE_MARSHAL(ncMigrateInstancesType, request, pMeta);
}
// set op-specific input fields
for (int i=0; i<instancesLen; i++) {
adb_instanceType_t *instance_adb = adb_instanceType_create(env);
copy_instance_to_adb(instance_adb, env, instances[i]);
- adb_ncMigrateInstanceType_set_instance(request, env, instance_adb);
+ adb_ncMigrateInstancesType_set_instances(request, env, instance_adb);
}
- adb_ncMigrateInstanceType_set_action(request, env, action);
+ adb_ncMigrateInstancesType_set_action(request, env, action);
if (credentials != NULL)
- adb_ncMigrateInstanceType_set_credentials(request, env, credentials);
- adb_ncMigrateInstance_set_ncMigrateInstance(input, env, request);
+ adb_ncMigrateInstancesType_set_credentials(request, env, credentials);
+ adb_ncMigrateInstances_set_ncMigrateInstances(input, env, request);
// do it
- if ((output = axis2_stub_op_EucalyptusNC_ncMigrateInstance (stub, env, input)) == NULL) {
+ if ((output = axis2_stub_op_EucalyptusNC_ncMigrateInstances (stub, env, input)) == NULL) {
LOGERROR(NULL_ERROR_MSG);
status = -1;
} else {
- response = adb_ncMigrateInstanceResponse_get_ncMigrateInstanceResponse (output, env);
- if ( adb_ncMigrateInstanceResponseType_get_return(response, env) == AXIS2_FALSE ) {
+ response = adb_ncMigrateInstancesResponse_get_ncMigrateInstancesResponse (output, env);
+ if ( adb_ncMigrateInstancesResponseType_get_return(response, env) == AXIS2_FALSE ) {
LOGERROR("returned an error\n");
status = 1;
}
@@ -940,7 +940,7 @@ int ncModifyNodeStub(ncStub * pStub, ncMetadata * pMeta, char * stateName)
//!
//! @return Always returns EUCA_OK
//!
-int ncMigrateInstanceStub(ncStub * pStub, ncMetadata * pMeta, ncInstance ** instances, int instancesLen, char * action, char * credentials)
+int ncMigrateInstancesStub(ncStub * pStub, ncMetadata * pMeta, ncInstance ** instances, int instancesLen, char * action, char * credentials)
{
return (EUCA_OK);
}
@@ -497,11 +497,11 @@ int ncModifyNodeStub(ncStub * pStub, ncMetadata * pMeta, char * stateName)
//! @param[in] destNodeName IP of the destination Node Controller
//! @param[in] credentials credentials that enable the migration
//!
-//! @return the result of doMigrateInstance() (either EUCA_OK or EUCA_ERROR)
+//! @return the result of doMigrateInstances() (either EUCA_OK or EUCA_ERROR)
//!
-//! @see doMigrateInstance()
+//! @see doMigrateInstances()
//!
-int ncMigrateInstanceStub(ncStub * pStub, ncMetadata * pMeta, ncInstance ** instances, int instancesLen, char * action, char * credentials)
+int ncMigrateInstancesStub(ncStub * pStub, ncMetadata * pMeta, ncInstance ** instances, int instancesLen, char * action, char * credentials)
{
return (EUCA_OK);
}
View
@@ -157,7 +157,7 @@ int ncCreateImageStub(ncStub * pStub, ncMetadata * pMeta, char *instanceId, char
int ncDescribeSensorsStub(ncStub * pStub, ncMetadata * pMeta, int historySize, long long collectionIntervalTimeMs, char **instIds, int instIdsLen,
char **sensorIds, int sensorIdsLen, sensorResource *** outResources, int *outResourcesLen);
int ncModifyNodeStub(ncStub * pStub, ncMetadata * pMeta, char * stateName);
-int ncMigrateInstanceStub(ncStub * pStub, ncMetadata * pMeta, ncInstance ** instances, int instancesLen, char * action, char * credentials);
+int ncMigrateInstancesStub(ncStub * pStub, ncMetadata * pMeta, ncInstance ** instances, int instancesLen, char * action, char * credentials);
/*----------------------------------------------------------------------------*\
| |
View
@@ -280,7 +280,7 @@ int doCreateImage(ncMetadata * pMeta, char *instanceId, char *volumeId, char *re
int doDescribeSensors(ncMetadata * pMeta, int historySize, long long collectionIntervalTimeMs, char **instIds, int instIdsLen, char **sensorIds,
int sensorIdsLen, sensorResource *** outResources, int *outResourcesLen);
int doModifyNode(ncMetadata * pMeta, char * stateName);
-int doMigrateInstance(ncMetadata * pMeta, ncInstance ** instances, int instancesLen, char * action, char * credentials);
+int doMigrateInstances(ncMetadata * pMeta, ncInstance ** instances, int instancesLen, char * action, char * credentials);
ncInstance *find_global_instance(const char *instanceId);
/*----------------------------------------------------------------------------*\
@@ -2843,7 +2843,7 @@ int doModifyNode(ncMetadata * pMeta, char * stateName)
//! @param[in] pMeta a pointer to the node controller (NC) metadata structure
//! TODO: doxygen
-int doMigrateInstance(ncMetadata * pMeta, ncInstance ** instances, int instancesLen, char * action, char * credentials)
+int doMigrateInstances(ncMetadata * pMeta, ncInstance ** instances, int instancesLen, char * action, char * credentials)
{
int ret = EUCA_OK;
@@ -2855,10 +2855,10 @@ int doMigrateInstance(ncMetadata * pMeta, ncInstance ** instances, int instances
instances[0]->instanceId, instances[0]->migration_src, instances[0]->migration_dst,
(credentials==NULL)?("unavailable"):("present"));
- if (nc_state.H->doMigrateInstance) {
- ret = nc_state.H->doMigrateInstance(&nc_state, pMeta, instances, instancesLen, action, credentials);
+ if (nc_state.H->doMigrateInstances) {
+ ret = nc_state.H->doMigrateInstances(&nc_state, pMeta, instances, instancesLen, action, credentials);
} else {
- ret = nc_state.D->doMigrateInstance(&nc_state, pMeta, instances, instancesLen, action, credentials);
+ ret = nc_state.D->doMigrateInstances(&nc_state, pMeta, instances, instancesLen, action, credentials);
}
return ret;
View
@@ -210,7 +210,7 @@ struct handlers {
int (*doDescribeSensors) (struct nc_state_t * nc, ncMetadata * pMeta, int historySize, long long collectionIntervalTimeMs, char **instIds,
int instIdsLen, char **sensorIds, int sensorIdsLen, sensorResource *** outResources, int *outResourcesLen);
int (*doModifyNode) (struct nc_state_t * nc, ncMetadata * pMeta, char * stateName);
- int (*doMigrateInstance) (struct nc_state_t * nc, ncMetadata * pMeta, ncInstance ** instances, int instancesLen, char * action, char * credentials);
+ int (*doMigrateInstances) (struct nc_state_t * nc, ncMetadata * pMeta, ncInstance ** instances, int instancesLen, char * action, char * credentials);
};
//! bundling structure
@@ -280,7 +280,7 @@ int doCreateImage(ncMetadata * pMeta, char *instanceId, char *volumeId, char *re
int doDescribeSensors(ncMetadata * pMeta, int historySize, long long collectionIntervalTimeMs, char **instIds, int instIdsLen, char **sensorIds,
int sensorIdsLen, sensorResource *** outResources, int *outResourcesLen);
int doModifyNode(ncMetadata * pMeta, char * stateName);
-int doMigrateInstance(ncMetadata * pMeta, ncInstance ** instances, int instancesLen, char * action, char * credentials);
+int doMigrateInstances(ncMetadata * pMeta, ncInstance ** instances, int instancesLen, char * action, char * credentials);
#endif /* HANDLERS_FANOUT */
int callBundleInstanceHelper(struct nc_state_t *nc, char *instanceId, char *bucketName, char *filePrefix, char *walrusURL, char *userPublicKey, char *S3Policy, char *S3PolicySig);
View
@@ -220,7 +220,7 @@ static int doDescribeBundleTasks(struct nc_state_t *nc, ncMetadata * pMeta, char
static int doDescribeSensors(struct nc_state_t *nc, ncMetadata * pMeta, int historySize, long long collectionIntervalTimeMs, char **instIds,
int instIdsLen, char **sensorIds, int sensorIdsLen, sensorResource *** outResources, int *outResourcesLen);
static int doModifyNode(struct nc_state_t * nc, ncMetadata * pMeta, char * stateName);
-static int doMigrateInstance(struct nc_state_t * nc, ncMetadata * pMeta, ncInstance ** instances, int instancesLen, char * action, char * credentials);
+static int doMigrateInstances(struct nc_state_t * nc, ncMetadata * pMeta, ncInstance ** instances, int instancesLen, char * action, char * credentials);
/*----------------------------------------------------------------------------*\
| |
@@ -250,7 +250,7 @@ struct handlers default_libvirt_handlers = {
.doDescribeBundleTasks = doDescribeBundleTasks,
.doDescribeSensors = doDescribeSensors,
.doModifyNode = doModifyNode,
- .doMigrateInstance = doMigrateInstance
+ .doMigrateInstances = doMigrateInstances
};
/*----------------------------------------------------------------------------*\
@@ -2004,7 +2004,7 @@ static int doModifyNode (struct nc_state_t * nc, ncMetadata * pMeta, char * stat
//! @param[in] pMeta a pointer to the node controller (NC) metadata structure
//! TODO: doxygen
//!
-static int doMigrateInstance (struct nc_state_t * nc, ncMetadata * pMeta, ncInstance ** instances, int instancesLen, char * action, char * credentials)
+static int doMigrateInstances (struct nc_state_t * nc, ncMetadata * pMeta, ncInstance ** instances, int instancesLen, char * action, char * credentials)
{
LOGERROR("no default for %s!\n", __func__);
return (EUCA_UNSUPPORTED_ERROR);
View
@@ -171,7 +171,7 @@ static int doInitialize(struct nc_state_t *nc);
static void *rebooting_thread(void *arg);
static int doRebootInstance(struct nc_state_t *nc, ncMetadata * pMeta, char *instanceId);
static int doGetConsoleOutput(struct nc_state_t *nc, ncMetadata * pMeta, char *instanceId, char **consoleOutput);
-static int doMigrateInstance (struct nc_state_t * nc, ncMetadata * pMeta, ncInstance ** instances, int instancesLen, char * action, char * credentials);
+static int doMigrateInstances (struct nc_state_t * nc, ncMetadata * pMeta, ncInstance ** instances, int instancesLen, char * action, char * credentials);
/*----------------------------------------------------------------------------*\
| |
@@ -196,7 +196,7 @@ struct handlers kvm_libvirt_handlers = {
.doDetachVolume = NULL,
.doDescribeSensors = NULL,
.doModifyNode = NULL,
- .doMigrateInstance = doMigrateInstance
+ .doMigrateInstances = doMigrateInstances
};
/*----------------------------------------------------------------------------*\
@@ -619,7 +619,7 @@ static void *migrating_thread(void *arg)
//!
//! TODO: doxygen
//!
-static int doMigrateInstance (struct nc_state_t * nc, ncMetadata * pMeta, ncInstance ** instances, int instancesLen, char * action, char * credentials)
+static int doMigrateInstances (struct nc_state_t * nc, ncMetadata * pMeta, ncInstance ** instances, int instancesLen, char * action, char * credentials)
{
int ret = EUCA_OK;
assert (instancesLen>0);
View
@@ -189,7 +189,7 @@ struct handlers xen_libvirt_handlers = {
.doDetachVolume = NULL,
.doDescribeSensors = NULL,
.doModifyNode = NULL,
- .doMigrateInstance = NULL // no support on Xen for instance migration, currently
+ .doMigrateInstances = NULL // no support on Xen for instance migration, currently
};
/*----------------------------------------------------------------------------*\
Oops, something went wrong.

0 comments on commit ca223b8

Please sign in to comment.