1

i create 10 vm by using loop.and every Vm use same number of MIPS , as the parameter for all the Vms are same .how i can create differnt vms with different mips?

    //VM Parameters
    long size = 10000; //image size (MB)
    int ram = 512; //vm memory (MB)
    int mips = 1000;
    long bw = 1000;
    int pesNumber = 1; //number of cpus
    String vmm = "Xen"; //VMM name

    //create VMs
    CondorVM[] vm = new CondorVM[vms];

    for (int i = 0; i < vms; i++) {
        double ratio = 1.0;
        vm[i] = new CondorVM(i, userId, mips * ratio, pesNumber, ram, bw, size, vmm, new CloudletSchedulerSpaceShared());
        list.add(vm[i]);
    }

    return list;
}

in the main method vmNum is initialized is equal to 10.

Fahad Khan
  • 35
  • 6
  • There are too many ways to do this. For instance, you could define VM profiles and read them from a config file. Please try to make your question a bit more specific so we can help you. – Thiago Sá Nov 24 '17 at 08:31
  • How to create 10 vm with differnt mips ? – Fahad Khan Nov 26 '17 at 09:36

1 Answers1

0

Simple is that. Create an array of mips and pass it to vm constructor over a loop.

In your example:

long size = 10000; //image size (MB)
int ram = 512; //vm memory (MB)
int[] mips= {1000,200,3000,.....,500}; //Here's the array
long bw = 1000;
    int pesNumber = 1; //number of cpus
    String vmm = "Xen"; //VMM name

    //create VMs
    CondorVM[] vm = new CondorVM[vms];

    for (int i = 0; i < vms; i++) {
        double ratio = 1.0;
        vm[i] = new CondorVM(i, userId, mips[i] * ratio, pesNumber, ram, bw, size, vmm, new CloudletSchedulerSpaceShared());
        list.add(vm[i]);
    }

    return list;
}

Hope it would help you !!

Chanda Korat
  • 2,453
  • 2
  • 19
  • 23