Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 228332

Re: unable to find vApp modification details in the blocking task.

$
0
0

You are not doing anything wrong. Blocking tasks sometimes do not give you enough information out of the box.

 

The name may be an easy one : get the vApp from the blocking task link. YOu can find a code example on how to do it here :

vCloud Director 5.1 blocking tasks and notification package using AMQP

 

As for the lease time here is a piece of code that may help. It is not best practice as it should find the vApp by href and not by name and then ID but you can get the idea.

 

//Using query service to get further information on the to be deployed vApp
var queryService = vcdHost.toAdminObject().toAdminExtensionObject().getExtensionQueryService();
var expression = new VclExpression(VclQueryVAppField.NAME, vApp.name, VclExpressionType.EQUALS);
var filter = new VclFilter(expression);
var params = new VclQueryParams();
params.setFilter(filter);
var resultSet = queryService.queryAllVappRecords(params);
while (resultSet != null) {    var records = resultSet.getRecords();    for each (var record in records) {        //Since we got the vApp by its name we want to check it is the right one        if (record.href == vApp.getReference().href) {            var vAppCreationDate = VclMiscObjectFactory.convertToGregorianCalendar(record.creationDate).toString();            var vAppNumberOfVMs = record.numberOfVMs;            var vAppStorageMB = record.storageKB / 1024;                var map = record.otherAttributes;            var vAppAutoDeleteDate = "Unlimited";            for each (k in map.keys) {                if (k.getLocalPart() == "autoDeleteDate") {                    var vAppAutoDeleteDateString = map.get(k);                    if  (vAppAutoDeleteDateString != null && vAppAutoDeleteDateString != undefined) {                        var vAppAutoDeleteDateXmlGregorianCalendar = VclMiscObjectFactory.xmlGregorianCalendarFromString(vAppAutoDeleteDateString);                        var vAppAutoDeleteDate = VclMiscObjectFactory.convertToGregorianCalendar(vAppAutoDeleteDateXmlGregorianCalendar).toString();                    }                    System.log(k.getLocalPart() + " : " + map.get(k));                }            }        }    }    resultSet = resultSet.getNextPage();
}

Viewing all articles
Browse latest Browse all 228332

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>