{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "b3474be6",
   "metadata": {},
   "source": [
    "###  Homework 4"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f4f188b5",
   "metadata": {},
   "source": [
    "**systemd**\n",
    "- On run01 VM, install package ```tinyproxy```.\n",
    "- Check the status of service ```tinyproxy```.\n",
    "- Assign ownership of ```tinyproxy``` user and group on directory /var/log/tinyproxy.\n",
    "- Restart service ```tinyproxy```.\n",
    "- Check the service status.\n",
    "- Browse the content of the unit file.\n",
    "\n",
    "**User environment**\n",
    "- On run01, create directory ```/usr/local/software/bin```.\n",
    "- Add the directory in the PATH environment variable for user jerry.\n",
    "- Add the directory in the PATH environment variable for all the users on the system.\n",
    "\n",
    "**Python scripting**\n",
    "- On the desktop, copy file ``` /etc/libvirt/qemu/kvm1.xml``` into directory Python, where jupyter notebook is running. Make the file readable for all users.\n",
    "- Develop a python script in jupyter to read the file and print out the value of RAM, number of CPUs, and the location of the qcow2 file for the VM.\n",
    "- Hint: in the lines, look for strings containing 'memory', 'vcpu', and 'source file', accordingly. Use module ```re``` and method ```split```, re.split(), to separate the line content by regular expressions depicting symbols ```<```, ```>```, ```/>```, and ```=```.\n",
    "- In the home directory on VD, create directory HW4. Copy `kvm1.xml` into directory HW4. In directory HW4, implement the above python script in executable file ```vm_xml.py```.\n",
    "- Modify the script to read the xml file as input parameter by using ```sys.argv[1]``` in the script to reference the file then run:\n",
    "  ```bash\n",
    "  ./vm_xml.py kvm1.xml\n",
    "  ```\n",
    "- Copy file ```/etc/libvirt/qemu/rocky10.xml``` in HW4, and run\n",
    "  ```bash\n",
    "  ./vm_xml.py rocky10.xml\n",
    "  ```"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.13.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
