1 Let's clone some PCs!

1.1 Update your workshop-kit repo, to be safe

cd /home/nsrc/workshop-kit
git pull

1.2 Check you have a gold VM image built.

First, make sure you have at least one gold image built... If it's not called gold but gold2 or gold3, then use that.

virsh list --all

If the gold is not called gold, but, say, gold3, then you will need to edit the file /home/nsrc/workshop-kit/scripts/cloneall-nmm.sh and change these lines:

img_name1=gold.ws.nsrc.org
img_name2=gold.ws.nsrc.org

To this:

img_name1=NAME_OF_GOLD.ws.nsrc.org
img_name2=NAME_OF_GOLD.ws.nsrc.org

NOTE: If you do not have at least a gold image, you will need to build one with vmbuilder.

1.3 Let's clone some VMs!

Go into the directory /home/nsrc/workshop-kit/scripts/, and run the cloneall-nmm.sh:

cd /home/nsrc/workshop-kit/scripts/
sudo ./cloneall-nmm.sh

You should see a lot of output, as the clone scripts first try and move any previous PCs out of the way, then clones the gold (or whatever it is called on your server) to the individual PC names (1 - 36).

If everything goes well, you should be able to type virsh list --all and see:

 Id Name                 State
----------------------------------
    ...
  - pc1.ws.nsrc.org      shut off
  - pc10.ws.nsrc.org     shut off
  - pc11.ws.nsrc.org     shut off
  - pc12.ws.nsrc.org     shut off
  - pc13.ws.nsrc.org     shut off
  - pc14.ws.nsrc.org     shut off
  - pc15.ws.nsrc.org     shut off
  - pc16.ws.nsrc.org     shut off
    ...

1.4 Start the VMs

Time to start all those PCs!

The easiest way:

for num in {1..36}
do
  virsh start pc$num.ws.nsrc.org
done

You should see:

Domain pc1.ws.nsrc.org started
Domain pc2.ws.nsrc.org started
Domain pc3.ws.nsrc.org started
...

1.5 Ping the PCs

Wait a few minutes, then try to ping one of the PCs:

ping pc1.ws.nsrc.org
ping pc5.ws.nsrc.org
ping pc9.ws.nsrc.org
...

You can try and ping the first PC in every group (1-4, 5-8, 9-12, etc...).

Do they answer ?

How do you think the correct IP address was given to each of these PCs ? Remember, we cloned the gold image, which means all machines were identical.

How does it work ?

Note: if the PCs do not answer, you can always log on to them using the virsh console command, for instance:

virsh console pcX.ws.nsrc.org

You can then log in as the sysadm user and the password you have learned in class. Run ifconfig to check which IP, if any, the PC has received.

1.6 Connectivity test

Now, try and ssh into one of the PCs as the sysadm user:

ssh sysadm@pcX.ws.nsrc.org

From there:

What do you observe ?