Skip to content
This repository was archived by the owner on Mar 31, 2023. It is now read-only.

Commit 4d26cf8

Browse files
authored
Merge pull request #184 from fabiokung/vm-ids
Expose VM ids to fitness constraints and functions
2 parents 4fb3ff9 + 723d095 commit 4d26cf8

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

fenzo-core/src/main/java/com/netflix/fenzo/AssignableVirtualMachine.java

+18-1
Original file line numberDiff line numberDiff line change
@@ -841,29 +841,37 @@ VirtualMachineCurrentState getVmCurrentState() {
841841
public String getHostname() {
842842
return hostname;
843843
}
844+
845+
@Override
846+
public String getVMId() {
847+
return currVMId;
848+
}
849+
844850
@Override
845851
public Map<String, PreferentialNamedConsumableResourceSet> getResourceSets() {
846852
return resourceSets;
847853
}
854+
848855
@Override
849856
public VirtualMachineLease getCurrAvailableResources() {
850857
return currTotalLease;
851858
}
852859

853860
@Override
854861
public Collection<Protos.Offer> getAllCurrentOffers() {
855-
System.out.println("****************************** ");
856862
return offers;
857863
}
858864

859865
@Override
860866
public Collection<TaskAssignmentResult> getTasksCurrentlyAssigned() {
861867
return Collections.emptyList();
862868
}
869+
863870
@Override
864871
public Collection<TaskRequest> getRunningTasks() {
865872
return Collections.unmodifiableCollection(previouslyAssignedTasksMap.values());
866873
}
874+
867875
@Override
868876
public long getDisabledUntil() {
869877
return disabledUntil;
@@ -881,10 +889,17 @@ private VirtualMachineCurrentState vmCurrentState() {
881889
public String getHostname() {
882890
return hostname;
883891
}
892+
893+
@Override
894+
public String getVMId() {
895+
return currVMId;
896+
}
897+
884898
@Override
885899
public Map<String, PreferentialNamedConsumableResourceSet> getResourceSets() {
886900
return resourceSets;
887901
}
902+
888903
@Override
889904
public VirtualMachineLease getCurrAvailableResources() {
890905
return currTotalLease;
@@ -899,10 +914,12 @@ public Collection<Protos.Offer> getAllCurrentOffers() {
899914
public Collection<TaskAssignmentResult> getTasksCurrentlyAssigned() {
900915
return Collections.unmodifiableCollection(assignmentResults.values());
901916
}
917+
902918
@Override
903919
public Collection<TaskRequest> getRunningTasks() {
904920
return Collections.unmodifiableCollection(previouslyAssignedTasksMap.values());
905921
}
922+
906923
@Override
907924
public long getDisabledUntil() {
908925
return disabledUntil;

fenzo-core/src/main/java/com/netflix/fenzo/VirtualMachineCurrentState.java

+10-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@ public interface VirtualMachineCurrentState {
3535
*/
3636
String getHostname();
3737

38+
/**
39+
* Get the virtual machine id provided by the last seen {@link VirtualMachineLease lease} of this host.
40+
*
41+
* @return an identifier provided by the last {@link VirtualMachineLease}. It can be <tt>null</tt> when no leases
42+
* were seen yet, or when leases do not include a VM id.
43+
*/
44+
String getVMId();
45+
3846
/**
3947
* Get a map of resource sets of the virtual machine.
4048
*
@@ -53,6 +61,7 @@ public interface VirtualMachineCurrentState {
5361
/**
5462
* Get all offers for the VM that represent the available resources. There may be more than one offer over time
5563
* if Mesos master offered partial resources for the VM multiple times.
64+
*
5665
* @return A collection of Mesos resource offers.
5766
*/
5867
Collection<Protos.Offer> getAllCurrentOffers();
@@ -61,7 +70,7 @@ public interface VirtualMachineCurrentState {
6170
* Get list of task assignment results for this host so far in the current scheduling run.
6271
*
6372
* @return a collection of tasks that the current scheduling iteration assigned to this host but that are
64-
* not launched/executing yet
73+
* not launched/executing yet
6574
*/
6675
Collection<TaskAssignmentResult> getTasksCurrentlyAssigned();
6776

0 commit comments

Comments
 (0)