<commit_before>.. _vm-deployment:

Deploy VMs From Controller
==========================

On Controller VM
----------------

- Create a group for the VMs (this example will create a group for infrastructure VMs within the additional groups of ``services,cluster,domain`` and containing the nodes ``infra[1-3]``)::

    metal configure group infra

- Create a deployment file for the ``infra`` group at ``/var/lib/metalware/repo/config/infra.yaml`` with the following content::

    vm:
      server: master1 master2
      virtpool: /opt/vm/
      nodename: "<%= node.name %>-<%= domain.config.cluster %>"
      primac: 52:54:00:78:<%= '%02x' % node.group.index %>:<%= '%02x' % node.index %>
      extmac: 52:54:00:78:<%= '%02x' % (node.group.index + 1) %>:<%= '%02x' % node.index %>
      vncpassword: 'password'
      disksize: 250
    kernelappendoptions: "console=tty0 console=ttyS0 115200n8"
    disksetup: |
      zerombr
      bootloader --location=mbr --driveorder=vda --append="console=tty0 console=ttyS0,115200n8"
      clearpart --all --initlabel

      #Disk partitioning information
      part /boot --fstype ext4 --size=4096 --asprimary --ondisk vda
      part pv.01 --size=1 --grow --asprimary --ondisk vda
      volgroup system pv.01
      logvol  /  --fstype ext4 --vgname=system  --size=16384 --name=root
      logvol  /var --fstype ext4 --vgname=system --size=16384 --name=var
      logvol  /tmp --fstype ext4 --vgname=system --size=1 --grow --name=tmp
      logvol  swap  --fstype swap --vgname=system  --size=8096  --name=swap1

.. note:: Replace ``master1 master2`` with the hostnames of the libvirt master, ensure that there's an entry for the server in ``/etc/hosts``. If there are more than one VM servers then create a space separated list

- Add the following to the configuration file for the controller node at ``/var/lib/metalware/repo/config/self.yaml`` (using the same vm server names as above)::

    vm:
      server: master1 master2

- Install the libvirt client package on the controller for managing the VM master server::

    yum -y install libvirt-client virt-install

- Additionally, download the certificate authority script to ``/opt/alces/install/scripts/certificate_authority.sh`` and VM creation script to ``/opt/alces/install/scripts/vm.sh``::<commit_msg>Fix string conversion for MAC address generation<commit_after>.. _vm-deployment:

Deploy VMs From Controller
==========================

On Controller VM
----------------

- Create a group for the VMs (this example will create a group for infrastructure VMs within the additional groups of ``services,cluster,domain`` and containing the nodes ``infra[1-3]``)::

    metal configure group infra

- Create a deployment file for the ``infra`` group at ``/var/lib/metalware/repo/config/infra.yaml`` with the following content::

    vm:
      server: master1 master2
      virtpool: /opt/vm/
      nodename: "<%= node.name %>-<%= domain.config.cluster %>"
      primac: 52:54:00:78:<%= '%02x' % node.group.index.to_s %>:<%= '%02x' % node.index.to_s %>
      extmac: 52:54:00:78:<%= '%02x' % (node.group.index + 1).to_s %>:<%= '%02x' % node.index.to_s %>
      vncpassword: 'password'
      disksize: 250
    kernelappendoptions: "console=tty0 console=ttyS0 115200n8"
    disksetup: |
      zerombr
      bootloader --location=mbr --driveorder=vda --append="console=tty0 console=ttyS0,115200n8"
      clearpart --all --initlabel

      #Disk partitioning information
      part /boot --fstype ext4 --size=4096 --asprimary --ondisk vda
      part pv.01 --size=1 --grow --asprimary --ondisk vda
      volgroup system pv.01
      logvol  /  --fstype ext4 --vgname=system  --size=16384 --name=root
      logvol  /var --fstype ext4 --vgname=system --size=16384 --name=var
      logvol  /tmp --fstype ext4 --vgname=system --size=1 --grow --name=tmp
      logvol  swap  --fstype swap --vgname=system  --size=8096  --name=swap1

.. note:: Replace ``master1 master2`` with the hostnames of the libvirt master, ensure that there's an entry for the server in ``/etc/hosts``. If there are more than one VM servers then create a space separated list

- Add the following to the configuration file for the controller node at ``/var/lib/metalware/repo/config/self.yaml`` (using the same vm server names as above)::

    vm:
      server: master1 master2

- Install the libvirt client package on the controller for managing the VM master server::

    yum -y install libvirt-client virt-install

- Additionally, download the certificate authority script to ``/opt/alces/install/scripts/certificate_authority.sh`` and VM creation script to ``/opt/alces/install/scripts/vm.sh``::
{'fraction_non_alphanumeric': 0.14258106076873522, 'fraction_numerical': 0.035645265192183806, 'mean_word_length': 3.162645218945487, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2129207', 'n_tokens_mistral': 1555, 'n_tokens_neox': 1421, 'n_words': 475}