//! //! //! //! @param[in] key //! @param[in] val //! //! @pre //! //! @post //! static void set_global_parameter(char *key, char *val) { if (strcmp(key, "debug") == 0) { print_debug = parse_boolean(val); set_debug(print_debug); } else if (strcmp(key, "argv") == 0) { print_argv = parse_boolean(val); } else if (strcmp(key, "work") == 0) { set_work_dir(val); } else if (strcmp(key, "work_size") == 0) { set_work_limit(parse_bytes(val)); } else if (strcmp(key, "cache") == 0) { set_cache_dir(val); } else if (strcmp(key, "cache_size") == 0) { set_cache_limit(parse_bytes(val)); } else if (strcmp(key, "purge_cache") == 0) { purge_cache = parse_boolean(val); } else if (strcmp(key, "cloud_cert") == 0) { euca_strncpy(cloud_cert_path, val, sizeof(cloud_cert_path)); } else if (strcmp(key, "service_key") == 0) { euca_strncpy(service_key_path, val, sizeof(service_key_path)); } else { err("unknown global parameter '%s'", key); } LOGINFO("GLOBAL: %s=%s\n", key, val); }
void vm_config(char* vcas_address, unsigned int vcas_port, char* vks_address, unsigned int vks_port, char* company, char* dir, char* amino_mac, char* machine_id, int protocolVersion) { struct stat st = {0}; if (vcas_address != 0) str_realloc_copy(&vcasServerAddress, vcas_address); if (vks_address != 0) str_realloc_copy(&vksServerAddress, vks_address); if (company != 0) str_realloc_copy(&api_company, company); if (vcas_port > 0) VCAS_Port_SSL = vcas_port; if (vks_port > 0) VKS_Port_SSL = vks_port; if (dir != 0) set_cache_dir(dir); if (amino_mac != 0) { memcpy(api_clientID, amino_mac, 13); } if (machine_id != 0) { memcpy(api_machineID, machine_id, 64); } else if (amino_mac != 0) { memcpy(api_machineID, amino_mac, 13); } if (protocolVersion != 0) { api_msgformat = protocolVersion; } if (stat(f_dir, &st) == -1) { LOG(ERROR, "[API] Directory %s doesn't exist", f_dir); } else if (access(f_dir, W_OK) != 0) { LOG(ERROR, "[API] Directory %s isn't writable", f_dir); exit(-1); } }
//! //! //! //! @param[in] key //! @param[in] val //! //! @pre //! //! @post //! static void set_global_parameter(char *key, char *val) { if (strcmp(key, "debug") == 0) { print_debug = parse_boolean(val); set_debug(print_debug); } else if (strcmp(key, "argv") == 0) { print_argv = parse_boolean(val); } else if (strcmp(key, "work") == 0) { set_work_dir(val); } else if (strcmp(key, "work_size") == 0) { set_work_limit(parse_bytes(val)); } else if (strcmp(key, "cache") == 0) { set_cache_dir(val); } else if (strcmp(key, "cache_size") == 0) { set_cache_limit(parse_bytes(val)); } else { err("unknown global parameter '%s'", key); } LOGINFO("GLOBAL: %s=%s\n", key, val); }