Tabnine Logo
Host.getId
Code IndexAdd Tabnine to your IDE (free)

How to use
getId
method
in
org.cloudbus.cloudsim.Host

Best Java code snippets using org.cloudbus.cloudsim.Host.getId (Showing top 15 results out of 315)

origin: Cloudslab/cloudsim

/**
 * Gets a {@link Host} with a given id.
 * 
 * @param <T> the generic type
 * @param hostList the list of existing hosts
 * @param id the host ID
 * @return a Host with the given ID or $null if not found
   * 
 * @pre id >= 0
 * @post $none
 */
public static <T extends Host> T getById(List<T> hostList, int id) {
  for (T host : hostList) {
    if (host.getId() == id) {
      return host;
    }
  }
  return null;
}
origin: Cloudslab/cloudsim

NetworkHost hs1 = (NetworkHost) hs;
hs1.bandwidth = NetworkConstants.BandWidthEdgeHost;
int switchnum = (int) (hs.getId() / NetworkConstants.EdgeSwitchPort);
edgeswitch[switchnum].hostlist.put(hs.getId(), hs1);
dc.HostToSwitchid.put(hs.getId(), edgeswitch[switchnum].getId());
hs1.sw = edgeswitch[switchnum];
List<NetworkHost> hslist = hs1.sw.fintimelistHost.get(0D);
origin: Cloudslab/cloudsim

Host host = hosts.get(j);
if (!vmAllocationPolicy.getTimeHistory().containsKey(host.getId())) {
  continue;
File file = new File(outputPath + "_" + host.getId() + ".csv");
try {
  file.createNewFile();
  List<Double> timeData = vmAllocationPolicy.getTimeHistory().get(host.getId());
  List<Double> utilizationData = vmAllocationPolicy.getUtilizationHistory().get(host.getId());
  List<Double> metricData = vmAllocationPolicy.getMetricHistory().get(host.getId());
origin: Cloudslab/cloudsim

/**
 * Sets the PEs of the host to a FAILED status. NOTE: <tt>resName</tt> is used for debugging
 * purposes, which is <b>ON</b> by default. Use {@link #setFailed(boolean)} if you do not want
 * this information.
 * 
 * @param resName the name of the resource
 * @param failed the failed
 * @return <tt>true</tt> if successful, <tt>false</tt> otherwise
 */
public boolean setFailed(String resName, boolean failed) {
  // all the PEs are failed (or recovered, depending on fail)
  this.failed = failed;
  PeList.setStatusFailed(getPeList(), resName, getId(), failed);
  return true;
}
origin: Cloudslab/cloudsim

/**
 * Prints the metric history.
 * 
 * @param hosts the hosts
 * @param vmAllocationPolicy the vm allocation policy
 */
public static void printMetricHistory(
    List<? extends Host> hosts,
    PowerVmAllocationPolicyMigrationAbstract vmAllocationPolicy) {
  for (int i = 0; i < 10; i++) {
    Host host = hosts.get(i);
    Log.printLine("Host #" + host.getId());
    Log.printLine("Time:");
    if (!vmAllocationPolicy.getTimeHistory().containsKey(host.getId())) {
      continue;
    }
    for (Double time : vmAllocationPolicy.getTimeHistory().get(host.getId())) {
      Log.format("%.2f, ", time);
    }
    Log.printLine();
    for (Double utilization : vmAllocationPolicy.getUtilizationHistory().get(host.getId())) {
      Log.format("%.2f, ", utilization);
    }
    Log.printLine();
    for (Double metric : vmAllocationPolicy.getMetricHistory().get(host.getId())) {
      Log.format("%.2f, ", metric);
    }
    Log.printLine();
  }
}
origin: Cloudslab/cloudsim

  @Override
  public boolean allocateHostForVm(Vm vm, Host host) {
    if (host.vmCreate(vm)) { // if vm has been succesfully created in the host
      getVmTable().put(vm.getUid(), host);

      int requiredPes = vm.getNumberOfPes();
      int idx = getHostList().indexOf(host);
      getUsedPes().put(vm.getUid(), requiredPes);
      getFreePes().set(idx, getFreePes().get(idx) - requiredPes);

      Log.formatLine(
          "%.2f: VM #" + vm.getId() + " has been allocated to the host #" + host.getId(),
          CloudSim.clock());
      return true;
    }

    return false;
  }
}
origin: Cloudslab/cloudsim

  @Override
  public boolean allocateHostForVm(Vm vm, Host host) {
    if (host.vmCreate(vm)) { // if vm has been succesfully created in the host
      getVmTable().put(vm.getUid(), host);

      int requiredPes = vm.getNumberOfPes();
      int idx = getHostList().indexOf(host);
      getUsedPes().put(vm.getUid(), requiredPes);
      getFreePes().set(idx, getFreePes().get(idx) - requiredPes);

      Log.formatLine(
          "%.2f: VM #" + vm.getId() + " has been allocated to the host #" + host.getId(),
          CloudSim.clock());
      return true;
    }

    return false;
  }
}
origin: Cloudslab/cloudsim

/**
 * Creates the given VM within the NetworkDatacenter. 
   * It can be directly accessed by Datacenter Broker which manages allocation of Cloudlets.
 * 
   * @param vm
   * @return true if the VW was created successfully, false otherwise
 */
public boolean processVmCreateNetwork(Vm vm) {
  boolean result = getVmAllocationPolicy().allocateHostForVm(vm);
  if (result) {
    VmToSwitchid.put(vm.getId(), ((NetworkHost) vm.getHost()).sw.getId());
    VmtoHostlist.put(vm.getId(), vm.getHost().getId());
    System.out.println(vm.getId() + " VM is created on " + vm.getHost().getId());
    getVmList().add(vm);
    vm.updateVmProcessing(CloudSim.clock(), getVmAllocationPolicy().getHost(vm).getVmScheduler()
        .getAllocatedMipsForVm(vm));
  }
  return result;
}
origin: Cloudslab/cloudsim

@Override
public boolean allocateHostForVm(Vm vm, Host host) {
  if (host == null) {
    Log.formatLine("%.2f: No suitable host found for VM #" + vm.getId() + "\n", CloudSim.clock());
    return false;
  }
  if (host.vmCreate(vm)) { // if vm has been succesfully created in the host
    getVmTable().put(vm.getUid(), host);
    Log.formatLine(
        "%.2f: VM #" + vm.getId() + " has been allocated to the host #" + host.getId(),
        CloudSim.clock());
    return true;
  }
  Log.formatLine(
      "%.2f: Creation of VM #" + vm.getId() + " on the host #" + host.getId() + " failed\n",
      CloudSim.clock());
  return false;
}
origin: Cloudslab/cloudsim

if (getStorage() < vm.getSize()) {
  Log.printConcatLine("[VmScheduler.addMigratingInVm] Allocation of VM #", vm.getId(), " to Host #",
      getId(), " failed by storage");
  System.exit(0);
      getId(), " failed by RAM");
  System.exit(0);
      + getId() + " failed by BW");
  System.exit(0);
if (!getVmScheduler().allocatePesForVm(vm, vm.getCurrentRequestedMips())) {
  Log.printLine("[VmScheduler.addMigratingInVm] Allocation of VM #" + vm.getId() + " to Host #"
      + getId() + " failed by MIPS");
  System.exit(0);
origin: Cloudslab/cloudsim

    CloudSim.clock(),
    vm.getId(),
    host.getId());
vm.setInMigration(false);
origin: Cloudslab/cloudsim

Log.printConcatLine("[VmScheduler.vmCreate] Allocation of VM #", vm.getId(), " to Host #", getId(),
    " failed by storage");
return false;
Log.printConcatLine("[VmScheduler.vmCreate] Allocation of VM #", vm.getId(), " to Host #", getId(),
    " failed by RAM");
return false;
Log.printConcatLine("[VmScheduler.vmCreate] Allocation of VM #", vm.getId(), " to Host #", getId(),
    " failed by BW");
getRamProvisioner().deallocateRamForVm(vm);
Log.printConcatLine("[VmScheduler.vmCreate] Allocation of VM #", vm.getId(), " to Host #", getId(),
    " failed by MIPS");
getRamProvisioner().deallocateRamForVm(vm);
origin: thiagotts/CloudReports

    getVmsToDatacentersMap().put(vmId, datacenterId);
    getVmsCreatedList().add(VmList.getById(getVmList(), vmId));
    Log.printLine(CloudSim.clock()+": "+getName()+ ": VM #"+vmId+" has been created in " + getDatacenterCharacteristicsList().get(datacenterId).getResourceName() + ", Host #" + VmList.getById(getVmsCreatedList(), vmId).getHost().getId());
} else {
    Log.printLine(CloudSim.clock()+": "+getName()+ ": Creation of VM #"+vmId+" failed in "+ getDatacenterCharacteristicsList().get(datacenterId).getResourceName());
origin: Cloudslab/cloudsim

  Log.printConcatLine(CloudSim.clock(), ": ", getName(), ": VM #", vmId,
      " has been created in Datacenter #", datacenterId, ", Host #",
      VmList.getById(getVmsCreatedList(), vmId).getHost().getId());
} else {
  Log.printConcatLine(CloudSim.clock(), ": ", getName(), ": Creation of VM #", vmId,
origin: Cloudslab/cloudsim

Log.formatLine(
    "%.2f: [Host #" + getId() + "] Total allocated MIPS for VM #" + vm.getId()
        + " (Host #" + vm.getHost().getId()
        + ") is %.2f, was requested %.2f out of total %.2f (%.2f%%)",
    CloudSim.clock(),
org.cloudbus.cloudsimHostgetId

Javadoc

Gets the host id.

Popular methods of Host

  • allocatePesForVm
    Allocates PEs for a VM.
  • getAllocatedMipsForVm
    Gets the MIPS share of each Pe that is allocated to a given VM.
  • getRamProvisioner
    Gets the ram provisioner.
  • vmCreate
    Try to allocate resources to a new VM in the Host.
  • <init>
    Instantiates a new host.
  • getBwProvisioner
    Gets the bw provisioner.
  • getNumberOfPes
    Gets the pes number.
  • getPeList
    Gets the pe list.
  • getStorage
    Gets the host storage.
  • getTotalMips
    Gets the total mips.
  • getVm
    Gets a VM by its id and user.
  • getVmList
    Gets the vm list.
  • getVm,
  • getVmList,
  • getVmScheduler,
  • getVmsMigratingIn,
  • isFailed,
  • reallocateMigratingInVms,
  • removeMigratingInVm,
  • setBwProvisioner,
  • setDatacenter

Popular in Java

  • Reactive rest calls using spring rest template
  • putExtra (Intent)
  • scheduleAtFixedRate (Timer)
  • addToBackStack (FragmentTransaction)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now