else if ( !strcmp(tmps, "last_update_time") ) cond->attr = EDG_WLL_QUERY_ATTR_LASTUPDATETIME;
else if ( !strcmp(tmps, "jdl_attr") ) cond->attr = EDG_WLL_QUERY_ATTR_JDL_ATTR;
else if ( !strcmp(tmps, "job_type") ) cond->attr = EDG_WLL_QUERY_ATTR_JOB_TYPE;
+ else if ( !strcmp(tmps, "vm_status") ) cond->attr = EDG_WLL_QUERY_ATTR_VM_STATUS;
/**< When entered current status */
cond->value2.t.tv_sec = StrToTime(tmps);
}
break;
+
case EDG_WLL_QUERY_ATTR_JOB_TYPE:
if ( 0 > (cond->value.i = edg_wll_JobtypeStrToCode(tmps))) {
fprintf(stderr,"%s: invalid job type (%s)\n", myname, tmps);
return 0;
}
break;
+
+ case EDG_WLL_QUERY_ATTR_VM_STATUS:
+ if ( 0 > (cond->value.i = edg_wll_StringToVMStat(tmps))) {
+ fprintf(stderr,"%s: invalid VM status value (%s)\n", myname, tmps);
+ return 0;
+ }
+ break;
default:
break;
EDG_WLL_QUERY_ATTR_LASTUPDATETIME, /**< Time of the last known event of the job */
EDG_WLL_QUERY_ATTR_NETWORK_SERVER, /**< Network server aka RB aka WMproxy endpoint */
EDG_WLL_QUERY_ATTR_JOB_TYPE, /**< Event type \see _edg_wll_QueryRec */
+ EDG_WLL_QUERY_ATTR_VM_STATUS, /**< Current VM job status */
EDG_WLL_QUERY_ATTR__LAST
/* if adding new attribute, add conversion string to common/xml_conversions.c too !! */
} edg_wll_QueryAttr;
void edg_wll_add_jobid_to_XMLBody(char **body, glite_jobid_const_t toAdd, const char *tag, const void *null);
void edg_wll_add_notifid_to_XMLBody(char **body, edg_wll_NotifId toAdd, const char *tag, const void *null);
void edg_wll_add_edg_wll_JobStatCode_to_XMLBody(char **body, edg_wll_JobStatCode toAdd, const char *tag, const edg_wll_JobStatCode null);
+void edg_wll_add_edg_wll_StatVm_state_to_XMLBody(char **body, enum edg_wll_StatVm_state toAdd, const char *tag, const enum edg_wll_StatVm_state null);
void edg_wll_add_edg_wll_EventCode_to_XMLBody(char **body, edg_wll_EventCode toAdd, const char *tag, const edg_wll_EventCode null);
void edg_wll_add_time_t_to_XMLBody(char **body, const time_t toAdd, const char *tag, const time_t null);
void edg_wll_add_tagged_time_t_to_XMLBody(char **body, const time_t toAdd, const char *tag, const char *name, const char *tag2, const time_t null);
glite_jobid_t edg_wll_from_string_to_jobid(edg_wll_XML_ctx *XMLCtx);
edg_wll_NotifId edg_wll_from_string_to_notifid(edg_wll_XML_ctx *XMLCtx);
edg_wll_JobStatCode edg_wll_from_string_to_edg_wll_JobStatCode(edg_wll_XML_ctx *XMLCtx);
+enum edg_wll_StatVm_state edg_wll_from_string_to_edg_wll_StatVm_state(edg_wll_XML_ctx *XMLCtx);
int edg_wll_from_string_to_int(edg_wll_XML_ctx *XMLCtx);
float edg_wll_from_string_to_float(edg_wll_XML_ctx *XMLCtx);
double edg_wll_from_string_to_double(edg_wll_XML_ctx *XMLCtx);
"donecode","usertag","time","level","host","source",
"instance","type","chkpt_tag", "resubmitted", "parent_job",
"exitcode", "jdl", "stateentertime", "lastupdatetime",
- "networkserver", "jobtype" };
+ "networkserver", "jobtype", "vm_status" };
/**
* Names for the predefined types of query operands
case EDG_WLL_QUERY_ATTR_STATEENTERTIME:
case EDG_WLL_QUERY_ATTR_LASTUPDATETIME:
case EDG_WLL_QUERY_ATTR_JOB_TYPE:
+ case EDG_WLL_QUERY_ATTR_VM_STATUS:
/* do nothing */
break;
default:
return strdup(vm_statNames[statCode]);
}
+enum edg_wll_StatVm_state edg_wll_StringToVMStat(const char* name)
+{
+ unsigned int i;
+
+ for (i=0; i<sizeof(vm_statNames)/sizeof(vm_statNames[0]); i++)
+ if (strcasecmp(vm_statNames[i],name) == 0) return (enum edg_wll_StatVm_state) i;
+ return (enum edg_wll_StatVm_state) -1;
+}
+
char *edg_wll_JDLField(edg_wll_JobStat *stat, const char *field_name)
{
}
}
+void edg_wll_add_edg_wll_StatVm_state_to_XMLBody(char **body, enum edg_wll_StatVm_state toAdd, const char *tag, const enum edg_wll_StatVm_state null)
+{
+ if (toAdd != null) {
+ char *newBody, *pom;
+
+ trio_asprintf(&newBody,"%s\t\t\t<%s>%|Xs</%s>\r\n",
+ *body, tag, pom = edg_wll_VMStatToString(toAdd), tag);
+
+ free(*body);
+ free(pom);
+ *body = newBody;
+ }
+}
+
+
void edg_wll_add_edg_wll_EventCode_to_XMLBody(char **body, edg_wll_EventCode toAdd, const char *tag, const edg_wll_EventCode null)
{
char *newBody, *pom;
+enum edg_wll_StatVm_state edg_wll_from_string_to_edg_wll_StatVm_state(edg_wll_XML_ctx *XMLCtx)
+{
+ edg_wll_JobStatCode out = -1;
+ char *s;
+
+ s = glite_lbu_UnescapeXML((const char *) XMLCtx->char_buf);
+ if (s) {
+ out = edg_wll_StringToVMStat(s);
+ free(s);
+ }
+ edg_wll_freeBuf(XMLCtx);
+
+ return(out);
+}
+
+
+
enum edg_wll_StatJobtype edg_wll_from_string_to_edg_wll_StatJobtype(edg_wll_XML_ctx *XMLCtx)
{
enum edg_wll_StatJobtype out = -1;
"EDG_WLL_QUERY_ATTR_STATEENTERTIME",
"EDG_WLL_QUERY_ATTR_LASTUPDATETIME",
"EDG_WLL_QUERY_ATTR_JOB_TYPE",
+ "EDG_WLL_QUERY_ATTR_VM_STATUS",
"EDG_WLL_QUERY_ATTR__LAST",
};
case EDG_WLL_QUERY_ATTR_JOB_TYPE:
edg_wll_add_string_to_XMLBody(&pomValue, edg_wll_StatusJobtypeNames[conditions[row][i].value.i],
"jobtype", NULL);
+ break;
+ case EDG_WLL_QUERY_ATTR_VM_STATUS:
+ /*XXX currently no within or changed implemented */
+ edg_wll_add_edg_wll_StatVm_state_to_XMLBody(&pomValue, conditions[row][i].value.i, "vm_status", -1); /* have no undef state*/
break;
default: