case EDG_WLL_STAT_FILE_TRANSFER_COLLECTION:
printf("%sjobtype : FILE_TRANSFER_COLLECTION\n", ind);
break;
+ case EDG_WLL_STAT_VIRTUAL_MACHINE:
+ printf("%sjobtype : VIRTUAL_MACHINE\n", ind);
+ break;
default:
printf("%sjobtype : UNKNOWN\n", ind);
break;
printf("%sft_sandbox_type : UNKNOWN\n", ind);
printf("%sft_src : %s\n", ind, stat.ft_src);
printf("%sft_dest : %s\n", ind, stat.ft_dest);
-
+
+ char *vm_stat_name = edg_wll_VMStatToString(stat.vm_state);
+ if (stat.jobtype == EDG_WLL_STAT_VIRTUAL_MACHINE){
+ printf("%svm_state : %s\n", ind, vm_stat_name);
+ printf("%svm_hostname : %s\n", ind, stat.vm_hostname);
+ printf("%svm_image : %s\n", ind, stat.vm_image);
+ printf("%svm_require : %s\n", ind, stat.vm_require);
+ printf("%svm_usage : %s\n", ind, stat.vm_usage);
+ }
printf("\n");
NEWSTATE
NEWSUBSTATE
RESOURCES
+ IMAGE
+ REQUIRE
+ HOSTVM
/;
PAYLOAD_OWNER
ACCESS_RIGHTS
HISTORY
+ VM_HOSTNAME
+ VM_IMAGE
+ VM_MACHINE
+ VM_REQUIRE
+ VM_STATE
+ VM_USAGE
/;
*/
extern char *edg_wll_CreamStatToString(enum edg_wll_StatCream_state);
+/**
+ * Convert numeric VM status code to string representation
+ */
+extern char *edg_wll_VMStatToString(enum edg_wll_StatVm_state);
+
+
/**
* Extract a variable from the JDL attribute
*/
return strdup(cream_statNames[statCode]);
}
+static const char * const vm_statNames[] = {
+@@@{
+ my $f = selectField $status vm_state;
+ if ($f->{codes}) {
+ for (@{$f->{codes}}) {
+ my $lc = lc $_->{name};
+ my $uc = ucfirst $lc;
+ gen qq{
+! "$uc",
+};
+ }
+ }
+@@@}
+};
+
+
+char *edg_wll_VMStatToString(enum edg_wll_StatVm_state statCode)
+{
+ if ((int)statCode < 0 || statCode >= sizeof(vm_statNames)/sizeof(vm_statNames[0])) return (char *) NULL;
+ return strdup(vm_statNames[statCode]);
+}
char *edg_wll_JDLField(edg_wll_JobStat *stat, const char *field_name)
if (ret) ret = enc_int(ret, stat->ft_sandbox_type);
if (ret) ret = enc_string(ret, stat->ft_src);
if (ret) ret = enc_string(ret, stat->ft_dest);
+ if (ret) ret = enc_int(ret, stat->vm_state);
+ if (ret) ret = enc_string(ret, stat->vm_image);
+ if (ret) ret = enc_string(ret, stat->vm_require);
+ if (ret) ret = enc_string(ret, stat->vm_usage);
+ if (ret) ret = enc_string(ret, stat->vm_hostname);
+ if (ret) ret = enc_string(ret, stat->vm_machine);
return ret;
}
if (tmp_in != NULL) stat->ft_sandbox_type = dec_int(tmp_in, &tmp_in);
if (tmp_in != NULL) stat->ft_src = dec_string(tmp_in, &tmp_in);
if (tmp_in != NULL) stat->ft_dest = dec_string(tmp_in, &tmp_in);
-
+ if (tmp_in != NULL) stat->vm_state = dec_int(tmp_in, &tmp_in);
+ if (tmp_in != NULL) stat->vm_image = dec_string(tmp_in, &tmp_in);
+ if (tmp_in != NULL) stat->vm_require = dec_string(tmp_in, &tmp_in);
+ if (tmp_in != NULL) stat->vm_usage = dec_string(tmp_in, &tmp_in);
+ if (tmp_in != NULL) stat->vm_hostname = dec_string(tmp_in, &tmp_in);
+ if (tmp_in != NULL) stat->vm_machine = dec_string(tmp_in, &tmp_in);
*rest = tmp_in;
switch (e->any.type) {
case EDG_WLL_EVENT_REGJOB:
if (USABLE(res)) {
- js->pub.state = EDG_WLL_JOB_SUBMITTED;
+ js->pub.vm_state = EDG_WLL_STAT_VM_PENDING;
}
- /*if (USABLE_DATA(res)) {
- edg_wlc_JobIdFree(js->pub.parent_job);
- edg_wlc_JobIdDup(e->regJob.parent, &js->pub.parent_job);
- }*/
break;
+ case EDG_WLL_EVENT_VMCREATE:
+ if (USABLE_DATA(res)) {
+ rep_cond(js->pub.vm_require, e->vMCreate.require);
+ rep_cond(js->pub.vm_image, e->vMCreate.image);
+ }
+ break;
+ case EDG_WLL_EVENT_VMHOST:
+ if (USABLE_DATA(res)) {
+ rep_cond(js->pub.vm_hostname, e->vMHost.hostvm);
+ //XXX transfer to prolog/boot state?
+ }
+ break;
+ case EDG_WLL_EVENT_VMRUNNING:
+ if (USABLE(res)) {
+ js->pub.vm_state = EDG_WLL_STAT_VM_RUNNING;
+ }
+ break;
+ case EDG_WLL_EVENT_VMSHUTDOWN:
+ if (USABLE(res)) {
+ js->pub.vm_state = EDG_WLL_STAT_VM_SHUTDOWN;
+ }
+ break;
+ case EDG_WLL_EVENT_VMSTOP:
+ if (USABLE(res)) {
+ js->pub.vm_state = EDG_WLL_STAT_VM_STOPPED;
+ }
+ break;
+ case EDG_WLL_EVENT_VMRESUME:
+ if (USABLE(res)) {
+ js->pub.vm_state = EDG_WLL_STAT_VM_PENDING;
+ //XXX clear hostname here?
+ }
+ break;
+ case EDG_WLL_EVENT_VMDONE:
+ if (USABLE(res)) {
+ switch (e->vMDone.status_code){
+ case EDG_WLL_VMDONE_OK:
+ case EDG_WLL_VMDONE_DELETE:
+ js->pub.vm_state = EDG_WLL_STAT_VM_DONE;
+ break;
+ case EDG_WLL_VMDONE_FAILURE:
+ js->pub.vm_state = EDG_WLL_STAT_VM_FAILURE;
+ break;
+ case EDG_WLL_VMDONE_STATUS_CODE_UNDEFINED:
+ break;
+ }
+ if (USABLE_DATA(res))
+ rep_cond(js->pub.vm_usage, e->vMDone.usage);
+ }
+ break;
default:
break;
}
if (USABLE(res)) {
- rep(js->last_seqcode, e->any.seqcode);
+ //rep(js->last_seqcode, e->any.seqcode);
js->pub.lastUpdateTime = e->any.timestamp;
if (old_state != js->pub.state) {
= (int)js->pub.lastUpdateTime.tv_sec;
}
}
- if (! js->pub.location) js->pub.location = strdup("this is FILE TRANSFER");
-
+ if (! js->pub.location) js->pub.location = strdup("this is VIRTUAL MACHINE");
return RET_OK;
}
@flesh VirtualMachine
@type VMCreate create (register) virtual machine
- string name machine name
+ string image machine image
+ string require machine requirements
+
+@type VMHost
+ string hostvm hostname of VM
+
+@type VMRunning VM is running
+
+@type VMShutdown
+
+@type VMStop
+
+@type VMResume
+
+@type VMDone
+ int status_code
+ _code_ OK
+ _code_ DELETE
+ _code_ FAILURE
+ string usage
+ _optional_
-@type VMRunning machine running
_pad_ 20
+int vm_state VM job state
+ _null_ -1
+ _code_ VM_PENDING pending
+ _code_ VM_BOOT boot
+ _code_ VM_RUNNING running
+ _code_ VM_SHUTDOWN shutdown
+ _code_ VM_STOPPED stopped
+ _code_ VM_DONE done
+ _code_ VM_FAILURE failure
+string vm_image VM image
+string vm_require VM requirement on physical machine
+string vm_usage VM usage
+string vm_hostname VM hostname
+string vm_machine physical machine on which VM runs
+
+_pad_ 20
+
@type Submitted Entered by the user to the User Interface or registered by Job Partitioner.
@type Waiting Accepted by WMS, waiting for resource allocation.
@type Ready Matching resources found.