Package org.cloudsimplus.faultinjection
Class VmClonerSimple
java.lang.Object
org.cloudsimplus.faultinjection.VmClonerSimple
- All Implemented Interfaces:
VmCloner
A basic implementation of a
VmCloner
.- Since:
- CloudSim Plus 1.2.2
- Author:
- raysaoliveira
-
Field Summary
-
Constructor Summary
ConstructorDescriptionVmClonerSimple
(UnaryOperator<Vm> vmClonerFunction, Function<Vm, List<Cloudlet>> cloudletsClonerFunction) Creates aVm
cloner which makes the maximum of 1 Vm clone. -
Method Summary
Modifier and TypeMethodDescriptionClones a givenVm
using the Vm Cloner Function and their Cloudlets using the Cloudlets Cloner Function, binding the cloned Cloudlets to the cloned Vm.int
Gets the number of VMs cloned so far.int
Gets the maximum number of Vm clones to create.boolean
Checks if the maximum number of Vm clones to be created was reached.final VmCloner
setCloudletsClonerFunction
(Function<Vm, List<Cloudlet>> cloudletsClonerFunction) setMaxClonesNumber
(int maxClonesNumber) Sets the maximum number of Vm clones to create.final VmCloner
setVmClonerFunction
(UnaryOperator<Vm> vmClonerFunction) Sets theUnaryOperator
to be used to cloneVm
s.
-
Constructor Details
-
VmClonerSimple
public VmClonerSimple(UnaryOperator<Vm> vmClonerFunction, Function<Vm, List<Cloudlet>> cloudletsClonerFunction) Creates aVm
cloner which makes the maximum of 1 Vm clone.- Parameters:
vmClonerFunction
- theUnaryOperator
to be used to cloneVm
s.cloudletsClonerFunction
- theFunction
to be used to clone Vm'sCloudlet
s.- See Also:
-
-
Method Details
-
getClonedVmsNumber
public int getClonedVmsNumber()Description copied from interface:VmCloner
Gets the number of VMs cloned so far.- Specified by:
getClonedVmsNumber
in interfaceVmCloner
- Returns:
-
clone
Description copied from interface:VmCloner
Clones a givenVm
using the Vm Cloner Function and their Cloudlets using the Cloudlets Cloner Function, binding the cloned Cloudlets to the cloned Vm. -
setVmClonerFunction
Description copied from interface:VmCloner
Sets theUnaryOperator
to be used to cloneVm
s. It is a Function which, when called, creates a clone of a specific Vm.- Specified by:
setVmClonerFunction
in interfaceVmCloner
- Parameters:
vmClonerFunction
- theVm
cloner Function to set- Returns:
-
setCloudletsClonerFunction
public final VmCloner setCloudletsClonerFunction(Function<Vm, List<Cloudlet>> cloudletsClonerFunction) Description copied from interface:VmCloner
Gets theFunction
to be used to clone Vm'sCloudlet
s. When the given Function is called, creates a clone of cloudlets which were running inside a specific Vm.Such a Function is used to recreate those Cloudlets inside a clone of the failed VM. In this case, all the Cloudlets are recreated from scratch into the cloned VM. This way, when they are submitted to a broker, they re-start execution from the beginning.
- Specified by:
setCloudletsClonerFunction
in interfaceVmCloner
- Parameters:
cloudletsClonerFunction
- theCloudlet
s cloner Function to set- Returns:
-
getMaxClonesNumber
public int getMaxClonesNumber()Description copied from interface:VmCloner
Gets the maximum number of Vm clones to create. For instance, if this value is equal to 2, it means if all VMs from a given broker are destroyed multiple times, a clone will be created only 2 times. If all VMs are destroyed again for the 3rd time, no clone will be created. The default value is 1.- Specified by:
getMaxClonesNumber
in interfaceVmCloner
- Returns:
-
isMaxClonesNumberReached
public boolean isMaxClonesNumberReached()Description copied from interface:VmCloner
Checks if the maximum number of Vm clones to be created was reached.- Specified by:
isMaxClonesNumberReached
in interfaceVmCloner
- Returns:
- true if the maximum number of clones was reached, false otherwise
-
setMaxClonesNumber
Description copied from interface:VmCloner
Sets the maximum number of Vm clones to create. For instance, if this value is equal to 2, it means if all VMs from a given broker are destroyed multiple times, a clone will be created only 2 times. If all VMs are destroyed again for the 3rd time, no clone will be created. The default value is 1.- Specified by:
setMaxClonesNumber
in interfaceVmCloner
- Parameters:
maxClonesNumber
- the value to set- Returns:
-