Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
G
gpucloudsim
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LPDS
gpucloudsim
Commits
163c51e4
Commit
163c51e4
authored
Apr 27, 2011
by
Anton Beloglazov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Added handling null migrationMap
parent
ef051eb2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
36 deletions
+40
-36
PowerDatacenter.java
...ain/java/org/cloudbus/cloudsim/power/PowerDatacenter.java
+20
-18
PowerDatacenterNonPowerAware.java
...cloudbus/cloudsim/power/PowerDatacenterNonPowerAware.java
+20
-18
No files found.
modules/cloudsim/src/main/java/org/cloudbus/cloudsim/power/PowerDatacenter.java
View file @
163c51e4
...
...
@@ -147,25 +147,27 @@ public class PowerDatacenter extends Datacenter {
if
(!
isDisableMigrations
())
{
List
<
Map
<
String
,
Object
>>
migrationMap
=
getVmAllocationPolicy
().
optimizeAllocation
(
getVmList
());
for
(
Map
<
String
,
Object
>
migrate
:
migrationMap
)
{
Vm
vm
=
(
Vm
)
migrate
.
get
(
"vm"
);
PowerHost
targetHost
=
(
PowerHost
)
migrate
.
get
(
"host"
);
PowerHost
oldHost
=
(
PowerHost
)
vm
.
getHost
();
targetHost
.
addMigratingInVm
(
vm
);
if
(
oldHost
==
null
)
{
Log
.
formatLine
(
"%.2f: Migration of VM #%d to Host #%d is started"
,
CloudSim
.
clock
(),
vm
.
getId
(),
targetHost
.
getId
());
}
else
{
Log
.
formatLine
(
"%.2f: Migration of VM #%d from Host #%d to Host #%d is started"
,
CloudSim
.
clock
(),
vm
.
getId
(),
oldHost
.
getId
(),
targetHost
.
getId
());
if
(
migrationMap
!=
null
)
{
for
(
Map
<
String
,
Object
>
migrate
:
migrationMap
)
{
Vm
vm
=
(
Vm
)
migrate
.
get
(
"vm"
);
PowerHost
targetHost
=
(
PowerHost
)
migrate
.
get
(
"host"
);
PowerHost
oldHost
=
(
PowerHost
)
vm
.
getHost
();
targetHost
.
addMigratingInVm
(
vm
);
if
(
oldHost
==
null
)
{
Log
.
formatLine
(
"%.2f: Migration of VM #%d to Host #%d is started"
,
CloudSim
.
clock
(),
vm
.
getId
(),
targetHost
.
getId
());
}
else
{
Log
.
formatLine
(
"%.2f: Migration of VM #%d from Host #%d to Host #%d is started"
,
CloudSim
.
clock
(),
vm
.
getId
(),
oldHost
.
getId
(),
targetHost
.
getId
());
}
incrementMigrationCount
();
vm
.
setInMigration
(
true
);
/** VM migration delay = RAM / bandwidth + C (C = 10 sec) **/
send
(
getId
(),
vm
.
getRam
()
/
((
double
)
vm
.
getBw
()
/
8000
)
+
0
,
CloudSimTags
.
VM_MIGRATE
,
migrate
);
}
incrementMigrationCount
();
vm
.
setInMigration
(
true
);
/** VM migration delay = RAM / bandwidth + C (C = 10 sec) **/
send
(
getId
(),
vm
.
getRam
()
/
((
double
)
vm
.
getBw
()
/
8000
)
+
0
,
CloudSimTags
.
VM_MIGRATE
,
migrate
);
}
}
...
...
modules/cloudsim/src/main/java/org/cloudbus/cloudsim/power/PowerDatacenterNonPowerAware.java
View file @
163c51e4
...
...
@@ -121,25 +121,27 @@ public class PowerDatacenterNonPowerAware extends PowerDatacenter {
if
(!
isDisableMigrations
())
{
List
<
Map
<
String
,
Object
>>
migrationMap
=
getVmAllocationPolicy
().
optimizeAllocation
(
getVmList
());
for
(
Map
<
String
,
Object
>
migrate
:
migrationMap
)
{
Vm
vm
=
(
Vm
)
migrate
.
get
(
"vm"
);
PowerHost
targetHost
=
(
PowerHost
)
migrate
.
get
(
"host"
);
PowerHost
oldHost
=
(
PowerHost
)
vm
.
getHost
();
targetHost
.
addMigratingInVm
(
vm
);
if
(
oldHost
==
null
)
{
Log
.
formatLine
(
"%.2f: Migration of VM #%d to Host #%d is started"
,
CloudSim
.
clock
(),
vm
.
getId
(),
targetHost
.
getId
());
}
else
{
Log
.
formatLine
(
"%.2f: Migration of VM #%d from Host #%d to Host #%d is started"
,
CloudSim
.
clock
(),
vm
.
getId
(),
oldHost
.
getId
(),
targetHost
.
getId
());
if
(
migrationMap
!=
null
)
{
for
(
Map
<
String
,
Object
>
migrate
:
migrationMap
)
{
Vm
vm
=
(
Vm
)
migrate
.
get
(
"vm"
);
PowerHost
targetHost
=
(
PowerHost
)
migrate
.
get
(
"host"
);
PowerHost
oldHost
=
(
PowerHost
)
vm
.
getHost
();
targetHost
.
addMigratingInVm
(
vm
);
if
(
oldHost
==
null
)
{
Log
.
formatLine
(
"%.2f: Migration of VM #%d to Host #%d is started"
,
CloudSim
.
clock
(),
vm
.
getId
(),
targetHost
.
getId
());
}
else
{
Log
.
formatLine
(
"%.2f: Migration of VM #%d from Host #%d to Host #%d is started"
,
CloudSim
.
clock
(),
vm
.
getId
(),
oldHost
.
getId
(),
targetHost
.
getId
());
}
incrementMigrationCount
();
vm
.
setInMigration
(
true
);
/** VM migration delay = RAM / bandwidth + C (C = 10 sec) **/
send
(
getId
(),
vm
.
getRam
()
/
((
double
)
vm
.
getBw
()
/
8000
)
+
10
,
CloudSimTags
.
VM_MIGRATE
,
migrate
);
}
incrementMigrationCount
();
vm
.
setInMigration
(
true
);
/** VM migration delay = RAM / bandwidth + C (C = 10 sec) **/
send
(
getId
(),
vm
.
getRam
()
/
((
double
)
vm
.
getBw
()
/
8000
)
+
10
,
CloudSimTags
.
VM_MIGRATE
,
migrate
);
}
}
...
...
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