diff options
Diffstat (limited to 'tools/pharos-validator/docs/howto')
6 files changed, 74 insertions, 0 deletions
diff --git a/tools/pharos-validator/docs/howto/virt-manager/HOWTO b/tools/pharos-validator/docs/howto/virt-manager/HOWTO new file mode 100644 index 00000000..bed105a7 --- /dev/null +++ b/tools/pharos-validator/docs/howto/virt-manager/HOWTO @@ -0,0 +1,50 @@ +Syntax guide: + 1. [[ denotes commands / code ]] + 2. <> denotes bullet, sub-bullets will have an extra > appended depending on their sub-level + 3. ${denotes variables the the user is expected to fill out depending on their specific needs} + +Tutorials: + 1. Configure host machine for virtualization + 2. Make a Virtual Machine with storage + 3. Make a blank virtual machine awaiting PXE + 4. Install and save default VM image + 5. Configure Networking with VMs +; + +1 -- + <> Install Host OS (CentOS7) + <> Use package manager (yum) to install qemu, kvm, virt-install, and virt-manager) + <> Edit kernel commandline option with "kvm-intel.nested=1" and or edit /etc/modprobe.d/kvm-intel.conf to contain "options kvm-intel nested=1". This will allow for nested performance to not be absolutely terrible and slow. + <>> A command to do this is [[ echo "options kvm-intel nested=1" | sudo tee /etc/modprobe.d/kvm-intel.conf ]] + <> + +2 -- + <> Creating new disks uses the command [[ qemu-img create -f raw ${image-name}.img ${size} ]], where image-name is the name of your vm's disk, and size is the size of the disk you want (e.g. 2G will be a 2 Gigabyte disk, 512M will be 512 Megabytes) + <> Download some installation media (e.g. CentOS7-DVD.iso) + <> Using those disks utilizing the virt-install tool [[ virt-install -n name_of_vm --graphics none --vcpus=2 -l /path/to/installation.iso --ram=512 --disk path=/path/to/disk.img,cache=none --extra-args="console=ttyS0" ]] don't use --extra-args="console=ttyS0" if you would rather have the VM use the X-display instead of a serial console. + <> + +3 -- + <> TODO + +4 -- + <> Either script the install or make a template of the VM + +5 -- + <> [[ virsh attach-interface --domain ${name} --type network --source default --model virtio --mac ${mac-address} --config --live ]] Where name is the name of the virtual machine that virsh knows of, and ${mac-address} is any randomly generated MAC address. + <> Each node will require at least 3 variants of the above command to have 3 more NICs in addition to the one a virtual machine has by default as the pharos specification requires. + <> You can verify the addition of the above NICs with [[ virsh domiflist ${name} ]] where ${name} is the virtual machine you would like to see the NICs of. + <> These NICs may be detached with the command [[ virsh detach-interface --domain ${name} --type network --mac ${mac-address} --config ]] where ${name} is the vm you're targeting and ${mac-address} is the NIC's specific MAC address. + +0 6 -- + <> Add a virtual interface to a bridge by editing the configuration file that qemu generates. + <> Change the line from this: + <interface type='network'> + <mac address='00:11:22:33:44:55'/> + <source network='default'/> + </interface> + <> To this: + <interface type='bridge'> + <mac address='00:11:22:33:44:55'/> + <source bridge='br0'/> + </interface> diff --git a/tools/pharos-validator/docs/howto/virt-manager/bridgevm.sh b/tools/pharos-validator/docs/howto/virt-manager/bridgevm.sh new file mode 100755 index 00000000..370132b5 --- /dev/null +++ b/tools/pharos-validator/docs/howto/virt-manager/bridgevm.sh @@ -0,0 +1 @@ +sudo /usr/libexec/qemu-kvm -hda /vm/template/jump-host.img -device e1000,netdev=net0,mac=DE:AD:BE:EF:FE:7A -netdev tap,id=net0 diff --git a/tools/pharos-validator/docs/howto/virt-manager/genmac.sh b/tools/pharos-validator/docs/howto/virt-manager/genmac.sh new file mode 100755 index 00000000..10b12f92 --- /dev/null +++ b/tools/pharos-validator/docs/howto/virt-manager/genmac.sh @@ -0,0 +1,3 @@ +#!/bin/bash +# generate a random mac address for the qemu nic +printf 'DE:AD:BE:EF:%02X:%02X\n' $((RANDOM%256)) $((RANDOM%256)) diff --git a/tools/pharos-validator/docs/howto/virt-manager/jump-server.sh b/tools/pharos-validator/docs/howto/virt-manager/jump-server.sh new file mode 100755 index 00000000..465ea132 --- /dev/null +++ b/tools/pharos-validator/docs/howto/virt-manager/jump-server.sh @@ -0,0 +1 @@ +sudo virt-install -n jump-host-centos7_0 --graphics none --vcpus=2 --ram=512 --os-type=linux -l /iso/CentOS-7-x86_64-DVD-1511.iso --disk path=/vm/template/jump-host.img,cache=none --extra-args console=ttyS0 diff --git a/tools/pharos-validator/docs/howto/virt-manager/node-cycle.sh b/tools/pharos-validator/docs/howto/virt-manager/node-cycle.sh new file mode 100755 index 00000000..5b945dc7 --- /dev/null +++ b/tools/pharos-validator/docs/howto/virt-manager/node-cycle.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +for i in range $(seq 1 5);do + qemu-kvm -m 512M -boot n -enable-kvm -net nic -net user,tftp=/srv/tftp/,bootfile=/pxelinux.0 & +done diff --git a/tools/pharos-validator/docs/howto/virt-manager/virsh-commands.txt b/tools/pharos-validator/docs/howto/virt-manager/virsh-commands.txt new file mode 100644 index 00000000..45f81856 --- /dev/null +++ b/tools/pharos-validator/docs/howto/virt-manager/virsh-commands.txt @@ -0,0 +1,14 @@ +# Installing an OS on a new VM +virt-install -n jump-host-centos7 --graphics none --vcpus=2 --ram=512 --os-type=linux -l /iso/CentOS-7-x86_64-DVD-1511.iso --disk path=/vm/template/jump-host.img,cache=none --extra-args="console=ttyS0" + +# PXE booting a new vm +virt-install --name jump-host-centos7 --graphics none --vcpus 2 --ram=512 --os-type=linux --os-variant=centos7 --network=bridge:"network_birdge_name" --pxe + +# Unused option for pxe +#--disk path=/vm/template/jump-host.img,cache=none + +# Can't delete a VM? Here are some troubleshooting options +Remember to login as root if needing to destroy virtual machines created by root + +# Command to add network interfaces to VM guest +attach-interface jump-host-centos7_0 --type network --source default --model virtio --mac DE:AD:BE:EF:B4:EF --config --live |