Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Lucas Cavalcante
cloudsimplus
Commits
89a4945f
Commit
89a4945f
authored
Jul 19, 2018
by
Rafael Vieira Falcão
Browse files
Adding consolidation algorithm approach
parent
e0401313
Changes
1
Hide whitespace changes
Inline
Side-by-side
cloudsim-plus/src/main/java/org/cloudbus/cloudsim/allocationpolicies/migration/VmAllocationPolicyMigrationSlaFixedTightHost.java
View file @
89a4945f
package
org.cloudbus.cloudsim.allocationpolicies.migration
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -61,6 +62,7 @@ public class VmAllocationPolicyMigrationSlaFixedTightHost extends VmAllocationPo
Map
<
Vm
,
Host
>
migrationMap
=
super
.
getOptimizedAllocationMap
(
vmList
);
// Consolidate Loose hosts
optimisticConsolidation
(
migrationMap
);
return
migrationMap
;
}
...
...
@@ -96,8 +98,31 @@ public class VmAllocationPolicyMigrationSlaFixedTightHost extends VmAllocationPo
return
bestCandidateHost
;
}
private
boolean
isTightHost
(
Host
host
)
{
return
host
.
getIopsProvisioner
()
instanceof
ResourceProvisionerShared
;
private
Map
<
Vm
,
Host
>
optimisticConsolidation
(
Map
<
Vm
,
Host
>
actualMigrationMap
)
{
List
<
Host
>
orderedLooseHosts
=
getOrderedLooseHosts
();
for
(
int
i
=
0
;
i
<
orderedLooseHosts
.
size
();
i
++)
{
for
(
int
j
=
orderedLooseHosts
.
size
()
-
1
;
j
>=
0
;
j
--)
{
if
(
i
>=
j
)
continue
;
for
(
Vm
vm
:
orderedLooseHosts
.
get
(
i
).
getVmList
())
{
if
(
orderedLooseHosts
.
get
(
j
).
isSuitableForVm
(
vm
))
{
actualMigrationMap
.
put
(
vm
,
orderedLooseHosts
.
get
(
j
));
}
}
}
}
return
actualMigrationMap
;
}
// Returns the list of loose hosts ordered (increse order) by the number of Vm
private
List
<
Host
>
getOrderedLooseHosts
()
{
List
<
Host
>
looseHosts
=
getHostsWithLooseSla
();
sort
(
looseHosts
);
Collections
.
reverse
(
looseHosts
);
return
looseHosts
;
}
private
int
getVmsThreshold
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment