diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index b8092607fe1bb201303651230d34e86ac87b2a0b..46609830afaa4e84efabd9c4f3e27e8f5929b540 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -4724,6 +4724,24 @@ qemu-kvm -net nic,model=? /dev/null </devices> ... +
Spice channel
+ +

+ The character device is accessible through spice connection + under a channel name specified in the channel + attribute. Since 1.2.2 +

+ +
+  ...
+  <devices>
+    <serial type="spiceport">
+      <source channel="org.qemu.console.serial.0"/>
+      <target port="1"/>
+    </serial>
+  </devices>
+  ...
+

Sound devices

diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 5b33f4d8c582a8216c58bef7caa00041ef41d387..c1efcd21cb8259479263e4cb769b0e5bfe4009a0 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -2916,6 +2916,7 @@ vc pty spicevmc + spiceport @@ -2985,6 +2986,9 @@ + + + diff --git a/src/conf/domain_audit.c b/src/conf/domain_audit.c index 11cf5c8e7b55c2f02ec1a32b861ba5d53f68b5d0..b6564c2eaf07ccaf855d4725671bf2fe5fbb3ce9 100644 --- a/src/conf/domain_audit.c +++ b/src/conf/domain_audit.c @@ -1,7 +1,7 @@ /* * domain_audit.c: Domain audit management * - * Copyright (C) 2006-2013 Red Hat, Inc. + * Copyright (C) 2006-2014 Red Hat, Inc. * Copyright (C) 2006 Daniel P. Berrange * * This library is free software; you can redistribute it and/or @@ -81,6 +81,7 @@ virDomainAuditChardevPath(virDomainChrSourceDefPtr chr) case VIR_DOMAIN_CHR_TYPE_VC: case VIR_DOMAIN_CHR_TYPE_STDIO: case VIR_DOMAIN_CHR_TYPE_SPICEVMC: + case VIR_DOMAIN_CHR_TYPE_SPICEPORT: case VIR_DOMAIN_CHR_TYPE_LAST: return NULL; } diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index f3e965bf3f7b8ef0ff591befa1407a02988e2df8..f6065ed36b1780e38a8a2ec6424275a4f6e22d0f 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -437,7 +437,8 @@ VIR_ENUM_IMPL(virDomainChr, VIR_DOMAIN_CHR_TYPE_LAST, "udp", "tcp", "unix", - "spicevmc") + "spicevmc", + "spiceport") VIR_ENUM_IMPL(virDomainChrTcpProtocol, VIR_DOMAIN_CHR_TCP_PROTOCOL_LAST, "raw", @@ -1584,6 +1585,11 @@ virDomainChrSourceDefIsEqual(const virDomainChrSourceDef *src, STREQ_NULLABLE(src->data.nix.path, tgt->data.nix.path); break; + case VIR_DOMAIN_CHR_TYPE_SPICEPORT: + return STREQ_NULLABLE(src->data.spiceport.channel, + tgt->data.spiceport.channel); + break; + case VIR_DOMAIN_CHR_TYPE_VC: case VIR_DOMAIN_CHR_TYPE_STDIO: case VIR_DOMAIN_CHR_TYPE_SPICEVMC: @@ -7141,6 +7147,9 @@ error: return ret; } +#define SERIAL_CHANNEL_NAME_CHARS \ + "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-." + /* Parse the source half of the XML definition for a character device, * where node is the first element of node->children of the parent * element. def->type must already be valid. Return -1 on failure, @@ -7161,6 +7170,7 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr def, char *path = NULL; char *mode = NULL; char *protocol = NULL; + char *channel = NULL; int remaining = 0; while (cur != NULL) { @@ -7205,6 +7215,11 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr def, VIR_FREE(mode); break; + case VIR_DOMAIN_CHR_TYPE_SPICEPORT: + if (!channel) + channel = virXMLPropString(cur, "channel"); + break; + case VIR_DOMAIN_CHR_TYPE_LAST: case VIR_DOMAIN_CHR_TYPE_NULL: case VIR_DOMAIN_CHR_TYPE_VC: @@ -7344,6 +7359,21 @@ virDomainChrSourceDefParseXML(virDomainChrSourceDefPtr def, def->data.nix.path = path; path = NULL; break; + + case VIR_DOMAIN_CHR_TYPE_SPICEPORT: + if (!channel) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("Missing source channel attribute for char device")); + goto error; + } + if (strspn(channel, SERIAL_CHANNEL_NAME_CHARS) < strlen(channel)) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("Invalid character in source channel for char device")); + goto error; + } + def->data.spiceport.channel = channel; + channel = NULL; + break; } cleanup: @@ -7354,6 +7384,7 @@ cleanup: VIR_FREE(connectHost); VIR_FREE(connectService); VIR_FREE(path); + VIR_FREE(channel); return remaining; @@ -15686,6 +15717,12 @@ virDomainChrSourceDefFormat(virBufferPtr buf, virBufferEscapeString(buf, " path='%s'", def->data.nix.path); virBufferAddLit(buf, "/>\n"); break; + + case VIR_DOMAIN_CHR_TYPE_SPICEPORT: + virBufferAsprintf(buf, " \n", + def->data.spiceport.channel); + break; + } return 0; diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 41aa457ada9cd5aec2b3f5e7270a379e1e8e0d2a..4895e814d0dbe4c87c78c90afdbc2a212e3f2917 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1,7 +1,7 @@ /* * domain_conf.h: domain XML processing * - * Copyright (C) 2006-2013 Red Hat, Inc. + * Copyright (C) 2006-2014 Red Hat, Inc. * Copyright (C) 2006-2008 Daniel P. Berrange * * This library is free software; you can redistribute it and/or @@ -1104,6 +1104,7 @@ enum virDomainChrType { VIR_DOMAIN_CHR_TYPE_TCP, VIR_DOMAIN_CHR_TYPE_UNIX, VIR_DOMAIN_CHR_TYPE_SPICEVMC, + VIR_DOMAIN_CHR_TYPE_SPICEPORT, VIR_DOMAIN_CHR_TYPE_LAST }; @@ -1152,6 +1153,9 @@ struct _virDomainChrSourceDef { bool listen; } nix; int spicevmc; + struct { + char *channel; + } spiceport; } data; }; diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index ec3b95876dd567879116db96902de601a454f079..5e825acb329b499bac6178bc2935366d0c5bad44 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -1,7 +1,7 @@ /* * qemu_monitor_json.c: interaction with QEMU monitor console * - * Copyright (C) 2006-2013 Red Hat, Inc. + * Copyright (C) 2006-2014 Red Hat, Inc. * Copyright (C) 2006 Daniel P. Berrange * * This library is free software; you can redistribute it and/or @@ -5318,6 +5318,7 @@ qemuMonitorJSONAttachCharDevCommand(const char *chrID, break; case VIR_DOMAIN_CHR_TYPE_SPICEVMC: + case VIR_DOMAIN_CHR_TYPE_SPICEPORT: case VIR_DOMAIN_CHR_TYPE_PIPE: case VIR_DOMAIN_CHR_TYPE_STDIO: case VIR_DOMAIN_CHR_TYPE_LAST: