1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-01 16:36:06 +00:00

refactor(instances): a new disk's name prefix comes from vol_dev_type

get_new_disk_dev() mapped virtio to vd, ide to hd, fdc to fd and other buses to sd itself; vrtManager.util.vol_dev_type() has that mapping, and the bus change in vrtManager uses it with the same sd fallback.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
This commit is contained in:
catborise 2026-11-08 12:24:18 +03:00
parent cc104716e0
commit f97708a7b7
2 changed files with 13 additions and 10 deletions

View file

@ -18,7 +18,7 @@ from logs.audit import reason, write
from operations.models import Operation
from vrtManager.connection import other_hosts, wvmConnect
from vrtManager.instance import wvmInstance, wvmInstances
from vrtManager.util import ConnectionFailed, message
from vrtManager.util import ConnectionFailed, message, vol_dev_type
from .models import Instance
@ -206,14 +206,7 @@ def check_user_quota(user, instance, cpu, memory, disk_size):
def get_new_disk_dev(media, disks, bus):
existing_disk_devs = []
existing_media_devs = []
if bus == "virtio":
dev_base = "vd"
elif bus == "ide":
dev_base = "hd"
elif bus == "fdc":
dev_base = "fd"
else:
dev_base = "sd"
dev_base = vol_dev_type(bus) or "sd"
if disks:
existing_disk_devs = [disk["dev"] for disk in disks]