1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-16 22:50:10 +03:00

F #4984: Add graphics section to vmm_exec_kvm.conf (#1386)

This commit is contained in:
Pavel Czerný 2021-08-03 09:55:05 +02:00 committed by GitHub
parent 8dda911074
commit 0edcc7a7ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 12 deletions

View File

@ -418,10 +418,11 @@ int VirtualMachine::parse_graphics(string& error_str, Template * tmpl)
}
}
string random_passwd = graphics->vector_value("RANDOM_PASSWD");
bool random_passwd;
graphics->vector_value("RANDOM_PASSWD", random_passwd);
string password = graphics->vector_value("PASSWD");
if ( !random_passwd.empty() && password.empty() )
if ( random_passwd && password.empty() )
{
password = one_util::random_password();

View File

@ -536,12 +536,6 @@ int LibVirtDriver::deployment_description_kvm(
const VectorAttribute * graphics;
string listen = "";
string port = "";
string passwd = "";
string keymap = "";
string spice_options = "";
const VectorAttribute * input;
vector<const VectorAttribute *> pci;
@ -1589,11 +1583,33 @@ int LibVirtDriver::deployment_description_kvm(
if ( graphics != 0 )
{
type = graphics->vector_value("TYPE");
listen = graphics->vector_value("LISTEN");
string listen;
string port;
string passwd;
string keymap;
string spice_options;
bool random_passwrd;
get_attribute(vm, host, cluster, "GRAPHICS", "TYPE", type);
get_attribute(vm, host, cluster, "GRAPHICS", "LISTEN", listen);
get_attribute(vm, host, cluster, "GRAPHICS", "PASSWD", passwd);
get_attribute(vm, host, cluster, "GRAPHICS", "KEYMAP", keymap);
get_attribute(vm, host, cluster, "GRAPHICS", "RANDOM_PASSWD", random_passwrd);
port = graphics->vector_value("PORT");
passwd = graphics->vector_value("PASSWD");
keymap = graphics->vector_value("KEYMAP");
if ( random_passwrd && passwd.empty())
{
passwd = one_util::random_password();
if ( graphics->vector_value("TYPE") == "SPICE" )
{
// Spice password must be 60 characters maximum
passwd = passwd.substr(0, 59);
}
const_cast<VectorAttribute*>(graphics)->replace("PASSWD", passwd);
}
one_util::tolower(type);

View File

@ -21,6 +21,7 @@
# - os [kernel,initrd,boot,root,kernel_cmd,arch,machine,sd_disk_bus]
# - vcpu
# - memory_slots: number of memory slots for hotplug memory
# - graphics [type, listen, passwd, keymap, random_passwd]
# - features [acpi, pae, apic, hyperv, localtime, guest_agent, virtio_scsi_queues, iothreads]
# - cpu_model [model]
# - disk [driver, cache, io, discard, total_bytes_sec, total_iops_sec, read_bytes_sec, write_bytes_sec, read_iops_sec, write_iops_sec, size_iops_sec]
@ -62,6 +63,14 @@ NIC = [
# FILTER = "clean-traffic"
]
# GRAPHICS = [
# TYPE = "vnc",
# LISTEN = "0.0.0.0",
# PASSWD = "",
# KEYMAP = "",
# RANDOM_PASSWD = "YES"
# ]
#RAW = "<devices><serial type=\"pty\"><source path=\"/dev/pts/5\"/><target port=\"0\"/></serial><console type=\"pty\" tty=\"/dev/pts/5\"><source path=\"/dev/pts/5\"/><target port=\"0\"/></console></devices>"
HYPERV_OPTIONS = "<relaxed state='on'/><vapic state='on'/><spinlocks state='on' retries='4096'/>"