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
53e893b0
Commit
53e893b0
authored
Mar 21, 2011
by
rodrigo.calheiros
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #1 solved: Host now considers its available storage before accepting a VM.
parent
755f3817
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletion
+9
-1
Host.java
...es/cloudsim/src/main/java/org/cloudbus/cloudsim/Host.java
+9
-1
No files found.
modules/cloudsim/src/main/java/org/cloudbus/cloudsim/Host.java
View file @
53e893b0
...
...
@@ -159,6 +159,11 @@ public class Host {
* @post $none
*/
public
boolean
vmCreate
(
Vm
vm
)
{
if
(
storage
<
vm
.
getSize
()){
Log
.
printLine
(
"Allocation of VM #"
+
vm
.
getId
()
+
" to Host #"
+
getId
()
+
" failed by storage"
);
return
false
;
}
if
(!
getRamProvisioner
().
allocateRamForVm
(
vm
,
vm
.
getCurrentRequestedRam
()))
{
Log
.
printLine
(
"Allocation of VM #"
+
vm
.
getId
()
+
" to Host #"
+
getId
()
+
" failed by RAM"
);
return
false
;
...
...
@@ -177,6 +182,7 @@ public class Host {
return
false
;
}
storage
-=
vm
.
getSize
();
getVmList
().
add
(
vm
);
vm
.
setHost
(
this
);
return
true
;
...
...
@@ -195,6 +201,7 @@ public class Host {
vmDeallocate
(
vm
);
getVmList
().
remove
(
vm
);
vm
.
setHost
(
null
);
storage
+=
vm
.
getSize
();
}
}
...
...
@@ -208,6 +215,7 @@ public class Host {
vmDeallocateAll
();
for
(
Vm
vm
:
getVmList
())
{
vm
.
setHost
(
null
);
storage
+=
vm
.
getSize
();
}
getVmList
().
clear
();
}
...
...
@@ -383,7 +391,7 @@ public class Host {
* @return the machine storage
*
* @pre $none
* @post $result > 0
* @post $result >
=
0
*/
public
long
getStorage
()
{
return
storage
;
...
...
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