{"node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "revisions": [{"id": "f1e17efe-2f95-11f1-a544-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <dom name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n**xen** \r\n | xm create /etc/xen/<dom name>\r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<dom name>.xml\r\n | virsh start <dom name>\r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n**xen** \r\n xm console <dom name>\r\n\r\n**kvm** \r\n virsh console <dom name>\r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n**xen** \r\n xm shutdown <dom name> \r\n\r\n**kvm** \r\n virsh shutdown <dom name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n | <feature> \r\n |  <acpi/>\r\n | </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n**xen** \r\n ln -s /etc/xen/<dom name> /etc/xen/auto/<dom name>\r\n\r\n**kvm** \r\n virsh autostart <dom name>\r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <dom name>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <dom name>\r\n\r\n**kvm**\r\n virsh destroy <dom name>\r\n\r\nQuit virsh cli\r\n-----------------\r\n**kvm** \r\n virsh quit\r\n\r\n\r\n\r\n\r\n\r\nVirtual Serial Console configuration\r\n======================================\r\n**From the KVM host run:**\r\n\r\n.. code-block:: xml\r\n\r\n virsh edit <dom>\r\n\r\nThen add the following inside the <device></device> directives:\r\n\r\n.. code-block:: xml\r\n\r\n <serial type=\"pty\">\r\n     <source path=\"/dev/pts/3\" />\r\n     <target port=\"1\" />\r\n </serial>\r\n\r\n**From the Guest run:**\r\n\r\n.. code-block:: xml\r\n\r\n sudo cp -p /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n sudo vi /etc/init/ttyS0.conf\r\n sudo diff /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n\r\n\r\n\r\n\r\nVmbuilder Example\r\n======================\r\nThis example assumes ubuntu linux.\r\n\r\nInstall vmbuilder\r\n---------------------\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\nDisplay Help vmbuilder\r\n--------------------------------\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\nCustom vmbuilder string\t\r\n-------------------------------\t\t\t\r\n \t\t\t\r\nmbison example \t\r\n\r\n.. code-block:: bash\t\t\t\r\n\t\t\r\n VMNAME=mbison\t\t\t\r\n mkdir /vms/$VMNAME\t\t\t\r\n \t\t\t\r\n sudo vmbuilder kvm ubuntu --libvirt=qemu:///system --suite=lucid --flavour=virtual \\\t\t\t\r\n --hostname=$VMNAME --domain='foxhop.net' --rootsize='10240' --mem='1024' \\\t\t\t\r\n --ip=192.168.1.51 --gw=192.168.1.254 --dns=192.168.1.22 --bridge=br0 \\\t\t\t\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT --verbose\t\t\t\r\n\t \t\t\t\r\ncammy example\t\t\t\r\n \t\t\t\r\n.. code-block:: bash\t\t\t\r\n \t\t\t\r\n VMNAME=cammy\t\t\t\r\n mkdir /vms/$VMNAME\t\t\t\r\n \t\t\t\r\n sudo vmbuilder kvm ubuntu       \\\t\t\t\r\n     --libvirt=qemu:///system    \\\t\t\t\r\n     --suite=lucid               \\\t\t\t\r\n     --arch=amd64 -o             \\\t\t\t\r\n     --flavour=virtual           \\\t\t\t\r\n     --hostname=$VMNAME          \\\t\t\t\r\n     --dest=/vms/$VMNAME         \\\t\t\t\r\n     --rootsize=20480            \\\t\t\t\r\n     --mem=1024                  \\\t\t\t\r\n     --bridge=br0                \\\t\t\t\r\n     --ip=192.168.1.52           \\\t\t\t\r\n     --gw=192.168.1.254          \\\t\t\t\r\n     --dns=192.168.1.22          \\\t\t\t\r\n     --user=john                 \\\t\t\t\r\n     --pass=doe                  \\\t\t\t\r\n     --addpkg=openssh-server     \\\t\t\t\r\n     --addpkg=acpid              \\\t\t\t\r\n     --timezone=EDT              \\ \t\t\t\r\n     --verbose\r\n\r\n\r\nvirt-install\r\n================\r\ndebian netboot example\r\n---------------------------\r\n\r\nThis method shows the virt-install script installing from a debian netboot image hosted on the internet\r\n\r\n.. code-block:: bash\r\n\r\n HOSTNAME=tehforum\r\n DOMAIN=foxhop.net\r\n\r\n sudo virt-install \\\r\n --name=$HOSTNAME \\\r\n --vcpu=1 \\\r\n --ram=396 \\\r\n --disk=/KVMROOT/$HOSTNAME.qcow2,size=10 \\\r\n --os-type=linux \\\r\n --autostart \\\r\n --location=http://ftp.nl.debian.org/debian/dists/wheezy/main/installer-amd64/ \\\r\n --extra-args=\"auto=true priority=critical keymap=us locale=en_US hostname=$HOSTNAME domain=$DOMAIN url=http://192.168.1.22/foxhop-debconf-preseed.txt\"\r\n\r\nubuntu netboot example\r\n----------------------------\r\n\r\nThis method shows the virt-install script installing from an ubuntu netboot image hosted on the internet\r\n\r\n.. code-block:: bash\r\n\r\n HOSTNAME=mbison\r\n DOMAIN=foxhop.net\r\n\r\n sudo virt-install \\\r\n --name=$HOSTNAME \\\r\n --vcpu=1 \\\r\n --ram=396 \\\r\n --disk=/KVMROOT/$HOSTNAME.qcow2,size=10 \\\r\n --os-type=linux \\\r\n --autostart \\\r\n --location=http://archive.ubuntu.com/ubuntu/dists/raring/main/installer-amd64/ \\\r\n --extra-args=\"auto=true priority=critical keymap=us locale=en_US hostname=$HOSTNAME domain=$DOMAIN url=http://192.168.1.22/foxhop-debconf-preseed.txt\"\r\n\r\n\r\nMounting a qcow2 image on the host\r\n======================================\r\n\r\nSometimes it is helpful to be able to mount a drive image under the host system. For example, if the guest doesn't have network support, the only way to transfer files into and out of the guest will be by the storage devices it can address or to restore files from a backup image.\r\n\r\nTo mount qcow2 images there is (at least in F-11 qemu) very useful qemu-nbd util. It shares image through kernel network block device protocol and this allows to mount it:\r\n\r\n.. code-block:: bash\r\n   \r\n  sudo modprobe nbd max_part=63\r\n  sudo qemu-nbd -c /dev/nbd0 image.img\r\n  sudo mount /dev/nbd0p1 /mnt/image\r\n\r\n\r\n\r\n\r\nAdd another disk image to a guest\r\n====================================\r\n\r\nThis is how you add an additional disk to a guest.  In this example I will be adding a 20GB disk image to a guest dom named cammy.\r\n\r\n.. code-block:: bash\r\n\r\n fallocate -l 20g /vms/cammy/cammy-aux.img\r\n\r\nor\r\n\r\n.. code-block:: bash\r\n\r\n qemu-img create -f qcow2 /vms/cammy/cammy-aux.img 20G\r\n\r\nIf you want to look that the image statistics try this command.\r\n\r\n.. code-block:: bash\r\n\r\n\r\n qemu-img info /vms/cammy/cammy-aux.img\r\n\r\nNow we need to mount this disk:\r\n\r\n.. code-block:: bash\r\n\r\n sudo virsh attach-disk cammy /vms/cammy/cammy-aux.img vdb\r\n\r\nThat command only mounted the disk.  To make this change permanent we need to alter the dom's xml:\r\n\r\n.. code-block:: xml\r\n\r\n # sudo virsh edit cammy\r\n\r\n  <disk type='file' device='disk'>\r\n    <driver name='qemu' type='qcow2'/>\r\n    <source file='/KVMROOT/cammy.qcow2'/>\r\n    <target dev='vda' bus='virtio'/>\r\n    <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>\r\n  </disk>\r\n\r\n  <disk type='file' device='disk'>\r\n    <driver name='qemu' type='raw'/>\r\n    <source file='/KVMROOT/cammy-aux.img'/>\r\n    <target dev='vdb' bus='virtio'/>\r\n  <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>\r\n\r\nSSH to the guest and verify that the disk shows up in *fdisk -l*.  You may now partition this disk how you like.  For more information view `linux raw filesystem management <http://www.foxhop.net/linux-raw-filesystem-management>`_.\r\n\r\n", "source_format": "rst", "revision_number": 72, "created": 1389007498000}, {"id": "f1e17447-2f95-11f1-9354-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <dom name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<dom name>\r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<dom name>.xml\r\n | virsh start <dom name>\r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <dom name>\r\n\r\n**kvm** \r\n virsh console <dom name>\r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <dom name> \r\n\r\n**kvm** \r\n virsh shutdown <dom name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n | <feature> \r\n |  <acpi/>\r\n | </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<dom name> /etc/xen/auto/<dom name>\r\n\r\n**kvm** \r\n virsh autostart <dom name>\r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <dom name>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <dom name>\r\n\r\n**kvm**\r\n virsh destroy <dom name>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh quit\r\n\r\n\r\n\r\n\r\n\r\nVirtual Serial Console configuration\r\n======================================\r\n\r\n**From the KVM host run:**\r\n\r\n.. code-block:: xml\r\n\r\n virsh edit <dom>\r\n\r\nThen add the following inside the <device></device> directives:\r\n\r\n.. code-block:: xml\r\n\r\n <serial type=\"pty\">\r\n     <source path=\"/dev/pts/3\" />\r\n     <target port=\"1\" />\r\n </serial>\r\n\r\n**From the Guest run:**\r\n\r\n.. code-block:: xml\r\n\r\n sudo cp -p /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n sudo vi /etc/init/ttyS0.conf\r\n sudo diff /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n\r\n\r\n\r\n\r\nVmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\nInstall vmbuilder\r\n---------------------\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\nDisplay Help vmbuilder\r\n--------------------------------\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\nCustom vmbuilder string\t\r\n-------------------------------\t\t\t\r\n \t\t\t\r\nmbison example \t\r\n\r\n.. code-block:: bash\t\t\t\r\n\t\t\r\n VMNAME=mbison\t\t\t\r\n mkdir /vms/$VMNAME\t\t\t\r\n \t\t\t\r\n sudo vmbuilder kvm ubuntu --libvirt=qemu:///system --suite=lucid --flavour=virtual \\\t\t\t\r\n --hostname=$VMNAME --domain='foxhop.net' --rootsize='10240' --mem='1024' \\\t\t\t\r\n --ip=192.168.1.51 --gw=192.168.1.254 --dns=192.168.1.22 --bridge=br0 \\\t\t\t\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT --verbose\t\t\t\r\n\t \t\t\t\r\ncammy example\t\t\t\r\n \t\t\t\r\n.. code-block:: bash\t\t\t\r\n \t\t\t\r\n VMNAME=cammy\t\t\t\r\n mkdir /vms/$VMNAME\t\t\t\r\n \t\t\t\r\n sudo vmbuilder kvm ubuntu       \\\t\t\t\r\n     --libvirt=qemu:///system    \\\t\t\t\r\n     --suite=lucid               \\\t\t\t\r\n     --arch=amd64 -o             \\\t\t\t\r\n     --flavour=virtual           \\\t\t\t\r\n     --hostname=$VMNAME          \\\t\t\t\r\n     --dest=/vms/$VMNAME         \\\t\t\t\r\n     --rootsize=20480            \\\t\t\t\r\n     --mem=1024                  \\\t\t\t\r\n     --bridge=br0                \\\t\t\t\r\n     --ip=192.168.1.52           \\\t\t\t\r\n     --gw=192.168.1.254          \\\t\t\t\r\n     --dns=192.168.1.22          \\\t\t\t\r\n     --user=john                 \\\t\t\t\r\n     --pass=doe                  \\\t\t\t\r\n     --addpkg=openssh-server     \\\t\t\t\r\n     --addpkg=acpid              \\\t\t\t\r\n     --timezone=EDT              \\ \t\t\t\r\n     --verbose\r\n\r\n\r\nvirt-install\r\n================\r\n\r\ndebian netboot example\r\n---------------------------\r\n\r\nThis method shows the virt-install script installing from a debian netboot image hosted on the internet\r\n\r\n.. code-block:: bash\r\n\r\n HOSTNAME=tehforum\r\n DOMAIN=foxhop.net\r\n\r\n sudo virt-install \\\r\n --name=$HOSTNAME \\\r\n --vcpu=1 \\\r\n --ram=396 \\\r\n --disk=/KVMROOT/$HOSTNAME.qcow2,size=10 \\\r\n --os-type=linux \\\r\n --autostart \\\r\n --location=http://ftp.nl.debian.org/debian/dists/wheezy/main/installer-amd64/ \\\r\n --extra-args=\"auto=true priority=critical keymap=us locale=en_US hostname=$HOSTNAME domain=$DOMAIN url=http://192.168.1.22/foxhop-debconf-preseed.txt\"\r\n\r\nubuntu netboot example\r\n----------------------------\r\n\r\nThis method shows the virt-install script installing from an ubuntu netboot image hosted on the internet\r\n\r\n.. code-block:: bash\r\n\r\n HOSTNAME=mbison\r\n DOMAIN=foxhop.net\r\n\r\n sudo virt-install \\\r\n --name=$HOSTNAME \\\r\n --vcpu=1 \\\r\n --ram=396 \\\r\n --disk=/KVMROOT/$HOSTNAME.qcow2,size=10 \\\r\n --os-type=linux \\\r\n --autostart \\\r\n --location=http://archive.ubuntu.com/ubuntu/dists/raring/main/installer-amd64/ \\\r\n --extra-args=\"auto=true priority=critical keymap=us locale=en_US hostname=$HOSTNAME domain=$DOMAIN url=http://192.168.1.22/foxhop-debconf-preseed.txt\"\r\n\r\n\r\nMounting a qcow2 image on the host\r\n======================================\r\n\r\nSometimes it is helpful to be able to mount a drive image under the host system. For example, if the guest doesn't have network support, the only way to transfer files into and out of the guest will be by the storage devices it can address or to restore files from a backup image.\r\n\r\nTo mount qcow2 images there is (at least in F-11 qemu) very useful qemu-nbd util. It shares image through kernel network block device protocol and this allows to mount it:\r\n\r\n.. code-block:: bash\r\n   \r\n  sudo modprobe nbd max_part=63\r\n  sudo qemu-nbd -c /dev/nbd0 image.img\r\n  sudo mount /dev/nbd0p1 /mnt/image\r\n\r\n\r\n\r\n\r\nAdd another disk image to a guest\r\n====================================\r\n\r\nThis is how you add an additional disk to a guest.  In this example I will be adding a 20GB disk image to a guest dom named cammy.\r\n\r\n.. code-block:: bash\r\n\r\n fallocate -l 20g /vms/cammy/cammy-aux.img\r\n\r\nor\r\n\r\n.. code-block:: bash\r\n\r\n qemu-img create -f qcow2 /vms/cammy/cammy-aux.img 20G\r\n\r\nIf you want to look that the image statistics try this command.\r\n\r\n.. code-block:: bash\r\n\r\n\r\n qemu-img info /vms/cammy/cammy-aux.img\r\n\r\nNow we need to mount this disk:\r\n\r\n.. code-block:: bash\r\n\r\n sudo virsh attach-disk cammy /vms/cammy/cammy-aux.img vdb\r\n\r\nThat command only mounted the disk.  To make this change permanent we need to alter the dom's xml:\r\n\r\n.. code-block:: xml\r\n\r\n # sudo virsh edit cammy\r\n\r\n  <disk type='file' device='disk'>\r\n    <driver name='qemu' type='qcow2'/>\r\n    <source file='/KVMROOT/cammy.qcow2'/>\r\n    <target dev='vda' bus='virtio'/>\r\n    <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>\r\n  </disk>\r\n\r\n  <disk type='file' device='disk'>\r\n    <driver name='qemu' type='raw'/>\r\n    <source file='/KVMROOT/cammy-var.img'/>\r\n    <target dev='vdb' bus='virtio'/>\r\n  <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>\r\n\r\nSSH to the guest and verify that the disk shows up in *fdisk -l*.  You may now partition this disk how you like.  For more information view `linux raw filesystem management <http://www.foxhop.net/linux-raw-filesystem-management>`_.\r\n\r\n", "source_format": "rst", "revision_number": 71, "created": 1370116575000}, {"id": "f1e16f58-2f95-11f1-a508-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <dom name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<dom name>\r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<dom name>.xml\r\n | virsh start <dom name>\r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <dom name>\r\n\r\n**kvm** \r\n virsh console <dom name>\r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <dom name> \r\n\r\n**kvm** \r\n virsh shutdown <dom name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n | <feature> \r\n |  <acpi/>\r\n | </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<dom name> /etc/xen/auto/<dom name>\r\n\r\n**kvm** \r\n virsh autostart <dom name>\r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <dom name>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <dom name>\r\n\r\n**kvm**\r\n virsh destroy <dom name>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh quit\r\n\r\n\r\n\r\n\r\n\r\nVirtual Serial Console configuration\r\n======================================\r\n\r\n**From the KVM host run:**\r\n\r\n.. code-block:: xml\r\n\r\n virsh edit <dom>\r\n\r\nThen add the following inside the <device></device> directives:\r\n\r\n.. code-block:: xml\r\n\r\n <serial type=\"pty\">\r\n     <source path=\"/dev/pts/3\" />\r\n     <target port=\"1\" />\r\n </serial>\r\n\r\n**From the Guest run:**\r\n\r\n.. code-block:: xml\r\n\r\n sudo cp -p /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n sudo vi /etc/init/ttyS0.conf\r\n sudo diff /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n\r\n\r\n\r\n\r\nVmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\nInstall vmbuilder\r\n---------------------\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\nDisplay Help vmbuilder\r\n--------------------------------\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\nCustom vmbuilder string\t\r\n-------------------------------\t\t\t\r\n \t\t\t\r\nmbison example \t\r\n\r\n.. code-block:: bash\t\t\t\r\n\t\t\r\n VMNAME=mbison\t\t\t\r\n mkdir /vms/$VMNAME\t\t\t\r\n \t\t\t\r\n sudo vmbuilder kvm ubuntu --libvirt=qemu:///system --suite=lucid --flavour=virtual \\\t\t\t\r\n --hostname=$VMNAME --domain='foxhop.net' --rootsize='10240' --mem='1024' \\\t\t\t\r\n --ip=192.168.1.51 --gw=192.168.1.254 --dns=192.168.1.22 --bridge=br0 \\\t\t\t\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT --verbose\t\t\t\r\n\t \t\t\t\r\ncammy example\t\t\t\r\n \t\t\t\r\n.. code-block:: bash\t\t\t\r\n \t\t\t\r\n VMNAME=cammy\t\t\t\r\n mkdir /vms/$VMNAME\t\t\t\r\n \t\t\t\r\n sudo vmbuilder kvm ubuntu       \\\t\t\t\r\n     --libvirt=qemu:///system    \\\t\t\t\r\n     --suite=lucid               \\\t\t\t\r\n     --arch=amd64 -o             \\\t\t\t\r\n     --flavour=virtual           \\\t\t\t\r\n     --hostname=$VMNAME          \\\t\t\t\r\n     --dest=/vms/$VMNAME         \\\t\t\t\r\n     --rootsize=20480            \\\t\t\t\r\n     --mem=1024                  \\\t\t\t\r\n     --bridge=br0                \\\t\t\t\r\n     --ip=192.168.1.52           \\\t\t\t\r\n     --gw=192.168.1.254          \\\t\t\t\r\n     --dns=192.168.1.22          \\\t\t\t\r\n     --user=john                 \\\t\t\t\r\n     --pass=doe                  \\\t\t\t\r\n     --addpkg=openssh-server     \\\t\t\t\r\n     --addpkg=acpid              \\\t\t\t\r\n     --timezone=EDT              \\ \t\t\t\r\n     --verbose\r\n\r\n\r\nvirt-install\r\n================\r\n\r\nThis method shows the virt-install script installing from a debian netboot image hosted on the internet\r\n\r\n.. code-block:: bash\r\n\r\n HOSTNAME=tehforum\r\n DOMAIN=foxhop.net\r\n\r\n sudo virt-install \\\r\n --name=$HOSTNAME \\\r\n --vcpu=1 \\\r\n --ram=396 \\\r\n --disk=/KVMROOT/$HOSTNAME.qcow2,size=10 \\\r\n --os-type=linux \\\r\n --autostart \\\r\n --location=http://ftp.nl.debian.org/debian/dists/wheezy/main/installer-amd64/ \\\r\n --extra-args=\"auto=true priority=critical keymap=us locale=en_US hostname=$HOSTNAME domain=$DOMAIN url=http://192.168.1.22/foxhop-debconf-preseed.txt\"\r\n\r\n\r\n\r\n\r\nMounting a qcow2 image on the host\r\n======================================\r\n\r\nSometimes it is helpful to be able to mount a drive image under the host system. For example, if the guest doesn't have network support, the only way to transfer files into and out of the guest will be by the storage devices it can address or to restore files from a backup image.\r\n\r\nTo mount qcow2 images there is (at least in F-11 qemu) very useful qemu-nbd util. It shares image through kernel network block device protocol and this allows to mount it:\r\n\r\n.. code-block:: bash\r\n   \r\n  sudo modprobe nbd max_part=63\r\n  sudo qemu-nbd -c /dev/nbd0 image.img\r\n  sudo mount /dev/nbd0p1 /mnt/image\r\n\r\n\r\n\r\n\r\nAdd another disk image to a guest\r\n====================================\r\n\r\nThis is how you add an additional disk to a guest.  In this example I will be adding a 20GB disk image to a guest dom named cammy.\r\n\r\n.. code-block:: bash\r\n\r\n fallocate -l 20g /vms/cammy/cammy-aux.img\r\n\r\nor\r\n\r\n.. code-block:: bash\r\n\r\n qemu-img create -f qcow2 /vms/cammy/cammy-aux.img 20G\r\n\r\nIf you want to look that the image statistics try this command.\r\n\r\n.. code-block:: bash\r\n\r\n\r\n qemu-img info /vms/cammy/cammy-aux.img\r\n\r\nNow we need to mount this disk:\r\n\r\n.. code-block:: bash\r\n\r\n sudo virsh attach-disk cammy /vms/cammy/cammy-aux.img vdb\r\n\r\nThat command only mounted the disk.  To make this change permanent we need to alter the dom's xml:\r\n\r\n.. code-block:: xml\r\n\r\n # sudo virsh edit cammy\r\n\r\n  <disk type='file' device='disk'>\r\n    <driver name='qemu' type='qcow2'/>\r\n    <source file='/KVMROOT/cammy.qcow2'/>\r\n    <target dev='vda' bus='virtio'/>\r\n    <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>\r\n  </disk>\r\n\r\n  <disk type='file' device='disk'>\r\n    <driver name='qemu' type='raw'/>\r\n    <source file='/KVMROOT/cammy-var.img'/>\r\n    <target dev='vdb' bus='virtio'/>\r\n  <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>\r\n\r\nSSH to the guest and verify that the disk shows up in *fdisk -l*.  You may now partition this disk how you like.  For more information view `linux raw filesystem management <http://www.foxhop.net/linux-raw-filesystem-management>`_.\r\n\r\n", "source_format": "rst", "revision_number": 70, "created": 1368972733000}, {"id": "f1e16afa-2f95-11f1-8a51-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <dom name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<dom name>\r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<dom name>.xml\r\n | virsh start <dom name>\r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <dom name>\r\n\r\n**kvm** \r\n virsh console <dom name>\r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <dom name> \r\n\r\n**kvm** \r\n virsh shutdown <dom name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n | <feature> \r\n |  <acpi/>\r\n | </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<dom name> /etc/xen/auto/<dom name>\r\n\r\n**kvm** \r\n virsh autostart <dom name>\r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <dom name>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <dom name>\r\n\r\n**kvm**\r\n virsh destroy <dom name>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh quit\r\n\r\n\r\n\r\n\r\n\r\nVirtual Serial Console configuration\r\n======================================\r\n\r\n**From the KVM host run:**\r\n\r\n.. code-block:: xml\r\n\r\n virsh edit <dom>\r\n\r\nThen add the following inside the <device></device> directives:\r\n\r\n.. code-block:: xml\r\n\r\n <serial type=\"pty\">\r\n     <source path=\"/dev/pts/3\" />\r\n     <target port=\"1\" />\r\n </serial>\r\n\r\n**From the Guest run:**\r\n\r\n.. code-block:: xml\r\n\r\n sudo cp -p /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n sudo vi /etc/init/ttyS0.conf\r\n sudo diff /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n\r\n\r\n\r\n\r\nVmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\nInstall vmbuilder\r\n---------------------\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\nDisplay Help vmbuilder\r\n--------------------------------\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\nCustom vmbuilder string\t\r\n-------------------------------\t\t\t\r\n \t\t\t\r\nmbison example \t\r\n\r\n.. code-block:: bash\t\t\t\r\n\t\t\r\n VMNAME=mbison\t\t\t\r\n mkdir /vms/$VMNAME\t\t\t\r\n \t\t\t\r\n sudo vmbuilder kvm ubuntu --libvirt=qemu:///system --suite=lucid --flavour=virtual \\\t\t\t\r\n --hostname=$VMNAME --domain='foxhop.net' --rootsize='10240' --mem='1024' \\\t\t\t\r\n --ip=192.168.1.51 --gw=192.168.1.254 --dns=192.168.1.22 --bridge=br0 \\\t\t\t\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT --verbose\t\t\t\r\n\t \t\t\t\r\ncammy example\t\t\t\r\n \t\t\t\r\n.. code-block:: bash\t\t\t\r\n \t\t\t\r\n VMNAME=cammy\t\t\t\r\n mkdir /vms/$VMNAME\t\t\t\r\n \t\t\t\r\n sudo vmbuilder kvm ubuntu       \\\t\t\t\r\n     --libvirt=qemu:///system    \\\t\t\t\r\n     --suite=lucid               \\\t\t\t\r\n     --arch=amd64 -o             \\\t\t\t\r\n     --flavour=virtual           \\\t\t\t\r\n     --hostname=$VMNAME          \\\t\t\t\r\n     --dest=/vms/$VMNAME         \\\t\t\t\r\n     --rootsize=20480            \\\t\t\t\r\n     --mem=1024                  \\\t\t\t\r\n     --bridge=br0                \\\t\t\t\r\n     --ip=192.168.1.52           \\\t\t\t\r\n     --gw=192.168.1.254          \\\t\t\t\r\n     --dns=192.168.1.22          \\\t\t\t\r\n     --user=john                 \\\t\t\t\r\n     --pass=doe                  \\\t\t\t\r\n     --addpkg=openssh-server     \\\t\t\t\r\n     --addpkg=acpid              \\\t\t\t\r\n     --timezone=EDT              \\ \t\t\t\r\n     --verbose\r\n\r\n\r\nvirt-install\r\n================\r\n\r\nThis method shows the virt-install script installing from a debian netboot image hosted on the internet\r\n\r\n.. code-block:: bash\r\n\r\n HOSTNAME=tehforum\r\n DOMAIN=foxhop.net\r\n\r\n sudo virt-install \\\r\n --name=$HOSTNAME \\\r\n --vcpu=1 \\\r\n --ram=396 \\\r\n --disk=/KVMROOT/$HOSTNAME.qcow2,size=10 \\\r\n --os-type=linux \\\r\n --autostart \\\r\n --location=http://ftp.nl.debian.org/debian/dists/wheezy/main/installer-amd64/ \\\r\n --extra-args=\"auto=true priority=critical keymap=us locale=en_US url=http://192.168.1.22/foxhop-debconf-preseed.txt hostname=$HOSTNAME domain=$DOMAIN\"\r\n\r\n\r\n\r\n\r\nMounting a qcow2 image on the host\r\n======================================\r\n\r\nSometimes it is helpful to be able to mount a drive image under the host system. For example, if the guest doesn't have network support, the only way to transfer files into and out of the guest will be by the storage devices it can address or to restore files from a backup image.\r\n\r\nTo mount qcow2 images there is (at least in F-11 qemu) very useful qemu-nbd util. It shares image through kernel network block device protocol and this allows to mount it:\r\n\r\n.. code-block:: bash\r\n   \r\n  sudo modprobe nbd max_part=63\r\n  sudo qemu-nbd -c /dev/nbd0 image.img\r\n  sudo mount /dev/nbd0p1 /mnt/image\r\n\r\n\r\n\r\n\r\nAdd another disk image to a guest\r\n====================================\r\n\r\nThis is how you add an additional disk to a guest.  In this example I will be adding a 20GB disk image to a guest dom named cammy.\r\n\r\n.. code-block:: bash\r\n\r\n fallocate -l 20g /vms/cammy/cammy-aux.img\r\n\r\nor\r\n\r\n.. code-block:: bash\r\n\r\n qemu-img create -f qcow2 /vms/cammy/cammy-aux.img 20G\r\n\r\nIf you want to look that the image statistics try this command.\r\n\r\n.. code-block:: bash\r\n\r\n\r\n qemu-img info /vms/cammy/cammy-aux.img\r\n\r\nNow we need to mount this disk:\r\n\r\n.. code-block:: bash\r\n\r\n sudo virsh attach-disk cammy /vms/cammy/cammy-aux.img vdb\r\n\r\nThat command only mounted the disk.  To make this change permanent we need to alter the dom's xml:\r\n\r\n.. code-block:: xml\r\n\r\n # sudo virsh edit cammy\r\n\r\n  <disk type='file' device='disk'>\r\n    <driver name='qemu' type='qcow2'/>\r\n    <source file='/KVMROOT/cammy.qcow2'/>\r\n    <target dev='vda' bus='virtio'/>\r\n    <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>\r\n  </disk>\r\n\r\n  <disk type='file' device='disk'>\r\n    <driver name='qemu' type='raw'/>\r\n    <source file='/KVMROOT/cammy-var.img'/>\r\n    <target dev='vdb' bus='virtio'/>\r\n  <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>\r\n\r\nSSH to the guest and verify that the disk shows up in *fdisk -l*.  You may now partition this disk how you like.  For more information view `linux raw filesystem management <http://www.foxhop.net/linux-raw-filesystem-management>`_.\r\n\r\n", "source_format": "rst", "revision_number": 69, "created": 1368914160000}, {"id": "f1e166d7-2f95-11f1-b7f5-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <dom name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<dom name>\r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<dom name>.xml\r\n | virsh start <dom name>\r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <dom name>\r\n\r\n**kvm** \r\n virsh console <dom name>\r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <dom name> \r\n\r\n**kvm** \r\n virsh shutdown <dom name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n | <feature> \r\n |  <acpi/>\r\n | </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<dom name> /etc/xen/auto/<dom name>\r\n\r\n**kvm** \r\n virsh autostart <dom name>\r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <dom name>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <dom name>\r\n\r\n**kvm**\r\n virsh destroy <dom name>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh quit\r\n\r\n\r\n\r\n\r\n\r\nVirtual Serial Console configuration\r\n======================================\r\n\r\n**From the KVM host run:**\r\n\r\n.. code-block:: xml\r\n\r\n virsh edit <dom>\r\n\r\nThen add the following inside the <device></device> directives:\r\n\r\n.. code-block:: xml\r\n\r\n <serial type=\"pty\">\r\n     <source path=\"/dev/pts/3\" />\r\n     <target port=\"1\" />\r\n </serial>\r\n\r\n**From the Guest run:**\r\n\r\n.. code-block:: xml\r\n\r\n sudo cp -p /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n sudo vi /etc/init/ttyS0.conf\r\n sudo diff /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n\r\n\r\n\r\n\r\nVmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\nInstall vmbuilder\r\n---------------------\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\nDisplay Help vmbuilder\r\n--------------------------------\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\nCustom vmbuilder string\t\r\n-------------------------------\t\t\t\r\n \t\t\t\r\nmbison example \t\r\n\r\n.. code-block:: bash\t\t\t\r\n\t\t\r\n VMNAME=mbison\t\t\t\r\n mkdir /vms/$VMNAME\t\t\t\r\n \t\t\t\r\n sudo vmbuilder kvm ubuntu --libvirt=qemu:///system --suite=lucid --flavour=virtual \\\t\t\t\r\n --hostname=$VMNAME --domain='foxhop.net' --rootsize='10240' --mem='1024' \\\t\t\t\r\n --ip=192.168.1.51 --gw=192.168.1.254 --dns=192.168.1.22 --bridge=br0 \\\t\t\t\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT --verbose\t\t\t\r\n\t \t\t\t\r\ncammy example\t\t\t\r\n \t\t\t\r\n.. code-block:: bash\t\t\t\r\n \t\t\t\r\n VMNAME=cammy\t\t\t\r\n mkdir /vms/$VMNAME\t\t\t\r\n \t\t\t\r\n sudo vmbuilder kvm ubuntu       \\\t\t\t\r\n     --libvirt=qemu:///system    \\\t\t\t\r\n     --suite=lucid               \\\t\t\t\r\n     --arch=amd64 -o             \\\t\t\t\r\n     --flavour=virtual           \\\t\t\t\r\n     --hostname=$VMNAME          \\\t\t\t\r\n     --dest=/vms/$VMNAME         \\\t\t\t\r\n     --rootsize=20480            \\\t\t\t\r\n     --mem=1024                  \\\t\t\t\r\n     --bridge=br0                \\\t\t\t\r\n     --ip=192.168.1.52           \\\t\t\t\r\n     --gw=192.168.1.254          \\\t\t\t\r\n     --dns=192.168.1.22          \\\t\t\t\r\n     --user=john                 \\\t\t\t\r\n     --pass=doe                  \\\t\t\t\r\n     --addpkg=openssh-server     \\\t\t\t\r\n     --addpkg=acpid              \\\t\t\t\r\n     --timezone=EDT              \\ \t\t\t\r\n     --verbose\r\n\r\n\r\nvirt-install\r\n================\r\n\r\nThis method shows the virt-install script installing from a debian netboot image hosted on the internet\r\n\r\n.. code-block:: bash\r\n\r\n HOSTNAME=tehforum\r\n DOMAIN=foxhop.net\r\n\r\n sudo virt-install \\\r\n --name=$HOSTNAME \\\r\n --vcpu=1 \\\r\n --ram=396 \\\r\n --disk=/KVMROOT/$HOSTNAME.qcow2,size=10 \\\r\n --os-type=linux \\\r\n --autostart \\\r\n --location=http://ftp.nl.debian.org/debian/dists/wheezy/main/installer-amd64/ \\\r\n --extra-args=\"auto=true priority=critical locale=en_US url=http://192.168.1.22/foxhop-debconf-preseed.txt hostname=$HOSTNAME domain=$DOMAIN\"\r\n\r\n\r\n\r\n\r\nMounting a qcow2 image on the host\r\n======================================\r\n\r\nSometimes it is helpful to be able to mount a drive image under the host system. For example, if the guest doesn't have network support, the only way to transfer files into and out of the guest will be by the storage devices it can address or to restore files from a backup image.\r\n\r\nTo mount qcow2 images there is (at least in F-11 qemu) very useful qemu-nbd util. It shares image through kernel network block device protocol and this allows to mount it:\r\n\r\n.. code-block:: bash\r\n   \r\n  sudo modprobe nbd max_part=63\r\n  sudo qemu-nbd -c /dev/nbd0 image.img\r\n  sudo mount /dev/nbd0p1 /mnt/image\r\n\r\n\r\n\r\n\r\nAdd another disk image to a guest\r\n====================================\r\n\r\nThis is how you add an additional disk to a guest.  In this example I will be adding a 20GB disk image to a guest dom named cammy.\r\n\r\n.. code-block:: bash\r\n\r\n fallocate -l 20g /vms/cammy/cammy-aux.img\r\n\r\nor\r\n\r\n.. code-block:: bash\r\n\r\n qemu-img create -f qcow2 /vms/cammy/cammy-aux.img 20G\r\n\r\nIf you want to look that the image statistics try this command.\r\n\r\n.. code-block:: bash\r\n\r\n\r\n qemu-img info /vms/cammy/cammy-aux.img\r\n\r\nNow we need to mount this disk:\r\n\r\n.. code-block:: bash\r\n\r\n sudo virsh attach-disk cammy /vms/cammy/cammy-aux.img vdb\r\n\r\nThat command only mounted the disk.  To make this change permanent we need to alter the dom's xml:\r\n\r\n.. code-block:: xml\r\n\r\n # sudo virsh edit cammy\r\n\r\n  <disk type='file' device='disk'>\r\n    <driver name='qemu' type='qcow2'/>\r\n    <source file='/KVMROOT/cammy.qcow2'/>\r\n    <target dev='vda' bus='virtio'/>\r\n    <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>\r\n  </disk>\r\n\r\n  <disk type='file' device='disk'>\r\n    <driver name='qemu' type='raw'/>\r\n    <source file='/KVMROOT/cammy-var.img'/>\r\n    <target dev='vdb' bus='virtio'/>\r\n  <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>\r\n\r\nSSH to the guest and verify that the disk shows up in *fdisk -l*.  You may now partition this disk how you like.  For more information view `linux raw filesystem management <http://www.foxhop.net/linux-raw-filesystem-management>`_.\r\n\r\n", "source_format": "rst", "revision_number": 68, "created": 1368912750000}, {"id": "f1e16231-2f95-11f1-988f-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <dom name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<dom name>\r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<dom name>.xml\r\n | virsh start <dom name>\r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <dom name>\r\n\r\n**kvm** \r\n virsh console <dom name>\r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <dom name> \r\n\r\n**kvm** \r\n virsh shutdown <dom name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n | <feature> \r\n |  <acpi/>\r\n | </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<dom name> /etc/xen/auto/<dom name>\r\n\r\n**kvm** \r\n virsh autostart <dom name>\r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <dom name>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <dom name>\r\n\r\n**kvm**\r\n virsh destroy <dom name>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh quit\r\n\r\n\r\n\r\n\r\n\r\nVirtual Serial Console configuration\r\n======================================\r\n\r\n**From the KVM host run:**\r\n\r\n.. code-block:: xml\r\n\r\n virsh edit <dom>\r\n\r\nThen add the following inside the <device></device> directives:\r\n\r\n.. code-block:: xml\r\n\r\n <serial type=\"pty\">\r\n     <source path=\"/dev/pts/3\" />\r\n     <target port=\"1\" />\r\n </serial>\r\n\r\n**From the Guest run:**\r\n\r\n.. code-block:: xml\r\n\r\n sudo cp -p /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n sudo vi /etc/init/ttyS0.conf\r\n sudo diff /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n\r\n\r\n\r\n\r\nVmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\nInstall vmbuilder\r\n---------------------\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\nDisplay Help vmbuilder\r\n--------------------------------\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\nCustom vmbuilder string\t\r\n-------------------------------\t\t\t\r\n \t\t\t\r\nmbison example \t\r\n\r\n.. code-block:: bash\t\t\t\r\n\t\t\r\n VMNAME=mbison\t\t\t\r\n mkdir /vms/$VMNAME\t\t\t\r\n \t\t\t\r\n sudo vmbuilder kvm ubuntu --libvirt=qemu:///system --suite=lucid --flavour=virtual \\\t\t\t\r\n --hostname=$VMNAME --domain='foxhop.net' --rootsize='10240' --mem='1024' \\\t\t\t\r\n --ip=192.168.1.51 --gw=192.168.1.254 --dns=192.168.1.22 --bridge=br0 \\\t\t\t\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT --verbose\t\t\t\r\n\t \t\t\t\r\ncammy example\t\t\t\r\n \t\t\t\r\n.. code-block:: bash\t\t\t\r\n \t\t\t\r\n VMNAME=cammy\t\t\t\r\n mkdir /vms/$VMNAME\t\t\t\r\n \t\t\t\r\n sudo vmbuilder kvm ubuntu       \\\t\t\t\r\n     --libvirt=qemu:///system    \\\t\t\t\r\n     --suite=lucid               \\\t\t\t\r\n     --arch=amd64 -o             \\\t\t\t\r\n     --flavour=virtual           \\\t\t\t\r\n     --hostname=$VMNAME          \\\t\t\t\r\n     --dest=/vms/$VMNAME         \\\t\t\t\r\n     --rootsize=20480            \\\t\t\t\r\n     --mem=1024                  \\\t\t\t\r\n     --bridge=br0                \\\t\t\t\r\n     --ip=192.168.1.52           \\\t\t\t\r\n     --gw=192.168.1.254          \\\t\t\t\r\n     --dns=192.168.1.22          \\\t\t\t\r\n     --user=john                 \\\t\t\t\r\n     --pass=doe                  \\\t\t\t\r\n     --addpkg=openssh-server     \\\t\t\t\r\n     --addpkg=acpid              \\\t\t\t\r\n     --timezone=EDT              \\ \t\t\t\r\n     --verbose\r\n\r\n\r\nvirt-install\r\n================\r\n\r\nThis method shows the virt-install script installing from a debian netboot image hosted on the internet\r\n\r\n.. code-block:: bash\r\n\r\n HOSTNAME=tehforum\r\n DOMAIN=foxhop.net\r\n\r\n sudo virt-install \\\r\n --name=$HOSTNAME \\\r\n --vcpu=1 \\\r\n --ram=396 \\\r\n --disk=/KVMROOT/$HOSTNAME.qcow2,size=10 \\\r\n --os-type=linux \\\r\n --autostart \\\r\n --location=http://ftp.nl.debian.org/debian/dists/wheezy/main/installer-amd64/ \\\r\n --extra-args=\"auto=true priority=critical locale=en_US interface=eth0 url=http://192.168.1.22/foxhop-debconf-preseed.txt hostname=$HOSTNAME domain=$DOMAIN\"\r\n\r\n\r\n\r\n\r\nMounting a qcow2 image on the host\r\n======================================\r\n\r\nSometimes it is helpful to be able to mount a drive image under the host system. For example, if the guest doesn't have network support, the only way to transfer files into and out of the guest will be by the storage devices it can address or to restore files from a backup image.\r\n\r\nTo mount qcow2 images there is (at least in F-11 qemu) very useful qemu-nbd util. It shares image through kernel network block device protocol and this allows to mount it:\r\n\r\n.. code-block:: bash\r\n   \r\n  sudo modprobe nbd max_part=63\r\n  sudo qemu-nbd -c /dev/nbd0 image.img\r\n  sudo mount /dev/nbd0p1 /mnt/image\r\n\r\n\r\n\r\n\r\nAdd another disk image to a guest\r\n====================================\r\n\r\nThis is how you add an additional disk to a guest.  In this example I will be adding a 20GB disk image to a guest dom named cammy.\r\n\r\n.. code-block:: bash\r\n\r\n fallocate -l 20g /vms/cammy/cammy-aux.img\r\n\r\nor\r\n\r\n.. code-block:: bash\r\n\r\n qemu-img create -f qcow2 /vms/cammy/cammy-aux.img 20G\r\n\r\nIf you want to look that the image statistics try this command.\r\n\r\n.. code-block:: bash\r\n\r\n\r\n qemu-img info /vms/cammy/cammy-aux.img\r\n\r\nNow we need to mount this disk:\r\n\r\n.. code-block:: bash\r\n\r\n sudo virsh attach-disk cammy /vms/cammy/cammy-aux.img vdb\r\n\r\nThat command only mounted the disk.  To make this change permanent we need to alter the dom's xml:\r\n\r\n.. code-block:: xml\r\n\r\n # sudo virsh edit cammy\r\n\r\n  <disk type='file' device='disk'>\r\n    <driver name='qemu' type='qcow2'/>\r\n    <source file='/KVMROOT/cammy.qcow2'/>\r\n    <target dev='vda' bus='virtio'/>\r\n    <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>\r\n  </disk>\r\n\r\n  <disk type='file' device='disk'>\r\n    <driver name='qemu' type='raw'/>\r\n    <source file='/KVMROOT/cammy-var.img'/>\r\n    <target dev='vdb' bus='virtio'/>\r\n  <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>\r\n\r\nSSH to the guest and verify that the disk shows up in *fdisk -l*.  You may now partition this disk how you like.  For more information view `linux raw filesystem management <http://www.foxhop.net/linux-raw-filesystem-management>`_.\r\n\r\n", "source_format": "rst", "revision_number": 67, "created": 1368912476000}, {"id": "f1e15cd6-2f95-11f1-a3dc-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <dom name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<dom name>\r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<dom name>.xml\r\n | virsh start <dom name>\r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <dom name>\r\n\r\n**kvm** \r\n virsh console <dom name>\r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <dom name> \r\n\r\n**kvm** \r\n virsh shutdown <dom name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n | <feature> \r\n |  <acpi/>\r\n | </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<dom name> /etc/xen/auto/<dom name>\r\n\r\n**kvm** \r\n virsh autostart <dom name>\r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <dom name>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <dom name>\r\n\r\n**kvm**\r\n virsh destroy <dom name>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh quit\r\n\r\n\r\n\r\n\r\n\r\nVirtual Serial Console configuration\r\n======================================\r\n\r\n**From the KVM host run:**\r\n\r\n.. code-block:: xml\r\n\r\n virsh edit <dom>\r\n\r\nThen add the following inside the <device></device> directives:\r\n\r\n.. code-block:: xml\r\n\r\n <serial type=\"pty\">\r\n     <source path=\"/dev/pts/3\" />\r\n     <target port=\"1\" />\r\n </serial>\r\n\r\n**From the Guest run:**\r\n\r\n.. code-block:: xml\r\n\r\n sudo cp -p /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n sudo vi /etc/init/ttyS0.conf\r\n sudo diff /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n\r\n\r\n\r\n\r\nVmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\nInstall vmbuilder\r\n---------------------\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\nDisplay Help vmbuilder\r\n--------------------------------\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\nCustom vmbuilder string\t\r\n-------------------------------\t\t\t\r\n \t\t\t\r\nmbison example \t\r\n\r\n.. code-block:: bash\t\t\t\r\n\t\t\r\n VMNAME=mbison\t\t\t\r\n mkdir /vms/$VMNAME\t\t\t\r\n \t\t\t\r\n sudo vmbuilder kvm ubuntu --libvirt=qemu:///system --suite=lucid --flavour=virtual \\\t\t\t\r\n --hostname=$VMNAME --domain='foxhop.net' --rootsize='10240' --mem='1024' \\\t\t\t\r\n --ip=192.168.1.51 --gw=192.168.1.254 --dns=192.168.1.22 --bridge=br0 \\\t\t\t\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT --verbose\t\t\t\r\n\t \t\t\t\r\ncammy example\t\t\t\r\n \t\t\t\r\n.. code-block:: bash\t\t\t\r\n \t\t\t\r\n VMNAME=cammy\t\t\t\r\n mkdir /vms/$VMNAME\t\t\t\r\n \t\t\t\r\n sudo vmbuilder kvm ubuntu       \\\t\t\t\r\n     --libvirt=qemu:///system    \\\t\t\t\r\n     --suite=lucid               \\\t\t\t\r\n     --arch=amd64 -o             \\\t\t\t\r\n     --flavour=virtual           \\\t\t\t\r\n     --hostname=$VMNAME          \\\t\t\t\r\n     --dest=/vms/$VMNAME         \\\t\t\t\r\n     --rootsize=20480            \\\t\t\t\r\n     --mem=1024                  \\\t\t\t\r\n     --bridge=br0                \\\t\t\t\r\n     --ip=192.168.1.52           \\\t\t\t\r\n     --gw=192.168.1.254          \\\t\t\t\r\n     --dns=192.168.1.22          \\\t\t\t\r\n     --user=john                 \\\t\t\t\r\n     --pass=doe                  \\\t\t\t\r\n     --addpkg=openssh-server     \\\t\t\t\r\n     --addpkg=acpid              \\\t\t\t\r\n     --timezone=EDT              \\ \t\t\t\r\n     --verbose\r\n\r\n\r\nvirt-install\r\n================\r\n\r\nThis method shows the virt-install script installing from a debian netboot image hosted on the internet\r\n\r\n.. code-block:: bash\r\n\r\n HOSTNAME=tehforum\r\n DOMAIN=foxhop.net\r\n\r\n sudo virt-install \\\r\n --name=$HOSTNAME \\\r\n --vcpu=1 \\\r\n --ram=396 \\\r\n --disk=/KVMROOT/$HOSTNAME.qcow2,size=10 \\\r\n --os-type=linux \\\r\n --autostart \\\r\n --location=http://ftp.nl.debian.org/debian/dists/wheezy/main/installer-amd64/ \\\r\n --extra-args=\"auto=true priority=critical interface=eth0 url=http://192.168.1.22/foxhop-debconf-preseed.txt hostname=$HOSTNAME domain=$DOMAIN\"\r\n\r\n\r\n\r\n\r\nMounting a qcow2 image on the host\r\n======================================\r\n\r\nSometimes it is helpful to be able to mount a drive image under the host system. For example, if the guest doesn't have network support, the only way to transfer files into and out of the guest will be by the storage devices it can address or to restore files from a backup image.\r\n\r\nTo mount qcow2 images there is (at least in F-11 qemu) very useful qemu-nbd util. It shares image through kernel network block device protocol and this allows to mount it:\r\n\r\n.. code-block:: bash\r\n   \r\n  sudo modprobe nbd max_part=63\r\n  sudo qemu-nbd -c /dev/nbd0 image.img\r\n  sudo mount /dev/nbd0p1 /mnt/image\r\n\r\n\r\n\r\n\r\nAdd another disk image to a guest\r\n====================================\r\n\r\nThis is how you add an additional disk to a guest.  In this example I will be adding a 20GB disk image to a guest dom named cammy.\r\n\r\n.. code-block:: bash\r\n\r\n fallocate -l 20g /vms/cammy/cammy-aux.img\r\n\r\nor\r\n\r\n.. code-block:: bash\r\n\r\n qemu-img create -f qcow2 /vms/cammy/cammy-aux.img 20G\r\n\r\nIf you want to look that the image statistics try this command.\r\n\r\n.. code-block:: bash\r\n\r\n\r\n qemu-img info /vms/cammy/cammy-aux.img\r\n\r\nNow we need to mount this disk:\r\n\r\n.. code-block:: bash\r\n\r\n sudo virsh attach-disk cammy /vms/cammy/cammy-aux.img vdb\r\n\r\nThat command only mounted the disk.  To make this change permanent we need to alter the dom's xml:\r\n\r\n.. code-block:: xml\r\n\r\n # sudo virsh edit cammy\r\n\r\n  <disk type='file' device='disk'>\r\n    <driver name='qemu' type='qcow2'/>\r\n    <source file='/KVMROOT/cammy.qcow2'/>\r\n    <target dev='vda' bus='virtio'/>\r\n    <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>\r\n  </disk>\r\n\r\n  <disk type='file' device='disk'>\r\n    <driver name='qemu' type='raw'/>\r\n    <source file='/KVMROOT/cammy-var.img'/>\r\n    <target dev='vdb' bus='virtio'/>\r\n  <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>\r\n\r\nSSH to the guest and verify that the disk shows up in *fdisk -l*.  You may now partition this disk how you like.  For more information view `linux raw filesystem management <http://www.foxhop.net/linux-raw-filesystem-management>`_.\r\n\r\n", "source_format": "rst", "revision_number": 66, "created": 1368912159000}, {"id": "f1e154c6-2f95-11f1-a2a5-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <dom name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<dom name>\r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<dom name>.xml\r\n | virsh start <dom name>\r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <dom name>\r\n\r\n**kvm** \r\n virsh console <dom name>\r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <dom name> \r\n\r\n**kvm** \r\n virsh shutdown <dom name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n | <feature> \r\n |  <acpi/>\r\n | </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<dom name> /etc/xen/auto/<dom name>\r\n\r\n**kvm** \r\n virsh autostart <dom name>\r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <dom name>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <dom name>\r\n\r\n**kvm**\r\n virsh destroy <dom name>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh quit\r\n\r\n\r\n\r\n\r\n\r\nVirtual Serial Console configuration\r\n======================================\r\n\r\n**From the KVM host run:**\r\n\r\n.. code-block:: xml\r\n\r\n virsh edit <dom>\r\n\r\nThen add the following inside the <device></device> directives:\r\n\r\n.. code-block:: xml\r\n\r\n <serial type=\"pty\">\r\n     <source path=\"/dev/pts/3\" />\r\n     <target port=\"1\" />\r\n </serial>\r\n\r\n**From the Guest run:**\r\n\r\n.. code-block:: xml\r\n\r\n sudo cp -p /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n sudo vi /etc/init/ttyS0.conf\r\n sudo diff /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n\r\n\r\n\r\n\r\nVmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\nInstall vmbuilder\r\n---------------------\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\nDisplay Help vmbuilder\r\n--------------------------------\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\nCustom vmbuilder string\t\r\n-------------------------------\t\t\t\r\n \t\t\t\r\nmbison example \t\r\n\r\n.. code-block:: bash\t\t\t\r\n\t\t\r\n VMNAME=mbison\t\t\t\r\n mkdir /vms/$VMNAME\t\t\t\r\n \t\t\t\r\n sudo vmbuilder kvm ubuntu --libvirt=qemu:///system --suite=lucid --flavour=virtual \\\t\t\t\r\n --hostname=$VMNAME --domain='foxhop.net' --rootsize='10240' --mem='1024' \\\t\t\t\r\n --ip=192.168.1.51 --gw=192.168.1.254 --dns=192.168.1.22 --bridge=br0 \\\t\t\t\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT --verbose\t\t\t\r\n\t \t\t\t\r\ncammy example\t\t\t\r\n \t\t\t\r\n.. code-block:: bash\t\t\t\r\n \t\t\t\r\n VMNAME=cammy\t\t\t\r\n mkdir /vms/$VMNAME\t\t\t\r\n \t\t\t\r\n sudo vmbuilder kvm ubuntu       \\\t\t\t\r\n     --libvirt=qemu:///system    \\\t\t\t\r\n     --suite=lucid               \\\t\t\t\r\n     --arch=amd64 -o             \\\t\t\t\r\n     --flavour=virtual           \\\t\t\t\r\n     --hostname=$VMNAME          \\\t\t\t\r\n     --dest=/vms/$VMNAME         \\\t\t\t\r\n     --rootsize=20480            \\\t\t\t\r\n     --mem=1024                  \\\t\t\t\r\n     --bridge=br0                \\\t\t\t\r\n     --ip=192.168.1.52           \\\t\t\t\r\n     --gw=192.168.1.254          \\\t\t\t\r\n     --dns=192.168.1.22          \\\t\t\t\r\n     --user=john                 \\\t\t\t\r\n     --pass=doe                  \\\t\t\t\r\n     --addpkg=openssh-server     \\\t\t\t\r\n     --addpkg=acpid              \\\t\t\t\r\n     --timezone=EDT              \\ \t\t\t\r\n     --verbose\r\n\r\n\r\nvirt-install\r\n================\r\n\r\nThis method shows the virt-install script installing from a debian netboot image hosted on the internet\r\n\r\n.. code-block:: bash\r\n\r\n sudo virt-install --name=tehforum --vcpu=1 --ram=128 --disk=/KVMROOT/tehforum.qcow2,size=10 --os-type=linux --autostart --location=http://ftp.nl.debian.org/debian/dists/wheezy/main/installer-amd64/ --extra-args=\"auto=true priority=critical hostname=tehforum domain=foxhop.net url=http://akuma.foxhop.net:8000/foxhop-debconf-preseed.txt\"Mounting a qcow2 image on the host\r\n======================================\r\n\r\nSometimes it is helpful to be able to mount a drive image under the host system. For example, if the guest doesn't have network support, the only way to transfer files into and out of the guest will be by the storage devices it can address or to restore files from a backup image.\r\n\r\nTo mount qcow2 images there is (at least in F-11 qemu) very useful qemu-nbd util. It shares image through kernel network block device protocol and this allows to mount it:\r\n\r\n.. code-block:: bash\r\n   \r\n  sudo modprobe nbd max_part=63\r\n  sudo qemu-nbd -c /dev/nbd0 image.img\r\n  sudo mount /dev/nbd0p1 /mnt/image\r\n\r\n\r\n\r\n\r\nAdd another disk image to a guest\r\n====================================\r\n\r\nThis is how you add an additional disk to a guest.  In this example I will be adding a 20GB disk image to a guest dom named cammy.\r\n\r\n.. code-block:: bash\r\n\r\n fallocate -l 20g /vms/cammy/cammy-aux.img\r\n\r\nor\r\n\r\n.. code-block:: bash\r\n\r\n qemu-img create -f qcow2 /vms/cammy/cammy-aux.img 20G\r\n\r\nIf you want to look that the image statistics try this command.\r\n\r\n.. code-block:: bash\r\n\r\n\r\n qemu-img info /vms/cammy/cammy-aux.img\r\n\r\nNow we need to mount this disk:\r\n\r\n.. code-block:: bash\r\n\r\n sudo virsh attach-disk cammy /vms/cammy/cammy-aux.img vdb\r\n\r\nThat command only mounted the disk.  To make this change permanent we need to alter the dom's xml:\r\n\r\n.. code-block:: xml\r\n\r\n # sudo virsh edit cammy\r\n\r\n  <disk type='file' device='disk'>\r\n    <driver name='qemu' type='qcow2'/>\r\n    <source file='/KVMROOT/cammy.qcow2'/>\r\n    <target dev='vda' bus='virtio'/>\r\n    <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>\r\n  </disk>\r\n\r\n  <disk type='file' device='disk'>\r\n    <driver name='qemu' type='raw'/>\r\n    <source file='/KVMROOT/cammy-var.img'/>\r\n    <target dev='vdb' bus='virtio'/>\r\n  <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>\r\n\r\nSSH to the guest and verify that the disk shows up in *fdisk -l*.  You may now partition this disk how you like.  For more information view `linux raw filesystem management <http://www.foxhop.net/linux-raw-filesystem-management>`_.\r\n\r\n", "source_format": "rst", "revision_number": 65, "created": 1368907994000}, {"id": "f1e14d25-2f95-11f1-aaea-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <dom name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<dom name>\r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<dom name>.xml\r\n | virsh start <dom name>\r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <dom name>\r\n\r\n**kvm** \r\n virsh console <dom name>\r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <dom name> \r\n\r\n**kvm** \r\n virsh shutdown <dom name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n | <feature> \r\n |  <acpi/>\r\n | </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<dom name> /etc/xen/auto/<dom name>\r\n\r\n**kvm** \r\n virsh autostart <dom name>\r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <dom name>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <dom name>\r\n\r\n**kvm**\r\n virsh destroy <dom name>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh quit\r\n\r\n\r\n\r\n\r\n\r\nVirtual Serial Console configuration\r\n======================================\r\n\r\n**From the KVM host run:**\r\n\r\n.. code-block:: xml\r\n\r\n virsh edit <dom>\r\n\r\nThen add the following inside the <device></device> directives:\r\n\r\n.. code-block:: xml\r\n\r\n <serial type=\"pty\">\r\n     <source path=\"/dev/pts/3\" />\r\n     <target port=\"1\" />\r\n </serial>\r\n\r\n**From the Guest run:**\r\n\r\n.. code-block:: xml\r\n\r\n sudo cp -p /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n sudo vi /etc/init/ttyS0.conf\r\n sudo diff /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n\r\n\r\n\r\n\r\nVmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\nInstall vmbuilder\r\n---------------------\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\nDisplay Help vmbuilder\r\n--------------------------------\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\nCustom vmbuilder string\t\r\n-------------------------------\t\t\t\r\n \t\t\t\r\nmbison example \t\r\n\r\n.. code-block:: bash\t\t\t\r\n\t\t\r\n VMNAME=mbison\t\t\t\r\n mkdir /vms/$VMNAME\t\t\t\r\n \t\t\t\r\n sudo vmbuilder kvm ubuntu --libvirt=qemu:///system --suite=lucid --flavour=virtual \\\t\t\t\r\n --hostname=$VMNAME --domain='foxhop.net' --rootsize='10240' --mem='1024' \\\t\t\t\r\n --ip=192.168.1.51 --gw=192.168.1.254 --dns=192.168.1.22 --bridge=br0 \\\t\t\t\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT --verbose\t\t\t\r\n\t \t\t\t\r\ncammy example\t\t\t\r\n \t\t\t\r\n.. code-block:: bash\t\t\t\r\n \t\t\t\r\n VMNAME=cammy\t\t\t\r\n mkdir /vms/$VMNAME\t\t\t\r\n \t\t\t\r\n sudo vmbuilder kvm ubuntu       \\\t\t\t\r\n     --libvirt=qemu:///system    \\\t\t\t\r\n     --suite=lucid               \\\t\t\t\r\n     --arch=amd64 -o             \\\t\t\t\r\n     --flavour=virtual           \\\t\t\t\r\n     --hostname=$VMNAME          \\\t\t\t\r\n     --dest=/vms/$VMNAME         \\\t\t\t\r\n     --rootsize=20480            \\\t\t\t\r\n     --mem=1024                  \\\t\t\t\r\n     --bridge=br0                \\\t\t\t\r\n     --ip=192.168.1.52           \\\t\t\t\r\n     --gw=192.168.1.254          \\\t\t\t\r\n     --dns=192.168.1.22          \\\t\t\t\r\n     --user=john                 \\\t\t\t\r\n     --pass=doe                  \\\t\t\t\r\n     --addpkg=openssh-server     \\\t\t\t\r\n     --addpkg=acpid              \\\t\t\t\r\n     --timezone=EDT              \\ \t\t\t\r\n     --verbose\r\n\r\n\r\nvirt-install\r\n================\r\n\r\nThis method shows the virt-install script installing from a debian netboot image hosted on the internet\r\n\r\n.. code-block:: bash\r\n\r\n DOMNAME=tehforum\r\n\r\n sudo virt-install --name=$DOMNAME --vcpu=1 --ram=128 --os-type=linux --autostart \\\r\n --disk=/KVMROOT/tehforum.qcow2,size=10 \\\r\n --location=http://ftp.nl.debian.org/debian/dists/wheezy/main/installer-amd64/ \\\r\n --extra-args=\"auto=true priority=critical interface=auto lang=english console-keymaps-at/keymap=us locale=en_US hostname=$DOMNAME domain=foxhop.net url=http://www.debian.org/releases/stable/example-preseed.txt\"\r\n\r\n\r\n\r\n\r\n\r\nMounting a qcow2 image on the host\r\n======================================\r\n\r\nSometimes it is helpful to be able to mount a drive image under the host system. For example, if the guest doesn't have network support, the only way to transfer files into and out of the guest will be by the storage devices it can address or to restore files from a backup image.\r\n\r\nTo mount qcow2 images there is (at least in F-11 qemu) very useful qemu-nbd util. It shares image through kernel network block device protocol and this allows to mount it:\r\n\r\n.. code-block:: bash\r\n   \r\n  sudo modprobe nbd max_part=63\r\n  sudo qemu-nbd -c /dev/nbd0 image.img\r\n  sudo mount /dev/nbd0p1 /mnt/image\r\n\r\n\r\n\r\n\r\nAdd another disk image to a guest\r\n====================================\r\n\r\nThis is how you add an additional disk to a guest.  In this example I will be adding a 20GB disk image to a guest dom named cammy.\r\n\r\n.. code-block:: bash\r\n\r\n fallocate -l 20g /vms/cammy/cammy-aux.img\r\n\r\nor\r\n\r\n.. code-block:: bash\r\n\r\n qemu-img create -f qcow2 /vms/cammy/cammy-aux.img 20G\r\n\r\nIf you want to look that the image statistics try this command.\r\n\r\n.. code-block:: bash\r\n\r\n\r\n qemu-img info /vms/cammy/cammy-aux.img\r\n\r\nNow we need to mount this disk:\r\n\r\n.. code-block:: bash\r\n\r\n sudo virsh attach-disk cammy /vms/cammy/cammy-aux.img vdb\r\n\r\nThat command only mounted the disk.  To make this change permanent we need to alter the dom's xml:\r\n\r\n.. code-block:: xml\r\n\r\n # sudo virsh edit cammy\r\n\r\n  <disk type='file' device='disk'>\r\n    <driver name='qemu' type='qcow2'/>\r\n    <source file='/KVMROOT/cammy.qcow2'/>\r\n    <target dev='vda' bus='virtio'/>\r\n    <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>\r\n  </disk>\r\n\r\n  <disk type='file' device='disk'>\r\n    <driver name='qemu' type='raw'/>\r\n    <source file='/KVMROOT/cammy-var.img'/>\r\n    <target dev='vdb' bus='virtio'/>\r\n  <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>\r\n\r\nSSH to the guest and verify that the disk shows up in *fdisk -l*.  You may now partition this disk how you like.  For more information view `linux raw filesystem management <http://www.foxhop.net/linux-raw-filesystem-management>`_.\r\n\r\n", "source_format": "rst", "revision_number": 64, "created": 1368893989000}, {"id": "f1e146a9-2f95-11f1-a90d-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <dom name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<dom name>\r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<dom name>.xml\r\n | virsh start <dom name>\r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <dom name>\r\n\r\n**kvm** \r\n virsh console <dom name>\r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <dom name> \r\n\r\n**kvm** \r\n virsh shutdown <dom name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n | <feature> \r\n |  <acpi/>\r\n | </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<dom name> /etc/xen/auto/<dom name>\r\n\r\n**kvm** \r\n virsh autostart <dom name>\r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <dom name>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <dom name>\r\n\r\n**kvm**\r\n virsh destroy <dom name>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh quit\r\n\r\n\r\n\r\n\r\n\r\nVirtual Serial Console configuration\r\n======================================\r\n\r\n**From the KVM host run:**\r\n\r\n.. code-block:: xml\r\n\r\n virsh edit <dom>\r\n\r\nThen add the following inside the <device></device> directives:\r\n\r\n.. code-block:: xml\r\n\r\n <serial type=\"pty\">\r\n     <source path=\"/dev/pts/3\" />\r\n     <target port=\"1\" />\r\n </serial>\r\n\r\n**From the Guest run:**\r\n\r\n.. code-block:: xml\r\n\r\n sudo cp -p /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n sudo vi /etc/init/ttyS0.conf\r\n sudo diff /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n\r\n\r\n\r\n\r\nVmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\nInstall vmbuilder\r\n---------------------\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\nDisplay Help vmbuilder\r\n--------------------------------\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\nCustom vmbuilder string\t\r\n-------------------------------\t\t\t\r\n \t\t\t\r\nmbison example \t\r\n\r\n.. code-block:: bash\t\t\t\r\n\t\t\r\n VMNAME=mbison\t\t\t\r\n mkdir /vms/$VMNAME\t\t\t\r\n \t\t\t\r\n sudo vmbuilder kvm ubuntu --libvirt=qemu:///system --suite=lucid --flavour=virtual \\\t\t\t\r\n --hostname=$VMNAME --domain='foxhop.net' --rootsize='10240' --mem='1024' \\\t\t\t\r\n --ip=192.168.1.51 --gw=192.168.1.254 --dns=192.168.1.22 --bridge=br0 \\\t\t\t\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT --verbose\t\t\t\r\n\t \t\t\t\r\ncammy example\t\t\t\r\n \t\t\t\r\n.. code-block:: bash\t\t\t\r\n \t\t\t\r\n VMNAME=cammy\t\t\t\r\n mkdir /vms/$VMNAME\t\t\t\r\n \t\t\t\r\n sudo vmbuilder kvm ubuntu       \\\t\t\t\r\n     --libvirt=qemu:///system    \\\t\t\t\r\n     --suite=lucid               \\\t\t\t\r\n     --arch=amd64 -o             \\\t\t\t\r\n     --flavour=virtual           \\\t\t\t\r\n     --hostname=$VMNAME          \\\t\t\t\r\n     --dest=/vms/$VMNAME         \\\t\t\t\r\n     --rootsize=20480            \\\t\t\t\r\n     --mem=1024                  \\\t\t\t\r\n     --bridge=br0                \\\t\t\t\r\n     --ip=192.168.1.52           \\\t\t\t\r\n     --gw=192.168.1.254          \\\t\t\t\r\n     --dns=192.168.1.22          \\\t\t\t\r\n     --user=john                 \\\t\t\t\r\n     --pass=doe                  \\\t\t\t\r\n     --addpkg=openssh-server     \\\t\t\t\r\n     --addpkg=acpid              \\\t\t\t\r\n     --timezone=EDT              \\ \t\t\t\r\n     --verbose\r\n\r\n\r\nvirt-install\r\n================\r\n\r\nThis method shows the virt-install script installing from a debian netboot image hosted on the internet\r\n\r\n.. code-block:: bash\r\n\r\n sudo virt-install --name=mbison --ram=256 --disk=/KVMROOT/mbison.qcow2,size=10 --location=http://ftp.us.debian.org/debian/dists/Debian7.0.0/main/installer-amd64/\r\n\r\n\r\n\r\n\r\nMounting a qcow2 image on the host\r\n======================================\r\n\r\nSometimes it is helpful to be able to mount a drive image under the host system. For example, if the guest doesn't have network support, the only way to transfer files into and out of the guest will be by the storage devices it can address or to restore files from a backup image.\r\n\r\nTo mount qcow2 images there is (at least in F-11 qemu) very useful qemu-nbd util. It shares image through kernel network block device protocol and this allows to mount it:\r\n\r\n.. code-block:: bash\r\n   \r\n  sudo modprobe nbd max_part=63\r\n  sudo qemu-nbd -c /dev/nbd0 image.img\r\n  sudo mount /dev/nbd0p1 /mnt/image\r\n\r\n\r\n\r\n\r\nAdd another disk image to a guest\r\n====================================\r\n\r\nThis is how you add an additional disk to a guest.  In this example I will be adding a 20GB disk image to a guest dom named cammy.\r\n\r\n.. code-block:: bash\r\n\r\n fallocate -l 20g /vms/cammy/cammy-aux.img\r\n\r\nor\r\n\r\n.. code-block:: bash\r\n\r\n qemu-img create -f qcow2 /vms/cammy/cammy-aux.img 20G\r\n\r\nIf you want to look that the image statistics try this command.\r\n\r\n.. code-block:: bash\r\n\r\n\r\n qemu-img info /vms/cammy/cammy-aux.img\r\n\r\nNow we need to mount this disk:\r\n\r\n.. code-block:: bash\r\n\r\n sudo virsh attach-disk cammy /vms/cammy/cammy-aux.img vdb\r\n\r\nThat command only mounted the disk.  To make this change permanent we need to alter the dom's xml:\r\n\r\n.. code-block:: xml\r\n\r\n # sudo virsh edit cammy\r\n\r\n  <disk type='file' device='disk'>\r\n    <driver name='qemu' type='qcow2'/>\r\n    <source file='/KVMROOT/cammy.qcow2'/>\r\n    <target dev='vda' bus='virtio'/>\r\n    <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>\r\n  </disk>\r\n\r\n  <disk type='file' device='disk'>\r\n    <driver name='qemu' type='raw'/>\r\n    <source file='/KVMROOT/cammy-var.img'/>\r\n    <target dev='vdb' bus='virtio'/>\r\n  <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>\r\n\r\nSSH to the guest and verify that the disk shows up in *fdisk -l*.  You may now partition this disk how you like.  For more information view `linux raw filesystem management <http://www.foxhop.net/linux-raw-filesystem-management>`_.\r\n\r\n", "source_format": "rst", "revision_number": 63, "created": 1368844413000}, {"id": "f1e1402b-2f95-11f1-bc90-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <dom name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<dom name>\r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<dom name>.xml\r\n | virsh start <dom name>\r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <dom name>\r\n\r\n**kvm** \r\n virsh console <dom name>\r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <dom name> \r\n\r\n**kvm** \r\n virsh shutdown <dom name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n | <feature> \r\n |  <acpi/>\r\n | </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<dom name> /etc/xen/auto/<dom name>\r\n\r\n**kvm** \r\n virsh autostart <dom name>\r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <dom name>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <dom name>\r\n\r\n**kvm**\r\n virsh destroy <dom name>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh quit\r\n\r\n\r\n\r\n\r\n\r\nVirtual Serial Console configuration\r\n======================================\r\n\r\n**From the KVM host run:**\r\n\r\n.. code-block:: xml\r\n\r\n virsh edit <dom>\r\n\r\nThen add the following inside the <device></device> directives:\r\n\r\n.. code-block:: xml\r\n\r\n <serial type=\"pty\">\r\n     <source path=\"/dev/pts/3\" />\r\n     <target port=\"1\" />\r\n </serial>\r\n\r\n**From the Guest run:**\r\n\r\n.. code-block:: xml\r\n\r\n sudo cp -p /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n sudo vi /etc/init/ttyS0.conf\r\n sudo diff /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n\r\n\r\n\r\n\r\nVmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\nInstall vmbuilder\r\n---------------------\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\nDisplay Help vmbuilder\r\n--------------------------------\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\nCustom vmbuilder string\t\r\n-------------------------------\t\t\t\r\n \t\t\t\r\nmbison example \t\r\n\r\n.. code-block:: bash\t\t\t\r\n\t\t\r\n VMNAME=mbison\t\t\t\r\n mkdir /vms/$VMNAME\t\t\t\r\n \t\t\t\r\n sudo vmbuilder kvm ubuntu --libvirt=qemu:///system --suite=lucid --flavour=virtual \\\t\t\t\r\n --hostname=$VMNAME --domain='foxhop.net' --rootsize='10240' --mem='1024' \\\t\t\t\r\n --ip=192.168.1.51 --gw=192.168.1.254 --dns=192.168.1.22 --bridge=br0 \\\t\t\t\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT --verbose\t\t\t\r\n\t \t\t\t\r\ncammy example\t\t\t\r\n \t\t\t\r\n.. code-block:: bash\t\t\t\r\n \t\t\t\r\n VMNAME=cammy\t\t\t\r\n mkdir /vms/$VMNAME\t\t\t\r\n \t\t\t\r\n sudo vmbuilder kvm ubuntu       \\\t\t\t\r\n     --libvirt=qemu:///system    \\\t\t\t\r\n     --suite=lucid               \\\t\t\t\r\n     --arch=amd64 -o             \\\t\t\t\r\n     --flavour=virtual           \\\t\t\t\r\n     --hostname=$VMNAME          \\\t\t\t\r\n     --dest=/vms/$VMNAME         \\\t\t\t\r\n     --rootsize=20480            \\\t\t\t\r\n     --mem=1024                  \\\t\t\t\r\n     --bridge=br0                \\\t\t\t\r\n     --ip=192.168.1.52           \\\t\t\t\r\n     --gw=192.168.1.254          \\\t\t\t\r\n     --dns=192.168.1.22          \\\t\t\t\r\n     --user=john                 \\\t\t\t\r\n     --pass=doe                  \\\t\t\t\r\n     --addpkg=openssh-server     \\\t\t\t\r\n     --addpkg=acpid              \\\t\t\t\r\n     --timezone=EDT              \\ \t\t\t\r\n     --verbose\r\n\r\n\r\n\r\nMounting a qcow2 image on the host\r\n======================================\r\n\r\nSometimes it is helpful to be able to mount a drive image under the host system. For example, if the guest doesn't have network support, the only way to transfer files into and out of the guest will be by the storage devices it can address or to restore files from a backup image.\r\n\r\nTo mount qcow2 images there is (at least in F-11 qemu) very useful qemu-nbd util. It shares image through kernel network block device protocol and this allows to mount it:\r\n\r\n.. code-block:: bash\r\n   \r\n  sudo modprobe nbd max_part=63\r\n  sudo qemu-nbd -c /dev/nbd0 image.img\r\n  sudo mount /dev/nbd0p1 /mnt/image\r\n\r\n\r\n\r\n\r\nAdd another disk image to a guest\r\n====================================\r\n\r\nThis is how you add an additional disk to a guest.  In this example I will be adding a 20GB disk image to a guest dom named cammy.\r\n\r\n.. code-block:: bash\r\n\r\n fallocate -l 20g /vms/cammy/cammy-aux.img\r\n\r\nor\r\n\r\n.. code-block:: bash\r\n\r\n qemu-img create -f qcow2 /vms/cammy/cammy-aux.img 20G\r\n\r\nIf you want to look that the image statistics try this command.\r\n\r\n.. code-block:: bash\r\n\r\n\r\n qemu-img info /vms/cammy/cammy-aux.img\r\n\r\nNow we need to mount this disk:\r\n\r\n.. code-block:: bash\r\n\r\n sudo virsh attach-disk cammy /vms/cammy/cammy-aux.img vdb\r\n\r\nThat command only mounted the disk.  To make this change permanent we need to alter the dom's xml:\r\n\r\n.. code-block:: xml\r\n\r\n # sudo virsh edit cammy\r\n\r\n  <disk type='file' device='disk'>\r\n    <driver name='qemu' type='qcow2'/>\r\n    <source file='/KVMROOT/cammy.qcow2'/>\r\n    <target dev='vda' bus='virtio'/>\r\n    <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>\r\n  </disk>\r\n\r\n  <disk type='file' device='disk'>\r\n    <driver name='qemu' type='raw'/>\r\n    <source file='/KVMROOT/cammy-var.img'/>\r\n    <target dev='vdb' bus='virtio'/>\r\n  <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>\r\n\r\nSSH to the guest and verify that the disk shows up in *fdisk -l*.  You may now partition this disk how you like.  For more information view `linux raw filesystem management <http://www.foxhop.net/linux-raw-filesystem-management>`_.\r\n\r\n", "source_format": "rst", "revision_number": 62, "created": 1363908315000}, {"id": "f1e13a8f-2f95-11f1-bb17-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <dom name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<dom name>\r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<dom name>.xml\r\n | virsh start <dom name>\r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <dom name>\r\n\r\n**kvm** \r\n virsh console <dom name>\r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <dom name> \r\n\r\n**kvm** \r\n virsh shutdown <dom name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n | <feature> \r\n |  <acpi/>\r\n | </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<dom name> /etc/xen/auto/<dom name>\r\n\r\n**kvm** \r\n virsh autostart <dom name>\r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <dom name>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <dom name>\r\n\r\n**kvm**\r\n virsh destroy <dom name>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh quit\r\n\r\n\r\n\r\n\r\n\r\nVirtual Serial Console configuration\r\n======================================\r\n\r\n**From the KVM host run:**\r\n\r\n.. code-block:: xml\r\n\r\n virsh edit <dom>\r\n\r\nThen add the following inside the <device></device> directives:\r\n\r\n.. code-block:: xml\r\n\r\n <serial type=\"pty\">\r\n     <source path=\"/dev/pts/3\" />\r\n     <target port=\"1\" />\r\n </serial>\r\n\r\n**From the Guest run:**\r\n\r\n.. code-block:: xml\r\n\r\n sudo cp -p /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n sudo vi /etc/init/ttyS0.conf\r\n sudo diff /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n\r\n\r\n\r\n\r\nVmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\nInstall vmbuilder\r\n---------------------\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\nDisplay Help vmbuilder\r\n--------------------------------\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\nCustom vmbuilder string\t\r\n-------------------------------\t\t\t\r\n \t\t\t\r\nmbison example \t\r\n\r\n.. code-block:: bash\t\t\t\r\n\t\t\r\n VMNAME=mbison\t\t\t\r\n mkdir /vms/$VMNAME\t\t\t\r\n \t\t\t\r\n sudo vmbuilder kvm ubuntu --libvirt=qemu:///system --suite=lucid --flavour=virtual \\\t\t\t\r\n --hostname=$VMNAME --domain='foxhop.net' --rootsize='10240' --mem='1024' \\\t\t\t\r\n --ip=192.168.1.51 --gw=192.168.1.254 --dns=192.168.1.22 --bridge=br0 \\\t\t\t\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT --verbose\t\t\t\r\n\t \t\t\t\r\ncammy example\t\t\t\r\n \t\t\t\r\n.. code-block:: bash\t\t\t\r\n \t\t\t\r\n VMNAME=cammy\t\t\t\r\n mkdir /vms/$VMNAME\t\t\t\r\n \t\t\t\r\n sudo vmbuilder kvm ubuntu       \\\t\t\t\r\n     --libvirt=qemu:///system    \\\t\t\t\r\n     --suite=lucid               \\\t\t\t\r\n     --arch=amd64 -o             \\\t\t\t\r\n     --flavour=virtual           \\\t\t\t\r\n     --hostname=$VMNAME          \\\t\t\t\r\n     --dest=/vms/$VMNAME         \\\t\t\t\r\n     --rootsize=20480            \\\t\t\t\r\n     --mem=1024                  \\\t\t\t\r\n     --bridge=br0                \\\t\t\t\r\n     --ip=192.168.1.52           \\\t\t\t\r\n     --gw=192.168.1.254          \\\t\t\t\r\n     --dns=192.168.1.22          \\\t\t\t\r\n     --user=john                 \\\t\t\t\r\n     --pass=doe                  \\\t\t\t\r\n     --addpkg=openssh-server     \\\t\t\t\r\n     --addpkg=acpid              \\\t\t\t\r\n     --timezone=EDT              \\ \t\t\t\r\n     --verbose\r\n\r\n\r\n\r\nMounting a qcow2 image on the host\r\n======================================\r\n\r\nSometimes it is helpful to be able to mount a drive image under the host system. For example, if the guest doesn't have network support, the only way to transfer files into and out of the guest will be by the storage devices it can address or to restore files from a backup image.\r\n\r\nTo mount qcow2 images there is (at least in F-11 qemu) very useful qemu-nbd util. It shares image through kernel network block device protocol and this allows to mount it:\r\n\r\n.. code-block:: bash\r\n   \r\n  sudo modprobe nbd max_part=63\r\n  sudo qemu-nbd -c /dev/nbd0 image.img\r\n  sudo mount /dev/nbd0p1 /mnt/image\r\n\r\n\r\n\r\n\r\nAdd another disk image to a guest\r\n====================================\r\n\r\nThis is how you add an additional disk to a guest.  In this example I will be adding a 20GB disk image to a guest dom named cammy.\r\n\r\n.. code-block:: bash\r\n\r\n fallocate -l 20g /vms/cammy/cammy-aux.img\r\n\r\nor\r\n\r\n.. code-block:: bash\r\n\r\n qemu-img create -f qcow2 /vms/cammy/cammy-aux.img 20G\r\n\r\nIf you want to look that the image statistics try this command.\r\n\r\n.. code-block:: bash\r\n\r\n\r\n qemu-img info /vms/cammy/cammy-aux.img\r\n\r\nNow we need to mount this disk:\r\n\r\n.. code-block:: bash\r\n\r\n sudo virsh attach-disk cammy /vms/cammy/cammy-aux.img vdb\r\n\r\nThat command only mounted the disk.  To make this change permanent we need to alter the dom's xml:\r\n\r\n.. code-block:: xml\r\n\r\n # sudo virsh edit cammy\r\n\r\n  <disk type='file' device='disk'>\r\n    <driver name='qemu' type='qcow2'/>\r\n    <source file='/KVMROOT/cammy.qcow2'/>\r\n    <target dev='vda' bus='virtio'/>\r\n    <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>\r\n  </disk>\r\n\r\n  <disk type='file' device='disk'>\r\n    <driver name='qemu' type='raw'/>\r\n    <source file='/KVMROOT/cammy-var.img'/>\r\n    <target dev='vdb' bus='virtio'/>\r\n  <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>\r\n\r\nSSH to the guest and verify that the disk shows up in *fdisk -l*.  You may now partition this disk how you like.  For more information on `linux raw filesystem management <http://www.foxhop.net/linux-raw-filesystem-management>`_\r\n\r\n", "source_format": "rst", "revision_number": 61, "created": 1363908285000}, {"id": "f1e1362d-2f95-11f1-8146-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <dom name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<dom name>\r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<dom name>.xml\r\n | virsh start <dom name>\r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <dom name>\r\n\r\n**kvm** \r\n virsh console <dom name>\r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <dom name> \r\n\r\n**kvm** \r\n virsh shutdown <dom name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n | <feature> \r\n |  <acpi/>\r\n | </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<dom name> /etc/xen/auto/<dom name>\r\n\r\n**kvm** \r\n virsh autostart <dom name>\r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <dom name>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <dom name>\r\n\r\n**kvm**\r\n virsh destroy <dom name>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh quit\r\n\r\n\r\n\r\n\r\n\r\nVirtual Serial Console configuration\r\n======================================\r\n\r\n**From the KVM host run:**\r\n\r\n.. code-block:: xml\r\n\r\n virsh edit <dom>\r\n\r\nThen add the following inside the <device></device> directives:\r\n\r\n.. code-block:: xml\r\n\r\n <serial type=\"pty\">\r\n     <source path=\"/dev/pts/3\" />\r\n     <target port=\"1\" />\r\n </serial>\r\n\r\n**From the Guest run:**\r\n\r\n.. code-block:: xml\r\n\r\n sudo cp -p /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n sudo vi /etc/init/ttyS0.conf\r\n sudo diff /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n\r\n\r\n\r\n\r\nVmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\nInstall vmbuilder\r\n---------------------\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\nDisplay Help vmbuilder\r\n--------------------------------\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\nCustom vmbuilder string\t\r\n-------------------------------\t\t\t\r\n \t\t\t\r\nmbison example \t\r\n\r\n.. code-block:: bash\t\t\t\r\n\t\t\r\n VMNAME=mbison\t\t\t\r\n mkdir /vms/$VMNAME\t\t\t\r\n \t\t\t\r\n sudo vmbuilder kvm ubuntu --libvirt=qemu:///system --suite=lucid --flavour=virtual \\\t\t\t\r\n --hostname=$VMNAME --domain='foxhop.net' --rootsize='10240' --mem='1024' \\\t\t\t\r\n --ip=192.168.1.51 --gw=192.168.1.254 --dns=192.168.1.22 --bridge=br0 \\\t\t\t\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT --verbose\t\t\t\r\n\t \t\t\t\r\ncammy example\t\t\t\r\n \t\t\t\r\n.. code-block:: bash\t\t\t\r\n \t\t\t\r\n VMNAME=cammy\t\t\t\r\n mkdir /vms/$VMNAME\t\t\t\r\n \t\t\t\r\n sudo vmbuilder kvm ubuntu       \\\t\t\t\r\n     --libvirt=qemu:///system    \\\t\t\t\r\n     --suite=lucid               \\\t\t\t\r\n     --arch=amd64 -o             \\\t\t\t\r\n     --flavour=virtual           \\\t\t\t\r\n     --hostname=$VMNAME          \\\t\t\t\r\n     --dest=/vms/$VMNAME         \\\t\t\t\r\n     --rootsize=20480            \\\t\t\t\r\n     --mem=1024                  \\\t\t\t\r\n     --bridge=br0                \\\t\t\t\r\n     --ip=192.168.1.52           \\\t\t\t\r\n     --gw=192.168.1.254          \\\t\t\t\r\n     --dns=192.168.1.22          \\\t\t\t\r\n     --user=john                 \\\t\t\t\r\n     --pass=doe                  \\\t\t\t\r\n     --addpkg=openssh-server     \\\t\t\t\r\n     --addpkg=acpid              \\\t\t\t\r\n     --timezone=EDT              \\ \t\t\t\r\n     --verbose\r\n\r\n\r\n\r\nMounting a qcow2 image on the host\r\n======================================\r\n\r\nSometimes it is helpful to be able to mount a drive image under the host system. For example, if the guest doesn't have network support, the only way to transfer files into and out of the guest will be by the storage devices it can address or to restore files from a backup image.\r\n\r\nTo mount qcow2 images there is (at least in F-11 qemu) very useful qemu-nbd util. It shares image through kernel network block device protocol and this allows to mount it:\r\n\r\n.. code-block:: bash\r\n   \r\n  sudo modprobe nbd max_part=63\r\n  sudo qemu-nbd -c /dev/nbd0 image.img\r\n  sudo mount /dev/nbd0p1 /mnt/image\r\n\r\n\r\n\r\n\r\nAdd another disk image to a guest\r\n====================================\r\n\r\nThis is how you add an additional disk to a guest.  In this example I will be adding a 20GB disk image to a guest dom named cammy.\r\n\r\n.. code-block:: bash\r\n\r\n fallocate -l 20g /vms/cammy/cammy-aux.img\r\n\r\nor\r\n\r\n.. code-block:: bash\r\n\r\n qemu-img create -f qcow2 /vms/cammy/cammy-aux.img 20G\r\n\r\nIf you want to look that the image statistics try this command.\r\n\r\n.. code-block:: bash\r\n\r\n\r\n qemu-img info /vms/cammy/cammy-aux.img\r\n\r\nNow we need to mount this disk:\r\n\r\n.. code-block:: bash\r\n\r\n sudo virsh attach-disk cammy /vms/cammy/cammy-aux.img vdb\r\n\r\nThat command only mounted the disk.  To make this change permanent we need to alter the dom's xml:\r\n\r\n.. code-block:: xml\r\n\r\n # sudo virsh edit cammy\r\n\r\n  <disk type='file' device='disk'>\r\n    <driver name='qemu' type='qcow2'/>\r\n    <source file='/KVMROOT/cammy.qcow2'/>\r\n    <target dev='vda' bus='virtio'/>\r\n    <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>\r\n  </disk>\r\n\r\n  <disk type='file' device='disk'>\r\n    <driver name='qemu' type='raw'/>\r\n    <source file='/KVMROOT/cammy-var.img'/>\r\n    <target dev='vdb' bus='virtio'/>\r\n  <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>\r\n\r\n\r\n", "source_format": "rst", "revision_number": 60, "created": 1363908140000}, {"id": "f1e12ffa-2f95-11f1-a227-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <dom name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<dom name>\r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<dom name>.xml\r\n | virsh start <dom name>\r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <dom name>\r\n\r\n**kvm** \r\n virsh console <dom name>\r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <dom name> \r\n\r\n**kvm** \r\n virsh shutdown <dom name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n | <feature> \r\n |  <acpi/>\r\n | </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<dom name> /etc/xen/auto/<dom name>\r\n\r\n**kvm** \r\n virsh autostart <dom name>\r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <dom name>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <dom name>\r\n\r\n**kvm**\r\n virsh destroy <dom name>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh quit\r\n\r\n\r\n\r\n\r\n\r\nVirtual Serial Console configuration\r\n======================================\r\n\r\n**From the KVM host run:**\r\n\r\n.. code-block:: xml\r\n\r\n virsh edit <dom>\r\n\r\nThen add the following inside the <device></device> directives:\r\n\r\n.. code-block:: xml\r\n\r\n <serial type=\"pty\">\r\n     <source path=\"/dev/pts/3\" />\r\n     <target port=\"1\" />\r\n </serial>\r\n\r\n**From the Guest run:**\r\n\r\n.. code-block:: xml\r\n\r\n sudo cp -p /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n sudo vi /etc/init/ttyS0.conf\r\n sudo diff /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n\r\n\r\n\r\n\r\nVmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\nInstall vmbuilder\r\n---------------------\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\nDisplay Help vmbuilder\r\n--------------------------------\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\nCustom vmbuilder string\t\r\n-------------------------------\t\t\t\r\n \t\t\t\r\nmbison example \t\r\n\r\n.. code-block:: bash\t\t\t\r\n\t\t\r\n VMNAME=mbison\t\t\t\r\n mkdir /vms/$VMNAME\t\t\t\r\n \t\t\t\r\n sudo vmbuilder kvm ubuntu --libvirt=qemu:///system --suite=lucid --flavour=virtual \\\t\t\t\r\n --hostname=$VMNAME --domain='foxhop.net' --rootsize='10240' --mem='1024' \\\t\t\t\r\n --ip=192.168.1.51 --gw=192.168.1.254 --dns=192.168.1.22 --bridge=br0 \\\t\t\t\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT --verbose\t\t\t\r\n\t \t\t\t\r\ncammy example\t\t\t\r\n \t\t\t\r\n.. code-block:: bash\t\t\t\r\n \t\t\t\r\n VMNAME=cammy\t\t\t\r\n mkdir /vms/$VMNAME\t\t\t\r\n \t\t\t\r\n sudo vmbuilder kvm ubuntu       \\\t\t\t\r\n     --libvirt=qemu:///system    \\\t\t\t\r\n     --suite=lucid               \\\t\t\t\r\n     --arch=amd64 -o             \\\t\t\t\r\n     --flavour=virtual           \\\t\t\t\r\n     --hostname=$VMNAME          \\\t\t\t\r\n     --dest=/vms/$VMNAME         \\\t\t\t\r\n     --rootsize=20480            \\\t\t\t\r\n     --mem=1024                  \\\t\t\t\r\n     --bridge=br0                \\\t\t\t\r\n     --ip=192.168.1.52           \\\t\t\t\r\n     --gw=192.168.1.254          \\\t\t\t\r\n     --dns=192.168.1.22          \\\t\t\t\r\n     --user=john                 \\\t\t\t\r\n     --pass=doe                  \\\t\t\t\r\n     --addpkg=openssh-server     \\\t\t\t\r\n     --addpkg=acpid              \\\t\t\t\r\n     --timezone=EDT              \\ \t\t\t\r\n     --verbose\r\n\r\n\r\n\r\nMounting a qcow2 image on the host\r\n======================================\r\n\r\nSometimes it is helpful to be able to mount a drive image under the host system. For example, if the guest doesn't have network support, the only way to transfer files into and out of the guest will be by the storage devices it can address or to restore files from a backup image.\r\n\r\nTo mount qcow2 images there is (at least in F-11 qemu) very useful qemu-nbd util. It shares image through kernel network block device protocol and this allows to mount it:\r\n\r\n.. code-block:: bash\r\n   \r\n  sudo modprobe nbd max_part=63\r\n  sudo qemu-nbd -c /dev/nbd0 image.img\r\n  sudo mount /dev/nbd0p1 /mnt/image\r\n\r\n\r\n\r\n\r\nAdd another disk image to a guest\r\n====================================\r\n\r\nThis is how you add an additional disk to a guest.  In this example I will be adding a 20GB disk image to a guest dom named cammy.\r\n\r\n.. code-block:: bash\r\n\r\n fallocate -l 20g /vms/cammy/cammy-aux.img\r\n\r\nor\r\n\r\n.. code-block:: bash\r\n\r\n qemu-img create -f qcow2 /vms/cammy/cammy-aux.img 20G\r\n\r\nIf you want to look that the image statistics try this command.\r\n\r\n.. code-block:: bash\r\n\r\n\r\n qemu-img info /vms/cammy/cammy-aux.img\r\n", "source_format": "rst", "revision_number": 59, "created": 1331486545000}, {"id": "f1e128c4-2f95-11f1-ad70-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <dom name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<dom name>\r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<dom name>.xml\r\n | virsh start <dom name>\r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <dom name>\r\n\r\n**kvm** \r\n virsh console <dom name>\r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <dom name> \r\n\r\n**kvm** \r\n virsh shutdown <dom name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n | <feature> \r\n |  <acpi/>\r\n | </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<dom name> /etc/xen/auto/<dom name>\r\n\r\n**kvm** \r\n virsh autostart <dom name>\r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <dom name>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <dom name>\r\n\r\n**kvm**\r\n virsh destroy <dom name>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh quit\r\n\r\n\r\n\r\n\r\n\r\nVirtual Serial Console configuration\r\n======================================\r\n\r\n**From the KVM host run:**\r\n\r\n.. code-block:: xml\r\n\r\n virsh edit <dom>\r\n\r\nThen add the following inside the <device></device> directives:\r\n\r\n.. code-block:: xml\r\n\r\n <serial type=\"pty\">\r\n     <source path=\"/dev/pts/3\" />\r\n     <target port=\"1\" />\r\n </serial>\r\n\r\n**From the Guest run:**\r\n\r\n.. code-block:: xml\r\n\r\n sudo cp -p /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n sudo vi /etc/init/ttyS0.conf\r\n sudo diff /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n\r\n\r\n\r\n\r\nVmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\nInstall vmbuilder\r\n---------------------\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\nDisplay Help vmbuilder\r\n--------------------------------\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\nCustom vmbuilder string\t\r\n-------------------------------\t\t\t\r\n \t\t\t\r\nmbison example \t\r\n\r\n.. code-block:: bash\t\t\t\r\n\t\t\r\n VMNAME=mbison\t\t\t\r\n mkdir /vms/$VMNAME\t\t\t\r\n \t\t\t\r\n sudo vmbuilder kvm ubuntu --libvirt=qemu:///system --suite=lucid --flavour=virtual \\\t\t\t\r\n --hostname=$VMNAME --domain='foxhop.net' --rootsize='10240' --mem='1024' \\\t\t\t\r\n --ip=192.168.1.51 --gw=192.168.1.254 --dns=192.168.1.22 --bridge=br0 \\\t\t\t\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT --verbose\t\t\t\r\n\t \t\t\t\r\ncammy example\t\t\t\r\n \t\t\t\r\n.. code-block:: bash\t\t\t\r\n \t\t\t\r\n VMNAME=cammy\t\t\t\r\n mkdir /vms/$VMNAME\t\t\t\r\n \t\t\t\r\n sudo vmbuilder kvm ubuntu       \\\t\t\t\r\n     --libvirt=qemu:///system    \\\t\t\t\r\n     --suite=lucid               \\\t\t\t\r\n     --arch=amd64 -o             \\\t\t\t\r\n     --flavour=virtual           \\\t\t\t\r\n     --hostname=$VMNAME          \\\t\t\t\r\n     --dest=/vms/$VMNAME         \\\t\t\t\r\n     --rootsize=20480            \\\t\t\t\r\n     --mem=1024                  \\\t\t\t\r\n     --bridge=br0                \\\t\t\t\r\n     --ip=192.168.1.52           \\\t\t\t\r\n     --gw=192.168.1.254          \\\t\t\t\r\n     --dns=192.168.1.22          \\\t\t\t\r\n     --user=john                 \\\t\t\t\r\n     --pass=doe                  \\\t\t\t\r\n     --addpkg=openssh-server     \\\t\t\t\r\n     --addpkg=acpid              \\\t\t\t\r\n     --timezone=EDT              \\ \t\t\t\r\n     --verbose\r\n\r\n\r\n\r\nMounting a qcow2 image on the host\r\n======================================\r\n\r\nSometimes it is helpful to be able to mount a drive image under the host system. For example, if the guest doesn't have network support, the only way to transfer files into and out of the guest will be by the storage devices it can address or to restore files from a backup image.\r\n\r\nTo mount qcow2 images there is (at least in F-11 qemu) very useful qemu-nbd util. It shares image through kernel network block device protocol and this allows to mount it:\r\n\r\n.. code-block:: bash\r\n   \r\n  sudo modprobe nbd max_part=63\r\n  sudo qemu-nbd -c /dev/nbd0 image.img\r\n  sudo mount /dev/nbd0p1 /mnt/image\r\n\r\n\r\n\r\n\r\nAdd another disk image to a guest\r\n====================================\r\n\r\nThis is how you add an additional disk to a guest.  In this example I will be adding a 20GB disk image to a guest dom named cammy.\r\n\r\n::\r\n\r\n fallocate -l 20g /vms/cammy/cammy-aux.img\r\n\r\nor:: \r\n\r\n qemu-img create -f qcow2 /vms/cammy/cammy-aux.img 20G\r\n\r\nIf you want to look that the image statistics try this command.\r\n\r\n::\r\n\r\n qemu-img info /vms/cammy/cammy-aux.img\r\n", "source_format": "rst", "revision_number": 58, "created": 1331486466000}, {"id": "f1e123d6-2f95-11f1-a8ca-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <dom name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<dom name>\r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<dom name>.xml\r\n | virsh start <dom name>\r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <dom name>\r\n\r\n**kvm** \r\n virsh console <dom name>\r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <dom name> \r\n\r\n**kvm** \r\n virsh shutdown <dom name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n | <feature> \r\n |  <acpi/>\r\n | </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<dom name> /etc/xen/auto/<dom name>\r\n\r\n**kvm** \r\n virsh autostart <dom name>\r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <dom name>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <dom name>\r\n\r\n**kvm**\r\n virsh destroy <dom name>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh quit\r\n\r\n\r\n\r\n\r\n\r\nVirtual Serial Console configuration\r\n======================================\r\n\r\n**From the KVM host run:**\r\n\r\n.. code-block:: xml\r\n\r\n virsh edit <dom>\r\n\r\nThen add the following inside the <device></device> directives:\r\n\r\n.. code-block:: xml\r\n\r\n <serial type=\"pty\">\r\n     <source path=\"/dev/pts/3\" />\r\n     <target port=\"1\" />\r\n </serial>\r\n\r\n**From the Guest run:**\r\n\r\n.. code-block:: xml\r\n\r\n sudo cp -p /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n sudo vi /etc/init/ttyS0.conf\r\n sudo diff /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n\r\n\r\n\r\n\r\nVmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\nInstall vmbuilder\r\n---------------------\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\nDisplay Help vmbuilder\r\n--------------------------------\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\nCustom vmbuilder string\t\r\n-------------------------------\t\t\t\r\n \t\t\t\r\nmbison example \t\r\n\r\n.. code-block:: bash\t\t\t\r\n\t\t\r\n VMNAME=mbison\t\t\t\r\n mkdir /vms/$VMNAME\t\t\t\r\n \t\t\t\r\n sudo vmbuilder kvm ubuntu --libvirt=qemu:///system --suite=lucid --flavour=virtual \\\t\t\t\r\n --hostname=$VMNAME --domain='foxhop.net' --rootsize='10240' --mem='1024' \\\t\t\t\r\n --ip=192.168.1.51 --gw=192.168.1.254 --dns=192.168.1.22 --bridge=br0 \\\t\t\t\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT --verbose\t\t\t\r\n\t \t\t\t\r\ncammy example\t\t\t\r\n \t\t\t\r\n.. code-block:: bash\t\t\t\r\n \t\t\t\r\n VMNAME=cammy\t\t\t\r\n mkdir /vms/$VMNAME\t\t\t\r\n \t\t\t\r\n sudo vmbuilder kvm ubuntu       \\\t\t\t\r\n     --libvirt=qemu:///system    \\\t\t\t\r\n     --suite=lucid               \\\t\t\t\r\n     --arch=amd64 -o             \\\t\t\t\r\n     --flavour=virtual           \\\t\t\t\r\n     --hostname=$VMNAME          \\\t\t\t\r\n     --dest=/vms/$VMNAME         \\\t\t\t\r\n     --rootsize=20480            \\\t\t\t\r\n     --mem=1024                  \\\t\t\t\r\n     --bridge=br0                \\\t\t\t\r\n     --ip=192.168.1.52           \\\t\t\t\r\n     --gw=192.168.1.254          \\\t\t\t\r\n     --dns=192.168.1.22          \\\t\t\t\r\n     --user=john                 \\\t\t\t\r\n     --pass=doe                  \\\t\t\t\r\n     --addpkg=openssh-server     \\\t\t\t\r\n     --addpkg=acpid              \\\t\t\t\r\n     --timezone=EDT              \\ \t\t\t\r\n     --verbose\r\n\r\n\r\n\r\nMounting a qcow2 image on the host\r\n======================================\r\n\r\nSometimes it is helpful to be able to mount a drive image under the host system. For example, if the guest doesn't have network support, the only way to transfer files into and out of the guest will be by the storage devices it can address or to restore files from a backup image.\r\n\r\nTo mount qcow2 images there is (at least in F-11 qemu) very useful qemu-nbd util. It shares image through kernel network block device protocol and this allows to mount it:\r\n\r\n.. code-block:: bash\r\n   \r\n  sudo modprobe nbd max_part=63\r\n  sudo qemu-nbd -c /dev/nbd0 image.img\r\n  sudo mount /dev/nbd0p1 /mnt/image\r\n\r\n\r\n\r\n\r\nAdd another disk image to a guest\r\n====================================\r\n\r\nThis is how you add an additional disk to a guest.  In this example I will be adding a 20GB disk image to a guest dom named cammy.\r\n\r\n::\r\n\r\n fallocate -l 20g /vms/cammy/cammy-aux.img\r\n\r\nIf you want to look that the image statistics try this command.\r\n\r\n::\r\n\r\n qemu-img info /vms/cammy/cammy-aux.img\r\n", "source_format": "rst", "revision_number": 57, "created": 1331480715000}, {"id": "f1e11fde-2f95-11f1-951b-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <dom name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<dom name>\r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<dom name>.xml\r\n | virsh start <dom name>\r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <dom name>\r\n\r\n**kvm** \r\n virsh console <dom name>\r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <dom name> \r\n\r\n**kvm** \r\n virsh shutdown <dom name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n | <feature> \r\n |  <acpi/>\r\n | </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<dom name> /etc/xen/auto/<dom name>\r\n\r\n**kvm** \r\n virsh autostart <dom name>\r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <dom name>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <dom name>\r\n\r\n**kvm**\r\n virsh destroy <dom name>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh quit\r\n\r\n\r\n\r\n\r\n\r\nVirtual Serial Console configuration\r\n======================================\r\n\r\n**From the KVM host run:**\r\n\r\n.. code-block:: xml\r\n\r\n virsh edit <dom>\r\n\r\nThen add the following inside the <device></device> directives:\r\n\r\n.. code-block:: xml\r\n\r\n <serial type=\"pty\">\r\n     <source path=\"/dev/pts/3\" />\r\n     <target port=\"1\" />\r\n </serial>\r\n\r\n**From the Guest run:**\r\n\r\n.. code-block:: xml\r\n\r\n sudo cp -p /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n sudo vi /etc/init/ttyS0.conf\r\n sudo diff /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n\r\n\r\n\r\n\r\nVmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\nInstall vmbuilder\r\n---------------------\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\nDisplay Help vmbuilder\r\n--------------------------------\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\nCustom vmbuilder string\t\r\n-------------------------------\t\t\t\r\n \t\t\t\r\nmbison example \t\r\n\r\n.. code-block:: bash\t\t\t\r\n\t\t\r\n VMNAME=mbison\t\t\t\r\n mkdir /vms/$VMNAME\t\t\t\r\n \t\t\t\r\n sudo vmbuilder kvm ubuntu --libvirt=qemu:///system --suite=lucid --flavour=virtual \\\t\t\t\r\n --hostname=$VMNAME --domain='foxhop.net' --rootsize='10240' --mem='1024' \\\t\t\t\r\n --ip=192.168.1.51 --gw=192.168.1.254 --dns=192.168.1.22 --bridge=br0 \\\t\t\t\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT --verbose\t\t\t\r\n\t \t\t\t\r\ncammy example\t\t\t\r\n \t\t\t\r\n.. code-block:: bash\t\t\t\r\n \t\t\t\r\n VMNAME=cammy\t\t\t\r\n mkdir /vms/$VMNAME\t\t\t\r\n \t\t\t\r\n sudo vmbuilder kvm ubuntu       \\\t\t\t\r\n     --libvirt=qemu:///system    \\\t\t\t\r\n     --suite=lucid               \\\t\t\t\r\n     --arch=amd64 -o             \\\t\t\t\r\n     --flavour=virtual           \\\t\t\t\r\n     --hostname=$VMNAME          \\\t\t\t\r\n     --dest=/vms/$VMNAME         \\\t\t\t\r\n     --rootsize=20480            \\\t\t\t\r\n     --mem=1024                  \\\t\t\t\r\n     --bridge=br0                \\\t\t\t\r\n     --ip=192.168.1.52           \\\t\t\t\r\n     --gw=192.168.1.254          \\\t\t\t\r\n     --dns=192.168.1.22          \\\t\t\t\r\n     --user=john                 \\\t\t\t\r\n     --pass=doe                  \\\t\t\t\r\n     --addpkg=openssh-server     \\\t\t\t\r\n     --addpkg=acpid              \\\t\t\t\r\n     --timezone=EDT              \\ \t\t\t\r\n     --verbose\r\n\r\n\r\n\r\nMounting a qcow2 image on the host\r\n======================================\r\n\r\nSometimes it is helpful to be able to mount a drive image under the host system. For example, if the guest doesn't have network support, the only way to transfer files into and out of the guest will be by the storage devices it can address or to restore files from a backup image.\r\n\r\nTo mount qcow2 images there is (at least in F-11 qemu) very useful qemu-nbd util. It shares image through kernel network block device protocol and this allows to mount it:\r\n\r\n.. code-block:: bash\r\n   \r\n  sudo modprobe nbd max_part=63\r\n  sudo qemu-nbd -c /dev/nbd0 image.img\r\n  sudo mount /dev/nbd0p1 /mnt/image\r\n\r\n\r\n\r\n\r\nAdd another disk image to a guest\r\n====================================\r\n\r\nThis is how you add an additional disk to a guest.  In this example I will be adding a 20GB disk image to a guest dom named cammy.\r\n\r\n::\r\n\r\n fallocate -l 20g /vms/cammy/cammy-aux.img\r\n\r\nIf you want to look that the image statistics try this command\r\n\r\n::\r\n qemu-img info /vms/cammy/cammy-aux.img\r\n", "source_format": "rst", "revision_number": 56, "created": 1331480693000}, {"id": "f1e11b81-2f95-11f1-9833-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <dom name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<dom name>\r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<dom name>.xml\r\n | virsh start <dom name>\r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <dom name>\r\n\r\n**kvm** \r\n virsh console <dom name>\r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <dom name> \r\n\r\n**kvm** \r\n virsh shutdown <dom name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n | <feature> \r\n |  <acpi/>\r\n | </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<dom name> /etc/xen/auto/<dom name>\r\n\r\n**kvm** \r\n virsh autostart <dom name>\r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <dom name>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <dom name>\r\n\r\n**kvm**\r\n virsh destroy <dom name>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh quit\r\n\r\n\r\n\r\n\r\n\r\nVirtual Serial Console configuration\r\n======================================\r\n\r\n**From the KVM host run:**\r\n\r\n.. code-block:: xml\r\n\r\n virsh edit <dom>\r\n\r\nThen add the following inside the <device></device> directives:\r\n\r\n.. code-block:: xml\r\n\r\n <serial type=\"pty\">\r\n     <source path=\"/dev/pts/3\" />\r\n     <target port=\"1\" />\r\n </serial>\r\n\r\n**From the Guest run:**\r\n\r\n.. code-block:: xml\r\n\r\n sudo cp -p /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n sudo vi /etc/init/ttyS0.conf\r\n sudo diff /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n\r\n\r\n\r\n\r\nVmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\nInstall vmbuilder\r\n---------------------\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\nDisplay Help vmbuilder\r\n--------------------------------\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\nCustom vmbuilder string\t\r\n-------------------------------\t\t\t\r\n \t\t\t\r\nmbison example \t\r\n\r\n.. code-block:: bash\t\t\t\r\n\t\t\r\n VMNAME=mbison\t\t\t\r\n mkdir /vms/$VMNAME\t\t\t\r\n \t\t\t\r\n sudo vmbuilder kvm ubuntu --libvirt=qemu:///system --suite=lucid --flavour=virtual \\\t\t\t\r\n --hostname=$VMNAME --domain='foxhop.net' --rootsize='10240' --mem='1024' \\\t\t\t\r\n --ip=192.168.1.51 --gw=192.168.1.254 --dns=192.168.1.22 --bridge=br0 \\\t\t\t\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT --verbose\t\t\t\r\n\t \t\t\t\r\ncammy example\t\t\t\r\n \t\t\t\r\n.. code-block:: bash\t\t\t\r\n \t\t\t\r\n VMNAME=cammy\t\t\t\r\n mkdir /vms/$VMNAME\t\t\t\r\n \t\t\t\r\n sudo vmbuilder kvm ubuntu       \\\t\t\t\r\n     --libvirt=qemu:///system    \\\t\t\t\r\n     --suite=lucid               \\\t\t\t\r\n     --arch=amd64 -o             \\\t\t\t\r\n     --flavour=virtual           \\\t\t\t\r\n     --hostname=$VMNAME          \\\t\t\t\r\n     --dest=/vms/$VMNAME         \\\t\t\t\r\n     --rootsize=20480            \\\t\t\t\r\n     --mem=1024                  \\\t\t\t\r\n     --bridge=br0                \\\t\t\t\r\n     --ip=192.168.1.52           \\\t\t\t\r\n     --gw=192.168.1.254          \\\t\t\t\r\n     --dns=192.168.1.22          \\\t\t\t\r\n     --user=john                 \\\t\t\t\r\n     --pass=doe                  \\\t\t\t\r\n     --addpkg=openssh-server     \\\t\t\t\r\n     --addpkg=acpid              \\\t\t\t\r\n     --timezone=EDT              \\ \t\t\t\r\n     --verbose\r\n\r\n\r\n\r\nMounting a qcow2 image on the host\r\n======================================\r\n\r\nSometimes it is helpful to be able to mount a drive image under the host system. For example, if the guest doesn't have network support, the only way to transfer files into and out of the guest will be by the storage devices it can address or to restore files from a backup image.\r\n\r\nTo mount qcow2 images there is (at least in F-11 qemu) very useful qemu-nbd util. It shares image through kernel network block device protocol and this allows to mount it:\r\n\r\n.. code-block:: bash\r\n   \r\n  sudo modprobe nbd max_part=63\r\n  sudo qemu-nbd -c /dev/nbd0 image.img\r\n  sudo mount /dev/nbd0p1 /mnt/image\r\n\r\n\r\n\r\n\r\nAdd another disk image to a guest\r\n====================================\r\n\r\nThis is how you add an additional disk to a guest.  In this example I will be adding a 20GB disk image to a guest dom named cammy.\r\n\r\n\r\n\r\n", "source_format": "rst", "revision_number": 55, "created": 1331480369000}, {"id": "f1e116e1-2f95-11f1-af71-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <dom name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<dom name>\r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<dom name>.xml\r\n | virsh start <dom name>\r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <dom name>\r\n\r\n**kvm** \r\n virsh console <dom name>\r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <dom name> \r\n\r\n**kvm** \r\n virsh shutdown <dom name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n | <feature> \r\n |  <acpi/>\r\n | </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<dom name> /etc/xen/auto/<dom name>\r\n\r\n**kvm** \r\n virsh autostart <dom name>\r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <dom name>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <dom name>\r\n\r\n**kvm**\r\n virsh destroy <dom name>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh quit\r\n\r\n\r\n\r\n\r\n\r\nVirtual Serial Console configuration\r\n======================================\r\n\r\n**From the KVM host run:**\r\n\r\n.. code-block:: xml\r\n\r\n virsh edit <dom>\r\n\r\nThen add the following inside the <device></device> directives:\r\n\r\n.. code-block:: xml\r\n\r\n <serial type=\"pty\">\r\n     <source path=\"/dev/pts/3\" />\r\n     <target port=\"1\" />\r\n </serial>\r\n\r\n**From the Guest run:**\r\n\r\n.. code-block:: xml\r\n\r\n sudo cp -p /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n sudo vi /etc/init/ttyS0.conf\r\n sudo diff /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n\r\n\r\n\r\n\r\nVmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\nInstall vmbuilder\r\n---------------------\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\nDisplay Help vmbuilder\r\n--------------------------------\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\nCustom vmbuilder string\t\r\n-------------------------------\t\t\t\r\n \t\t\t\r\nmbison example \t\r\n\r\n.. code-block:: bash\t\t\t\r\n\t\t\r\n VMNAME=mbison\t\t\t\r\n mkdir /vms/$VMNAME\t\t\t\r\n \t\t\t\r\n sudo vmbuilder kvm ubuntu --libvirt=qemu:///system --suite=lucid --flavour=virtual \\\t\t\t\r\n --hostname=$VMNAME --domain='foxhop.net' --rootsize='10240' --mem='1024' \\\t\t\t\r\n --ip=192.168.1.51 --gw=192.168.1.254 --dns=192.168.1.22 --bridge=br0 \\\t\t\t\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT --verbose\t\t\t\r\n\t \t\t\t\r\ncammy example\t\t\t\r\n \t\t\t\r\n.. code-block:: bash\t\t\t\r\n \t\t\t\r\n VMNAME=cammy\t\t\t\r\n mkdir /vms/$VMNAME\t\t\t\r\n \t\t\t\r\n sudo vmbuilder kvm ubuntu       \\\t\t\t\r\n     --libvirt=qemu:///system    \\\t\t\t\r\n     --suite=lucid               \\\t\t\t\r\n     --arch=amd64 -o             \\\t\t\t\r\n     --flavour=virtual           \\\t\t\t\r\n     --hostname=$VMNAME          \\\t\t\t\r\n     --dest=/vms/$VMNAME         \\\t\t\t\r\n     --rootsize=20480            \\\t\t\t\r\n     --mem=1024                  \\\t\t\t\r\n     --bridge=br0                \\\t\t\t\r\n     --ip=192.168.1.52           \\\t\t\t\r\n     --gw=192.168.1.254          \\\t\t\t\r\n     --dns=192.168.1.22          \\\t\t\t\r\n     --user=john                 \\\t\t\t\r\n     --pass=doe                  \\\t\t\t\r\n     --addpkg=openssh-server     \\\t\t\t\r\n     --addpkg=acpid              \\\t\t\t\r\n     --timezone=EDT              \\ \t\t\t\r\n     --verbose\r\n\r\n\r\n\r\nMounting a qcow2 image on the host\r\n======================================\r\n\r\nSometimes it is helpful to be able to mount a drive image under the host system. For example, if the guest doesn't have network support, the only way to transfer files into and out of the guest will be by the storage devices it can address or to restore files from a backup image.\r\n\r\nTo mount qcow2 images there is (at least in F-11 qemu) very useful qemu-nbd util. It shares image through kernel network block device protocol and this allows to mount it:\r\n\r\n.. code-block:: bash\r\n   \r\n  sudo modprobe nbd max_part=63\r\n  sudo qemu-nbd -c /dev/nbd0 image.img\r\n  sudo mount /dev/nbd0p1 /mnt/image\r\n\r\n\r\n\r\n\r\nAdd another disk image to a guest\r\n====================================\r\n\r\nThis is how you add an additional disk to a guest.  In this example I will be adding a 20GB disk image to a guest dom named cammy.\r\n\r\nfallocate -l 20g /vms/cammy/cammy-aux.img\r\n\r\nAnalyze an Disk Image\r\n==========================\r\n\r\n**This is how**::\r\n\r\n  qemu-img info cammy.qcow2\u00a0\r\n  image: cammy.qcow2\r\n  file format: qcow2\r\n  virtual size: 21G (22548578304 bytes)\r\n  disk size: 895M\r\n  cluster_size: 65536\r\n\r\n  qemu-img info cammy-aux.img\r\n  image: cammy-aux.img\r\n  file format: raw\r\n  virtual size: 20G (21474836480 bytes)\r\n  disk size: 20G\r\n\r\n", "source_format": "rst", "revision_number": 54, "created": 1331480240000}, {"id": "f1e112ec-2f95-11f1-94b8-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <dom name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<dom name>\r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<dom name>.xml\r\n | virsh start <dom name>\r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <dom name>\r\n\r\n**kvm** \r\n virsh console <dom name>\r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <dom name> \r\n\r\n**kvm** \r\n virsh shutdown <dom name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n | <feature> \r\n |  <acpi/>\r\n | </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<dom name> /etc/xen/auto/<dom name>\r\n\r\n**kvm** \r\n virsh autostart <dom name>\r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <dom name>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <dom name>\r\n\r\n**kvm**\r\n virsh destroy <dom name>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh quit\r\n\r\n\r\n\r\n\r\n\r\nVirtual Serial Console configuration\r\n======================================\r\n\r\n**From the KVM host run:**\r\n\r\n.. code-block:: xml\r\n\r\n virsh edit <dom>\r\n\r\nThen add the following inside the <device></device> directives:\r\n\r\n.. code-block:: xml\r\n\r\n <serial type=\"pty\">\r\n     <source path=\"/dev/pts/3\" />\r\n     <target port=\"1\" />\r\n </serial>\r\n\r\n**From the Guest run:**\r\n\r\n.. code-block:: xml\r\n\r\n sudo cp -p /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n sudo vi /etc/init/ttyS0.conf\r\n sudo diff /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n\r\n\r\n\r\n\r\nVmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\nInstall vmbuilder\r\n---------------------\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\nDisplay Help vmbuilder\r\n--------------------------------\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\nCustom vmbuilder string\t\r\n-------------------------------\t\t\t\r\n \t\t\t\r\nmbison example \t\r\n\r\n.. code-block:: bash\t\t\t\r\n\t\t\r\n VMNAME=mbison\t\t\t\r\n mkdir /vms/$VMNAME\t\t\t\r\n \t\t\t\r\n sudo vmbuilder kvm ubuntu --libvirt=qemu:///system --suite=lucid --flavour=virtual \\\t\t\t\r\n --hostname=$VMNAME --domain='foxhop.net' --rootsize='10240' --mem='1024' \\\t\t\t\r\n --ip=192.168.1.51 --gw=192.168.1.254 --dns=192.168.1.22 --bridge=br0 \\\t\t\t\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT --verbose\t\t\t\r\n\t \t\t\t\r\ncammy example\t\t\t\r\n \t\t\t\r\n.. code-block:: bash\t\t\t\r\n \t\t\t\r\n VMNAME=cammy\t\t\t\r\n mkdir /vms/$VMNAME\t\t\t\r\n \t\t\t\r\n sudo vmbuilder kvm ubuntu       \\\t\t\t\r\n     --libvirt=qemu:///system    \\\t\t\t\r\n     --suite=lucid               \\\t\t\t\r\n     --arch=amd64 -o             \\\t\t\t\r\n     --flavour=virtual           \\\t\t\t\r\n     --hostname=$VMNAME          \\\t\t\t\r\n     --dest=/vms/$VMNAME         \\\t\t\t\r\n     --rootsize=20480            \\\t\t\t\r\n     --mem=1024                  \\\t\t\t\r\n     --bridge=br0                \\\t\t\t\r\n     --ip=192.168.1.52           \\\t\t\t\r\n     --gw=192.168.1.254          \\\t\t\t\r\n     --dns=192.168.1.22          \\\t\t\t\r\n     --user=john                 \\\t\t\t\r\n     --pass=doe                  \\\t\t\t\r\n     --addpkg=openssh-server     \\\t\t\t\r\n     --addpkg=acpid              \\\t\t\t\r\n     --timezone=EDT              \\ \t\t\t\r\n     --verbose\r\n\r\n\r\n\r\nMounting a qcow2 image on the host\r\n======================================\r\n\r\nSometimes it is helpful to be able to mount a drive image under the host system. For example, if the guest doesn't have network support, the only way to transfer files into and out of the guest will be by the storage devices it can address or to restore files from a backup image.\r\n\r\nTo mount qcow2 images there is (at least in F-11 qemu) very useful qemu-nbd util. It shares image through kernel network block device protocol and this allows to mount it:\r\n\r\n.. code-block:: bash\r\n   \r\n  sudo modprobe nbd max_part=63\r\n  sudo qemu-nbd -c /dev/nbd0 image.img\r\n  sudo mount /dev/nbd0p1 /mnt/image\r\n\r\n\r\n\r\n\r\nAdd another disk image to a guest\r\n====================================\r\n\r\nThis is how you add an additional disk to a guest.  In this example I will be adding a 20GB disk image to a guest dom named cammy.\r\n\r\n\r\n\r\n", "source_format": "rst", "revision_number": 53, "created": 1331478815000}, {"id": "f1e10f0a-2f95-11f1-bd5f-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <dom name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<dom name>\r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<dom name>.xml\r\n | virsh start <dom name>\r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <dom name>\r\n\r\n**kvm** \r\n virsh console <dom name>\r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <dom name> \r\n\r\n**kvm** \r\n virsh shutdown <dom name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n | <feature> \r\n |  <acpi/>\r\n | </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<dom name> /etc/xen/auto/<dom name>\r\n\r\n**kvm** \r\n virsh autostart <dom name>\r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <dom name>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <dom name>\r\n\r\n**kvm**\r\n virsh destroy <dom name>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh quit\r\n\r\n\r\n\r\n\r\n\r\nVirtual Serial Console configuration\r\n======================================\r\n\r\n**From the KVM host run:**\r\n\r\n.. code-block:: xml\r\n\r\n virsh edit <dom>\r\n\r\nThen add the following inside the <device></device> directives:\r\n\r\n.. code-block:: xml\r\n\r\n <serial type=\"pty\">\r\n     <source path=\"/dev/pts/3\" />\r\n     <target port=\"1\" />\r\n </serial>\r\n\r\n**From the Guest run:**\r\n\r\n.. code-block:: xml\r\n\r\n sudo cp -p /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n sudo vi /etc/init/ttyS0.conf\r\n sudo diff /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n\r\n\r\n\r\n\r\nVmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\nInstall vmbuilder\r\n---------------------\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\nDisplay Help vmbuilder\r\n--------------------------------\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\nCustom vmbuilder string\t\r\n-------------------------------\t\t\t\r\n \t\t\t\r\nmbison example \t\r\n\r\n.. code-block:: bash\t\t\t\r\n\t\t\r\n VMNAME=mbison\t\t\t\r\n mkdir /vms/$VMNAME\t\t\t\r\n \t\t\t\r\n sudo vmbuilder kvm ubuntu --libvirt=qemu:///system --suite=lucid --flavour=virtual \\\t\t\t\r\n --hostname=$VMNAME --domain='foxhop.net' --rootsize='10240' --mem='1024' \\\t\t\t\r\n --ip=192.168.1.51 --gw=192.168.1.254 --dns=192.168.1.22 --bridge=br0 \\\t\t\t\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT --verbose\t\t\t\r\n\t \t\t\t\r\ncammy example\t\t\t\r\n \t\t\t\r\n.. code-block:: bash\t\t\t\r\n \t\t\t\r\n VMNAME=cammy\t\t\t\r\n mkdir /vms/$VMNAME\t\t\t\r\n \t\t\t\r\n sudo vmbuilder kvm ubuntu       \\\t\t\t\r\n     --libvirt=qemu:///system    \\\t\t\t\r\n     --suite=lucid               \\\t\t\t\r\n     --arch=amd64 -o             \\\t\t\t\r\n     --flavour=virtual           \\\t\t\t\r\n     --hostname=$VMNAME          \\\t\t\t\r\n     --dest=/vms/$VMNAME         \\\t\t\t\r\n     --rootsize=20480            \\\t\t\t\r\n     --mem=1024                  \\\t\t\t\r\n     --bridge=br0                \\\t\t\t\r\n     --ip=192.168.1.52           \\\t\t\t\r\n     --gw=192.168.1.254          \\\t\t\t\r\n     --dns=192.168.1.22          \\\t\t\t\r\n     --user=john                 \\\t\t\t\r\n     --pass=doe                  \\\t\t\t\r\n     --addpkg=openssh-server     \\\t\t\t\r\n     --addpkg=acpid              \\\t\t\t\r\n     --timezone=EDT              \\ \t\t\t\r\n     --verbose\r\n\r\n\r\n\r\nMounting a qcow2 image on the host\r\n======================================\r\n\r\nSometimes it is helpful to be able to mount a drive image under the host system. For example, if the guest doesn't have network support, the only way to transfer files into and out of the guest will be by the storage devices it can address or to restore files from a backup image.\r\n\r\nTo mount qcow2 images there is (at least in F-11 qemu) very useful qemu-nbd util. It shares image through kernel network block device protocol and this allows to mount it:\r\n\r\n.. code-block:: bash\r\n   \r\n  sudo modprobe nbd max_part=63\r\n  sudo qemu-nbd -c /dev/nbd0 image.img\r\n  sudo mount /dev/nbd0p1 /mnt/image\r\n\r\n\r\n\r\n", "source_format": "rst", "revision_number": 52, "created": 1328651219000}, {"id": "f1e10b10-2f95-11f1-a426-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <dom name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<dom name>\r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<dom name>.xml\r\n | virsh start <dom name>\r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <dom name>\r\n\r\n**kvm** \r\n virsh console <dom name>\r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <dom name> \r\n\r\n**kvm** \r\n virsh shutdown <dom name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n | <feature> \r\n |  <acpi/>\r\n | </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<dom name> /etc/xen/auto/<dom name>\r\n\r\n**kvm** \r\n virsh autostart <dom name>\r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <dom name>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <dom name>\r\n\r\n**kvm**\r\n virsh destroy <dom name>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh quit\r\n\r\n\r\n\r\n\r\n\r\nVirtual Serial Console configuration\r\n======================================\r\n\r\n**From the KVM host run:**\r\n\r\n.. code-block:: xml\r\n\r\n virsh edit <dom>\r\n\r\nThen add the following inside the <device></device> directives:\r\n\r\n.. code-block:: xml\r\n\r\n <serial type=\"pty\">\r\n     <source path=\"/dev/pts/3\" />\r\n     <target port=\"1\" />\r\n </serial>\r\n\r\n**From the Guest run:**\r\n\r\n.. code-block:: xml\r\n\r\n sudo cp -p /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n sudo vi /etc/init/ttyS0.conf\r\n sudo diff /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n\r\n\r\n\r\n\r\nVmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\nInstall vmbuilder\r\n---------------------\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\nDisplay Help vmbuilder\r\n--------------------------------\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\n\r\n\r\nMounting a qcow2 image on the host\r\n======================================\r\n\r\nSometimes it is helpful to be able to mount a drive image under the host system. For example, if the guest doesn't have network support, the only way to transfer files into and out of the guest will be by the storage devices it can address or to restore files from a backup image.\r\n\r\nTo mount qcow2 images there is (at least in F-11 qemu) very useful qemu-nbd util. It shares image through kernel network block device protocol and this allows to mount it:\r\n\r\n.. code-block:: bash\r\n   \r\n  sudo modprobe nbd max_part=63\r\n  sudo qemu-nbd -c /dev/nbd0 image.img\r\n  sudo mount /dev/nbd0p1 /mnt/image\r\n\r\n", "source_format": "rst", "revision_number": 51, "created": 1315165643000}, {"id": "f1e10674-2f95-11f1-b7a4-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <dom name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<dom name>\r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<dom name>.xml\r\n | virsh start <dom name>\r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <dom name>\r\n\r\n**kvm** \r\n virsh console <dom name>\r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <dom name> \r\n\r\n**kvm** \r\n virsh shutdown <dom name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n | <feature> \r\n |  <acpi/>\r\n | </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<dom name> /etc/xen/auto/<dom name>\r\n\r\n**kvm** \r\n virsh autostart <dom name>\r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <dom name>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <dom name>\r\n\r\n**kvm**\r\n virsh destroy <dom name>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh quit\r\n\r\n\r\n\r\n\r\n\r\nVirtual Serial Console configuration\r\n======================================\r\n\r\n**From the KVM host run:**\r\n\r\n.. code-block:: xml\r\n\r\n virsh edit <dom>\r\n\r\nThen add the following inside the <device></device> directives:\r\n\r\n.. code-block:: xml\r\n\r\n <serial type=\"pty\">\r\n     <source path=\"/dev/pts/3\" />\r\n     <target port=\"1\" />\r\n </serial>\r\n\r\n**From the Guest run:**\r\n\r\n.. code-block:: xml\r\n\r\n sudo cp -p /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n sudo vi /etc/init/ttyS0.conf\r\n sudo diff /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n\r\n\r\n\r\n\r\nVmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\nInstall vmbuilder\r\n---------------------\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\nDisplay Help vmbuilder\r\n--------------------------------\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\n", "source_format": "rst", "revision_number": 50, "created": 1315164896000}, {"id": "f1e101af-2f95-11f1-a561-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <dom name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<dom name>\r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<dom name>.xml\r\n | virsh start <dom name>\r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <dom name>\r\n\r\n**kvm** \r\n virsh console <dom name>\r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <dom name> \r\n\r\n**kvm** \r\n virsh shutdown <dom name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n | <feature> \r\n |  <acpi/>\r\n | </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<dom name> /etc/xen/auto/<dom name>\r\n\r\n**kvm** \r\n virsh autostart <dom name>\r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <dom name>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <dom name>\r\n\r\n**kvm**\r\n virsh destroy <dom name>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh quit\r\n\r\n\r\n\r\n\r\n\r\nVirtual Serial Console configuration\r\n======================================\r\n\r\n**From the KVM host run:**\r\n\r\n.. code-block:: xml\r\n\r\n virsh edit <dom>\r\n\r\nThen add the following inside the <device></device> directives:\r\n\r\n.. code-block:: xml\r\n\r\n <serial type=\"pty\">\r\n     <source path=\"/dev/pts/3\" />\r\n     <target port=\"1\" />\r\n </serial>\r\n\r\n**From the Guest run:**\r\n\r\n.. code-block:: xml\r\n\r\n sudo cp -p /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n sudo vi /etc/init/ttyS0.conf\r\n sudo diff /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n\r\n\r\n\r\n\r\n\r\n Vmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\nInstall vmbuilder\r\n---------------------\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\nDisplay Help vmbuilder\r\n--------------------------------\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\n", "source_format": "rst", "revision_number": 49, "created": 1315164859000}, {"id": "f1e0fdbf-2f95-11f1-b4a3-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <dom name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<dom name>\r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<dom name>.xml\r\n | virsh start <dom name>\r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <dom name>\r\n\r\n**kvm** \r\n virsh console <dom name>\r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <dom name> \r\n\r\n**kvm** \r\n virsh shutdown <dom name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n | <feature> \r\n |  <acpi/>\r\n | </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<dom name> /etc/xen/auto/<dom name>\r\n\r\n**kvm** \r\n virsh autostart <dom name>\r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <dom name>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <dom name>\r\n\r\n**kvm**\r\n virsh destroy <dom name>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh quit\r\n\r\n\r\n\r\n\r\n\r\nVirtual Serial Console configuration\r\n======================================\r\n\r\n**From the KVM host run:**\r\n\r\n.. code-block:: xml\r\n\r\n virsh edit <dom>\r\n\r\nThen add the following inside the <device></device> directives:\r\n\r\n.. code-block:: xml\r\n\r\n <serial type=\"pty\">\r\n     <source path=\"/dev/pts/3\" />\r\n     <target port=\"1\" />\r\n </serial>\r\n\r\n**From the Guest run:**\r\n\r\n.. code-block:: xml\r\n\r\n sudo cp -p /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n sudo vi /etc/init/ttyS0.conf\r\n sudo diff /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n\r\n\r\n\r\n Vmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\nInstall vmbuilder\r\n---------------------\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\nDisplay Help vmbuilder\r\n--------------------------------\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\nCustom vmbuilder string\r\n-------------------------------\r\n\r\nmbison example \r\n\r\n.. code-block:: bash\r\n\r\n VMNAME=mbison\r\n mkdir /vms/$VMNAME\r\n\r\n sudo vmbuilder kvm ubuntu --libvirt=qemu:///system --suite=lucid --flavour=virtual \\\r\n --hostname=$VMNAME --domain='foxhop.net' --rootsize='10240' --mem='1024' \\\r\n --ip=192.168.1.51 --gw=192.168.1.254 --dns=192.168.1.22 --bridge=br0 \\\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT --verbose\r\n\r\ncammy example\r\n\r\n.. code-block:: bash\r\n\r\n\r\n VMNAME=cammy\r\n mkdir /vms/$VMNAME\r\n\r\n sudo vmbuilder kvm ubuntu       \\\r\n     --libvirt=qemu:///system    \\\r\n     --suite=lucid               \\\r\n     --arch=amd64 -o             \\\r\n     --flavour=virtual           \\\r\n     --hostname=$VMNAME          \\\r\n     --dest=/vms/$VMNAME         \\\r\n     --rootsize=20480            \\\r\n     --mem=1024                  \\\r\n     --bridge=br0                \\\r\n     --ip=192.168.1.52           \\\r\n     --gw=192.168.1.254          \\\r\n     --dns=192.168.1.22          \\\r\n     --user=john                 \\\r\n     --pass=doe                  \\\r\n     --addpkg=openssh-server     \\\r\n     --addpkg=acpid              \\\r\n     --timezone=EDT              \\ \r\n     --verbose\r\n\r\n\r\n\r\n", "source_format": "rst", "revision_number": 48, "created": 1309472490000}, {"id": "f1e0f9db-2f95-11f1-b26f-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <dom name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<dom name>\r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<dom name>.xml\r\n | virsh start <dom name>\r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <dom name>\r\n\r\n**kvm** \r\n virsh console <dom name>\r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <dom name> \r\n\r\n**kvm** \r\n virsh shutdown <dom name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n | <feature> \r\n |  <acpi/>\r\n | </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<dom name> /etc/xen/auto/<dom name>\r\n\r\n**kvm** \r\n virsh autostart <dom name>\r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <dom name>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <dom name>\r\n\r\n**kvm**\r\n virsh destroy <dom name>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh quit\r\n\r\n\r\n\r\n\r\n\r\nconfigure kvm serial console\r\n==================================\r\n\r\n**From the KVM host run:**\r\n\r\n.. code-block:: xml\r\n\r\n virsh edit <dom>\r\n\r\nThen add the following inside the <device></device> directives:\r\n\r\n.. code-block:: xml\r\n\r\n <serial type=\"pty\">\r\n     <source path=\"/dev/pts/3\" />\r\n     <target port=\"1\" />\r\n </serial>\r\n\r\n**From the Guest run:**\r\n\r\n.. code-block:: xml\r\n\r\n sudo cp -p /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n sudo vi /etc/init/ttyS0.conf\r\n sudo diff /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n Vmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\nInstall vmbuilder\r\n---------------------\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\nDisplay Help vmbuilder\r\n--------------------------------\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\nCustom vmbuilder string\r\n-------------------------------\r\n\r\nmbison example \r\n\r\n.. code-block:: bash\r\n\r\n VMNAME=mbison\r\n mkdir /vms/$VMNAME\r\n\r\n sudo vmbuilder kvm ubuntu --libvirt=qemu:///system --suite=lucid --flavour=virtual \\\r\n --hostname=$VMNAME --domain='foxhop.net' --rootsize='10240' --mem='1024' \\\r\n --ip=192.168.1.51 --gw=192.168.1.254 --dns=192.168.1.22 --bridge=br0 \\\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT --verbose\r\n\r\ncammy example\r\n\r\n.. code-block:: bash\r\n\r\n\r\n VMNAME=cammy\r\n mkdir /vms/$VMNAME\r\n\r\n sudo vmbuilder kvm ubuntu       \\\r\n     --libvirt=qemu:///system    \\\r\n     --suite=lucid               \\\r\n     --arch=amd64 -o             \\\r\n     --flavour=virtual           \\\r\n     --hostname=$VMNAME          \\\r\n     --dest=/vms/$VMNAME         \\\r\n     --rootsize=20480            \\\r\n     --mem=1024                  \\\r\n     --bridge=br0                \\\r\n     --ip=192.168.1.52           \\\r\n     --gw=192.168.1.254          \\\r\n     --dns=192.168.1.22          \\\r\n     --user=john                 \\\r\n     --pass=doe                  \\\r\n     --addpkg=openssh-server     \\\r\n     --addpkg=acpid              \\\r\n     --timezone=EDT              \\ \r\n     --verbose\r\n\r\n\r\n\r\nMount a qcow2 or raw image file\r\n=================================\r\n\r\nThe following procedures allow a host to mount a guest image file.  This is useful when trouble shooting issues with the guest.  The following procedures require root access (you can sudo).\r\n\r\n**qcow2**\r\n\r\n.. code-block:: python\r\n\r\n modprobe nbd max_part=63\r\n qemu-nbd -c /dev/nbd0 image.img\r\n mount /dev/nbd0p1 /mnt/image\r\n\r\n**raw**\r\n\r\n.. code-block:: python\r\n \r\n losetup /dev/loop0 image.img\r\n kpartx -a /dev/loop0\r\n mount /dev/mapper/loop0p1 /mnt/image\r\n\r\nIf there is an LVM present on the image file, you can initialize it by running\r\n\r\n.. code-block:: python\r\n\r\n vgscan\r\n vgchange -ay\r\n mount /dev/VolGroupName/LogVolName /mnt/image\r\n\r\nRun the following when finished\r\n\r\n.. code-block:: python\r\n\r\n umount /mnt/image\r\n vgchange -an VolGroupName\r\n killall qemu-nbd\r\n kpartx -d /dev/loop0\r\n losetup -d /dev/loop0\r\n\r\nreference: http://en.wikibooks.org/wiki/QEMU/Images\r\n\r\n\r\n", "source_format": "rst", "revision_number": 47, "created": 1309467982000}, {"id": "f1e0f5eb-2f95-11f1-af6b-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <dom name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<dom name>\r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<dom name>.xml\r\n | virsh start <dom name>\r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <dom name>\r\n\r\n**kvm** \r\n virsh console <dom name>\r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <dom name> \r\n\r\n**kvm** \r\n virsh shutdown <dom name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n | <feature> \r\n |  <acpi/>\r\n | </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<dom name> /etc/xen/auto/<dom name>\r\n\r\n**kvm** \r\n virsh autostart <dom name>\r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <dom name>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <dom name>\r\n\r\n**kvm**\r\n virsh destroy <dom name>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh quit\r\n\r\n\r\n\r\n\r\n\r\nconfigure kvm serial console\r\n---------------------------------\r\n\r\n**From the KVM host run:**\r\n\r\n.. code-block:: xml\r\n\r\n virsh edit <dom>\r\n\r\nThen add the following inside the <device></device> directives:\r\n\r\n.. code-block:: xml\r\n\r\n <serial type=\"pty\">\r\n     <source path=\"/dev/pts/3\" />\r\n     <target port=\"1\" />\r\n </serial>\r\n\r\n**From the Guest run:**\r\n\r\n.. code-block:: xml\r\n\r\n sudo cp -p /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n sudo vi /etc/init/ttyS0.conf\r\n sudo diff /etc/init/tty06.conf /etc/init/ttyS0.conf\r\n Vmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\nInstall vmbuilder\r\n---------------------\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\nDisplay Help vmbuilder\r\n--------------------------------\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\nCustom vmbuilder string\r\n-------------------------------\r\n\r\nmbison example \r\n\r\n.. code-block:: bash\r\n\r\n VMNAME=mbison\r\n mkdir /vms/$VMNAME\r\n\r\n sudo vmbuilder kvm ubuntu --libvirt=qemu:///system --suite=lucid --flavour=virtual \\\r\n --hostname=$VMNAME --domain='foxhop.net' --rootsize='10240' --mem='1024' \\\r\n --ip=192.168.1.51 --gw=192.168.1.254 --dns=192.168.1.22 --bridge=br0 \\\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT --verbose\r\n\r\ncammy example\r\n\r\n.. code-block:: bash\r\n\r\n\r\n VMNAME=cammy\r\n mkdir /vms/$VMNAME\r\n\r\n sudo vmbuilder kvm ubuntu       \\\r\n     --libvirt=qemu:///system    \\\r\n     --suite=lucid               \\\r\n     --arch=amd64 -o             \\\r\n     --flavour=virtual           \\\r\n     --hostname=$VMNAME          \\\r\n     --dest=/vms/$VMNAME         \\\r\n     --rootsize=20480            \\\r\n     --mem=1024                  \\\r\n     --bridge=br0                \\\r\n     --ip=192.168.1.52           \\\r\n     --gw=192.168.1.254          \\\r\n     --dns=192.168.1.22          \\\r\n     --user=john                 \\\r\n     --pass=doe                  \\\r\n     --addpkg=openssh-server     \\\r\n     --addpkg=acpid              \\\r\n     --timezone=EDT              \\ \r\n     --verbose\r\n\r\n\r\n\r\nMount a qcow2 or raw image file\r\n=================================\r\n\r\nThe following procedures allow a host to mount a guest image file.  This is useful when trouble shooting issues with the guest.  The following procedures require root access (you can sudo).\r\n\r\n**qcow2**\r\n\r\n.. code-block:: python\r\n\r\n modprobe nbd max_part=63\r\n qemu-nbd -c /dev/nbd0 image.img\r\n mount /dev/nbd0p1 /mnt/image\r\n\r\n**raw**\r\n\r\n.. code-block:: python\r\n \r\n losetup /dev/loop0 image.img\r\n kpartx -a /dev/loop0\r\n mount /dev/mapper/loop0p1 /mnt/image\r\n\r\nIf there is an LVM present on the image file, you can initialize it by running\r\n\r\n.. code-block:: python\r\n\r\n vgscan\r\n vgchange -ay\r\n mount /dev/VolGroupName/LogVolName /mnt/image\r\n\r\nRun the following when finished\r\n\r\n.. code-block:: python\r\n\r\n umount /mnt/image\r\n vgchange -an VolGroupName\r\n killall qemu-nbd\r\n kpartx -d /dev/loop0\r\n losetup -d /dev/loop0\r\n\r\nreference: http://en.wikibooks.org/wiki/QEMU/Images\r\n\r\n\r\nBacking up kvm guests with virtback\r\n=======================================\r\n\r\nhttp://russell.ballestrini.net/virtback-a-python-libvirt-backup-utility-for-kvm/\r\n\r\ndownload virt-back and place it into usr/local/bin \r\n\r\nrun: *virt-back -h* for a list of options\r\n", "source_format": "rst", "revision_number": 46, "created": 1309467316000}, {"id": "f1e0f1d4-2f95-11f1-9a96-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <dom name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<dom name>\r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<dom name>.xml\r\n | virsh start <dom name>\r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <dom name>\r\n\r\n**kvm** \r\n virsh console <dom name>\r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <dom name> \r\n\r\n**kvm** \r\n virsh shutdown <dom name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n | <feature> \r\n |  <acpi/>\r\n | </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<dom name> /etc/xen/auto/<dom name>\r\n\r\n**kvm** \r\n virsh autostart <dom name>\r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <dom name>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <dom name>\r\n\r\n**kvm**\r\n virsh destroy <dom name>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh quit\r\n\r\n\r\n\r\n\r\n\r\nNote\r\n------\r\nTypically the guests harddrive is not attached, you must add it in the configuration.\r\n\r\nTypically the guests memory is set to 100mbs, you might want to change that in the configuration.\r\n\r\nOnce booted and ssh'd into the VM, cat /etc/network/interfaces to verify that the DNS settings are correct.\r\n\r\nDebian/ubuntu guest don't have acpid installed by default. (Could change the vmbuilder string)\r\n\r\n\r\nVmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\nInstall vmbuilder\r\n---------------------\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\nDisplay Help vmbuilder\r\n--------------------------------\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\nCustom vmbuilder string\r\n-------------------------------\r\n\r\nmbison example \r\n\r\n.. code-block:: bash\r\n\r\n VMNAME=mbison\r\n mkdir /vms/$VMNAME\r\n\r\n sudo vmbuilder kvm ubuntu --libvirt=qemu:///system --suite=lucid --flavour=virtual \\\r\n --hostname=$VMNAME --domain='foxhop.net' --rootsize='10240' --mem='1024' \\\r\n --ip=192.168.1.51 --gw=192.168.1.254 --dns=192.168.1.22 --bridge=br0 \\\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT --verbose\r\n\r\ncammy example\r\n\r\n.. code-block:: bash\r\n\r\n\r\n VMNAME=cammy\r\n mkdir /vms/$VMNAME\r\n\r\n sudo vmbuilder kvm ubuntu       \\\r\n     --libvirt=qemu:///system    \\\r\n     --suite=lucid               \\\r\n     --arch=amd64 -o             \\\r\n     --flavour=virtual           \\\r\n     --hostname=$VMNAME          \\\r\n     --dest=/vms/$VMNAME         \\\r\n     --rootsize=20480            \\\r\n     --mem=1024                  \\\r\n     --bridge=br0                \\\r\n     --ip=192.168.1.52           \\\r\n     --gw=192.168.1.254          \\\r\n     --dns=192.168.1.22          \\\r\n     --user=john                 \\\r\n     --pass=doe                  \\\r\n     --addpkg=openssh-server     \\\r\n     --addpkg=acpid              \\\r\n     --timezone=EDT              \\ \r\n     --verbose\r\n\r\n\r\n\r\nMount a qcow2 or raw image file\r\n=================================\r\n\r\nThe following procedures allow a host to mount a guest image file.  This is useful when trouble shooting issues with the guest.  The following procedures require root access (you can sudo).\r\n\r\n**qcow2**\r\n\r\n.. code-block:: python\r\n\r\n modprobe nbd max_part=63\r\n qemu-nbd -c /dev/nbd0 image.img\r\n mount /dev/nbd0p1 /mnt/image\r\n\r\n**raw**\r\n\r\n.. code-block:: python\r\n \r\n losetup /dev/loop0 image.img\r\n kpartx -a /dev/loop0\r\n mount /dev/mapper/loop0p1 /mnt/image\r\n\r\nIf there is an LVM present on the image file, you can initialize it by running\r\n\r\n.. code-block:: python\r\n\r\n vgscan\r\n vgchange -ay\r\n mount /dev/VolGroupName/LogVolName /mnt/image\r\n\r\nRun the following when finished\r\n\r\n.. code-block:: python\r\n\r\n umount /mnt/image\r\n vgchange -an VolGroupName\r\n killall qemu-nbd\r\n kpartx -d /dev/loop0\r\n losetup -d /dev/loop0\r\n\r\nreference: http://en.wikibooks.org/wiki/QEMU/Images\r\n\r\n\r\nBacking up kvm guests with virtback\r\n=======================================\r\n\r\nhttp://russell.ballestrini.net/virtback-a-python-libvirt-backup-utility-for-kvm/\r\n\r\ndownload virtback and place it into usr/local/bin \r\n\r\nrun: *virtback -h* for a list of options\r\n", "source_format": "rst", "revision_number": 45, "created": 1309396865000}, {"id": "f1e0ed4a-2f95-11f1-af3a-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <dom name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<dom name>\r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<dom name>.xml\r\n | virsh start <dom name>\r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <dom name>\r\n\r\n**kvm** \r\n virsh console <dom name>\r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <dom name> \r\n\r\n**kvm** \r\n virsh shutdown <dom name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n | <feature> \r\n |  <acpi/>\r\n | </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<dom name> /etc/xen/auto/<dom name>\r\n\r\n**kvm** \r\n virsh autostart <dom name>\r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <dom name>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <dom name>\r\n\r\n**kvm**\r\n virsh destroy <dom name>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh quit\r\n\r\n\r\n\r\n\r\n\r\nNote\r\n------\r\nTypically the guests harddrive is not attached, you must add it in the configuration.\r\n\r\nTypically the guests memory is set to 100mbs, you might want to change that in the configuration.\r\n\r\nOnce booted and ssh'd into the VM, cat /etc/network/interfaces to verify that the DNS settings are correct.\r\n\r\nDebian/ubuntu guest don't have acpid installed by default. (Could change the vmbuilder string)\r\n\r\n\r\nVmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\nInstall vmbuilder\r\n---------------------\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\nDisplay Help vmbuilder\r\n--------------------------------\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\nCustom vmbuilder string\r\n-------------------------------\r\n\r\nmbison example \r\n\r\n.. code-block:: bash\r\n\r\n VMNAME=mbison\r\n mkdir /vms/$VMNAME\r\n\r\n sudo vmbuilder kvm ubuntu --libvirt=qemu:///system --suite=lucid --flavour=virtual \\\r\n --hostname=$VMNAME --domain='foxhop.net' --rootsize='10240' --mem='1024' \\\r\n --ip=192.168.1.51 --gw=192.168.1.254 --dns=192.168.1.22 --bridge=br0 \\\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT --verbose\r\n\r\ncammy example\r\n\r\n.. code-block:: bash\r\n\r\n\r\n VMNAME=cammy\r\n mkdir /vms/$VMNAME\r\n\r\n sudo vmbuilder kvm ubuntu       \\\r\n     --libvirt=qemu:///system    \\\r\n     --suite=lucid               \\\r\n     --arch=amd64 -o             \\\r\n     --flavour=virtual           \\\r\n     --hostname=$VMNAME          \\\r\n     --dest=/vms/$VMNAME         \\\r\n     --rootsize=20480            \\\r\n     --mem=1024                  \\\r\n     --bridge=br0                \\\r\n     --ip=192.168.1.52           \\\r\n     --gw=192.168.1.254          \\\r\n     --dns=192.168.1.22          \\\r\n     --addpkg=openssh-server     \\\r\n     --addpkg=acpid              \\\r\n     --timezone=EDT              \\ \r\n     --verbose\r\n\r\n\r\n\r\nMount a qcow2 or raw image file\r\n=================================\r\n\r\nThe following procedures allow a host to mount a guest image file.  This is useful when trouble shooting issues with the guest.  The following procedures require root access (you can sudo).\r\n\r\n**qcow2**\r\n\r\n.. code-block:: python\r\n\r\n modprobe nbd max_part=63\r\n qemu-nbd -c /dev/nbd0 image.img\r\n mount /dev/nbd0p1 /mnt/image\r\n\r\n**raw**\r\n\r\n.. code-block:: python\r\n \r\n losetup /dev/loop0 image.img\r\n kpartx -a /dev/loop0\r\n mount /dev/mapper/loop0p1 /mnt/image\r\n\r\nIf there is an LVM present on the image file, you can initialize it by running\r\n\r\n.. code-block:: python\r\n\r\n vgscan\r\n vgchange -ay\r\n mount /dev/VolGroupName/LogVolName /mnt/image\r\n\r\nRun the following when finished\r\n\r\n.. code-block:: python\r\n\r\n umount /mnt/image\r\n vgchange -an VolGroupName\r\n killall qemu-nbd\r\n kpartx -d /dev/loop0\r\n losetup -d /dev/loop0\r\n\r\nreference: http://en.wikibooks.org/wiki/QEMU/Images\r\n\r\n\r\nBacking up kvm guests with virtback\r\n=======================================\r\n\r\nhttp://russell.ballestrini.net/virtback-a-python-libvirt-backup-utility-for-kvm/\r\n\r\ndownload virtback and place it into usr/local/bin \r\n\r\nrun: *virtback -h* for a list of options\r\n", "source_format": "rst", "revision_number": 44, "created": 1309395662000}, {"id": "f1e0e938-2f95-11f1-bd6c-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <dom name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<dom name>\r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<dom name>.xml\r\n | virsh start <dom name>\r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <dom name>\r\n\r\n**kvm** \r\n virsh console <dom name>\r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <dom name> \r\n\r\n**kvm** \r\n virsh shutdown <dom name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n | <feature> \r\n |  <acpi/>\r\n | </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<dom name> /etc/xen/auto/<dom name>\r\n\r\n**kvm** \r\n virsh autostart <dom name>\r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <dom name>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <dom name>\r\n\r\n**kvm**\r\n virsh destroy <dom name>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh quit\r\n\r\n\r\n\r\n\r\n\r\nNote\r\n------\r\nTypically the guests harddrive is not attached, you must add it in the configuration.\r\n\r\nTypically the guests memory is set to 100mbs, you might want to change that in the configuration.\r\n\r\nOnce booted and ssh'd into the VM, cat /etc/network/interfaces to verify that the DNS settings are correct.\r\n\r\nDebian/ubuntu guest don't have acpid installed by default. (Could change the vmbuilder string)\r\n\r\n\r\nVmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\nInstall vmbuilder\r\n---------------------\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\nDisplay Help vmbuilder\r\n--------------------------------\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\nCustom vmbuilder string\r\n-------------------------------\r\n\r\nmbison example \r\n\r\n.. code-block:: bash\r\n\r\n VMNAME=mbison\r\n mkdir /vms/$VMNAME\r\n\r\n sudo vmbuilder kvm ubuntu --libvirt=qemu:///system --suite=lucid --flavour=virtual \\\r\n --hostname=$VMNAME --domain='foxhop.net' --rootsize='10240' --mem='1024' \\\r\n --ip=192.168.1.51 --gw=192.168.1.254 --dns=192.168.1.22 --bridge=br0 \\\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT --verbose\r\n\r\ncammy example\r\n\r\n.. code-block:: bash\r\n\r\n\r\n VMNAME=cammy\r\n mkdir /vms/$VMNAME\r\n\r\n sudo vmbuilder kvm ubuntu       \\\r\n     --libvirt=qemu:///system    \\\r\n     --suite=lucid               \\\r\n     --arch=amd64 -o             \\\r\n     --flavour=virtual           \\\r\n     --hostname=$VMNAME          \\\r\n     --dest=/vms/$VMNAME         \\\r\n     --raw=/vms/$VMNAME.dcow2    \\\r\n     --rootsize=20480            \\\r\n     --mem=1024                  \\\r\n     --bridge=br0                \\\r\n     --ip=192.168.1.52           \\\r\n     --gw=192.168.1.254          \\\r\n     --dns=192.168.1.22          \\\r\n     --addpkg=openssh-server     \\\r\n     --addpkg=acpid              \\\r\n     --timezone=EDT              \\ \r\n     --verbose\r\n\r\n\r\n\r\nMount a qcow2 or raw image file\r\n=================================\r\n\r\nThe following procedures allow a host to mount a guest image file.  This is useful when trouble shooting issues with the guest.  The following procedures require root access (you can sudo).\r\n\r\n**qcow2**\r\n\r\n.. code-block:: python\r\n\r\n modprobe nbd max_part=63\r\n qemu-nbd -c /dev/nbd0 image.img\r\n mount /dev/nbd0p1 /mnt/image\r\n\r\n**raw**\r\n\r\n.. code-block:: python\r\n \r\n losetup /dev/loop0 image.img\r\n kpartx -a /dev/loop0\r\n mount /dev/mapper/loop0p1 /mnt/image\r\n\r\nIf there is an LVM present on the image file, you can initialize it by running\r\n\r\n.. code-block:: python\r\n\r\n vgscan\r\n vgchange -ay\r\n mount /dev/VolGroupName/LogVolName /mnt/image\r\n\r\nRun the following when finished\r\n\r\n.. code-block:: python\r\n\r\n umount /mnt/image\r\n vgchange -an VolGroupName\r\n killall qemu-nbd\r\n kpartx -d /dev/loop0\r\n losetup -d /dev/loop0\r\n\r\nreference: http://en.wikibooks.org/wiki/QEMU/Images\r\n\r\n\r\nBacking up kvm guests with virtback\r\n=======================================\r\n\r\nhttp://russell.ballestrini.net/virtback-a-python-libvirt-backup-utility-for-kvm/\r\n\r\ndownload virtback and place it into usr/local/bin \r\n\r\nrun: *virtback -h* for a list of options\r\n", "source_format": "rst", "revision_number": 43, "created": 1309394944000}, {"id": "f1e0e53f-2f95-11f1-ba36-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <dom name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<dom name>\r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<dom name>.xml\r\n | virsh start <dom name>\r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <dom name>\r\n\r\n**kvm** \r\n virsh console <dom name>\r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <dom name> \r\n\r\n**kvm** \r\n virsh shutdown <dom name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n | <feature> \r\n |  <acpi/>\r\n | </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<dom name> /etc/xen/auto/<dom name>\r\n\r\n**kvm** \r\n virsh autostart <dom name>\r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <dom name>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <dom name>\r\n\r\n**kvm**\r\n virsh destroy <dom name>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh quit\r\n\r\n\r\n\r\n\r\n\r\nNote\r\n------\r\nTypically the guests harddrive is not attached, you must add it in the configuration.\r\n\r\nTypically the guests memory is set to 100mbs, you might want to change that in the configuration.\r\n\r\nOnce booted and ssh'd into the VM, cat /etc/network/interfaces to verify that the DNS settings are correct.\r\n\r\nDebian/ubuntu guest don't have acpid installed by default. (Could change the vmbuilder string)\r\n\r\n\r\nVmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\nInstall vmbuilder\r\n---------------------\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\nDisplay Help vmbuilder\r\n--------------------------------\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\nCustom vmbuilder string\r\n-------------------------------\r\n\r\nmbison example \r\n\r\n.. code-block:: bash\r\n\r\n VMNAME=mbison\r\n mkdir /vms/$VMNAME\r\n\r\n sudo vmbuilder kvm ubuntu --libvirt=qemu:///system --suite=lucid --flavour=virtual \\\r\n --hostname=$VMNAME --domain='foxhop.net' --rootsize='10240' --mem='1024' \\\r\n --ip=192.168.1.51 --gw=192.168.1.254 --dns=192.168.1.22 --bridge=br0 \\\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT --verbose\r\n\r\ncammy example\r\n\r\n.. code-block:: bash\r\n\r\n\r\n VMNAME=cammy\r\n mkdir /vms/$VMNAME\r\n\r\n sudo vmbuilder kvm ubuntu       \\\r\n     --libvirt=qemu:///system    \\\r\n     --suite=lucid               \\\r\n     --flavour=virtual           \\ \r\n     --arch=amd64 -o             \\\r\n     --hostname=$VMNAME          \\\r\n     --dest=/vms/$VMNAME         \\\r\n     --raw=/vms/$VMNAME.dcow2    \\\r\n     --rootsize=20480            \\\r\n     --mem=1024                  \\\r\n     --bridge=br0                \\\r\n     --ip=192.168.1.52           \\\r\n     --gw=192.168.1.254          \\\r\n     --dns=192.168.1.22          \\\r\n     --addpkg=openssh-server     \\\r\n     --addpkg=acpid              \\\r\n     --timezone=EDT              \\ \r\n     --verbose\r\n\r\n\r\n\r\n\r\n\r\nMount a qcow2 or raw image file\r\n=================================\r\n\r\nThe following procedures allow a host to mount a guest image file.  This is useful when trouble shooting issues with the guest.  The following procedures require root access (you can sudo).\r\n\r\n**qcow2**\r\n\r\n.. code-block:: python\r\n\r\n modprobe nbd max_part=63\r\n qemu-nbd -c /dev/nbd0 image.img\r\n mount /dev/nbd0p1 /mnt/image\r\n\r\n**raw**\r\n\r\n.. code-block:: python\r\n \r\n losetup /dev/loop0 image.img\r\n kpartx -a /dev/loop0\r\n mount /dev/mapper/loop0p1 /mnt/image\r\n\r\nIf there is an LVM present on the image file, you can initialize it by running\r\n\r\n.. code-block:: python\r\n\r\n vgscan\r\n vgchange -ay\r\n mount /dev/VolGroupName/LogVolName /mnt/image\r\n\r\nRun the following when finished\r\n\r\n.. code-block:: python\r\n\r\n umount /mnt/image\r\n vgchange -an VolGroupName\r\n killall qemu-nbd\r\n kpartx -d /dev/loop0\r\n losetup -d /dev/loop0\r\n\r\nreference: http://en.wikibooks.org/wiki/QEMU/Images\r\n\r\n\r\nBacking up kvm guests with virtback\r\n=======================================\r\n\r\nhttp://russell.ballestrini.net/virtback-a-python-libvirt-backup-utility-for-kvm/\r\n\r\ndownload virtback and place it into usr/local/bin \r\n\r\nrun: *virtback -h* for a list of options\r\n", "source_format": "rst", "revision_number": 42, "created": 1309394858000}, {"id": "f1e0e0dc-2f95-11f1-8310-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <dom name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<dom name>\r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<dom name>.xml\r\n | virsh start <dom name>\r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <dom name>\r\n\r\n**kvm** \r\n virsh console <dom name>\r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <dom name> \r\n\r\n**kvm** \r\n virsh shutdown <dom name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n | <feature> \r\n |  <acpi/>\r\n | </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<dom name> /etc/xen/auto/<dom name>\r\n\r\n**kvm** \r\n virsh autostart <dom name>\r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <dom name>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <dom name>\r\n\r\n**kvm**\r\n virsh destroy <dom name>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh quit\r\n\r\n\r\n\r\n\r\n\r\nNote\r\n------\r\nTypically the guests harddrive is not attached, you must add it in the configuration.\r\n\r\nTypically the guests memory is set to 100mbs, you might want to change that in the configuration.\r\n\r\nOnce booted and ssh'd into the VM, cat /etc/network/interfaces to verify that the DNS settings are correct.\r\n\r\nDebian/ubuntu guest don't have acpid installed by default. (Could change the vmbuilder string)\r\n\r\n\r\nVmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\nInstall vmbuilder\r\n---------------------\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\nDisplay Help vmbuilder\r\n--------------------------------\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\nCustom vmbuilder string\r\n-------------------------------\r\n\r\nmbison example \r\n\r\n.. code-block:: bash\r\n\r\n VMNAME=mbison\r\n mkdir /vms/$VMNAME\r\n\r\n sudo vmbuilder kvm ubuntu --libvirt=qemu:///system --suite=lucid --flavour=virtual \\\r\n --hostname=$VMNAME --domain='foxhop.net' --rootsize='10240' --mem='1024' \\\r\n --ip=192.168.1.51 --gw=192.168.1.254 --dns=192.168.1.22 --bridge=br0 \\\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT --verbose\r\n\r\ncammy example\r\n\r\n.. code-block:: bash\r\n\r\n\r\n VMNAME=cammy\r\n mkdir /vms/$VMNAME\r\n\r\n sudo vmbuilder kvm ubuntu       \\\r\n     --libvirt=qemu:///system    \\\r\n     --suite=lucid               \\\r\n     --flavour=virtual           \\ \r\n     --arch=amd64                \\\r\n     --hostname=$VMNAME          \\\r\n     --dest=/vms/$VMNAME         \\\r\n     --raw=/vms/$VMNAME.dcow2    \\\r\n     --rootsize=20480            \\\r\n     --mem=1024                  \\\r\n     --bridge=br0                \\\r\n     --ip=192.168.1.52           \\\r\n     --gw=192.168.1.254          \\\r\n     --dns=192.168.1.22          \\\r\n     --addpkg=openssh-server     \\\r\n     --addpkg=acpid              \\\r\n     --timezone=EDT              \\ \r\n     --verbose\r\n\r\n\r\n\r\n\r\n\r\n\r\nMount a qcow2 or raw image file\r\n=================================\r\n\r\nThe following procedures allow a host to mount a guest image file.  This is useful when trouble shooting issues with the guest.  The following procedures require root access (you can sudo).\r\n\r\n**qcow2**\r\n\r\n.. code-block:: python\r\n\r\n modprobe nbd max_part=63\r\n qemu-nbd -c /dev/nbd0 image.img\r\n mount /dev/nbd0p1 /mnt/image\r\n\r\n**raw**\r\n\r\n.. code-block:: python\r\n \r\n losetup /dev/loop0 image.img\r\n kpartx -a /dev/loop0\r\n mount /dev/mapper/loop0p1 /mnt/image\r\n\r\nIf there is an LVM present on the image file, you can initialize it by running\r\n\r\n.. code-block:: python\r\n\r\n vgscan\r\n vgchange -ay\r\n mount /dev/VolGroupName/LogVolName /mnt/image\r\n\r\nRun the following when finished\r\n\r\n.. code-block:: python\r\n\r\n umount /mnt/image\r\n vgchange -an VolGroupName\r\n killall qemu-nbd\r\n kpartx -d /dev/loop0\r\n losetup -d /dev/loop0\r\n\r\nreference: http://en.wikibooks.org/wiki/QEMU/Images\r\n\r\n\r\nBacking up kvm guests with virtback\r\n=======================================\r\n\r\nhttp://russell.ballestrini.net/virtback-a-python-libvirt-backup-utility-for-kvm/\r\n\r\ndownload virtback and place it into usr/local/bin \r\n\r\nrun: *virtback -h* for a list of options\r\n", "source_format": "rst", "revision_number": 41, "created": 1309394575000}, {"id": "f1e0d9d3-2f95-11f1-908b-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <dom name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<dom name>\r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<dom name>.xml\r\n | virsh start <dom name>\r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <dom name>\r\n\r\n**kvm** \r\n virsh console <dom name>\r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <dom name> \r\n\r\n**kvm** \r\n virsh shutdown <dom name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n | <feature> \r\n |  <acpi/>\r\n | </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<dom name> /etc/xen/auto/<dom name>\r\n\r\n**kvm** \r\n virsh autostart <dom name>\r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <dom name>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <dom name>\r\n\r\n**kvm**\r\n virsh destroy <dom name>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh quit\r\n\r\n\r\n\r\n\r\n\r\nNote\r\n------\r\nTypically the guests harddrive is not attached, you must add it in the configuration.\r\n\r\nTypically the guests memory is set to 100mbs, you might want to change that in the configuration.\r\n\r\nOnce booted and ssh'd into the VM, cat /etc/network/interfaces to verify that the DNS settings are correct.\r\n\r\nDebian/ubuntu guest don't have acpid installed by default. (Could change the vmbuilder string)\r\n\r\n\r\nVmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\nInstall vmbuilder\r\n---------------------\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\nDisplay Help vmbuilder\r\n--------------------------------\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\nCustom vmbuilder string\r\n-------------------------------\r\n\r\nmbison example \r\n\r\n.. code-block:: bash\r\n\r\n VMNAME=mbison\r\n mkdir /vms/$VMNAME\r\n\r\n sudo vmbuilder kvm ubuntu --libvirt=qemu:///system --suite=lucid --flavour=virtual \\\r\n --hostname=$VMNAME --domain='foxhop.net' --rootsize='10240' --mem='1024' \\\r\n --ip=192.168.1.51 --gw=192.168.1.254 --dns=192.168.1.22 --bridge=br0 \\\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT --verbose\r\n\r\ncammy example\r\n\r\n.. code-block:: bash\r\n\r\n VMNAME=cammy\r\n mkdir /vms/$VMNAME\r\n\r\n sudo vmbuilder kvm ubuntu --libvirt=qemu:///system --suite=lucid --flavour=virtual \\\r\n --ip=192.168.1.52 --gw=192.168.1.254 --dns=192.168.1.22 \\\r\n --hostname=$VMNAME --domain='foxhop.net' --bridge=br0 \\\r\n --raw=/vms/$VMNAME.dcow2 --rootsize='20480' --mem='1024' \\\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT --verbose\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nMount a qcow2 or raw image file\r\n=================================\r\n\r\nThe following procedures allow a host to mount a guest image file.  This is useful when trouble shooting issues with the guest.  The following procedures require root access (you can sudo).\r\n\r\n**qcow2**\r\n\r\n.. code-block:: python\r\n\r\n modprobe nbd max_part=63\r\n qemu-nbd -c /dev/nbd0 image.img\r\n mount /dev/nbd0p1 /mnt/image\r\n\r\n**raw**\r\n\r\n.. code-block:: python\r\n \r\n losetup /dev/loop0 image.img\r\n kpartx -a /dev/loop0\r\n mount /dev/mapper/loop0p1 /mnt/image\r\n\r\nIf there is an LVM present on the image file, you can initialize it by running\r\n\r\n.. code-block:: python\r\n\r\n vgscan\r\n vgchange -ay\r\n mount /dev/VolGroupName/LogVolName /mnt/image\r\n\r\nRun the following when finished\r\n\r\n.. code-block:: python\r\n\r\n umount /mnt/image\r\n vgchange -an VolGroupName\r\n killall qemu-nbd\r\n kpartx -d /dev/loop0\r\n losetup -d /dev/loop0\r\n\r\nreference: http://en.wikibooks.org/wiki/QEMU/Images\r\n\r\n\r\nBacking up kvm guests with virtback\r\n=======================================\r\n\r\nhttp://russell.ballestrini.net/virtback-a-python-libvirt-backup-utility-for-kvm/\r\n\r\ndownload virtback and place it into usr/local/bin \r\n\r\nrun: *virtback -h* for a list of options\r\n", "source_format": "rst", "revision_number": 40, "created": 1309383355000}, {"id": "f1e0d36f-2f95-11f1-9354-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <dom name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<dom name>\r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<dom name>.xml\r\n | virsh start <dom name>\r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <dom name>\r\n\r\n**kvm** \r\n virsh console <dom name>\r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <dom name> \r\n\r\n**kvm** \r\n virsh shutdown <dom name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n | <feature> \r\n |  <acpi/>\r\n | </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<dom name> /etc/xen/auto/<dom name>\r\n\r\n**kvm** \r\n virsh autostart <dom name>\r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <dom name>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <dom name>\r\n\r\n**kvm**\r\n virsh destroy <dom name>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh quit\r\n\r\n\r\n\r\n\r\n\r\nNote\r\n------\r\nTypically the guests harddrive is not attached, you must add it in the configuration.\r\n\r\nTypically the guests memory is set to 100mbs, you might want to change that in the configuration.\r\n\r\nOnce booted and ssh'd into the VM, cat /etc/network/interfaces to verify that the DNS settings are correct.\r\n\r\nDebian/ubuntu guest don't have acpid installed by default. (Could change the vmbuilder string)\r\n\r\n\r\nVmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\nInstall vmbuilder\r\n---------------------\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\nDisplay Help vmbuilder\r\n--------------------------------\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\nCustom vmbuilder string\r\n-------------------------------\r\n\r\nmbison example \r\n\r\n.. code-block:: bash\r\n\r\n VMNAME=mbison\r\n mkdir /vms/$VMNAME\r\n\r\n sudo vmbuilder kvm ubuntu --libvirt=qemu:///system --suite=lucid --flavour=virtual \\\r\n --hostname=$VMNAME --domain='foxhop.net' --rootsize='10240' --mem='1024' \\\r\n --ip=192.168.1.51 --gw=192.168.1.254 --dns=192.168.1.22 --bridge=br0 \\\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT --verbose\r\n\r\ncammy example\r\n\r\n.. code-block:: bash\r\n\r\n VMNAME=cammy\r\n mkdir /vms/$VMNAME\r\n\r\n sudo vmbuilder kvm ubuntu --libvirt=qemu:///system --suite=lucid --flavour=virtual \\\r\n --ip=192.168.1.52 --gw=192.168.1.254 --dns=192.168.1.22 \\\r\n --hostname=$VMNAME --domain='foxhop.net' --bridge=br0 \\\r\n --raw=/vms/$VMNAME --rootsize='20480' --mem='1024' \\\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT --verbose\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nMount a qcow2 or raw image file\r\n=================================\r\n\r\nThe following procedures allow a host to mount a guest image file.  This is useful when trouble shooting issues with the guest.  The following procedures require root access (you can sudo).\r\n\r\n**qcow2**\r\n\r\n.. code-block:: python\r\n\r\n modprobe nbd max_part=63\r\n qemu-nbd -c /dev/nbd0 image.img\r\n mount /dev/nbd0p1 /mnt/image\r\n\r\n**raw**\r\n\r\n.. code-block:: python\r\n \r\n losetup /dev/loop0 image.img\r\n kpartx -a /dev/loop0\r\n mount /dev/mapper/loop0p1 /mnt/image\r\n\r\nIf there is an LVM present on the image file, you can initialize it by running\r\n\r\n.. code-block:: python\r\n\r\n vgscan\r\n vgchange -ay\r\n mount /dev/VolGroupName/LogVolName /mnt/image\r\n\r\nRun the following when finished\r\n\r\n.. code-block:: python\r\n\r\n umount /mnt/image\r\n vgchange -an VolGroupName\r\n killall qemu-nbd\r\n kpartx -d /dev/loop0\r\n losetup -d /dev/loop0\r\n\r\nreference: http://en.wikibooks.org/wiki/QEMU/Images\r\n\r\n\r\nBacking up kvm guests with virtback\r\n=======================================\r\n\r\nhttp://russell.ballestrini.net/virtback-a-python-libvirt-backup-utility-for-kvm/\r\n\r\ndownload virtback and place it into usr/local/bin \r\n\r\nrun: *virtback -h* for a list of options\r\n", "source_format": "rst", "revision_number": 39, "created": 1309382931000}, {"id": "f1e0ccfa-2f95-11f1-9d0a-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <dom name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<dom name>\r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<dom name>.xml\r\n | virsh start <dom name>\r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <dom name>\r\n\r\n**kvm** \r\n virsh console <dom name>\r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <dom name> \r\n\r\n**kvm** \r\n virsh shutdown <dom name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n | <feature> \r\n |  <acpi/>\r\n | </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<dom name> /etc/xen/auto/<dom name>\r\n\r\n**kvm** \r\n virsh autostart <dom name>\r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <dom name>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <dom name>\r\n\r\n**kvm**\r\n virsh destroy <dom name>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh quit\r\n\r\n\r\n\r\n\r\n\r\nNote\r\n------\r\nTypically the guests harddrive is not attached, you must add it in the configuration.\r\n\r\nTypically the guests memory is set to 100mbs, you might want to change that in the configuration.\r\n\r\nOnce booted and ssh'd into the VM, cat /etc/network/interfaces to verify that the DNS settings are correct.\r\n\r\nDebian/ubuntu guest don't have acpid installed by default. (Could change the vmbuilder string)\r\n\r\n\r\nVmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\nInstall vmbuilder\r\n---------------------\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\nDisplay Help vmbuilder\r\n--------------------------------\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\nCustom vmbuilder string\r\n-------------------------------\r\n\r\nmbison example \r\n\r\n.. code-block:: bash\r\n\r\n VMNAME=mbison\r\n mkdir /vms/$VMNAME\r\n\r\n sudo vmbuilder kvm ubuntu --libvirt=qemu:///system --suite=lucid --flavour=virtual \\\r\n --hostname=$VMNAME --domain='foxhop.net' --rootsize='10240' --mem='1024' \\\r\n --ip=192.168.1.51 --gw=192.168.1.254 --dns=192.168.1.22 --bridge=br0 \\\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT --verbose\r\n\r\ncammy example\r\n\r\n.. code-block:: bash\r\n\r\n VMNAME=cammy\r\n mkdir /vms/$VMNAME\r\n\r\n sudo vmbuilder kvm ubuntu --libvirt=qemu:///system --suite=lucid --flavour=virtual \\\r\n --ip=192.168.1.52 --gw=192.168.1.254 --dns=192.168.1.22 \r\n --hostname=$VMNAME --domain='foxhop.net' --bridge=br0 \\\r\n --raw=/vms/$VMNAME --rootsize='20480' --mem='1024' \\\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT --verbose\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nMount a qcow2 or raw image file\r\n=================================\r\n\r\nThe following procedures allow a host to mount a guest image file.  This is useful when trouble shooting issues with the guest.  The following procedures require root access (you can sudo).\r\n\r\n**qcow2**\r\n\r\n.. code-block:: python\r\n\r\n modprobe nbd max_part=63\r\n qemu-nbd -c /dev/nbd0 image.img\r\n mount /dev/nbd0p1 /mnt/image\r\n\r\n**raw**\r\n\r\n.. code-block:: python\r\n \r\n losetup /dev/loop0 image.img\r\n kpartx -a /dev/loop0\r\n mount /dev/mapper/loop0p1 /mnt/image\r\n\r\nIf there is an LVM present on the image file, you can initialize it by running\r\n\r\n.. code-block:: python\r\n\r\n vgscan\r\n vgchange -ay\r\n mount /dev/VolGroupName/LogVolName /mnt/image\r\n\r\nRun the following when finished\r\n\r\n.. code-block:: python\r\n\r\n umount /mnt/image\r\n vgchange -an VolGroupName\r\n killall qemu-nbd\r\n kpartx -d /dev/loop0\r\n losetup -d /dev/loop0\r\n\r\nreference: http://en.wikibooks.org/wiki/QEMU/Images\r\n\r\n\r\nBacking up kvm guests with virtback\r\n=======================================\r\n\r\nhttp://russell.ballestrini.net/virtback-a-python-libvirt-backup-utility-for-kvm/\r\n\r\ndownload virtback and place it into usr/local/bin \r\n\r\nrun: *virtback -h* for a list of options\r\n", "source_format": "rst", "revision_number": 38, "created": 1309382757000}, {"id": "f1e0c783-2f95-11f1-89cd-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <dom name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<dom name>\r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<dom name>.xml\r\n | virsh start <dom name>\r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <dom name>\r\n\r\n**kvm** \r\n virsh console <dom name>\r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <dom name> \r\n\r\n**kvm** \r\n virsh shutdown <dom name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n | <feature> \r\n |  <acpi/>\r\n | </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<dom name> /etc/xen/auto/<dom name>\r\n\r\n**kvm** \r\n virsh autostart <dom name>\r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <dom name>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <dom name>\r\n\r\n**kvm**\r\n virsh destroy <dom name>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh quit\r\n\r\n\r\n\r\n\r\n\r\nNote\r\n------\r\nTypically the guests harddrive is not attached, you must add it in the configuration.\r\n\r\nTypically the guests memory is set to 100mbs, you might want to change that in the configuration.\r\n\r\nOnce booted and ssh'd into the VM, cat /etc/network/interfaces to verify that the DNS settings are correct.\r\n\r\nDebian/ubuntu guest don't have acpid installed by default. (Could change the vmbuilder string)\r\n\r\n\r\nVmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\nInstall vmbuilder\r\n---------------------\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\nDisplay Help vmbuilder\r\n--------------------------------\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\nCustom vmbuilder string\r\n-------------------------------\r\n\r\nmbison example \r\n\r\n.. code-block:: bash\r\n\r\n VMNAME=mbison\r\n mkdir /vms/$VMNAME\r\n\r\n sudo vmbuilder kvm ubuntu --libvirt=qemu:///system --suite=lucid --flavour=virtual \\\r\n --hostname=$VMNAME --domain='foxhop.net' --rootsize='10240' --mem='1024' \\\r\n --ip=192.168.1.51 --gw=192.168.1.254 --dns=192.168.1.22 --bridge=br0 \\\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT --verbose\r\n\r\ncammy example\r\n\r\n.. code-block:: bash\r\n\r\n VMNAME=cammy\r\n mkdir /vms/$VMNAME\r\n\r\n sudo vmbuilder kvm ubuntu --libvirt=qemu:///system --suite=lucid --flavour=virtual \\\r\n --hostname=$VMNAME --domain='foxhop.net' --rootsize='20480' --mem='1024' \\\r\n --ip=192.168.1.52 --gw=192.168.1.254 --dns=192.168.1.22 --bridge=br0 \\\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT --verbose\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nMount a qcow2 or raw image file\r\n=================================\r\n\r\nThe following procedures allow a host to mount a guest image file.  This is useful when trouble shooting issues with the guest.  The following procedures require root access (you can sudo).\r\n\r\n**qcow2**\r\n\r\n.. code-block:: python\r\n\r\n modprobe nbd max_part=63\r\n qemu-nbd -c /dev/nbd0 image.img\r\n mount /dev/nbd0p1 /mnt/image\r\n\r\n**raw**\r\n\r\n.. code-block:: python\r\n \r\n losetup /dev/loop0 image.img\r\n kpartx -a /dev/loop0\r\n mount /dev/mapper/loop0p1 /mnt/image\r\n\r\nIf there is an LVM present on the image file, you can initialize it by running\r\n\r\n.. code-block:: python\r\n\r\n vgscan\r\n vgchange -ay\r\n mount /dev/VolGroupName/LogVolName /mnt/image\r\n\r\nRun the following when finished\r\n\r\n.. code-block:: python\r\n\r\n umount /mnt/image\r\n vgchange -an VolGroupName\r\n killall qemu-nbd\r\n kpartx -d /dev/loop0\r\n losetup -d /dev/loop0\r\n\r\nreference: http://en.wikibooks.org/wiki/QEMU/Images\r\n\r\n\r\nBacking up kvm guests with virtback\r\n=======================================\r\n\r\nhttp://russell.ballestrini.net/virtback-a-python-libvirt-backup-utility-for-kvm/\r\n\r\ndownload virtback and place it into usr/local/bin \r\n\r\nrun: *virtback -h* for a list of options\r\n", "source_format": "rst", "revision_number": 37, "created": 1309381505000}, {"id": "f1e0c39c-2f95-11f1-a06a-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <dom name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<dom name>\r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<dom name>.xml\r\n | virsh start <dom name>\r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <dom name>\r\n\r\n**kvm** \r\n virsh console <dom name>\r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <dom name> \r\n\r\n**kvm** \r\n virsh shutdown <dom name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n | <feature> \r\n |  <acpi/>\r\n | </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<dom name> /etc/xen/auto/<dom name>\r\n\r\n**kvm** \r\n virsh autostart <dom name>\r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <dom name>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <dom name>\r\n\r\n**kvm**\r\n virsh destroy <dom name>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh quit\r\n\r\n\r\n\r\n\r\n\r\nNote\r\n------\r\nTypically the guests harddrive is not attached, you must add it in the configuration.\r\n\r\nTypically the guests memory is set to 100mbs, you might want to change that in the configuration.\r\n\r\nOnce booted and ssh'd into the VM, cat /etc/network/interfaces to verify that the DNS settings are correct.\r\n\r\nDebian/ubuntu guest don't have acpid installed by default. (Could change the vmbuilder string)\r\n\r\n\r\nVmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\nInstall vmbuilder\r\n---------------------\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\nDisplay Help vmbuilder\r\n--------------------------------\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\nCustom vmbuilder string\r\n-------------------------------\r\n\r\nmbison example \r\n\r\n.. code-block:: bash\r\n\r\n VMNAME=mbison\r\n mkdir /vms/$VMNAME\r\n\r\n sudo vmbuilder kvm ubuntu --libvirt=qemu:///system --suite=lucid --flavour=virtual \\\r\n --hostname=$VMNAME --domain='foxhop.net' --rootsize='10240' --mem='1024' \\\r\n --ip=192.168.1.52 --gw=192.168.1.254 --dns=192.168.1.22 --bridge=br0 \\\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT --verbose\r\n\r\ncammy example\r\n\r\n.. code-block:: bash\r\n\r\n VMNAME=cammy\r\n mkdir /vms/$VMNAME\r\n\r\n sudo vmbuilder kvm ubuntu --libvirt=qemu:///system --suite=lucid --flavour=virtual \\\r\n --hostname=$VMNAME --domain='foxhop.net' --rootsize='20480' --mem='1024' \\\r\n --ip=192.168.1.52 --gw=192.168.1.254 --dns=192.168.1.22 --bridge=br0 \\\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT --verbose\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nMount a qcow2 or raw image file\r\n=================================\r\n\r\nThe following procedures allow a host to mount a guest image file.  This is useful when trouble shooting issues with the guest.  The following procedures require root access (you can sudo).\r\n\r\n**qcow2**\r\n\r\n.. code-block:: python\r\n\r\n modprobe nbd max_part=63\r\n qemu-nbd -c /dev/nbd0 image.img\r\n mount /dev/nbd0p1 /mnt/image\r\n\r\n**raw**\r\n\r\n.. code-block:: python\r\n \r\n losetup /dev/loop0 image.img\r\n kpartx -a /dev/loop0\r\n mount /dev/mapper/loop0p1 /mnt/image\r\n\r\nIf there is an LVM present on the image file, you can initialize it by running\r\n\r\n.. code-block:: python\r\n\r\n vgscan\r\n vgchange -ay\r\n mount /dev/VolGroupName/LogVolName /mnt/image\r\n\r\nRun the following when finished\r\n\r\n.. code-block:: python\r\n\r\n umount /mnt/image\r\n vgchange -an VolGroupName\r\n killall qemu-nbd\r\n kpartx -d /dev/loop0\r\n losetup -d /dev/loop0\r\n\r\nreference: http://en.wikibooks.org/wiki/QEMU/Images\r\n\r\n\r\nBacking up kvm guests with virtback\r\n=======================================\r\n\r\nhttp://russell.ballestrini.net/virtback-a-python-libvirt-backup-utility-for-kvm/\r\n\r\ndownload virtback and place it into usr/local/bin \r\n\r\nrun: *virtback -h* for a list of options\r\n", "source_format": "rst", "revision_number": 36, "created": 1309381303000}, {"id": "f1e0bed5-2f95-11f1-bf9f-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <dom name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<dom name>\r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<dom name>.xml\r\n | virsh start <dom name>\r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <dom name>\r\n\r\n**kvm** \r\n virsh console <dom name>\r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <dom name> \r\n\r\n**kvm** \r\n virsh shutdown <dom name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n | <feature> \r\n |  <acpi/>\r\n | </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<dom name> /etc/xen/auto/<dom name>\r\n\r\n**kvm** \r\n virsh autostart <dom name>\r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <dom name>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <dom name>\r\n\r\n**kvm**\r\n virsh destroy <dom name>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh quit\r\n\r\n\r\n\r\n\r\n\r\nNote\r\n------\r\nTypically the guests harddrive is not attached, you must add it in the configuration.\r\n\r\nTypically the guests memory is set to 100mbs, you might want to change that in the configuration.\r\n\r\nOnce booted and ssh'd into the VM, cat /etc/network/interfaces to verify that the DNS settings are correct.\r\n\r\nDebian/ubuntu guest don't have acpid installed by default. (Could change the vmbuilder string)\r\n\r\n\r\nVmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\nInstall vmbuilder\r\n---------------------\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\nDisplay Help vmbuilder\r\n--------------------------------\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\nCustom vmbuilder string\r\n-------------------------------\r\n\r\n.. code-block:: bash\r\n\r\n VMNAME=mbison\r\n mkdir /vms/$VMNAME\r\n\r\n sudo vmbuilder kvm ubuntu --libvirt=qemu:///system --suite=lucid --flavour=virtual \\\r\n --hostname=$VMNAME --domain='foxhop.net' --rootsize='10240' --mem='1024' \\\r\n --ip=192.168.1.52 --gw=192.168.1.254 --dns=192.168.1.22 --bridge=br0 \\\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT --verbose\r\n\r\n\r\n\r\n\r\nMount a qcow2 or raw image file\r\n=================================\r\n\r\nThe following procedures allow a host to mount a guest image file.  This is useful when trouble shooting issues with the guest.  The following procedures require root access (you can sudo).\r\n\r\n**qcow2**\r\n\r\n.. code-block:: python\r\n\r\n modprobe nbd max_part=63\r\n qemu-nbd -c /dev/nbd0 image.img\r\n mount /dev/nbd0p1 /mnt/image\r\n\r\n**raw**\r\n\r\n.. code-block:: python\r\n \r\n losetup /dev/loop0 image.img\r\n kpartx -a /dev/loop0\r\n mount /dev/mapper/loop0p1 /mnt/image\r\n\r\nIf there is an LVM present on the image file, you can initialize it by running\r\n\r\n.. code-block:: python\r\n\r\n vgscan\r\n vgchange -ay\r\n mount /dev/VolGroupName/LogVolName /mnt/image\r\n\r\nRun the following when finished\r\n\r\n.. code-block:: python\r\n\r\n umount /mnt/image\r\n vgchange -an VolGroupName\r\n killall qemu-nbd\r\n kpartx -d /dev/loop0\r\n losetup -d /dev/loop0\r\n\r\nreference: http://en.wikibooks.org/wiki/QEMU/Images\r\n\r\n\r\nBacking up kvm guests with virtback\r\n=======================================\r\n\r\nhttp://russell.ballestrini.net/virtback-a-python-libvirt-backup-utility-for-kvm/\r\n\r\ndownload virtback and place it into usr/local/bin \r\n\r\nrun: *virtback -h* for a list of options\r\n", "source_format": "rst", "revision_number": 35, "created": 1301097113000}, {"id": "f1e0baa0-2f95-11f1-a1ce-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <dom name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<dom name>\r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<dom name>.xml\r\n | virsh start <dom name>\r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <dom name>\r\n\r\n**kvm** \r\n virsh console <dom name>\r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <dom name> \r\n\r\n**kvm** \r\n virsh shutdown <dom name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n | <feature> \r\n |  <acpi/>\r\n | </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<dom name> /etc/xen/auto/<dom name>\r\n\r\n**kvm** \r\n virsh autostart <dom name>\r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <dom name>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <dom name>\r\n\r\n**kvm**\r\n virsh destroy <dom name>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh quit\r\n\r\n\r\n\r\n\r\n\r\nNote\r\n------\r\nTypically the guests harddrive is not attached, you must add it in the configuration.\r\n\r\nTypically the guests memory is set to 100mbs, you might want to change that in the configuration.\r\n\r\nOnce booted and ssh'd into the VM, cat /etc/network/interfaces to verify that the DNS settings are correct.\r\n\r\nDebian/ubuntu guest don't have acpid installed by default. (Could change the vmbuilder string)\r\n\r\n\r\nVmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\nInstall vmbuilder\r\n---------------------\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\nDisplay Help vmbuilder\r\n--------------------------------\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\nCustom vmbuilder string\r\n-------------------------------\r\n\r\n.. code-block:: bash\r\n\r\n VMNAME=mbison\r\n mkdir /vms/$VMNAME\r\n\r\n sudo vmbuilder kvm ubuntu --libvirt=qemu:///system --suite=lucid --flavour=virtual \\\r\n --hostname=$VMNAME --domain='foxhop.net' --rootsize='10240' --mem='1024' \\\r\n --ip=192.168.1.52 --gw=192.168.1.254 --dns=192.168.1.22 --bridge=br0 \\\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT --verbose\r\n\r\n\r\n\r\n\r\nMount a qcow2 or raw image file\r\n=================================\r\n\r\nThe following procedures allow a host to mount a guest image file.  This is useful when trouble shooting issues with the guest.  The following procedures require root access (you can sudo).\r\n\r\n**qcow2**\r\n\r\n.. code-block:: python\r\n\r\n modprobe nbd max_part=63\r\n qemu-nbd -c /dev/nbd0 image.img\r\n mount /dev/nbd0p1 /mnt/image\r\n\r\n**raw**\r\n\r\n.. code-block:: python\r\n \r\n losetup /dev/loop0 image.img\r\n kpartx -a /dev/loop0\r\n mount /dev/mapper/loop0p1 /mnt/image\r\n\r\nIf there is an LVM present on the image file, you can initialize it by running\r\n\r\n.. code-block:: python\r\n\r\n vgscan\r\n vgchange -ay\r\n mount /dev/VolGroupName/LogVolName /mnt/image\r\n\r\nRun the following when finished\r\n\r\n.. code-block:: python\r\n\r\n umount /mnt/image\r\n vgchange -an VolGroupName\r\n killall qemu-nbd\r\n kpartx -d /dev/loop0\r\n losetup -d /dev/loop0\r\n\r\nreference: http://en.wikibooks.org/wiki/QEMU/Images\r\n", "source_format": "rst", "revision_number": 34, "created": 1300409809000}, {"id": "f1e0b65e-2f95-11f1-8758-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <dom name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<dom name>\r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<dom name>.xml\r\n | virsh start <dom name>\r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <dom name>\r\n\r\n**kvm** \r\n virsh console <dom name>\r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <dom name> \r\n\r\n**kvm** \r\n virsh shutdown <dom name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n | <feature> \r\n |  <acpi/>\r\n | </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<dom name> /etc/xen/auto/<dom name>\r\n\r\n**kvm** \r\n virsh autostart <dom name>\r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <dom name>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <dom name>\r\n\r\n**kvm**\r\n virsh destroy <dom name>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh quit\r\n\r\n\r\n\r\n\r\n\r\nNote\r\n------\r\nTypically the guests harddrive is not attached, you must add it in the configuration.\r\n\r\nTypically the guests memory is set to 100mbs, you might want to change that in the configuration.\r\n\r\nOnce booted and ssh'd into the VM, cat /etc/network/interfaces to verify that the DNS settings are correct.\r\n\r\nDebian/ubuntu guest don't have acpid installed by default. (Could change the vmbuilder string)\r\n\r\n\r\nVmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\nInstall vmbuilder\r\n---------------------\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\nDisplay Help vmbuilder\r\n--------------------------------\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\nCustom vmbuilder string\r\n-------------------------------\r\n\r\n.. code-block:: bash\r\n\r\n VMNAME=mbison\r\n mkdir /vms/$VMNAME\r\n\r\n sudo vmbuilder kvm ubuntu --suite=lucid --flavour=virtual \\\r\n --hostname=$VMNAME --domain='foxhop.net' --rootsize='10240' --mem='1024' \\\r\n --ip=192.168.1.52 --gw=192.168.1.254 --dns=192.168.1.22 --bridge=br0 \\\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT --verbose\r\n\r\n\r\n\r\n\r\nMount a qcow2 or raw image file\r\n=================================\r\n\r\nThe following procedures allow a host to mount a guest image file.  This is useful when trouble shooting issues with the guest.  The following procedures require root access (you can sudo).\r\n\r\n**qcow2**\r\n\r\n.. code-block:: python\r\n\r\n modprobe nbd max_part=63\r\n qemu-nbd -c /dev/nbd0 image.img\r\n mount /dev/nbd0p1 /mnt/image\r\n\r\n**raw**\r\n\r\n.. code-block:: python\r\n \r\n losetup /dev/loop0 image.img\r\n kpartx -a /dev/loop0\r\n mount /dev/mapper/loop0p1 /mnt/image\r\n\r\nIf there is an LVM present on the image file, you can initialize it by running\r\n\r\n.. code-block:: python\r\n\r\n vgscan\r\n vgchange -ay\r\n mount /dev/VolGroupName/LogVolName /mnt/image\r\n\r\nRun the following when finished\r\n\r\n.. code-block:: python\r\n\r\n umount /mnt/image\r\n vgchange -an VolGroupName\r\n killall qemu-nbd\r\n kpartx -d /dev/loop0\r\n losetup -d /dev/loop0\r\n\r\nreference: http://en.wikibooks.org/wiki/QEMU/Images\r\n", "source_format": "rst", "revision_number": 33, "created": 1300409257000}, {"id": "f1e0b1af-2f95-11f1-8c6c-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <dom name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<dom name>\r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<dom name>.xml\r\n | virsh start <dom name>\r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <dom name>\r\n\r\n**kvm** \r\n virsh console <dom name>\r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <dom name> \r\n\r\n**kvm** \r\n virsh shutdown <dom name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n | <feature> \r\n |  <acpi/>\r\n | </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<dom name> /etc/xen/auto/<dom name>\r\n\r\n**kvm** \r\n virsh autostart <dom name>\r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <dom name>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <dom name>\r\n\r\n**kvm**\r\n virsh destroy <dom name>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh quit\r\n\r\n\r\n\r\n\r\n\r\nNote\r\n------\r\nTypically the guests harddrive is not attached, you must add it in the configuration.\r\n\r\nTypically the guests memory is set to 100mbs, you might want to change that in the configuration.\r\n\r\nOnce booted and ssh'd into the VM, cat /etc/network/interfaces to verify that the DNS settings are correct.\r\n\r\nDebian/ubuntu guest don't have acpid installed by default. (Could change the vmbuilder string)\r\n\r\n\r\nVmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\nInstall vmbuilder\r\n---------------------\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\nDisplay Help vmbuilder\r\n--------------------------------\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\nCustom vmbuilder string\r\n-------------------------------\r\n\r\n.. code-block:: bash\r\n\r\n VMNAME=mbison\r\n mkdir /vms/$VMNAME\r\n\r\n sudo vmbuilder kvm ubuntu --suite=lucid --flavour=virtual --hostname=$VMNAME --domain='foxhop.net' \\\r\n --raw='/vms/$VMNAME/$VMNAME.img' --rootsize='10240' --mem='1024' \\\r\n --ip=192.168.1.52 --gw=192.168.1.254 --dns=192.168.1.22 --bridge=br0 \\\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT --verbose\r\n\r\n\r\n\r\n\r\nMount a qcow2 or raw image file\r\n=================================\r\n\r\nThe following procedures allow a host to mount a guest image file.  This is useful when trouble shooting issues with the guest.  The following procedures require root access (you can sudo).\r\n\r\n**qcow2**\r\n\r\n.. code-block:: python\r\n\r\n modprobe nbd max_part=63\r\n qemu-nbd -c /dev/nbd0 image.img\r\n mount /dev/nbd0p1 /mnt/image\r\n\r\n**raw**\r\n\r\n.. code-block:: python\r\n \r\n losetup /dev/loop0 image.img\r\n kpartx -a /dev/loop0\r\n mount /dev/mapper/loop0p1 /mnt/image\r\n\r\nIf there is an LVM present on the image file, you can initialize it by running\r\n\r\n.. code-block:: python\r\n\r\n vgscan\r\n vgchange -ay\r\n mount /dev/VolGroupName/LogVolName /mnt/image\r\n\r\nRun the following when finished\r\n\r\n.. code-block:: python\r\n\r\n umount /mnt/image\r\n vgchange -an VolGroupName\r\n killall qemu-nbd\r\n kpartx -d /dev/loop0\r\n losetup -d /dev/loop0\r\n\r\nreference: http://en.wikibooks.org/wiki/QEMU/Images\r\n", "source_format": "rst", "revision_number": 32, "created": 1300407356000}, {"id": "f1e0aa59-2f95-11f1-91c0-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <dom name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<dom name>\r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<dom name>.xml\r\n | virsh start <dom name>\r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <dom name>\r\n\r\n**kvm** \r\n virsh console <dom name>\r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <dom name> \r\n\r\n**kvm** \r\n virsh shutdown <dom name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n | <feature> \r\n |  <acpi/>\r\n | </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<dom name> /etc/xen/auto/<dom name>\r\n\r\n**kvm** \r\n virsh autostart <dom name>\r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <dom name>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <dom name>\r\n\r\n**kvm**\r\n virsh destroy <dom name>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh quit\r\n\r\n\r\n\r\n\r\n\r\nNote\r\n------\r\nTypically the guests harddrive is not attached, you must add it in the configuration.\r\n\r\nTypically the guests memory is set to 100mbs, you might want to change that in the configuration.\r\n\r\nOnce booted and ssh'd into the VM, cat /etc/network/interfaces to verify that the DNS settings are correct.\r\n\r\nDebian/ubuntu guest don't have acpid installed by default. (Could change the vmbuilder string)\r\n\r\n\r\nVmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\nInstall vmbuilder\r\n---------------------\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\nDisplay Help vmbuilder\r\n--------------------------------\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\nCustom vmbuilder string\r\n-------------------------------\r\n\r\n.. code-block:: bash\r\n\r\n VMNAME=mbison\r\n mkdir /vms/$VMNAME\r\n\r\n sudo vmbuilder kvm ubuntu --suite=lucid --flavour=virtual --hostname=$VMNAME --domain=foxhop.net \\\r\n --rootsize=10240 --raw=/vms/$VMNAME/$VMNAME.img --mem=1024 \\\r\n --ip=192.168.1.52 --gw=192.168.1.254 --dns=192.168.1.22 --bridge=br0 \\\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT \r\n\r\n\r\n\r\n\r\nMount a qcow2 or raw image file\r\n=================================\r\n\r\nThe following procedures allow a host to mount a guest image file.  This is useful when trouble shooting issues with the guest.  The following procedures require root access (you can sudo).\r\n\r\n**qcow2**\r\n\r\n.. code-block:: python\r\n\r\n modprobe nbd max_part=63\r\n qemu-nbd -c /dev/nbd0 image.img\r\n mount /dev/nbd0p1 /mnt/image\r\n\r\n**raw**\r\n\r\n.. code-block:: python\r\n \r\n losetup /dev/loop0 image.img\r\n kpartx -a /dev/loop0\r\n mount /dev/mapper/loop0p1 /mnt/image\r\n\r\nIf there is an LVM present on the image file, you can initialize it by running\r\n\r\n.. code-block:: python\r\n\r\n vgscan\r\n vgchange -ay\r\n mount /dev/VolGroupName/LogVolName /mnt/image\r\n\r\nRun the following when finished\r\n\r\n.. code-block:: python\r\n\r\n umount /mnt/image\r\n vgchange -an VolGroupName\r\n killall qemu-nbd\r\n kpartx -d /dev/loop0\r\n losetup -d /dev/loop0\r\n\r\nreference: http://en.wikibooks.org/wiki/QEMU/Images\r\n", "source_format": "rst", "revision_number": 31, "created": 1300404782000}, {"id": "f1e0a35c-2f95-11f1-a731-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <dom name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<dom name>\r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<dom name>.xml\r\n | virsh start <dom name>\r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <dom name>\r\n\r\n**kvm** \r\n virsh console <dom name>\r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <dom name> \r\n\r\n**kvm** \r\n virsh shutdown <dom name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n | <feature> \r\n |  <acpi/>\r\n | </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<dom name> /etc/xen/auto/<dom name>\r\n\r\n**kvm** \r\n virsh autostart <dom name>\r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <dom name>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <dom name>\r\n\r\n**kvm**\r\n virsh destroy <dom name>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh quit\r\n\r\n\r\n\r\n\r\n\r\nNote\r\n------\r\nTypically the guests harddrive is not attached, you must add it in the configuration.\r\n\r\nTypically the guests memory is set to 100mbs, you might want to change that in the configuration.\r\n\r\nOnce booted and ssh'd into the VM, cat /etc/network/interfaces to verify that the DNS settings are correct.\r\n\r\nDebian/ubuntu guest don't have acpid installed by default. (Could change the vmbuilder string)\r\n\r\n\r\nVmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\nInstall vmbuilder\r\n---------------------\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\nDisplay Help vmbuilder\r\n--------------------------------\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\nCustom vmbuilder string\r\n-------------------------------\r\n\r\n.. code-block:: bash\r\n\r\n VMNAME=mbison\r\n mkdir /vms/$VMNAME\r\n\r\n sudo vmbuilder kvm ubuntu --suite=lucid --flavour=virtual \\\r\n --hostname=$VMNAME --domain=foxhop.net --rootsize=10240 --raw=/vms/$VMNAME --mem=1024 \\\r\n --ip=192.168.1.52 --gw=192.168.1.254 --dns=192.168.1.22 --bridge=br0 \\\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT \r\n\r\n\r\n\r\n\r\nMount a qcow2 or raw image file\r\n=================================\r\n\r\nThe following procedures allow a host to mount a guest image file.  This is useful when trouble shooting issues with the guest.  The following procedures require root access (you can sudo).\r\n\r\n**qcow2**\r\n\r\n.. code-block:: python\r\n\r\n modprobe nbd max_part=63\r\n qemu-nbd -c /dev/nbd0 image.img\r\n mount /dev/nbd0p1 /mnt/image\r\n\r\n**raw**\r\n\r\n.. code-block:: python\r\n \r\n losetup /dev/loop0 image.img\r\n kpartx -a /dev/loop0\r\n mount /dev/mapper/loop0p1 /mnt/image\r\n\r\nIf there is an LVM present on the image file, you can initialize it by running\r\n\r\n.. code-block:: python\r\n\r\n vgscan\r\n vgchange -ay\r\n mount /dev/VolGroupName/LogVolName /mnt/image\r\n\r\nRun the following when finished\r\n\r\n.. code-block:: python\r\n\r\n umount /mnt/image\r\n vgchange -an VolGroupName\r\n killall qemu-nbd\r\n kpartx -d /dev/loop0\r\n losetup -d /dev/loop0\r\n\r\nreference: http://en.wikibooks.org/wiki/QEMU/Images\r\n", "source_format": "rst", "revision_number": 30, "created": 1300404479000}, {"id": "f1e09e80-2f95-11f1-9c5c-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <dom name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<dom name>\r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<dom name>.xml\r\n | virsh start <dom name>\r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <dom name>\r\n\r\n**kvm** \r\n virsh console <dom name>\r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <dom name> \r\n\r\n**kvm** \r\n virsh shutdown <dom name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n | <feature> \r\n |  <acpi/>\r\n | </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<dom name> /etc/xen/auto/<dom name>\r\n\r\n**kvm** \r\n virsh autostart <dom name>\r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <dom name>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <dom name>\r\n\r\n**kvm**\r\n virsh destroy <dom name>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh quit\r\n\r\n\r\n\r\n\r\n\r\nNote\r\n------\r\nTypically the guests harddrive is not attached, you must add it in the configuration.\r\n\r\nTypically the guests memory is set to 100mbs, you might want to change that in the configuration.\r\n\r\nOnce booted and ssh'd into the VM, cat /etc/network/interfaces to verify that the DNS settings are correct.\r\n\r\nDebian/ubuntu guest don't have acpid installed by default. (Could change the vmbuilder string)\r\n\r\n\r\nVmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\nInstall vmbuilder\r\n---------------------\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\nDisplay Help vmbuilder\r\n--------------------------------\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\nCustom vmbuilder string\r\n-------------------------------\r\n\r\n.. code-block:: bash\r\n\r\n VMNAME=mbison\r\n mkdir /vms/$VMNAME\r\n\r\n sudo vmbuilder kvm ubuntu --suite=lucid --flavour=virtual \\\r\n --hostname=$VMNAME --domain=foxhop.net --rootsize=10240 --raw=/vms/$VMNAME --mem=1024 \\\r\n --ip=192.168.1.52 --gw=192.168.1.254 --dns=192.168.1.22 --bridge=br0 \\\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT --manifest=/vms/$VMNAME/manifest.txt\r\n\r\n\r\n\r\nMount a qcow2 or raw image file\r\n=================================\r\n\r\nThe following procedures allow a host to mount a guest image file.  This is useful when trouble shooting issues with the guest.  The following procedures require root access (you can sudo).\r\n\r\n**qcow2**\r\n\r\n.. code-block:: python\r\n\r\n modprobe nbd max_part=63\r\n qemu-nbd -c /dev/nbd0 image.img\r\n mount /dev/nbd0p1 /mnt/image\r\n\r\n**raw**\r\n\r\n.. code-block:: python\r\n \r\n losetup /dev/loop0 image.img\r\n kpartx -a /dev/loop0\r\n mount /dev/mapper/loop0p1 /mnt/image\r\n\r\nIf there is an LVM present on the image file, you can initialize it by running\r\n\r\n.. code-block:: python\r\n\r\n vgscan\r\n vgchange -ay\r\n mount /dev/VolGroupName/LogVolName /mnt/image\r\n\r\nRun the following when finished\r\n\r\n.. code-block:: python\r\n\r\n umount /mnt/image\r\n vgchange -an VolGroupName\r\n killall qemu-nbd\r\n kpartx -d /dev/loop0\r\n losetup -d /dev/loop0\r\n\r\nreference: http://en.wikibooks.org/wiki/QEMU/Images\r\n", "source_format": "rst", "revision_number": 29, "created": 1300402733000}, {"id": "f1e09a40-2f95-11f1-820f-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <dom name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<dom name>\r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<dom name>.xml\r\n | virsh start <dom name>\r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <dom name>\r\n\r\n**kvm** \r\n virsh console <dom name>\r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <dom name> \r\n\r\n**kvm** \r\n virsh shutdown <dom name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n | <feature> \r\n |  <acpi/>\r\n | </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<dom name> /etc/xen/auto/<dom name>\r\n\r\n**kvm** \r\n virsh autostart <dom name>\r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <dom name>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <dom name>\r\n\r\n**kvm**\r\n virsh destroy <dom name>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh quit\r\n\r\n\r\n\r\n\r\n\r\nNote\r\n------\r\nTypically the guests harddrive is not attached, you must add it in the configuration.\r\n\r\nTypically the guests memory is set to 100mbs, you might want to change that in the configuration.\r\n\r\nOnce booted and ssh'd into the VM, cat /etc/network/interfaces to verify that the DNS settings are correct.\r\n\r\nDebian/ubuntu guest don't have acpid installed by default. (Could change the vmbuilder string)\r\n\r\n\r\nVmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\nInstall vmbuilder\r\n---------------------\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\nDisplay Help vmbuilder\r\n--------------------------------\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\nCustom vmbuilder string\r\n-------------------------------\r\n\r\n.. code-block:: bash\r\n\r\n VMNAME=mbison\r\n mkdir /vms/$VMNAME\r\n\r\n sudo vmbuilder kvm ubuntu -o --libvirt=qemu:///system --suite=lucid --flavour=virtual \\\r\n --hostname=$VMNAME --domain=foxhop.net --rootsize=10240 --raw=/vms/$VMNAME --mem=1024 \\\r\n --ip=192.168.1.52 --gw=192.168.1.254 --dns=192.168.1.22 --bridge=br0 \\\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT --manifest=/vms/$VMNAME/manifest.txt\r\n\r\n\r\n\r\nMount a qcow2 or raw image file\r\n=================================\r\n\r\nThe following procedures allow a host to mount a guest image file.  This is useful when trouble shooting issues with the guest.  The following procedures require root access (you can sudo).\r\n\r\n**qcow2**\r\n\r\n.. code-block:: python\r\n\r\n modprobe nbd max_part=63\r\n qemu-nbd -c /dev/nbd0 image.img\r\n mount /dev/nbd0p1 /mnt/image\r\n\r\n**raw**\r\n\r\n.. code-block:: python\r\n \r\n losetup /dev/loop0 image.img\r\n kpartx -a /dev/loop0\r\n mount /dev/mapper/loop0p1 /mnt/image\r\n\r\nIf there is an LVM present on the image file, you can initialize it by running\r\n\r\n.. code-block:: python\r\n\r\n vgscan\r\n vgchange -ay\r\n mount /dev/VolGroupName/LogVolName /mnt/image\r\n\r\nRun the following when finished\r\n\r\n.. code-block:: python\r\n\r\n umount /mnt/image\r\n vgchange -an VolGroupName\r\n killall qemu-nbd\r\n kpartx -d /dev/loop0\r\n losetup -d /dev/loop0\r\n\r\nreference: http://en.wikibooks.org/wiki/QEMU/Images\r\n", "source_format": "rst", "revision_number": 28, "created": 1300402249000}, {"id": "f1e09590-2f95-11f1-bf7b-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <guest name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<guest name> \r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<guest name>.xml\r\n | virsh start <domain> \r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <guest name> \r\n\r\n**kvm** \r\n virsh console <guest name> \r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <guest name> \r\n\r\n**kvm** \r\n virsh shutdown <guest name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n <feature> <acpi/> </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<guest name> /etc/xen/auto/<guest name> \r\n\r\n**kvm** \r\n virsh autostart <guest name> \r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <domain>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <guest>\r\n\r\n**kvm**\r\n virsh destroy <domain>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh # quit\r\n\r\n\r\n\r\n\r\n\r\nNote\r\n------\r\nTypically the guests harddrive is not attached, you must add it in the configuration.\r\n\r\nTypically the guests memory is set to 100mbs, you might want to change that in the configuration.\r\n\r\nOnce booted and ssh'd into the VM, cat /etc/network/interfaces to verify that the DNS settings are correct.\r\n\r\nDebian/ubuntu guest don't have acpid installed by default. (Could change the vmbuilder string)\r\n\r\n\r\nVmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\nInstall vmbuilder\r\n---------------------\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\nDisplay Help vmbuilder\r\n--------------------------------\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\nCustom vmbuilder string\r\n-------------------------------\r\n\r\n.. code-block:: bash\r\n\r\n VMNAME=mbison\r\n mkdir /vms/$VMNAME\r\n\r\n sudo vmbuilder kvm ubuntu -o --libvirt=qemu:///system --suite=lucid --flavour=virtual \\\r\n --hostname=$VMNAME --domain=foxhop.net --rootsize=10240 --raw=/vms/$VMNAME --mem=1024 \\\r\n --ip=192.168.1.52 --gw=192.168.1.254 --dns=192.168.1.22 --bridge=br0 \\\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT --manifest=/vms/$VMNAME/manifest.txt\r\n\r\n\r\n\r\nMount a qcow2 or raw image file\r\n=================================\r\n\r\nThe following procedures allow a host to mount a guest image file.  This is useful when trouble shooting issues with the guest.  The following procedures require root access (you can sudo).\r\n\r\n**qcow2**\r\n\r\n.. code-block:: python\r\n\r\n modprobe nbd max_part=63\r\n qemu-nbd -c /dev/nbd0 image.img\r\n mount /dev/nbd0p1 /mnt/image\r\n\r\n**raw**\r\n\r\n.. code-block:: python\r\n \r\n losetup /dev/loop0 image.img\r\n kpartx -a /dev/loop0\r\n mount /dev/mapper/loop0p1 /mnt/image\r\n\r\nIf there is an LVM present on the image file, you can initialize it by running\r\n\r\n.. code-block:: python\r\n\r\n vgscan\r\n vgchange -ay\r\n mount /dev/VolGroupName/LogVolName /mnt/image\r\n\r\nRun the following when finished\r\n\r\n.. code-block:: python\r\n\r\n umount /mnt/image\r\n vgchange -an VolGroupName\r\n killall qemu-nbd\r\n kpartx -d /dev/loop0\r\n losetup -d /dev/loop0\r\n\r\nreference: http://en.wikibooks.org/wiki/QEMU/Images\r\n", "source_format": "rst", "revision_number": 27, "created": 1300401993000}, {"id": "f1e09158-2f95-11f1-8909-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <guest name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<guest name> \r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<guest name>.xml\r\n | virsh start <domain> \r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <guest name> \r\n\r\n**kvm** \r\n virsh console <guest name> \r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <guest name> \r\n\r\n**kvm** \r\n virsh shutdown <guest name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n <feature> <acpi/> </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<guest name> /etc/xen/auto/<guest name> \r\n\r\n**kvm** \r\n virsh autostart <guest name> \r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <domain>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <guest>\r\n\r\n**kvm**\r\n virsh destroy <domain>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh # quit\r\n\r\n\r\n\r\n\r\n\r\nNote\r\n------\r\nTypically the guests harddrive is not attached, you must add it in the configuration.\r\n\r\nTypically the guests memory is set to 100mbs, you might want to change that in the configuration.\r\n\r\nOnce booted and ssh'd into the VM, cat /etc/network/interfaces to verify that the DNS settings are correct.\r\n\r\nDebian/ubuntu guest don't have acpid installed by default. (Could change the vmbuilder string)\r\n\r\nMount a qcow2 or raw image file\r\n=================================\r\n\r\nThe following procedures allow a host to mount a guest image file.  This is useful when trouble shooting issues with the guest.  The following procedures require root access (you can sudo).\r\n\r\n**qcow2**\r\n\r\n.. code-block:: python\r\n\r\n modprobe nbd max_part=63\r\n qemu-nbd -c /dev/nbd0 image.img\r\n mount /dev/nbd0p1 /mnt/image\r\n\r\n**raw**\r\n\r\n.. code-block:: python\r\n \r\n losetup /dev/loop0 image.img\r\n kpartx -a /dev/loop0\r\n mount /dev/mapper/loop0p1 /mnt/image\r\n\r\nIf there is an LVM present on the image file, you can initialize it by running\r\n\r\n.. code-block:: python\r\n\r\n vgscan\r\n vgchange -ay\r\n mount /dev/VolGroupName/LogVolName /mnt/image\r\n\r\nRun the following when finished\r\n\r\n.. code-block:: python\r\n\r\n umount /mnt/image\r\n vgchange -an VolGroupName\r\n killall qemu-nbd\r\n kpartx -d /dev/loop0\r\n losetup -d /dev/loop0\r\n\r\nreference: http://en.wikibooks.org/wiki/QEMU/Images\r\n\r\n\r\nVmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\nInstall vmbuilder\r\n---------------------\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\nDisplay Help vmbuilder\r\n--------------------------------\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\nCustom vmbuilder string\r\n-------------------------------\r\n\r\n.. code-block:: bash\r\n\r\n VMNAME=mbison\r\n mkdir /vms/$VMNAME\r\n\r\n sudo vmbuilder kvm ubuntu -o --libvirt=qemu:///system --suite=lucid --flavour=virtual \\\r\n --hostname=$VMNAME --domain=foxhop.net --rootsize=10240 --raw=/vms/$VMNAME --mem=1024 \\\r\n --ip=192.168.1.52 --gw=192.168.1.254 --dns=192.168.1.22 --bridge=br0 \\\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT --manifest=/vms/$VMNAME/manifest.txt\r\n\r\n", "source_format": "rst", "revision_number": 26, "created": 1300401882000}, {"id": "f1e08cf6-2f95-11f1-85c7-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <guest name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<guest name> \r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<guest name>.xml\r\n | virsh start <domain> \r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <guest name> \r\n\r\n**kvm** \r\n virsh console <guest name> \r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <guest name> \r\n\r\n**kvm** \r\n virsh shutdown <guest name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n <feature> <acpi/> </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<guest name> /etc/xen/auto/<guest name> \r\n\r\n**kvm** \r\n virsh autostart <guest name> \r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <domain>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <guest>\r\n\r\n**kvm**\r\n virsh destroy <domain>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh # quit\r\n\r\n\r\n\r\n\r\n\r\nNote\r\n------\r\nTypically the guests harddrive is not attached, you must add it in the configuration.\r\n\r\nTypically the guests memory is set to 100mbs, you might want to change that in the configuration.\r\n\r\nOnce booted and ssh'd into the VM, cat /etc/network/interfaces to verify that the DNS settings are correct.\r\n\r\nDebian/ubuntu guest don't have acpid installed by default. (Could change the vmbuilder string)\r\n\r\nMount a qcow2 or raw image file\r\n=================================\r\n\r\nThe following procedures allow a host to mount a guest image file.  This is useful when trouble shooting issues with the guest.  The following procedures require root access (you can sudo).\r\n\r\n**qcow2**\r\n\r\n.. code-block:: python\r\n\r\n modprobe nbd max_part=63\r\n qemu-nbd -c /dev/nbd0 image.img\r\n mount /dev/nbd0p1 /mnt/image\r\n\r\n**raw**\r\n\r\n.. code-block:: python\r\n \r\n losetup /dev/loop0 image.img\r\n kpartx -a /dev/loop0\r\n mount /dev/mapper/loop0p1 /mnt/image\r\n\r\nIf there is an LVM present on the image file, you can initialize it by running\r\n\r\n.. code-block:: python\r\n\r\n vgscan\r\n vgchange -ay\r\n mount /dev/VolGroupName/LogVolName /mnt/image\r\n\r\nRun the following when finished\r\n\r\n.. code-block:: python\r\n\r\n umount /mnt/image\r\n vgchange -an VolGroupName\r\n killall qemu-nbd\r\n kpartx -d /dev/loop0\r\n losetup -d /dev/loop0\r\n\r\nreference: http://en.wikibooks.org/wiki/QEMU/Images\r\n\r\n\r\nVmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\n**install vmbuilder**\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\n**display help vmbuilder**\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\n**my custom vmbuilder string**\r\n\r\n.. code-block:: bash\r\n\r\n VMNAME=mbison\r\n mkdir /vms/$VMNAME\r\n\r\n sudo vmbuilder kvm ubuntu -o --libvirt=qemu:///system --suite=lucid --flavour=virtual \\\r\n --hostname=$VMNAME --domain=foxhop.net --rootsize=10240 --raw=/vms/$VMNAME --mem=1024 \\\r\n --ip=192.168.1.52 --gw=192.168.1.254 --dns=192.168.1.22 --bridge=br0 \\\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT --manifest=/vms/$VMNAME/manifest.txt\r\n\r\n", "source_format": "rst", "revision_number": 25, "created": 1300401721000}, {"id": "f1e086c6-2f95-11f1-88d7-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <guest name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<guest name> \r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<guest name>.xml\r\n | virsh start <domain> \r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <guest name> \r\n\r\n**kvm** \r\n virsh console <guest name> \r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <guest name> \r\n\r\n**kvm** \r\n virsh shutdown <guest name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n <feature> <acpi/> </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<guest name> /etc/xen/auto/<guest name> \r\n\r\n**kvm** \r\n virsh autostart <guest name> \r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <domain>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <guest>\r\n\r\n**kvm**\r\n virsh destroy <domain>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh # quit\r\n\r\n\r\n\r\n\r\n\r\nNote\r\n------\r\nTypically the guests harddrive is not attached, you must add it in the configuration.\r\n\r\nTypically the guests memory is set to 100mbs, you might want to change that in the configuration.\r\n\r\nOnce booted and ssh'd into the VM, cat /etc/network/interfaces to verify that the DNS settings are correct.\r\n\r\nDebian/ubuntu guest don't have acpid installed by default. (Could change the vmbuilder string)\r\n\r\nMount a qcow2 or raw image file\r\n=================================\r\n\r\nThe following procedures allow a host to mount a guest image file.  This is useful when trouble shooting issues with the guest.  The following procedures require root access (you can sudo).\r\n\r\n**qcow2**\r\n\r\n.. code-block:: python\r\n\r\n modprobe nbd max_part=63\r\n qemu-nbd -c /dev/nbd0 image.img\r\n mount /dev/nbd0p1 /mnt/image\r\n\r\n**raw**\r\n\r\n.. code-block:: python\r\n \r\n losetup /dev/loop0 image.img\r\n kpartx -a /dev/loop0\r\n mount /dev/mapper/loop0p1 /mnt/image\r\n\r\nIf there is an LVM present on the image file, you can initialize it by running\r\n\r\n.. code-block:: python\r\n\r\n vgscan\r\n vgchange -ay\r\n mount /dev/VolGroupName/LogVolName /mnt/image\r\n\r\nRun the following when finished\r\n\r\n.. code-block:: python\r\n\r\n umount /mnt/image\r\n vgchange -an VolGroupName\r\n killall qemu-nbd\r\n kpartx -d /dev/loop0\r\n losetup -d /dev/loop0\r\n\r\nreference: http://en.wikibooks.org/wiki/QEMU/Images\r\n\r\n\r\nVmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\n**install vmbuilder**\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\n**display help vmbuilder**\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\n**my custom vmbuilder string**\r\n\r\n.. code-block:: bash\r\n\r\n VMNAME=mbison\r\n\r\n sudo vmbuilder kvm ubuntu -o --libvirt=qemu:///system --suite=lucid --flavour=virtual \\\r\n --hostname=$VMNAME --domain=foxhop.net --rootsize=10240 --raw=/vms/$VMNAME --mem=1024 \\\r\n --ip=192.168.1.52 --gw=192.168.1.254 --dns=192.168.1.22 --bridge=br0 \\\r\n --addpkg=openssh-server --addpkg=acpid --timezone=EDT --manifest=/vms/$VMNAME/manifest.txt\r\n\r\n", "source_format": "rst", "revision_number": 24, "created": 1300400935000}, {"id": "f1e07f2f-2f95-11f1-8006-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <guest name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<guest name> \r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<guest name>.xml\r\n | virsh start <domain> \r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <guest name> \r\n\r\n**kvm** \r\n virsh console <guest name> \r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <guest name> \r\n\r\n**kvm** \r\n virsh shutdown <guest name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n <feature> <acpi/> </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<guest name> /etc/xen/auto/<guest name> \r\n\r\n**kvm** \r\n virsh autostart <guest name> \r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <domain>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <guest>\r\n\r\n**kvm**\r\n virsh destroy <domain>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh # quit\r\n\r\n\r\n\r\n\r\n\r\nNote\r\n------\r\nTypically the guests harddrive is not attached, you must add it in the configuration.\r\n\r\nTypically the guests memory is set to 100mbs, you might want to change that in the configuration.\r\n\r\nOnce booted and ssh'd into the VM, cat /etc/network/interfaces to verify that the DNS settings are correct.\r\n\r\nDebian/ubuntu guest don't have acpid installed by default. (Could change the vmbuilder string)\r\n\r\nMount a qcow2 or raw image file\r\n=================================\r\n\r\nThe following procedures allow a host to mount a guest image file.  This is useful when trouble shooting issues with the guest.  The following procedures require root access (you can sudo).\r\n\r\n**qcow2**\r\n\r\n.. code-block:: python\r\n\r\n modprobe nbd max_part=63\r\n qemu-nbd -c /dev/nbd0 image.img\r\n mount /dev/nbd0p1 /mnt/image\r\n\r\n**raw**\r\n\r\n.. code-block:: python\r\n \r\n losetup /dev/loop0 image.img\r\n kpartx -a /dev/loop0\r\n mount /dev/mapper/loop0p1 /mnt/image\r\n\r\nIf there is an LVM present on the image file, you can initialize it by running\r\n\r\n.. code-block:: python\r\n\r\n vgscan\r\n vgchange -ay\r\n mount /dev/VolGroupName/LogVolName /mnt/image\r\n\r\nRun the following when finished\r\n\r\n.. code-block:: python\r\n\r\n umount /mnt/image\r\n vgchange -an VolGroupName\r\n killall qemu-nbd\r\n kpartx -d /dev/loop0\r\n losetup -d /dev/loop0\r\n\r\nreference: http://en.wikibooks.org/wiki/QEMU/Images\r\n\r\n\r\nVmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\n**install vmbuilder**\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\n**display help vmbuilder**\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\n**my custom vmbuilder string**\r\n\r\n.. code-block:: python\r\n\r\n VMNAME=mbison\r\n\r\n vmbuilder kvm ubuntu --hostname $VMNAME --domain=foxhop.net --suite maverick --flavour virtual --rootsize=10240 --swapsize=1024 --raw=/vms/$VMNAME --ip 192.168.1.52 --bridge br0 --addpkg openssh-server --addpkg acpid\r\n\r\n-o --libvirt qemu:///system", "source_format": "rst", "revision_number": 23, "created": 1300399907000}, {"id": "f1e076c0-2f95-11f1-8a75-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <guest name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<guest name> \r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<guest name>.xml\r\n | virsh start <domain> \r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <guest name> \r\n\r\n**kvm** \r\n virsh console <guest name> \r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <guest name> \r\n\r\n**kvm** \r\n virsh shutdown <guest name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n <feature> <acpi/> </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<guest name> /etc/xen/auto/<guest name> \r\n\r\n**kvm** \r\n virsh autostart <guest name> \r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <domain>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <guest>\r\n\r\n**kvm**\r\n virsh destroy <domain>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh # quit\r\n\r\n\r\n\r\n\r\n\r\nNote\r\n------\r\nTypically the guests harddrive is not attached, you must add it in the configuration.\r\n\r\nTypically the guests memory is set to 100mbs, you might want to change that in the configuration.\r\n\r\nOnce booted and ssh'd into the VM, cat /etc/network/interfaces to verify that the DNS settings are correct.\r\n\r\nDebian/ubuntu guest don't have acpid installed by default. (Could change the vmbuilder string)\r\n\r\nMount a qcow2 or raw image file\r\n=================================\r\n\r\nThe following procedures allow a host to mount a guest image file.  This is useful when trouble shooting issues with the guest.  The following procedures require root access (you can sudo).\r\n\r\n**qcow2**\r\n\r\n.. code-block:: python\r\n\r\n modprobe nbd max_part=63\r\n qemu-nbd -c /dev/nbd0 image.img\r\n mount /dev/nbd0p1 /mnt/image\r\n\r\n**raw**\r\n\r\n.. code-block:: python\r\n \r\n losetup /dev/loop0 image.img\r\n kpartx -a /dev/loop0\r\n mount /dev/mapper/loop0p1 /mnt/image\r\n\r\nIf there is an LVM present on the image file, you can initialize it by running\r\n\r\n.. code-block:: python\r\n\r\n vgscan\r\n vgchange -ay\r\n mount /dev/VolGroupName/LogVolName /mnt/image\r\n\r\nRun the following when finished\r\n\r\n.. code-block:: python\r\n\r\n umount /mnt/image\r\n vgchange -an VolGroupName\r\n killall qemu-nbd\r\n kpartx -d /dev/loop0\r\n losetup -d /dev/loop0\r\n\r\nreference: http://en.wikibooks.org/wiki/QEMU/Images\r\n\r\n\r\nVmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\n**install vmbuilder**\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\n**display help vmbuilder**\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\n", "source_format": "rst", "revision_number": 22, "created": 1300398321000}, {"id": "f1e06f9f-2f95-11f1-806f-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <guest name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<guest name> \r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<guest name>.xml\r\n | virsh start <domain> \r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <guest name> \r\n\r\n**kvm** \r\n virsh console <guest name> \r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <guest name> \r\n\r\n**kvm** \r\n virsh shutdown <guest name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n <feature> <acpi/> </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<guest name> /etc/xen/auto/<guest name> \r\n\r\n**kvm** \r\n virsh autostart <guest name> \r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <domain>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <guest>\r\n\r\n**kvm**\r\n virsh destroy <domain>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh # quit\r\n\r\n\r\n\r\n\r\n\r\nNote\r\n------\r\nTypically the guests harddrive is not attached, you must add it in the configuration.\r\n\r\nTypically the guests memory is set to 100mbs, you might want to change that in the configuration.\r\n\r\nOnce booted and ssh'd into the VM, cat /etc/network/interfaces to verify that the DNS settings are correct.\r\n\r\nDebian/ubuntu guest don't have acpid installed by default. (Could change the vmbuilder string)\r\n\r\nMount a qcow2 or raw image file\r\n=================================\r\n\r\nThe following procedures allow a host to mount a guest image file.  This is useful when trouble shooting issues with the guest.  The following procedures require root access (you can sudo).\r\n\r\n**qcow2**\r\n\r\n.. code-block:: python\r\n\r\n modprobe nbd max_part=63\r\n qemu-nbd -c /dev/nbd0 image.img\r\n mount /dev/nbd0p1 /mnt/image\r\n\r\n**raw**\r\n\r\n.. code-block:: python\r\n \r\n losetup /dev/loop0 image.img\r\n kpartx -a /dev/loop0\r\n mount /dev/mapper/loop0p1 /mnt/image\r\n\r\nIf there is an LVM present on the image file, you can initialize it by running\r\n\r\n.. code-block:: python\r\n\r\n vgscan\r\n vgchange -ay\r\n mount /dev/VolGroupName/LogVolName /mnt/image\r\n\r\nRun the following when finished\r\n\r\n.. code-block:: python\r\n\r\n umount /mnt/image\r\n vgchange -an VolGroupName\r\n killall qemu-nbd\r\n kpartx -d /dev/loop0\r\n losetup -d /dev/loop0\r\n\r\nreference: http://en.wikibooks.org/wiki/QEMU/Images\r\n\r\n\r\nVmbuilder Example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\n**install vmbuilder**\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\n\r\nThis example assumes ubuntu linux.\r\n\r\n**display help vmbuilder**\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\n", "source_format": "rst", "revision_number": 21, "created": 1300398223000}, {"id": "f1e0679c-2f95-11f1-95fa-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <guest name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<guest name> \r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<guest name>.xml\r\n | virsh start <domain> \r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <guest name> \r\n\r\n**kvm** \r\n virsh console <guest name> \r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <guest name> \r\n\r\n**kvm** \r\n virsh shutdown <guest name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n <feature> <acpi/> </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<guest name> /etc/xen/auto/<guest name> \r\n\r\n**kvm** \r\n virsh autostart <guest name> \r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <domain>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <guest>\r\n\r\n**kvm**\r\n virsh destroy <domain>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh # quit\r\n\r\n\r\n\r\n\r\n\r\nNote\r\n------\r\nTypically the guests harddrive is not attached, you must add it in the configuration.\r\n\r\nTypically the guests memory is set to 100mbs, you might want to change that in the configuration.\r\n\r\nOnce booted and ssh'd into the VM, cat /etc/network/interfaces to verify that the DNS settings are correct.\r\n\r\nDebian/ubuntu guest don't have acpid installed by default. (Could change the vmbuilder string)\r\n\r\nMount a qcow2 or raw image file\r\n=================================\r\n\r\nThe following procedures allow a host to mount a guest image file.  This is useful when trouble shooting issues with the guest.  The following procedures require root access (you can sudo).\r\n\r\n**qcow2**\r\n\r\n.. code-block:: python\r\n\r\n modprobe nbd max_part=63\r\n qemu-nbd -c /dev/nbd0 image.img\r\n mount /dev/nbd0p1 /mnt/image\r\n\r\n**raw**\r\n\r\n.. code-block:: python\r\n \r\n losetup /dev/loop0 image.img\r\n kpartx -a /dev/loop0\r\n mount /dev/mapper/loop0p1 /mnt/image\r\n\r\nIf there is an LVM present on the image file, you can initialize it by running\r\n\r\n.. code-block:: python\r\n\r\n vgscan\r\n vgchange -ay\r\n mount /dev/VolGroupName/LogVolName /mnt/image\r\n\r\nRun the following when finished\r\n\r\n.. code-block:: python\r\n\r\n umount /mnt/image\r\n vgchange -an VolGroupName\r\n killall qemu-nbd\r\n kpartx -d /dev/loop0\r\n losetup -d /dev/loop0\r\n\r\nreference: http://en.wikibooks.org/wiki/QEMU/Images\r\n\r\n\r\nvmbuilder example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\n**install vmbuilder**\r\n\r\n.. code-block:: python\r\n\r\n sudo apt-get install python-vm-builder\r\n\r\n\r\nThis example assumes ubuntu linux.\r\n\r\n**display help vmbuilder**\r\n\r\n.. code-block:: python\r\n\r\n vmbuilder kvm ubuntu --help\r\n\r\n", "source_format": "rst", "revision_number": 20, "created": 1300398207000}, {"id": "f1e05fca-2f95-11f1-b8a8-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <guest name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<guest name> \r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<guest name>.xml\r\n | virsh start <domain> \r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <guest name> \r\n\r\n**kvm** \r\n virsh console <guest name> \r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <guest name> \r\n\r\n**kvm** \r\n virsh shutdown <guest name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n <feature> <acpi/> </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<guest name> /etc/xen/auto/<guest name> \r\n\r\n**kvm** \r\n virsh autostart <guest name> \r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <domain>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <guest>\r\n\r\n**kvm**\r\n virsh destroy <domain>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh # quit\r\n\r\n\r\n\r\n\r\n\r\nNote\r\n------\r\nTypically the guests harddrive is not attached, you must add it in the configuration.\r\n\r\nTypically the guests memory is set to 100mbs, you might want to change that in the configuration.\r\n\r\nOnce booted and ssh'd into the VM, cat /etc/network/interfaces to verify that the DNS settings are correct.\r\n\r\nDebian/ubuntu guest don't have acpid installed by default. (Could change the vmbuilder string)\r\n\r\nMount a qcow2 or raw image file\r\n=================================\r\n\r\nThe following procedures allow a host to mount a guest image file.  This is useful when trouble shooting issues with the guest.  The following procedures require root access (you can sudo).\r\n\r\n**qcow2**\r\n\r\n.. code-block:: python\r\n\r\n modprobe nbd max_part=63\r\n qemu-nbd -c /dev/nbd0 image.img\r\n mount /dev/nbd0p1 /mnt/image\r\n\r\n**raw**\r\n\r\n.. code-block:: python\r\n \r\n losetup /dev/loop0 image.img\r\n kpartx -a /dev/loop0\r\n mount /dev/mapper/loop0p1 /mnt/image\r\n\r\nIf there is an LVM present on the image file, you can initialize it by running\r\n\r\n.. code-block:: python\r\n\r\n vgscan\r\n vgchange -ay\r\n mount /dev/VolGroupName/LogVolName /mnt/image\r\n\r\nRun the following when finished\r\n\r\n.. code-block:: python\r\n\r\n umount /mnt/image\r\n vgchange -an VolGroupName\r\n killall qemu-nbd\r\n kpartx -d /dev/loop0\r\n losetup -d /dev/loop0\r\n\r\nreference: http://en.wikibooks.org/wiki/QEMU/Images\r\n\r\n\r\nvmbuilder example\r\n======================\r\n\r\nThis example assumes ubuntu linux.\r\n\r\n..code-block:: python\r\n\r\nsudo apt-get install python-vm-builder\r\n\r\n", "source_format": "rst", "revision_number": 19, "created": 1300397856000}, {"id": "f1e058ef-2f95-11f1-9d35-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <guest name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<guest name> \r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<guest name>.xml\r\n | virsh start <domain> \r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <guest name> \r\n\r\n**kvm** \r\n virsh console <guest name> \r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <guest name> \r\n\r\n**kvm** \r\n virsh shutdown <guest name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n <feature> <acpi/> </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<guest name> /etc/xen/auto/<guest name> \r\n\r\n**kvm** \r\n virsh autostart <guest name> \r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <domain>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <guest>\r\n\r\n**kvm**\r\n virsh destroy <domain>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh # quit\r\n\r\n\r\n\r\n\r\n\r\nNote\r\n------\r\nTypically the guests harddrive is not attached, you must add it in the configuration.\r\n\r\nTypically the guests memory is set to 100mbs, you might want to change that in the configuration.\r\n\r\nOnce booted and ssh'd into the VM, cat /etc/network/interfaces to verify that the DNS settings are correct.\r\n\r\nDebian/ubuntu guest don't have acpid installed by default. (Could change the vmbuilder string)\r\n\r\nMount a qcow2 or raw image file\r\n=================================\r\n\r\nThe following procedures allow a host to mount a guest image file.  This is useful when trouble shooting issues with the guest.  The following procedures require root access (you can sudo).\r\n\r\n**qcow2**\r\n\r\n.. code-block:: python\r\n\r\n modprobe nbd max_part=63\r\n qemu-nbd -c /dev/nbd0 image.img\r\n mount /dev/nbd0p1 /mnt/image\r\n\r\n**raw**\r\n\r\n.. code-block:: python\r\n \r\n losetup /dev/loop0 image.img\r\n kpartx -a /dev/loop0\r\n mount /dev/mapper/loop0p1 /mnt/image\r\n\r\nIf there is an LVM present on the image file, you can initialize it by running\r\n\r\n.. code-block:: python\r\n\r\n vgscan\r\n vgchange -ay\r\n mount /dev/VolGroupName/LogVolName /mnt/image\r\n\r\nRun the following when finished\r\n\r\n.. code-block:: python\r\n\r\n umount /mnt/image\r\n vgchange -an VolGroupName\r\n killall qemu-nbd\r\n kpartx -d /dev/loop0\r\n losetup -d /dev/loop0\r\n\r\nreference: http://en.wikibooks.org/wiki/QEMU/Images", "source_format": "rst", "revision_number": 18, "created": 1300231526000}, {"id": "f1e04f80-2f95-11f1-a1cd-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <guest name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<guest name> \r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<guest name>.xml\r\n | virsh start <domain> \r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <guest name> \r\n\r\n**kvm** \r\n virsh console <guest name> \r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <guest name> \r\n\r\n**kvm** \r\n virsh shutdown <guest name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n <feature> <acpi/> </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<guest name> /etc/xen/auto/<guest name> \r\n\r\n**kvm** \r\n virsh autostart <guest name> \r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <domain>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <guest>\r\n\r\n**kvm**\r\n virsh destroy <domain>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh # quit\r\n\r\n\r\n\r\n\r\n\r\nNote\r\n------\r\nTypically the guests harddrive is not attached, you must add it in the configuration.\r\n\r\nTypically the guests memory is set to 100mbs, you might want to change that in the configuration.\r\n\r\nOnce booted and ssh'd into the VM, cat /etc/network/interfaces to verify that the DNS settings are correct.\r\n\r\nDebian/ubuntu guest don't have acpid installed by default. (Could change the vmbuilder string)\r\n\r\nMount a qcow2 or raw image file\r\n=================================\r\n\r\nThe following procedures allow a host to mount a guest image file.  This is useful when trouble shooting issues with the guest.  The following procedures require root access (you can sudo).\r\n\r\n**qcow2**\r\n\r\n.. code-block:: python\r\n\r\n modprobe nbd max_part=63\r\n qemu-nbd -c /dev/nbd0 image.img\r\n mount /dev/nbd0p1 /mnt/image\r\n\r\n**raw**\r\n\r\n.. code-block:: python\r\n \r\n losetup /dev/loop0 image.img\r\n kpartx -a /dev/loop0\r\n mount /dev/mapper/loop0p1 /mnt/image\r\n\r\nIf there is an LVM present on the image file, you can initialize it by running\r\n\r\n.. code-block:: python\r\n\r\n vgscan\r\n vgchange -ay\r\n mount /dev/VolGroupName/LogVolName /mnt/image\r\n\r\nRun the following when finished\r\n\r\n.. code-block:: python\r\n\r\n umount /mnt/image\r\n vgchange -an VolGroupName\r\n killall qemu-nbd\r\n kpartx -d /dev/loop0\r\n losetup -d /dev/loop0", "source_format": "rst", "revision_number": 17, "created": 1300229219000}, {"id": "f1e046ea-2f95-11f1-b49d-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <guest name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<guest name> \r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<guest name>.xml\r\n | virsh start <domain> \r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <guest name> \r\n\r\n**kvm** \r\n virsh console <guest name> \r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <guest name> \r\n\r\n**kvm** \r\n virsh shutdown <guest name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n <feature> <acpi/> </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<guest name> /etc/xen/auto/<guest name> \r\n\r\n**kvm** \r\n virsh autostart <guest name> \r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <domain>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <guest>\r\n\r\n**kvm**\r\n virsh destroy <domain>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh # quit\r\n\r\n\r\n\r\n\r\n\r\nNote\r\n------\r\nTypically the guests harddrive is not attached, you must add it in the configuration.\r\n\r\nTypically the guests memory is set to 100mbs, you might want to change that in the configuration.\r\n\r\nOnce booted and ssh'd into the VM, cat /etc/network/interfaces to verify that the DNS settings are correct.\r\n\r\nDebian/ubuntu guest don't have acpid installed by default. (Could change the vmbuilder string)\r\n\r\nMount a qcow2 or raw image file\r\n=================================\r\n\r\nThe following procedures allow a host to mount a guest image file.  This is useful when trouble shooting issues with the guest.  The following procedures require root access (you can sudo).\r\n\r\n**qcow2**\r\n\r\n.. code-block:: python\r\n\r\n modprobe nbd max_part=63\r\n qemu-nbd -c /dev/nbd0 image.img\r\n mount /dev/nbd0p1 /mnt/image\r\n\r\n**raw**\r\n\r\n.. code-block:: python\r\n \r\n losetup /dev/loop0 image.img\r\n kpartx -a /dev/loop0\r\n mount /dev/mapper/loop0p1 /mnt/image\r\n\r\nIf there is an LVM present on the image file, you can initialize it by running\r\n\r\n.. code-block:: python\r\n\r\n vgscan\r\n vgchange -ay\r\n mount /dev/VolGroupName/LogVolName /mnt/image", "source_format": "rst", "revision_number": 16, "created": 1300228530000}, {"id": "f1e040f4-2f95-11f1-8239-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <guest name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<guest name> \r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<guest name>.xml\r\n | virsh start <domain> \r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <guest name> \r\n\r\n**kvm** \r\n virsh console <guest name> \r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <guest name> \r\n\r\n**kvm** \r\n virsh shutdown <guest name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n <feature> <acpi/> </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<guest name> /etc/xen/auto/<guest name> \r\n\r\n**kvm** \r\n virsh autostart <guest name> \r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <domain>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <guest>\r\n\r\n**kvm**\r\n virsh destroy <domain>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh # quit\r\n\r\n\r\n\r\n\r\n\r\nNote\r\n------\r\nTypically the guests harddrive is not attached, you must add it in the configuration.\r\n\r\nTypically the guests memory is set to 100mbs, you might want to change that in the configuration.\r\n\r\nOnce booted and ssh'd into the VM, cat /etc/network/interfaces to verify that the DNS settings are correct.\r\n\r\nDebian/ubuntu guest don't have acpid installed by default. (Could change the vmbuilder string)\r\n\r\nMount a qcow2 or raw image file\r\n=================================\r\n\r\nThe following procedures allow a host to mount a guest image file.  This is useful when trouble shooting issues with the guest.  The following procedures require root access (you can sudo).\r\n\r\n**qcow2**\r\n\r\n.. code-block:: python\r\n\r\n modprobe nbd max_part=63\r\n qemu-nbd -c /dev/nbd0 image.img\r\n mount /dev/nbd0p1 /mnt/image\r\n\r\n**raw**\r\n\r\n.. code-block:: python\r\n \r\n losetup /dev/loop0 image.img\r\n kpartx -a /dev/loop0\r\n mount /dev/mapper/loop0p1 /mnt/image", "source_format": "rst", "revision_number": 15, "created": 1300228426000}, {"id": "f1e03cd6-2f95-11f1-a45a-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <guest name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<guest name> \r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<guest name>.xml\r\n | virsh start <domain> \r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <guest name> \r\n\r\n**kvm** \r\n virsh console <guest name> \r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <guest name> \r\n\r\n**kvm** \r\n virsh shutdown <guest name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n <feature> <acpi/> </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<guest name> /etc/xen/auto/<guest name> \r\n\r\n**kvm** \r\n virsh autostart <guest name> \r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <domain>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <guest>\r\n\r\n**kvm**\r\n virsh destroy <domain>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh # quit\r\n\r\n\r\n\r\n\r\n\r\nNote\r\n------\r\nTypically the guests harddrive is not attached, you must add it in the configuration.\r\n\r\nTypically the guests memory is set to 100mbs, you might want to change that in the configuration.\r\n\r\nOnce booted and ssh'd into the VM, cat /etc/network/interfaces to verify that the DNS settings are correct.\r\n\r\nDebian/ubuntu guest don't have acpid installed by default. (Could change the vmbuilder string)\r\n\r\nMount a qcow2 or raw image file\r\n=================================\r\n\r\nThe following procedures allow a host to mount a guest image file.  This is useful when trouble shooting issues with the guest.  The following procedures require root access (you can sudo).\r\n\r\n**qcow2**\r\n\r\n.. code-block:: python\r\n\r\n modprobe nbd max_part=63\r\n qemu-nbd -c /dev/nbd0 image.img\r\n mount /dev/nbd0p1 /mnt/image\r\n\r\n**raw**\r\n\r\n.. code-block:: python\r\n\r\n kpartx -a /dev/loop0\r\n mount /dev/mapper/loop0p1 /mnt/image", "source_format": "rst", "revision_number": 14, "created": 1300228380000}, {"id": "f1e0389a-2f95-11f1-a4f5-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <guest name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<guest name> \r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<guest name>.xml\r\n | virsh start <domain> \r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <guest name> \r\n\r\n**kvm** \r\n virsh console <guest name> \r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <guest name> \r\n\r\n**kvm** \r\n virsh shutdown <guest name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n <feature> <acpi/> </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<guest name> /etc/xen/auto/<guest name> \r\n\r\n**kvm** \r\n virsh autostart <guest name> \r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <domain>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <guest>\r\n\r\n**kvm**\r\n virsh destroy <domain>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh # quit\r\n\r\n\r\n\r\n\r\n\r\nNote\r\n------\r\nTypically the guests harddrive is not attached, you must add it in the configuration.\r\n\r\nTypically the guests memory is set to 100mbs, you might want to change that in the configuration.\r\n\r\nOnce booted and ssh'd into the VM, cat /etc/network/interfaces to verify that the DNS settings are correct.\r\n\r\nDebian/ubuntu guest don't have acpid installed by default. (Could change the vmbuilder string)\r\n", "source_format": "rst", "revision_number": 13, "created": 1289340004000}, {"id": "f1e034d5-2f95-11f1-b76d-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": null, "author": null, "data": "vcKRpO  <a href=\"http://nvnmeexpvbyy.com/\">nvnmeexpvbyy</a>, [url=http://djdoyszaxthm.com/]djdoyszaxthm[/url], [link=http://ymzrlwfvjeug.com/]ymzrlwfvjeug[/link], http://dpfwihmqnjws.com/", "source_format": "rst", "revision_number": 12, "created": 1289305040000}, {"id": "f1e0301c-2f95-11f1-b69e-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": null, "author": null, "data": "vcKRpO  <a href=\"http://nvnmeexpvbyy.com/\">nvnmeexpvbyy</a>, [url=http://djdoyszaxthm.com/]djdoyszaxthm[/url], [link=http://ymzrlwfvjeug.com/]ymzrlwfvjeug[/link], http://dpfwihmqnjws.com/", "source_format": "rst", "revision_number": 11, "created": 1289305038000}, {"id": "f1e02b1f-2f95-11f1-bae3-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": null, "author": null, "data": "yyZUqx  <a href=\"http://zohrjsewwvef.com/\">zohrjsewwvef</a>, [url=http://wwenzdtguser.com/]wwenzdtguser[/url], [link=http://tugwvfmhobyj.com/]tugwvfmhobyj[/link], http://spsndbhfelnh.com/yyZUqx  <a href=\"http://zohrjsewwvef.com/\">zohrjsewwvef</a>, [url=http://wwenzdtguser.com/]wwenzdtguser[/url], [link=http://tugwvfmhobyj.com/]tugwvfmhobyj[/link], http://spsndbhfelnh.com/yyZUqx  <a href=\"http://zohrjsewwvef.com/\">zohrjsewwvef</a>, [url=http://wwenzdtguser.com/]wwenzdtguser[/url], [link=http://tugwvfmhobyj.com/]tugwvfmhobyj[/link], http://spsndbhfelnh.com/yyZUqx  <a href=\"http://zohrjsewwvef.com/\">zohrjsewwvef</a>, [url=http://wwenzdtguser.com/]wwenzdtguser[/url], [link=http://tugwvfmhobyj.com/]tugwvfmhobyj[/link], http://spsndbhfelnh.com/yyZUqx  <a href=\"http://zohrjsewwvef.com/\">zohrjsewwvef</a>, [url=http://wwenzdtguser.com/]wwenzdtguser[/url], [link=http://tugwvfmhobyj.com/]tugwvfmhobyj[/link], http://spsndbhfelnh.com/yyZUqx  <a href=\"http://zohrjsewwvef.com/\">zohrjsewwvef</a>, [url=http://wwenzdtguser.com/]wwenzdtguser[/url], [link=http://tugwvfmhobyj.com/]tugwvfmhobyj[/link], http://spsndbhfelnh.com/yyZUqx  <a href=\"http://zohrjsewwvef.com/\">zohrjsewwvef</a>, [url=http://wwenzdtguser.com/]wwenzdtguser[/url], [link=http://tugwvfmhobyj.com/]tugwvfmhobyj[/link], http://spsndbhfelnh.com/yyZUqx  <a href=\"http://zohrjsewwvef.com/\">zohrjsewwvef</a>, [url=http://wwenzdtguser.com/]wwenzdtguser[/url], [link=http://tugwvfmhobyj.com/]tugwvfmhobyj[/link], http://spsndbhfelnh.com/yyZUqx  <a href=\"http://zohrjsewwvef.com/\">zohrjsewwvef</a>, [url=http://wwenzdtguser.com/]wwenzdtguser[/url], [link=http://tugwvfmhobyj.com/]tugwvfmhobyj[/link], http://spsndbhfelnh.com/yyZUqx  <a href=\"http://zohrjsewwvef.com/\">zohrjsewwvef</a>, [url=http://wwenzdtguser.com/]wwenzdtguser[/url], [link=http://tugwvfmhobyj.com/]tugwvfmhobyj[/link], http://spsndbhfelnh.com/yyZUqx  <a href=\"http://zohrjsewwvef.com/\">zohrjsewwvef</a>, [url=http://wwenzdtguser.com/]wwenzdtguser[/url], [link=http://tugwvfmhobyj.com/]tugwvfmhobyj[/link], http://spsndbhfelnh.com/yyZUqx  <a href=\"http://zohrjsewwvef.com/\">zohrjsewwvef</a>, [url=http://wwenzdtguser.com/]wwenzdtguser[/url], [link=http://tugwvfmhobyj.com/]tugwvfmhobyj[/link], http://spsndbhfelnh.com/", "source_format": "rst", "revision_number": 10, "created": 1289277472000}, {"id": "f1e02679-2f95-11f1-8d94-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": null, "author": null, "data": "yyZUqx  <a href=\"http://zohrjsewwvef.com/\">zohrjsewwvef</a>, [url=http://wwenzdtguser.com/]wwenzdtguser[/url], [link=http://tugwvfmhobyj.com/]tugwvfmhobyj[/link], http://spsndbhfelnh.com/yyZUqx  <a href=\"http://zohrjsewwvef.com/\">zohrjsewwvef</a>, [url=http://wwenzdtguser.com/]wwenzdtguser[/url], [link=http://tugwvfmhobyj.com/]tugwvfmhobyj[/link], http://spsndbhfelnh.com/yyZUqx  <a href=\"http://zohrjsewwvef.com/\">zohrjsewwvef</a>, [url=http://wwenzdtguser.com/]wwenzdtguser[/url], [link=http://tugwvfmhobyj.com/]tugwvfmhobyj[/link], http://spsndbhfelnh.com/yyZUqx  <a href=\"http://zohrjsewwvef.com/\">zohrjsewwvef</a>, [url=http://wwenzdtguser.com/]wwenzdtguser[/url], [link=http://tugwvfmhobyj.com/]tugwvfmhobyj[/link], http://spsndbhfelnh.com/yyZUqx  <a href=\"http://zohrjsewwvef.com/\">zohrjsewwvef</a>, [url=http://wwenzdtguser.com/]wwenzdtguser[/url], [link=http://tugwvfmhobyj.com/]tugwvfmhobyj[/link], http://spsndbhfelnh.com/yyZUqx  <a href=\"http://zohrjsewwvef.com/\">zohrjsewwvef</a>, [url=http://wwenzdtguser.com/]wwenzdtguser[/url], [link=http://tugwvfmhobyj.com/]tugwvfmhobyj[/link], http://spsndbhfelnh.com/yyZUqx  <a href=\"http://zohrjsewwvef.com/\">zohrjsewwvef</a>, [url=http://wwenzdtguser.com/]wwenzdtguser[/url], [link=http://tugwvfmhobyj.com/]tugwvfmhobyj[/link], http://spsndbhfelnh.com/yyZUqx  <a href=\"http://zohrjsewwvef.com/\">zohrjsewwvef</a>, [url=http://wwenzdtguser.com/]wwenzdtguser[/url], [link=http://tugwvfmhobyj.com/]tugwvfmhobyj[/link], http://spsndbhfelnh.com/yyZUqx  <a href=\"http://zohrjsewwvef.com/\">zohrjsewwvef</a>, [url=http://wwenzdtguser.com/]wwenzdtguser[/url], [link=http://tugwvfmhobyj.com/]tugwvfmhobyj[/link], http://spsndbhfelnh.com/yyZUqx  <a href=\"http://zohrjsewwvef.com/\">zohrjsewwvef</a>, [url=http://wwenzdtguser.com/]wwenzdtguser[/url], [link=http://tugwvfmhobyj.com/]tugwvfmhobyj[/link], http://spsndbhfelnh.com/yyZUqx  <a href=\"http://zohrjsewwvef.com/\">zohrjsewwvef</a>, [url=http://wwenzdtguser.com/]wwenzdtguser[/url], [link=http://tugwvfmhobyj.com/]tugwvfmhobyj[/link], http://spsndbhfelnh.com/yyZUqx  <a href=\"http://zohrjsewwvef.com/\">zohrjsewwvef</a>, [url=http://wwenzdtguser.com/]wwenzdtguser[/url], [link=http://tugwvfmhobyj.com/]tugwvfmhobyj[/link], http://spsndbhfelnh.com/", "source_format": "rst", "revision_number": 9, "created": 1289277466000}, {"id": "f1e021bc-2f95-11f1-ad19-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nInstall packages \r\n===============================\r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <guest name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<guest name> \r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<guest name>.xml\r\n | virsh start <domain> \r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <guest name> \r\n\r\n**kvm** \r\n virsh console <guest name> \r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <guest name> \r\n\r\n**kvm** \r\n virsh shutdown <guest name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n <feature> <acpi/> </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<guest name> /etc/xen/auto/<guest name> \r\n\r\n**kvm** \r\n virsh autostart <guest name> \r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <domain>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <guest>\r\n\r\n**kvm**\r\n virsh destroy <domain>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh # quit\r\n\r\n\r\n\r\n\r\n\r\nNote\r\n------\r\nTypically the guests harddrive is not attached, you must add it in the configuration.\r\n\r\nTypically the guests memory is set to 100mbs, you might want to change that in the configuration.\r\n\r\nOnce booted and ssh'd into the VM, cat /etc/network/interfaces to verify that the DNS settings are correct.\r\n\r\nDebian/ubuntu guest don't have acpid installed by default. (Could change the vmbuilder string)\r\n", "source_format": "rst", "revision_number": 8, "created": 1288117043000}, {"id": "f1e01d9b-2f95-11f1-a03d-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nThis document talks about a guest named *mbison*. Change this name to better suit your purpose. \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <guest name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<guest name> \r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<guest name>.xml\r\n | virsh start <domain> \r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <guest name> \r\n\r\n**kvm** \r\n virsh console <guest name> \r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <guest name> \r\n\r\n**kvm** \r\n virsh shutdown <guest name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n <feature> <acpi/> </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<guest name> /etc/xen/auto/<guest name> \r\n\r\n**kvm** \r\n virsh autostart <guest name> \r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <domain>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <guest>\r\n\r\n**kvm**\r\n virsh destroy <domain>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh # quit\r\n\r\n\r\nInstall packages \r\n---------------------------------------------- \r\n\r\n**Debian or Ubuntu**\r\n\r\n* sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils\r\n\r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start\r\n\r\n\r\nNote\r\n------\r\nTypically the guests harddrive is not attached, you must add it in the configuration.\r\n\r\nTypically the guests memory is set to 100mbs, you might want to change that in the configuration.\r\n\r\nOnce booted and ssh'd into the VM, cat /etc/network/interfaces to verify that the DNS settings are correct.\r\n\r\nDebian/ubuntu guest don't have acpid installed by default. (Could change the vmbuilder string)\r\n", "source_format": "rst", "revision_number": 7, "created": 1288116990000}, {"id": "f1e01962-2f95-11f1-b56e-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nThis document talks about a guest named *mbison*. Change this name to better suit your purpose. \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n.. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n.. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm list \r\n\r\n**kvm** \r\n | virsh list \r\n | virsh dominfo <guest name> \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n | xm create /etc/xen/<guest name> \r\n\r\n**kvm** \r\n | virsh create /etc/libvirt/qemu/<guest name>.xml\r\n | virsh start <domain> \r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm console <guest name> \r\n\r\n**kvm** \r\n virsh console <guest name> \r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\n**xen** \r\n xm shutdown <guest name> \r\n\r\n**kvm** \r\n virsh shutdown <guest name> \r\n\r\nThis command doesn't always work...  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n <feature> <acpi/> </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\n**debian / ubuntu**\r\n sudo apt-get install acpid\r\n\r\n**fedora / redhat**\r\n yum install acpid\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\n**xen** \r\n ln -s /etc/xen/<guest name> /etc/xen/auto/<guest name> \r\n\r\n**kvm** \r\n virsh autostart <guest name> \r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n**xen**\r\n  NA\r\n\r\n**kvm**  \r\n virsh edit <domain>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n**xen**\r\n xm destroy <guest>\r\n\r\n**kvm**\r\n virsh destroy <domain>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\n**kvm** \r\n virsh # quit\r\n\r\n\r\nInstall packages \r\n---------------------------------------------- \r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start\r\n\r\n\r\nNote\r\n------\r\nTypically the guests harddrive is not attached, you must add it in the configuration.\r\n\r\nTypically the guests memory is set to 100mbs, you might want to change that in the configuration.\r\n\r\nOnce booted and ssh'd into the VM, cat /etc/network/interfaces to verify that the DNS settings are correct.\r\n\r\nDebian/ubuntu guest don't have acpid installed by default. (Could change the vmbuilder string)\r\n", "source_format": "rst", "revision_number": 6, "created": 1288116784000}, {"id": "f1e01481-2f95-11f1-acc1-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nThis document talks about a guest named *mbison*. Change this name to better suit your purpose. \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n .. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n .. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\nxen \r\n  xm list \r\n\r\nkvm \r\n  virsh list \r\n  virsh dominfo <guest name> ( more info on guest ) \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\nxen \r\n  xm create /etc/xen/<guest name> \r\n\r\nkvm \r\n  virsh create /etc/libvirt/qemu/<guest name>.xml\r\nor\r\n  virsh start <domain> \r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\nxen \r\n  xm console <guest name> \r\n\r\nkvm \r\n  virsh console <guest name> \r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\nxen \r\n  xm shutdown <guest name> \r\n\r\nkvm \r\n  virsh shutdown <guest name> \r\n\r\nThis doesn't always work.  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n .. code-block:: xml\r\n\r\n  <feature>\r\n\r\n     <acpi/>\r\n\r\n  </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\nOn debian / ubuntu run:\r\n \r\n .. code-block:: bash\r\n\r\n  $ sudo apt-get install acpid\r\n\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\nxen \r\n  ln -s /etc/xen/<guest name> /etc/xen/auto/<guest name> \r\n\r\nkvm \r\n  virsh autostart <guest name> \r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\nxen\r\n  NA\r\n\r\nkvm  \r\n virsh edit <domain>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n\r\nPull the power on a guest::  \r\n\r\n virsh destroy <domain>\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\nQuit virsh cli::  \r\n\r\n virsh # quit\r\n\r\n\r\nInstall packages \r\n---------------------------------------------- \r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start\r\n\r\n\r\nNote\r\n------\r\nTypically the guests harddrive is not attached, you must add it in the configuration.\r\n\r\nTypically the guests memory is set to 100mbs, you might want to change that in the configuration.\r\n\r\nOnce booted and ssh'd into the VM, cat /etc/network/interfaces to verify that the DNS settings are correct.\r\n\r\nDebian/ubuntu guest don't have acpid installed by default. (Could change the vmbuilder string)\r\n", "source_format": "rst", "revision_number": 5, "created": 1288115984000}, {"id": "f1e00eef-2f95-11f1-8da2-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nThis document talks about a guest named *mbison*. Change this name to better suit your purpose. \r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n .. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n .. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nKVM has its own commands, but we like to use virsh.   \r\n\r\nHere is a list comparing Xen and KVM (virsh) commands. \r\n\r\nList running guests \r\n---------------------------------------------- \r\n\r\nxen \r\n  xm list \r\n\r\nkvm \r\n  virsh list \r\n  virsh dominfo <guest name> ( more info on guest ) \r\n\r\nStart a guest \r\n---------------------------------------------- \r\n\r\nxen \r\n  xm create /etc/xen/<guest name> \r\n\r\nkvm \r\n  virsh create /etc/libvirt/qemu/<guest name>.xml\r\nor\r\n  virsh start <domain> \r\n\r\nConsole to guest\r\n---------------------------------------------- \r\n\r\nxen \r\n  xm console <guest name> \r\n\r\nkvm \r\n  virsh console <guest name> \r\n\r\nShutdown a guest \r\n---------------------------------------------- \r\n\r\nxen \r\n  xm shutdown <guest name> \r\n\r\nkvm \r\n  virsh shutdown <guest name> \r\n\r\nThis doesn't always work.  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n .. code-block:: xml\r\n\r\n  <feature>\r\n\r\n     <acpi/>\r\n\r\n  </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\nOn debian / ubuntu run:\r\n \r\n .. code-block:: bash\r\n\r\n  $ sudo apt-get install acpid\r\n\r\n\r\nAutostart guest on reboot \r\n---------------------------------------------- \r\n\r\nxen \r\n  ln -s /etc/xen/<guest name> /etc/xen/auto/<guest name> \r\n\r\nkvm \r\n  virsh autostart <guest name> \r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\nxen\r\n  NA\r\n\r\nkvm::  \r\n virsh edit <domain>\r\n\r\n\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n\r\nPull the power on a guest::  \r\n\r\n virsh # destroy mbison\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\nQuit virsh cli::  \r\n\r\n virsh # quit\r\n\r\n\r\nInstall packages \r\n---------------------------------------------- \r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start\r\n\r\n\r\nNote\r\n------\r\nTypically the guests harddrive is not attached, you must add it in the configuration.\r\n\r\nTypically the guests memory is set to 100mbs, you might want to change that in the configuration.\r\n\r\nOnce booted and ssh'd into the VM, cat /etc/network/interfaces to verify that the DNS settings are correct.\r\n\r\nDebian/ubuntu guest don't have acpid installed by default. (Could change the vmbuilder string)\r\n", "source_format": "rst", "revision_number": 4, "created": 1288115910000}, {"id": "f1e0091e-2f95-11f1-bb9c-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nThis document talks about a guest named *mbison*. Change this name to better suit your purpose. \r\n\r\n\r\n\r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n .. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n .. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nList all guests\r\n----------------\r\n \r\nList all guests:: \r\n \r\n virsh # list --all\r\n\r\n\r\n\r\nStart a guest\r\n------------------\r\n\r\nStart a guest::  \r\n\r\n virsh # start mbison\r\n\r\nFlag a guest for autostart on host reboot\r\n--------------------------------------------\r\n\r\nFlag a guest for autostart on host reboot::  \r\n\r\n virsh # autostart mbison\r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n\r\nEdit a guests configuration file::  \r\n\r\n virsh # edit mbison\r\n\r\nShutdown a guest\r\n---------------------\r\nShutdown a guest gracefully::\r\n \r\n virsh # shutdown mbison\r\n\r\nThis doesn't always work.  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n .. code-block:: xml\r\n\r\n  <feature>\r\n\r\n     <acpi/>\r\n\r\n  </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\nOn debian / ubuntu run:\r\n \r\n .. code-block:: bash\r\n\r\n  $ sudo apt-get install acpid\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n\r\nPull the power on a guest::  \r\n\r\n virsh # destroy mbison\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\nQuit virsh cli::  \r\n\r\n virsh # quit\r\n\r\n\r\n\r\nInstall packages \r\n---------------------------------------------- \r\n\r\n**Redhat or Fedora** \r\n\r\n* yum install kvm \r\n* yum install virt-manager libvirt libvirt-python python-virtinst \r\n* chkconfig libvirtd on \r\n* service libvirtd start\r\n\r\n\r\nNote\r\n------\r\nTypically the guests harddrive is not attached, you must add it in the configuration.\r\n\r\nTypically the guests memory is set to 100mbs, you might want to change that in the configuration.\r\n\r\nOnce booted and ssh'd into the VM, cat /etc/network/interfaces to verify that the DNS settings are correct.\r\n\r\nDebian/ubuntu guest don't have acpid installed by default. (Could change the vmbuilder string)\r\n", "source_format": "rst", "revision_number": 3, "created": 1288115532000}, {"id": "f1dffe80-2f95-11f1-bea3-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nThis document talks about a guest named *mbison*. Change this name to better suit your purpose. \r\n\r\n\r\n\r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n .. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n .. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nList all guests\r\n----------------\r\n \r\nList all guests:: \r\n \r\n virsh # list --all\r\n\r\n\r\n\r\nStart a guest\r\n------------------\r\n\r\nStart a guest::  \r\n\r\n virsh # start mbison\r\n\r\nFlag a guest for autostart on host reboot\r\n--------------------------------------------\r\n\r\nFlag a guest for autostart on host reboot::  \r\n\r\n virsh # autostart mbison\r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n\r\nEdit a guests configuration file::  \r\n\r\n virsh # edit mbison\r\n\r\nShutdown a guest\r\n---------------------\r\nShutdown a guest gracefully::\r\n \r\n virsh # shutdown mbison\r\n\r\nThis doesn't always work.  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n .. code-block:: xml\r\n\r\n  <feature>\r\n\r\n     <acpi/>\r\n\r\n  </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\nOn debian / ubuntu run:\r\n \r\n .. code-block:: bash\r\n\r\n  $ sudo apt-get install acpid\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n\r\nPull the power on a guest::  \r\n\r\n virsh # destroy mbison\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\nQuit virsh cli::  \r\n\r\n virsh # quit\r\n\r\n\r\n\r\nInstall packages \r\n---------------------------------------------- \r\n\r\nRedhat or Fedora \r\n  yum install kvm \r\n  yum install virt-manager libvirt libvirt-python python-virtinst \r\n  chkconfig libvirtd on \r\n  service libvirtd start\r\n\r\nNote\r\n------\r\nTypically the guests harddrive is not attached, you must add it in the configuration.\r\n\r\nTypically the guests memory is set to 100mbs, you might want to change that in the configuration.\r\n\r\nOnce booted and ssh'd into the VM, cat /etc/network/interfaces to verify that the DNS settings are correct.\r\n\r\nDebian/ubuntu guest don't have acpid installed by default. (Could change the vmbuilder string)\r\n", "source_format": "rst", "revision_number": 2, "created": 1288115400000}, {"id": "f1dff11c-2f95-11f1-be99-e86a64d24d78", "node_id": "f1df5bd8-2f95-11f1-9651-e86a64d24d78", "user_id": "edc3f576-2f95-11f1-900f-e86a64d24d78", "author": "foxhop", "data": "KVM guest management\r\n=======================\r\n\r\n.. contents:: \r\n\r\n\r\nThis document talks about a guest named *mbison*. Change this name to better suit your purpose. \r\n\r\n\r\n\r\n\r\n\r\nKVM virsh cheat sheet!\r\n============================\r\n\r\nThis is a list of commands to use in the virsh cli.\r\n\r\nTo start the virsh cli run the following cmd:\r\n\r\n .. code-block:: bash\r\n  \r\n  $ virsh\r\n\r\nor:\r\n\r\n .. code-block:: bash\r\n\r\n  virsh --connect qemu:///system\r\n\r\nList all guests\r\n----------------\r\n \r\nList all guests:: \r\n \r\n virsh # list --all\r\n\r\n\r\n\r\nStart a guest\r\n------------------\r\n\r\nStart a guest::  \r\n\r\n virsh # start mbison\r\n\r\nFlag a guest for autostart on host reboot\r\n--------------------------------------------\r\n\r\nFlag a guest for autostart on host reboot::  \r\n\r\n virsh # autostart mbison\r\n\r\nEdit a guests configuration file\r\n-----------------------------------\r\n\r\nEdit a guests configuration file::  \r\n\r\n virsh # edit mbison\r\n\r\nShutdown a guest\r\n---------------------\r\nShutdown a guest gracefully::\r\n \r\n virsh # shutdown mbison\r\n\r\nThis doesn't always work.  \r\n\r\nBe sure the guests XML file has the following entry:\r\n\r\n .. code-block:: xml\r\n\r\n  <feature>\r\n\r\n     <acpi/>\r\n\r\n  </feature>\r\n\r\nAlso make sure the apci is installed on the guest operating system.\r\n\r\nOn debian / ubuntu run:\r\n \r\n .. code-block:: bash\r\n\r\n  $ sudo apt-get install acpid\r\n\r\n\r\nPull the power on a guest\r\n----------------------------\r\n\r\nPull the power on a guest::  \r\n\r\n virsh # destroy mbison\r\n\r\nQuit virsh cli\r\n-----------------\r\n\r\nQuit virsh cli::  \r\n\r\n virsh # quit\r\n\r\n\r\nNote\r\n------\r\nTypically the guests harddrive is not attached, you must add it in the configuration.\r\n\r\nTypically the guests memory is set to 100mbs, you might want to change that in the configuration.\r\n\r\nOnce booted and ssh'd into the VM, cat /etc/network/interfaces to verify that the DNS settings are correct.\r\n\r\nDebian/ubuntu guest don't have acpid installed by default. (Could change the vmbuilder string)\r\n", "source_format": "rst", "revision_number": 1, "created": 1276973303000}], "count": 72}