Esempio n. 1
0
// Check the parameters to make sure the command
// is syntactically correct
int
verify_gahp_command(char ** argv, int argc) {

	if (strcasecmp (argv[0], GAHP_COMMAND_DOWNLOAD_SANDBOX) ==0 ||
		strcasecmp (argv[0], GAHP_COMMAND_UPLOAD_SANDBOX) ==0 ||
		strcasecmp (argv[0], GAHP_COMMAND_DESTROY_SANDBOX) ==0) {
		// Expecting:GAHP_COMMAND_*_SANDBOX <req_id> <sandbox_id> <job_ad>
		return verify_number_args (argc, 4) &&
				verify_request_id (argv[1]);
	} else if (strcasecmp (argv[0], GAHP_COMMAND_RESULTS) == 0 ||
				strcasecmp (argv[0], GAHP_COMMAND_VERSION) == 0 ||
				strcasecmp (argv[0], GAHP_COMMAND_COMMANDS) == 0 ||
				strcasecmp (argv[0], GAHP_COMMAND_QUIT) == 0 ||
				strcasecmp (argv[0], GAHP_COMMAND_ASYNC_MODE_ON) == 0 ||
				strcasecmp (argv[0], GAHP_COMMAND_ASYNC_MODE_OFF) == 0) {
	    // These are no-arg commands
	    return verify_number_args (argc, 1);
	} else if (strcasecmp (argv[0], GAHP_COMMAND_CONDOR_VERSION) == 0 ||
			   strcasecmp (argv[0], GAHP_COMMAND_CREATE_CONDOR_SECURITY_SESSION) == 0 ) {
		return verify_number_args (argc, 2);
	}

	dprintf (D_ALWAYS, "Unknown command\n");

	return FALSE;
}
// Expecting:EC2_VM_SERVER_TYPE <req_id> <serviceurl> <accesskeyfile> <secretkeyfile>
bool AmazonVMServerType::ioCheck(char **argv, int argc)
{
	return verify_number_args(argc, 5) &&
		verify_request_id(argv[1]) &&
		verify_string_name(argv[2]) &&
		verify_string_name(argv[3]) &&
		verify_string_name(argv[4]);
}
// Expecting:EC2_VM_DESTROY_KEYPAIR <req_id> <serviceurl> <accesskeyfile> <secretkeyfile> <keyname>
bool AmazonVMDestroyKeypair::ioCheck(char **argv, int argc)
{
	return verify_number_args(argc, 6) &&
		verify_request_id(argv[1]) &&
		verify_string_name(argv[2]) &&
		verify_string_name(argv[3]) &&
		verify_string_name(argv[4]) &&
		verify_string_name(argv[5]);
}
// Expecting:EC2_VM_ASSOCIATE_ADDRESS  <req_id> <serviceurl> <accesskeyfile> <secretkeyfile> <instance-id> <elastic-ip> 
bool AmazonAssociateAddress::ioCheck(char **argv, int argc)
{
    return verify_number_args(argc, 7) &&
        verify_request_id(argv[1]) &&
        verify_string_name(argv[2]) &&
        verify_string_name(argv[3]) &&
        verify_string_name(argv[4]) &&
        verify_string_name(argv[5]) && 
        verify_string_name(argv[6]);
}
Esempio n. 5
0
// Check the validity of the given parameters
bool VMGahp::verifyCommand(char **argv, int argc) {
	if(strcasecmp(argv[0], VMGAHP_COMMAND_VM_START) == 0 ) {
		// Expecting: VMGAHP_COMMAND_VM_START <req_id> <type>
		return verify_number_args(argc, 3) &&
			verify_request_id(argv[1]) &&
			verify_vm_type(argv[2]);

	} else if(strcasecmp(argv[0], VMGAHP_COMMAND_VM_STOP) == 0 ||
		strcasecmp(argv[0], VMGAHP_COMMAND_VM_SUSPEND) == 0 ||
		strcasecmp(argv[0], VMGAHP_COMMAND_VM_SOFT_SUSPEND) == 0 ||
		strcasecmp(argv[0], VMGAHP_COMMAND_VM_RESUME) == 0 ||
		strcasecmp(argv[0], VMGAHP_COMMAND_VM_CHECKPOINT) == 0 ||
		strcasecmp(argv[0], VMGAHP_COMMAND_VM_STATUS) == 0 ||
		strcasecmp(argv[0], VMGAHP_COMMAND_VM_GETPID) == 0) {
		// Expecting: VMGAHP_COMMAND_VM_STOP <req_id> <vmid>
		// Expecting: VMGAHP_COMMAND_VM_SUSPEND <req_id> <vmid>
		// Expecting: VMGAHP_COMMAND_VM_SOFT_SUSPEND <req_id> <vmid>
		// Expecting: VMGAHP_COMMAND_VM_RESUME <req_id> <vmid>
		// Expecting: VMGAHP_COMMAND_VM_CHECKPOINT <req_id> <vmid>
		// Expecting: VMGAHP_COMMAND_VM_STATUS <req_id> <vmid>
		// Expecting: VMGAHP_COMMAND_VM_GETPID <req_id> <vmid>

		return verify_number_args(argc, 3) &&
			verify_request_id(argv[1]) &&
			verify_vm_id(argv[2]);

	} else if(strcasecmp(argv[0], VMGAHP_COMMAND_ASYNC_MODE_ON) == 0 ||
		strcasecmp(argv[0], VMGAHP_COMMAND_ASYNC_MODE_OFF) == 0 ||
		strcasecmp(argv[0], VMGAHP_COMMAND_QUIT) == 0 ||
		strcasecmp(argv[0], VMGAHP_COMMAND_VERSION) == 0 ||
		strcasecmp(argv[0], VMGAHP_COMMAND_COMMANDS) == 0 ||
		strcasecmp(argv[0], VMGAHP_COMMAND_SUPPORT_VMS) == 0 ||
		strcasecmp(argv[0], VMGAHP_COMMAND_RESULTS) == 0 ||
		strcasecmp(argv[0], VMGAHP_COMMAND_CLASSAD) == 0 ||
		strcasecmp(argv[0], VMGAHP_COMMAND_CLASSAD_END) == 0 ) {
		//These commands need no-args
		return verify_number_args(argc,1);
	}

	vmprintf(D_ALWAYS, "Unknown command\n");
	return false;
}
// Expecting:EC2_VM_ATTACH_VOLUME <req_id> <serviceurl> <accesskeyfile> <secretkeyfile> <volume-id> <instance-id> <device-id>
bool AmazonAttachVolume::ioCheck(char **argv, int argc)
{
    return verify_number_args(argc, 8) &&
        verify_request_id(argv[1]) &&
        verify_string_name(argv[2]) &&
        verify_string_name(argv[3]) &&
        verify_string_name(argv[4]) &&
        verify_string_name(argv[5]) && 
        verify_string_name(argv[6]) && 
        verify_string_name(argv[7]);
}
Esempio n. 7
0
// Check the parameters to make sure the command
// is syntactically correct
static int
verify_gahp_command(char ** argv, int argc) {
	// Special Commands First
	if (strcasecmp (argv[0], GAHP_COMMAND_RESULTS) == 0 ||
			strcasecmp (argv[0], GAHP_COMMAND_VERSION) == 0 ||
			strcasecmp (argv[0], GAHP_COMMAND_COMMANDS) == 0 ||
			strcasecmp (argv[0], GAHP_COMMAND_QUIT) == 0 ||
			strcasecmp (argv[0], GAHP_COMMAND_ASYNC_MODE_ON) == 0 ||
			strcasecmp (argv[0], GAHP_COMMAND_ASYNC_MODE_OFF) == 0) {
		// These are no-arg commands
		return verify_number_args (argc, 1);
	}

	return executeIOCheckFunc(argv[0], argv, argc);
}