===== VMINFO ===== Base VM created. Specs of this are as follows * Name: centosbase * 1 vCPU * 1GB vRAM * 10GB vHDD * IPSET Used for install is 78.129.208.29 This machine is the base os to clone to other VMs. This when running can be accessed via the console when connected to HAL. I have created 3 users. These are darren, dave, and wayne. Auth keys copied from Skype, and other sources to allow them all to connect to this machine when turned on or copied to another target. No confirguration of the clined VMs due to ssh and user configuration completed on this machine. To clone the above. Log in to vms it will take you to the default vms user directory. the following code will need to be run uder this user keeping the paths the same. virt-clone --original centosbase -n (Insert New Name) -f /var/lib/libvirt/vms/images/(name of image).qcow2 ==== Connecting To the VM Through The Host ==== The following code has been activated on the Host. This must not be removed or stopped. sudo systemctl enable serial-getty@ttyS0.servicesudo systemctl enable serial-getty@ttyS0.service There are a number of ways to connect to each VM either via the use of an external program like Putty directly or via the Hosts command Line interface using virsh. In order to do this via the command line. We first need to get the name of the box we would like to connect to. So first login as vms user and change to its home directory. Next we will run the following command to get a list of VMs avaliable. virsh list This will give the following output showing each VM available. Id Name State ---------------------------------------------------- 7 base-v2 paused 8 base-v3 running We will then need to connect to the VM required. Note: You can only connect to VMs that are in the running state. virsh console (Name Goes Here), eg virsh console base-v3 ==== Quick Reference ==== virsh command quick reference taken from the following page. [[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/5/html/virtualization/chap-virtualization-managing_guests_with_virsh|https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/5/html/virtualization/chap-virtualization-managing_guests_with_virsh]] The following tables provide a quick reference for all virsh command line options. Guest management commands ^Command^Description| |help|Prints basic help information.| |list|Lists all guests.| |dumpxml|Outputs the XML configuration file for the guest.| |create|Creates a guest from an XML configuration file and starts the new guest.| |start|Starts an inactive guest.| |destroy|Forces a guest to stop.| |define|Outputs an XML configuration file for a guest.| |domid|Displays the guest's ID.| |domuuid|Displays the guest's UUID.| |dominfo|Displays guest information.| |domname|Displays the guest's name.| |domstate|Displays the state of a guest.| |quit|Quits the interactive terminal.| |reboot|Reboots a guest.| |restore|Restores a previously saved guest stored in a file.| |resume|Resumes a paused guest.| |save|Save the present state of a guest to a file.| |shutdown|Gracefully shuts down a guest.| |suspend|Pauses a guest.| |undefine|Deletes all files associated with a guest.| |migrate|Migrates a guest to another host.| The following virsh command options manage guest and hypervisor management options ^Command^Description| |setmem|Sets the allocated memory for a guest.| |setmaxmem|Sets maximum memory limit for the hypervisor.| |setvcpus|Changes number of virtual CPUs assigned to a guest. Note that this feature is unsupported in Red Hat Enterprise Linux 5.| |vcpuinfo|Displays virtual CPU information about a guest.| |vcpupin|Controls the virtual CPU affinity of a guest.| |domblkstat|Displays block device statistics for a running guest.| |domifstat|Displays network interface statistics for a running guest.| |attach-device|Attach a device to a guest, using a device definition in an XML file.| |attach-disk|Attaches a new disk device to a guest.| |attach-interface|Attaches a new network interface to a guest.| |detach-device|Detach a device from a guest, takes the same kind of XML descriptions as command attach-device.| |detach-disk|Detach a disk device from a guest.| |detach-interface|Detach a network interface from a guest.| |domxml-from-native|Convert from native guest configuration format to domain XML format. See the virsh man page for more details.| |domxml-to-native|Convert from domain XML format to native guest configuration format. See the virsh man page for more details.| These are miscellaneous virsh options ^Command^Description| |version|Displays the version of virsh| |nodeinfo|Outputs information about the hypervisor| Connecting to the hypervisorConnect to a hypervisor session with virsh: # virsh connect ''{hostname OR URL}'' Where is the machine name of the hypervisor. To initiate a read-only connection, append the above command with -readonly.Creating a virtual machine XML dump (configuration file)Output a guest's XML configuration file with virsh: # virsh dumpxml ''{domain-id, domain-name or domain-uuid}'' This command outputs the guest's XML configuration file to standard out (stdout). You can save the data by piping the output to a file. An example of piping the output to a file called //guest.xml//: # virsh dumpxml ''GuestID''> ''guest.xml'' This file guest.xml can recreate the guest . You can edit this XML configuration file to configure additional devices or to deploy additional guests. An example of virsh dumpxml output: # virsh dumpxml r5b2-mySQL01 r5b2-mySQL01 4a4c59a7ee3fc78196e4288f2862f011 /usr/bin/pygrub linux /var/lib/libvirt/vmlinuz.2dgnU_ /var/lib/libvirt/initrd.UQafMw ro root=/dev/VolGroup00/LogVol00 rhgb quiet 512000 1 destroy restart restart