- option to auto-attach ISO to VMs #20

- added splash screen (ASCII ART) option to skip #21
- Implemented disk options as variables from config #19
- Related changes in config creation / editing menus
This commit is contained in:
OVERLORD7F
2025-09-15 17:44:55 +03:00
parent 1a92e86704
commit 0f6e17a73c
5 changed files with 196 additions and 21 deletions

13
main.py
View File

@@ -7,7 +7,7 @@ from data_pools_api import *
from disk_edit_mode import *
from rich.panel import Panel
from rich.console import Console , Align
SVMU_ver="0.3-dev"
SVMU_ver="0.35-dev"
config_relative_path = os.path.join(os.getcwd() , 'SpaceVM_Utility.conf') #config in the same directory with main.py
@@ -18,10 +18,11 @@ if not os.path.exists(config_relative_path):
menu_choice=0
console = Console()
os.system('cls' if os.name=='nt' else 'clear')
show_startup_logo(SVMU_ver) #shows startup splash (ASCII art)
skip_startup_splash = get_skip_startup_splash(config_relative_path)
show_startup_logo(skip_startup_splash, SVMU_ver) #shows startup splash (ASCII art)
while(menu_choice != ""): #main menu loop
check_config(config_relative_path)
base_url, api_key, data_pool_uuid, data_pool_name, vm_uuids, vm_names, disk1_size, disk2_size, disk3_size = config_import(config_relative_path) #importing API-KEY / IP / DATA POOL UUID / VM-UUIDs from config
skip_startup_splash, base_url, api_key, data_pool_uuid, data_pool_name, vm_uuids, vm_names, disk1_size, disk2_size, disk3_size, disk_interface, preallocation, iso_uuid, iso_name = config_import(config_relative_path) #importing API-KEY / IP / DATA POOL UUID / VM-UUIDs from config
menu_options=f"[gold bold][1] [grey53 italic]Manage utility config\n[/grey53 italic] \
\n[gold bold][2] [grey53 italic]Enter disk edit mode[/grey53 italic]\n \
\n[gold bold][3] [grey53 italic]Show breif cluster overview[/grey53 italic]\n \
@@ -29,15 +30,15 @@ while(menu_choice != ""): #main menu loop
\n[gold bold][5] [grey53 italic]Show data pools[/grey53 italic]\n \
\n\n[green_yellow bold]ENTER - exit Utility[/]\n\n \
[underline bold grey53]Currently imported config:[/]\n \
[bold grey53]Connected to Controller: [bright_yellow]{base_url}[/]\n Selected Data Pool: [bright_yellow]{data_pool_name}[/]\n Selected VMs:\n [bright_yellow]{vm_names}"
[bold grey53]Connected to Controller: [bright_yellow]{base_url}[/]\n Selected Data Pool: [bright_yellow]{data_pool_name}[/]\n Selected VMs:\n [bright_yellow]{vm_names}[/]\n Auto-mount ISO: [bright_cyan]{iso_name}[/]"
menu_options=Align.center(menu_options, vertical="middle")
menu_subtitle = "[blue bold][link=https://github.com/OVERLORD7F/SpaceVM_VM_Utility]:wrench: Project_GitHub[/link] [yellow]| [magenta bold][link=https://spacevm.ru/docs/]:books: SpaceVM_Docs[/link] [yellow]| [red bold][link=https://comptek.ru]:briefcase: Comptek[/link]"
menu_subtitle = "[blue bold][link=https://github.com/OVERLORD7F/SVMU]:wrench: Project_GitHub[/link] [yellow]| [magenta bold][link=https://spacevm.ru/docs/]:books: SpaceVM_Docs[/link] [yellow]| [red bold][link=https://comptek.ru]:briefcase: Comptek[/link]"
console.print(Panel(menu_options, title=f"[bold magenta]SpaceVM Utility {SVMU_ver} - Main Menu" , subtitle = menu_subtitle, subtitle_align="right" , style="yellow" , width=150 , padding = 2))
menu_choice=str(input("\n>>> "))
if menu_choice == "1":
config_menu(base_url, api_key, config_relative_path)
if menu_choice == "2":
disk_edit_mode(base_url , api_key , data_pool_uuid , vm_uuids, disk1_size, disk2_size, disk3_size)
disk_edit_mode(base_url , api_key , data_pool_uuid , vm_uuids, disk1_size, disk2_size, disk3_size, disk_interface, preallocation, iso_uuid)
if menu_choice == "3":
cluster_info(base_url , api_key)
if menu_choice == "4":