public static TIntIntHashMap makeVMIndex ( Collection < Instance > instances ) { TIntIntHashMap index = new TIntIntHashMap ( ) ; int p = 0 ; for ( Instance i : instances ) { Mapping m = i . getModel ( ) . getMapping ( ) ; for ( Node n : m . getOnlineNodes ( ) ) { for ( VM v : m . getRunningVMs ( n ) ) { index . put ( v . id ( ) , p ) ; } for ( VM v : m . getSleepingVMs ( n ) ) { index . put ( v . id ( ) , p ) ; } } for ( VM v : m . getReadyVMs ( ) ) { index . put ( v . id ( ) , p ) ; } p ++ ; } return index ; }
Make an index revealing the position of each VM in a collection of disjoint instances