Convert the DateTime into ISO8601 format for Ceilometer
The fields of DateTime type should be converted to the time in ISO8601 format, when they are put in the usage information to be reported to Ceilometer. Change-Id: I67e9e3609291d0d835156dfd9cfda88deae119c1 closes-bug: #1372791
This commit is contained in:
		@@ -50,8 +50,10 @@ def _usage_from_volume(context, volume_ref, **kw):
 | 
			
		||||
                      volume_id=volume_ref['id'],
 | 
			
		||||
                      volume_type=volume_ref['volume_type_id'],
 | 
			
		||||
                      display_name=volume_ref['display_name'],
 | 
			
		||||
                      launched_at=null_safe_str(volume_ref['launched_at']),
 | 
			
		||||
                      created_at=null_safe_str(volume_ref['created_at']),
 | 
			
		||||
                      launched_at=timeutils.isotime(at=
 | 
			
		||||
                                                    volume_ref['launched_at']),
 | 
			
		||||
                      created_at=timeutils.isotime(at=
 | 
			
		||||
                                                   volume_ref['created_at']),
 | 
			
		||||
                      status=volume_ref['status'],
 | 
			
		||||
                      snapshot_id=volume_ref['snapshot_id'],
 | 
			
		||||
                      size=volume_ref['size'],
 | 
			
		||||
@@ -153,7 +155,7 @@ def _usage_from_consistencygroup(context, group_ref, **kw):
 | 
			
		||||
                      availability_zone=group_ref['availability_zone'],
 | 
			
		||||
                      consistencygroup_id=group_ref['id'],
 | 
			
		||||
                      name=group_ref['name'],
 | 
			
		||||
                      created_at=null_safe_str(group_ref['created_at']),
 | 
			
		||||
                      created_at=timeutils.isotime(at=group_ref['created_at']),
 | 
			
		||||
                      status=group_ref['status'])
 | 
			
		||||
 | 
			
		||||
    usage_info.update(kw)
 | 
			
		||||
@@ -185,7 +187,7 @@ def _usage_from_cgsnapshot(context, cgsnapshot_ref, **kw):
 | 
			
		||||
        cgsnapshot_id=cgsnapshot_ref['id'],
 | 
			
		||||
        name=cgsnapshot_ref['name'],
 | 
			
		||||
        consistencygroup_id=cgsnapshot_ref['consistencygroup_id'],
 | 
			
		||||
        created_at=null_safe_str(cgsnapshot_ref['created_at']),
 | 
			
		||||
        created_at=timeutils.isotime(at=cgsnapshot_ref['created_at']),
 | 
			
		||||
        status=cgsnapshot_ref['status'])
 | 
			
		||||
 | 
			
		||||
    usage_info.update(kw)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user