mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
conf: add <serial type='dbus'>
Like a Spice port, a dbus serial must specify an associated channel name. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
1ce258a570
commit
7648e40da5
@ -716,6 +716,7 @@ VIR_ENUM_IMPL(virDomainChr,
|
|||||||
"spiceport",
|
"spiceport",
|
||||||
"nmdm",
|
"nmdm",
|
||||||
"qemu-vdagent",
|
"qemu-vdagent",
|
||||||
|
"dbus",
|
||||||
);
|
);
|
||||||
|
|
||||||
VIR_ENUM_IMPL(virDomainChrTcpProtocol,
|
VIR_ENUM_IMPL(virDomainChrTcpProtocol,
|
||||||
@ -2712,6 +2713,7 @@ virDomainChrSourceDefGetPath(virDomainChrSourceDef *chr)
|
|||||||
case VIR_DOMAIN_CHR_TYPE_SPICEVMC:
|
case VIR_DOMAIN_CHR_TYPE_SPICEVMC:
|
||||||
case VIR_DOMAIN_CHR_TYPE_SPICEPORT:
|
case VIR_DOMAIN_CHR_TYPE_SPICEPORT:
|
||||||
case VIR_DOMAIN_CHR_TYPE_QEMU_VDAGENT:
|
case VIR_DOMAIN_CHR_TYPE_QEMU_VDAGENT:
|
||||||
|
case VIR_DOMAIN_CHR_TYPE_DBUS:
|
||||||
case VIR_DOMAIN_CHR_TYPE_LAST:
|
case VIR_DOMAIN_CHR_TYPE_LAST:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -2755,6 +2757,10 @@ virDomainChrSourceDefClear(virDomainChrSourceDef *def)
|
|||||||
case VIR_DOMAIN_CHR_TYPE_SPICEPORT:
|
case VIR_DOMAIN_CHR_TYPE_SPICEPORT:
|
||||||
VIR_FREE(def->data.spiceport.channel);
|
VIR_FREE(def->data.spiceport.channel);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case VIR_DOMAIN_CHR_TYPE_DBUS:
|
||||||
|
VIR_FREE(def->data.dbus.channel);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
VIR_FREE(def->logfile);
|
VIR_FREE(def->logfile);
|
||||||
@ -2826,6 +2832,10 @@ virDomainChrSourceDefCopy(virDomainChrSourceDef *dest,
|
|||||||
dest->data.qemuVdagent.mouse = src->data.qemuVdagent.mouse;
|
dest->data.qemuVdagent.mouse = src->data.qemuVdagent.mouse;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case VIR_DOMAIN_CHR_TYPE_DBUS:
|
||||||
|
dest->data.dbus.channel = g_strdup(src->data.dbus.channel);
|
||||||
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_CHR_TYPE_NULL:
|
case VIR_DOMAIN_CHR_TYPE_NULL:
|
||||||
case VIR_DOMAIN_CHR_TYPE_VC:
|
case VIR_DOMAIN_CHR_TYPE_VC:
|
||||||
case VIR_DOMAIN_CHR_TYPE_STDIO:
|
case VIR_DOMAIN_CHR_TYPE_STDIO:
|
||||||
@ -2910,6 +2920,12 @@ virDomainChrSourceDefIsEqual(const virDomainChrSourceDef *src,
|
|||||||
case VIR_DOMAIN_CHR_TYPE_QEMU_VDAGENT:
|
case VIR_DOMAIN_CHR_TYPE_QEMU_VDAGENT:
|
||||||
return src->data.qemuVdagent.clipboard == tgt->data.qemuVdagent.clipboard &&
|
return src->data.qemuVdagent.clipboard == tgt->data.qemuVdagent.clipboard &&
|
||||||
src->data.qemuVdagent.mouse == tgt->data.qemuVdagent.mouse;
|
src->data.qemuVdagent.mouse == tgt->data.qemuVdagent.mouse;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VIR_DOMAIN_CHR_TYPE_DBUS:
|
||||||
|
return STREQ_NULLABLE(src->data.dbus.channel,
|
||||||
|
tgt->data.dbus.channel);
|
||||||
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_CHR_TYPE_NULL:
|
case VIR_DOMAIN_CHR_TYPE_NULL:
|
||||||
case VIR_DOMAIN_CHR_TYPE_VC:
|
case VIR_DOMAIN_CHR_TYPE_VC:
|
||||||
@ -11343,6 +11359,10 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDef *def,
|
|||||||
def->data.spiceport.channel = virXMLPropString(sources[0], "channel");
|
def->data.spiceport.channel = virXMLPropString(sources[0], "channel");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case VIR_DOMAIN_CHR_TYPE_DBUS:
|
||||||
|
def->data.dbus.channel = virXMLPropString(sources[0], "channel");
|
||||||
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_CHR_TYPE_NMDM:
|
case VIR_DOMAIN_CHR_TYPE_NMDM:
|
||||||
def->data.nmdm.master = virXMLPropString(sources[0], "master");
|
def->data.nmdm.master = virXMLPropString(sources[0], "master");
|
||||||
def->data.nmdm.slave = virXMLPropString(sources[0], "slave");
|
def->data.nmdm.slave = virXMLPropString(sources[0], "slave");
|
||||||
@ -25210,6 +25230,11 @@ virDomainChrSourceDefFormat(virBuffer *buf,
|
|||||||
virBufferEscapeString(buf, "<source channel='%s'/>\n",
|
virBufferEscapeString(buf, "<source channel='%s'/>\n",
|
||||||
def->data.spiceport.channel);
|
def->data.spiceport.channel);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case VIR_DOMAIN_CHR_TYPE_DBUS:
|
||||||
|
virBufferEscapeString(buf, "<source channel='%s'/>\n",
|
||||||
|
def->data.dbus.channel);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (def->logfile) {
|
if (def->logfile) {
|
||||||
|
@ -1242,6 +1242,7 @@ typedef enum {
|
|||||||
VIR_DOMAIN_CHR_TYPE_SPICEPORT,
|
VIR_DOMAIN_CHR_TYPE_SPICEPORT,
|
||||||
VIR_DOMAIN_CHR_TYPE_NMDM,
|
VIR_DOMAIN_CHR_TYPE_NMDM,
|
||||||
VIR_DOMAIN_CHR_TYPE_QEMU_VDAGENT,
|
VIR_DOMAIN_CHR_TYPE_QEMU_VDAGENT,
|
||||||
|
VIR_DOMAIN_CHR_TYPE_DBUS,
|
||||||
|
|
||||||
VIR_DOMAIN_CHR_TYPE_LAST
|
VIR_DOMAIN_CHR_TYPE_LAST
|
||||||
} virDomainChrType;
|
} virDomainChrType;
|
||||||
@ -1321,6 +1322,9 @@ struct _virDomainChrSourceDef {
|
|||||||
virDomainMouseMode mouse;
|
virDomainMouseMode mouse;
|
||||||
virTristateBool clipboard;
|
virTristateBool clipboard;
|
||||||
} qemuVdagent;
|
} qemuVdagent;
|
||||||
|
struct {
|
||||||
|
char *channel;
|
||||||
|
} dbus;
|
||||||
} data;
|
} data;
|
||||||
char *logfile;
|
char *logfile;
|
||||||
virTristateSwitch logappend;
|
virTristateSwitch logappend;
|
||||||
|
@ -909,6 +909,24 @@ virDomainDiskDefValidate(const virDomainDef *def,
|
|||||||
#define SERIAL_CHANNEL_NAME_CHARS \
|
#define SERIAL_CHANNEL_NAME_CHARS \
|
||||||
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-."
|
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-."
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
virDomainChrSourceDefValidateChannelName(const char *name)
|
||||||
|
{
|
||||||
|
if (!name) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
|
_("Missing source channel attribute for char device"));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (strspn(name, SERIAL_CHANNEL_NAME_CHARS) < strlen(name)) {
|
||||||
|
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
||||||
|
_("Invalid character in source channel for char device"));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
virDomainChrSourceDefValidate(const virDomainChrSourceDef *src_def,
|
virDomainChrSourceDefValidate(const virDomainChrSourceDef *src_def,
|
||||||
const virDomainChrDef *chr_def,
|
const virDomainChrDef *chr_def,
|
||||||
@ -995,17 +1013,13 @@ virDomainChrSourceDefValidate(const virDomainChrSourceDef *src_def,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_CHR_TYPE_SPICEPORT:
|
case VIR_DOMAIN_CHR_TYPE_SPICEPORT:
|
||||||
if (!src_def->data.spiceport.channel) {
|
if (virDomainChrSourceDefValidateChannelName(src_def->data.spiceport.channel) < 0)
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
|
||||||
_("Missing source channel attribute for char device"));
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
break;
|
||||||
if (strspn(src_def->data.spiceport.channel,
|
|
||||||
SERIAL_CHANNEL_NAME_CHARS) < strlen(src_def->data.spiceport.channel)) {
|
case VIR_DOMAIN_CHR_TYPE_DBUS:
|
||||||
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
if (virDomainChrSourceDefValidateChannelName(src_def->data.dbus.channel) < 0)
|
||||||
_("Invalid character in source channel for char device"));
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4569,6 +4569,7 @@
|
|||||||
<value>spiceport</value>
|
<value>spiceport</value>
|
||||||
<value>nmdm</value>
|
<value>nmdm</value>
|
||||||
<value>qemu-vdagent</value>
|
<value>qemu-vdagent</value>
|
||||||
|
<value>dbus</value>
|
||||||
</choice>
|
</choice>
|
||||||
</define>
|
</define>
|
||||||
|
|
||||||
|
@ -1443,6 +1443,7 @@ qemuBuildChardevStr(const virDomainChrSourceDef *dev,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case VIR_DOMAIN_CHR_TYPE_DBUS:
|
||||||
case VIR_DOMAIN_CHR_TYPE_NMDM:
|
case VIR_DOMAIN_CHR_TYPE_NMDM:
|
||||||
case VIR_DOMAIN_CHR_TYPE_LAST:
|
case VIR_DOMAIN_CHR_TYPE_LAST:
|
||||||
default:
|
default:
|
||||||
@ -1531,6 +1532,7 @@ qemuBuildChardevCommand(virCommand *cmd,
|
|||||||
case VIR_DOMAIN_CHR_TYPE_SPICEVMC:
|
case VIR_DOMAIN_CHR_TYPE_SPICEVMC:
|
||||||
case VIR_DOMAIN_CHR_TYPE_SPICEPORT:
|
case VIR_DOMAIN_CHR_TYPE_SPICEPORT:
|
||||||
case VIR_DOMAIN_CHR_TYPE_QEMU_VDAGENT:
|
case VIR_DOMAIN_CHR_TYPE_QEMU_VDAGENT:
|
||||||
|
case VIR_DOMAIN_CHR_TYPE_DBUS:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_CHR_TYPE_NMDM:
|
case VIR_DOMAIN_CHR_TYPE_NMDM:
|
||||||
@ -8684,6 +8686,7 @@ qemuInterfaceVhostuserConnect(virCommand *cmd,
|
|||||||
case VIR_DOMAIN_CHR_TYPE_SPICEPORT:
|
case VIR_DOMAIN_CHR_TYPE_SPICEPORT:
|
||||||
case VIR_DOMAIN_CHR_TYPE_NMDM:
|
case VIR_DOMAIN_CHR_TYPE_NMDM:
|
||||||
case VIR_DOMAIN_CHR_TYPE_QEMU_VDAGENT:
|
case VIR_DOMAIN_CHR_TYPE_QEMU_VDAGENT:
|
||||||
|
case VIR_DOMAIN_CHR_TYPE_DBUS:
|
||||||
case VIR_DOMAIN_CHR_TYPE_LAST:
|
case VIR_DOMAIN_CHR_TYPE_LAST:
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("vhost-user type '%s' not supported"),
|
_("vhost-user type '%s' not supported"),
|
||||||
|
@ -6811,6 +6811,7 @@ qemuMonitorJSONAttachCharDevGetProps(const char *chrID,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case VIR_DOMAIN_CHR_TYPE_DBUS:
|
||||||
case VIR_DOMAIN_CHR_TYPE_SPICEPORT:
|
case VIR_DOMAIN_CHR_TYPE_SPICEPORT:
|
||||||
case VIR_DOMAIN_CHR_TYPE_PIPE:
|
case VIR_DOMAIN_CHR_TYPE_PIPE:
|
||||||
case VIR_DOMAIN_CHR_TYPE_STDIO:
|
case VIR_DOMAIN_CHR_TYPE_STDIO:
|
||||||
|
@ -6890,6 +6890,7 @@ qemuProcessPrepareHostBackendChardevOne(virDomainDeviceDef *dev,
|
|||||||
case VIR_DOMAIN_CHR_TYPE_SPICEVMC:
|
case VIR_DOMAIN_CHR_TYPE_SPICEVMC:
|
||||||
case VIR_DOMAIN_CHR_TYPE_SPICEPORT:
|
case VIR_DOMAIN_CHR_TYPE_SPICEPORT:
|
||||||
case VIR_DOMAIN_CHR_TYPE_QEMU_VDAGENT:
|
case VIR_DOMAIN_CHR_TYPE_QEMU_VDAGENT:
|
||||||
|
case VIR_DOMAIN_CHR_TYPE_DBUS:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_CHR_TYPE_FILE: {
|
case VIR_DOMAIN_CHR_TYPE_FILE: {
|
||||||
|
@ -2015,6 +2015,7 @@ qemuValidateDomainChrSourceDef(const virDomainChrSourceDef *def,
|
|||||||
case VIR_DOMAIN_CHR_TYPE_STDIO:
|
case VIR_DOMAIN_CHR_TYPE_STDIO:
|
||||||
case VIR_DOMAIN_CHR_TYPE_UDP:
|
case VIR_DOMAIN_CHR_TYPE_UDP:
|
||||||
case VIR_DOMAIN_CHR_TYPE_NMDM:
|
case VIR_DOMAIN_CHR_TYPE_NMDM:
|
||||||
|
case VIR_DOMAIN_CHR_TYPE_DBUS:
|
||||||
case VIR_DOMAIN_CHR_TYPE_LAST:
|
case VIR_DOMAIN_CHR_TYPE_LAST:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1556,6 +1556,7 @@ virSecurityDACSetChardevLabelHelper(virSecurityManager *mgr,
|
|||||||
case VIR_DOMAIN_CHR_TYPE_SPICEVMC:
|
case VIR_DOMAIN_CHR_TYPE_SPICEVMC:
|
||||||
case VIR_DOMAIN_CHR_TYPE_NMDM:
|
case VIR_DOMAIN_CHR_TYPE_NMDM:
|
||||||
case VIR_DOMAIN_CHR_TYPE_QEMU_VDAGENT:
|
case VIR_DOMAIN_CHR_TYPE_QEMU_VDAGENT:
|
||||||
|
case VIR_DOMAIN_CHR_TYPE_DBUS:
|
||||||
case VIR_DOMAIN_CHR_TYPE_LAST:
|
case VIR_DOMAIN_CHR_TYPE_LAST:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1641,6 +1642,7 @@ virSecurityDACRestoreChardevLabelHelper(virSecurityManager *mgr,
|
|||||||
case VIR_DOMAIN_CHR_TYPE_SPICEPORT:
|
case VIR_DOMAIN_CHR_TYPE_SPICEPORT:
|
||||||
case VIR_DOMAIN_CHR_TYPE_NMDM:
|
case VIR_DOMAIN_CHR_TYPE_NMDM:
|
||||||
case VIR_DOMAIN_CHR_TYPE_QEMU_VDAGENT:
|
case VIR_DOMAIN_CHR_TYPE_QEMU_VDAGENT:
|
||||||
|
case VIR_DOMAIN_CHR_TYPE_DBUS:
|
||||||
case VIR_DOMAIN_CHR_TYPE_LAST:
|
case VIR_DOMAIN_CHR_TYPE_LAST:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
43
tests/qemuxml2argvdata/graphics-dbus-chardev.xml
Normal file
43
tests/qemuxml2argvdata/graphics-dbus-chardev.xml
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<domain type='qemu'>
|
||||||
|
<name>QEMUGuest1</name>
|
||||||
|
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||||
|
<memory unit='KiB'>219100</memory>
|
||||||
|
<currentMemory unit='KiB'>219100</currentMemory>
|
||||||
|
<vcpu placement='static'>1</vcpu>
|
||||||
|
<os>
|
||||||
|
<type arch='i686' machine='pc'>hvm</type>
|
||||||
|
<boot dev='hd'/>
|
||||||
|
</os>
|
||||||
|
<clock offset='utc'/>
|
||||||
|
<on_poweroff>destroy</on_poweroff>
|
||||||
|
<on_reboot>restart</on_reboot>
|
||||||
|
<on_crash>destroy</on_crash>
|
||||||
|
<devices>
|
||||||
|
<emulator>/usr/bin/qemu-system-i386</emulator>
|
||||||
|
<controller type='usb' index='0'>
|
||||||
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
|
||||||
|
</controller>
|
||||||
|
<controller type='ide' index='0'>
|
||||||
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
|
||||||
|
</controller>
|
||||||
|
<controller type='pci' index='0' model='pci-root'/>
|
||||||
|
<serial type='dbus'>
|
||||||
|
<source channel='org.qemu.console.serial.0'/>
|
||||||
|
<target type='isa-serial' port='1'>
|
||||||
|
<model name='isa-serial'/>
|
||||||
|
</target>
|
||||||
|
</serial>
|
||||||
|
<console type='dbus'>
|
||||||
|
<source channel='org.qemu.console.serial.0'/>
|
||||||
|
<target type='serial' port='1'/>
|
||||||
|
</console>
|
||||||
|
<input type='mouse' bus='ps2'/>
|
||||||
|
<input type='keyboard' bus='ps2'/>
|
||||||
|
<graphics type='dbus' p2p='yes'/>
|
||||||
|
<video>
|
||||||
|
<model type='cirrus' vram='16384' heads='1' primary='yes'/>
|
||||||
|
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
|
||||||
|
</video>
|
||||||
|
<memballoon model='none'/>
|
||||||
|
</devices>
|
||||||
|
</domain>
|
1
tests/qemuxml2xmloutdata/graphics-dbus-chardev.xml
Symbolic link
1
tests/qemuxml2xmloutdata/graphics-dbus-chardev.xml
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../qemuxml2argvdata/graphics-dbus-chardev.xml
|
@ -416,6 +416,9 @@ mymain(void)
|
|||||||
QEMU_CAPS_DEVICE_CIRRUS_VGA,
|
QEMU_CAPS_DEVICE_CIRRUS_VGA,
|
||||||
QEMU_CAPS_DISPLAY_DBUS,
|
QEMU_CAPS_DISPLAY_DBUS,
|
||||||
QEMU_CAPS_AUDIODEV);
|
QEMU_CAPS_AUDIODEV);
|
||||||
|
DO_TEST("graphics-dbus-chardev",
|
||||||
|
QEMU_CAPS_DEVICE_CIRRUS_VGA,
|
||||||
|
QEMU_CAPS_DISPLAY_DBUS);
|
||||||
|
|
||||||
DO_TEST_CAPS_ARCH_LATEST("default-video-type-aarch64", "aarch64");
|
DO_TEST_CAPS_ARCH_LATEST("default-video-type-aarch64", "aarch64");
|
||||||
DO_TEST_CAPS_ARCH_LATEST("default-video-type-ppc64", "ppc64");
|
DO_TEST_CAPS_ARCH_LATEST("default-video-type-ppc64", "ppc64");
|
||||||
|
@ -1056,6 +1056,7 @@ testQemuPrepareHostBackendChardevOne(virDomainDeviceDef *dev,
|
|||||||
case VIR_DOMAIN_CHR_TYPE_SPICEVMC:
|
case VIR_DOMAIN_CHR_TYPE_SPICEVMC:
|
||||||
case VIR_DOMAIN_CHR_TYPE_SPICEPORT:
|
case VIR_DOMAIN_CHR_TYPE_SPICEPORT:
|
||||||
case VIR_DOMAIN_CHR_TYPE_QEMU_VDAGENT:
|
case VIR_DOMAIN_CHR_TYPE_QEMU_VDAGENT:
|
||||||
|
case VIR_DOMAIN_CHR_TYPE_DBUS:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_CHR_TYPE_FILE:
|
case VIR_DOMAIN_CHR_TYPE_FILE:
|
||||||
|
Loading…
Reference in New Issue
Block a user