diff --git a/DOCUMENTATION.md b/DOCUMENTATION.md index 6d50176..d7a8abb 100644 --- a/DOCUMENTATION.md +++ b/DOCUMENTATION.md @@ -10,6 +10,12 @@ Please refer to the README file, all install steps are described. Not refered in the install, but you can pipx for you install. +# Networking + +Hype use OpenvSwicth for interface and network creation. Common ovs command use in case of debgug. +DNSMask, provided by LXC, is used to create DHCP for Interface configuration. + + # Storage The server storage are in *{HYPE}/storage/* @@ -99,3 +105,9 @@ SOLUTION 1 (on CLI): virsh reset VM_NAME SOLUTION 2 (on CLI): virsh destroy VM_NAME (destroy the VM) + + +ERROR: libvirt: Storage Driver error : Requested operation is not valid: storage pool 'iso' is not active + +SOLUTION (on CLI): pool = conn.storagePoolLookupByName('iso') + pool.undefine() diff --git a/README.md b/README.md index 7e08f65..d21adbc 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ - Now compatible with Windows Install, just take care to launch the driver before scanning disks. - Screenshot and VM live edition (RAM and vCPU until Max declared) added - Disk creation and resize - +- Nework management (add,del network and interfaces) ```mermaid graph LR @@ -15,7 +15,8 @@ Server[Server] <----> LXC((LXC)) -## Install requirements +## Install requirements (Debian example +For your safty you can also find the packages on pip or pipx 1 - Update and Install packages : @@ -24,6 +25,8 @@ apt-get update -y -qq apt-get install git lxc lxcfs lxc-templates qemu qemu-utils qemu-kvm virtinst bridge-utils virt-manager libvirt-daemon libvirt-daemon-system virt-viewer libvirt-clients libosinfo-bin websockify sqlite3 novnc apt-get install python3 python3-flask python3-flask-login python3-flask-sqlalchemy python3-requests python3-lxc python3-libvirt python3-psutil python3-werkzeug python3-websockify python3-novnc python3-flask-socketio python3-types-pyopenssl +apt-get install openvswitch-switch openvswitch-common + ``` Clone the repository : @@ -222,7 +225,6 @@ systemctl start hype.service You can also change some configuration in the file *configuration.py* such as flask port, storage location...use it at your own risk. - ## Others You can upload ISO directly from the interface. diff --git a/functions/fnet.py b/functions/fnet.py index f6fec25..e3262e8 100644 --- a/functions/fnet.py +++ b/functions/fnet.py @@ -44,18 +44,28 @@ def get_int(net_name): def create_vswitch_int(net_int): cmd="ovs-vsctl add-br "+net_int - subprocess.call(cmd, shell=True) + out = subprocess.call(cmd, shell=True) + if out2 != 0: + raise Exception("Error on creating interface") + def delete_network(net_name,net_int): cmd = "ovs-vsctl del-br "+net_int - subprocess.call(cmd, shell=True) - network = conn.networkLookupByName(net_name) #Lapin + out = subprocess.call(cmd, shell=True) + if out != 0: + raise Exception("Error deleting interface") + network = conn.networkLookupByName(net_name) network.destroy() network.undefine() cmd2="kill $(cat /run/dhypecp_"+net_int+".pid)" - subprocess.call(cmd2, shell=True) + out2 = subprocess.call(cmd2, shell=True) + if out2 != 0: + raise Exception("Error on killing DHCP process") cmd3="rm -f /run/dhypecp_"+net_int+".pid" - subprocess.call(cmd3, shell=True) + out3 = subprocess.call(cmd3, shell=True) + if out3 != 0: + raise Exception("Error on Deleting DHCP process") + def create_network(net_name,net_int): create_vswitch_int(net_int) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..1387f44 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ +flask +flask_sqlalchemy +flask_login +pyopenssl diff --git a/templates/edit.html b/templates/edit.html index b09fa99..9268962 100644 --- a/templates/edit.html +++ b/templates/edit.html @@ -34,7 +34,7 @@


Changing vCPU and/or Memory will restart {{ vm_name }}

- + @@ -79,7 +79,7 @@
- +
@@ -103,7 +103,7 @@
- + @@ -126,7 +126,7 @@ {%endfor%}
- + diff --git a/templates/edit_lxc.html b/templates/edit_lxc.html index dd39a64..bddfbe9 100644 --- a/templates/edit_lxc.html +++ b/templates/edit_lxc.html @@ -23,7 +23,7 @@
Max Memory :

Swap :



- + diff --git a/templates/layout.html b/templates/layout.html index 99aaf94..13951eb 100644 --- a/templates/layout.html +++ b/templates/layout.html @@ -101,6 +101,10 @@ var menu_btn = document.querySelector("#menu-btn"); var sidebar = document.querySelector("#sidebar"); var container = document.querySelector(".my-container"); + +sidebar.classList.remove("active-nav"); +container.classList.remove("active-cont"); + menu_btn.addEventListener("click", () => { sidebar.classList.toggle("active-nav"); container.classList.toggle("active-cont"); diff --git a/templates/menu.html.ok b/templates/menu.html.ok new file mode 100644 index 0000000..0211781 --- /dev/null +++ b/templates/menu.html.ok @@ -0,0 +1,55 @@ + +
+ +
+ +
+{% with messages = get_flashed_messages(with_categories=true) %} + {% if messages %} + {% for category, message in messages %} +
{{ message }}
+ {% endfor %} + {% endif %} +{% endwith %} +
+
diff --git a/templates/network.html b/templates/network.html index 07fda18..69e7eab 100644 --- a/templates/network.html +++ b/templates/network.html @@ -4,66 +4,92 @@
Add Network


-Physical Interfaces: -
-
-
    -
  • +
    +
    +
    +
    + Physical interface +
    +
    {% for pint in net_hard_int %} - {{ pint }}
    + {{ pint }}
    {% endfor %} -
  • -
-
-
-

-
-Virtual Interfaces: -
-
-
    - {% for noac in net_na %} -
  • - {{ noac }} Not active
    -
  • - {% endfor %} - {% for item in net_tree %} -
  • -
    - {{ item[0][0][0] }} - {{ item[0][0][1] }} - {{ item[0][0][2] }} - -
    - - -
    -
    -
      - {% for sub_item in item[1] %} -
    • -

      {{ sub_item[0] }}

      - {% for pitem in sub_item[1] %} -
      -
      {{ pitem[0] }} - {{ pitem[1] }} - {{ pitem[2] }}
      -
      - - -
      - - - - - -
      -
      - {% endfor %} -
    • - {% endfor %} -
    -
  • - {% endfor %} -
-
+
+
+
- + +
+
+
+
+
+
+
+ Virtual interface +
+
+ +{% for noac in net_na %} +
+
+
+
+
+ {{ noac }} Not active +
+
+
+

+{% endfor %} +{% for item in net_tree %} +
+
+
+
+
+ +
+ {{ item[0][0][0] }} - {{ item[0][0][1] }} - {{ item[0][0][2] }} + +
+ + +
+
+
+
+ {% for sub_item in item[1] %} +
+
+
+
+
+ {{ sub_item[0] }}
+
+
+ {% for pitem in sub_item[1] %} + + +
+ {{ pitem[0] }} - {{ pitem[1] }} - {{ pitem[2] }}
+
+
+ + + + + +
+
+ {% endfor %} +
+
+
+
+
+ {% endfor %} +
+{% endfor %} {% endblock %}