[libvirt] [PATCH] qemuxml2argvtest: Pass some additional flags to graphics-spice-agentmouse
by Michal Privoznik
One of the recent commits introduced support for
spice agent-mouse. However, test for this feature
require some tweaking: pass QEMU_CAPS_CHARDEV_SPICEVMC |
QEMU_CAPS_NODEFCONFIG and add "-vga cirrus".
---
Since we default to '-vga cirrus' when QEMU_CAPS_VGA set,
I've added it to XML as well for completeness. The other
option would be to not set the capability.
Pushed under build-breaker rule as qemuxml2argvtest fails
without this.
.../qemuxml2argv-graphics-spice-agentmouse.args | 2 +-
.../qemuxml2argv-graphics-spice-agentmouse.xml | 3 +++
tests/qemuxml2argvtest.c | 4 +++-
3 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-agentmouse.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-agentmouse.args
index 2c3ef06..4a7bd2e 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-agentmouse.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-agentmouse.args
@@ -5,4 +5,4 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=spice \
-hda /dev/HostVG/QEMUGuest1 -chardev spicevmc,id=charchannel0,name=vdagent \
-device virtserialport,bus=virtio-serial1.0,nr=3,chardev=charchannel0,id=channel0,name=com.redhat.spice.0 \
-usb -spice port=5903,tls-port=5904,addr=127.0.0.1,agent-mouse=off,x509-dir=/etc/pki/libvirt-spice,tls-channel=main \
--device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
+-vga cirrus -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-agentmouse.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-agentmouse.xml
index facc7ac..95954fc 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-agentmouse.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-agentmouse.xml
@@ -31,6 +31,9 @@
<target type='virtio' name='com.redhat.spice.0'/>
<address type='virtio-serial' controller='1' bus='0' port='3'/>
</channel>
+ <video>
+ <model type='cirrus' vram='9216' heads='1'/>
+ </video>
<memballoon model='virtio'/>
</devices>
</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 3cfd69c..9001834 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -513,7 +513,9 @@ mymain(void)
QEMU_CAPS_DEVICE, QEMU_CAPS_SPICE);
DO_TEST("graphics-spice-agentmouse", false,
QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL,
- QEMU_CAPS_DEVICE, QEMU_CAPS_SPICE);
+ QEMU_CAPS_DEVICE, QEMU_CAPS_SPICE,
+ QEMU_CAPS_CHARDEV_SPICEVMC,
+ QEMU_CAPS_NODEFCONFIG);
DO_TEST("graphics-spice-compression", false,
QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL,
QEMU_CAPS_DEVICE, QEMU_CAPS_SPICE);
--
1.7.8.5
12 years, 7 months
[libvirt] Can't connect ESXi ssl with virsh
by Zhimou Peng
Hi,
I try to use virsh connect ESXi5.0 with ssl
[root@zheng ~]# virsh -c esx://10.66.6.211/
Enter username for 10.66.6.211 [root]:
Enter root's password for 10.66.6.211:
error: internal error curl_easy_perform() returned an error: Peer certificate cannot be authenticated with known CA certificates (60) : Peer certificate cannot be authenticated with known CA certificates
error: failed to connect to the hypervisor
I create kew key singed by my CA certificate, still the same error.
But i can use vsphere client and https://10.66.6.211/, the new certs are ok.
Here are my steps:
1, create a CA center.
ENV prepare:
# cd /etc/pki/CA/
# mkdir {certs,crl,newcerts}
# touch index.txt
# echo 00 > serial
create private key:
[root@zheng CA]# openssl req -new -x509 -extensions v3_ca -keyout myroot.key -out myroot.crt -days 3650
Generating a 2048 bit RSA private key
................................................................+++
...............................................+++
writing new private key to 'myroot.key'
Enter PEM pass phrase:
Verifying - Enter PEM pass phrase:
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [XX]:CN
State or Province Name (full name) []:BEIJING
Locality Name (eg, city) [Default City]:BEIJING
Organization Name (eg, company) [Default Company Ltd]:REDHAT
Organizational Unit Name (eg, section) []:QE
Common Name (eg, your name or your server's hostname) []:10.66.6.209
Email Address []:
[root@zheng CA]# mv myroot.key private/cakey.pem
[root@zheng CA]# mv myroot.crt cacert.pem
2, create private key and certificate request file for ESXi5.0 server.
# openssl req -new -nodes -out mycsr.csr
Generating a 2048 bit RSA private key
........+++
...............+++
writing new private key to 'privkey.pem'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [XX]:CN
State or Province Name (full name) []:BEIJING
Locality Name (eg, city) [Default City]:BEIJING
Organization Name (eg, company) [Default Company Ltd]:REDHAT
Organizational Unit Name (eg, section) []:QE
Common Name (eg, your name or your server's hostname) []:10.66.6.211
Email Address []:
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
3,scp the certificate request file to CA and certificate it.
[root@zheng CA]# openssl ca -out rui.crt -infiles mycsr.csr
Using configuration from /etc/pki/tls/openssl.cnf
Enter pass phrase for /etc/pki/CA/private/cakey.pem:
Check that the request matches the signature
Signature ok
Certificate Details:
Serial Number: 0 (0x0)
Validity
Not Before: Mar 5 06:53:52 2012 GMT
Not After : Mar 5 06:53:52 2013 GMT
Subject:
countryName = CN
stateOrProvinceName = BEIJING
organizationName = REDHAT
organizationalUnitName = QE
commonName = 10.66.6.211
X509v3 extensions:
X509v3 Basic Constraints:
CA:FALSE
Netscape Comment:
OpenSSL Generated Certificate
X509v3 Subject Key Identifier:
84:ED:53:00:56:7B:F3:AD:69:70:44:8C:D3:09:A0:6E:9D:69:30:0A
X509v3 Authority Key Identifier:
keyid:E5:FC:AC:8B:C4:6E:DD:DF:32:19:E3:C1:17:3E:08:5B:7D:0D:79:DD
Certificate is to be certified until Mar 5 06:53:52 2013 GMT (365 days)
Sign the certificate? [y/n]:y
1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Data Base Updated
4, change the ESXi to maintance mode and change ssl keys on /etc/vmware/ssl. restart hostd server
then quit the maintance mode.
5, test it with vsphere client and firefox. new ssl keys works well.
6,[root@zheng ~]# virsh -c esx://10.66.6.211
Enter username for 10.66.6.211 [root]:
Enter root's password for 10.66.6.211:
error: internal error curl_easy_perform() returned an error: Peer certificate cannot be authenticated with known CA certificates (60) : Peer certificate cannot be authenticated with known CA certificates
error: failed to connect to the hypervisor
So, i don't know if i have wrong steps or it's a bug?
12 years, 7 months
[libvirt] [Patch]: spice agent-mouse support [v3]
by Zhou Peng
Signed-off-by: Zhou Peng <zhoupeng(a)nfs.iscas.ac.cn>
spice agent-mouse support
Usage:
<graphics type='spice'>
<mouse mode='client'|'server'/>
<graphics/>
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 6fcca94..0adf859 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -2809,6 +2809,14 @@ qemu-kvm -net nic,model=? /dev/null
to <code>no</code>, <span class="since">since
0.9.3</span>.
</p>
+ <p>
+ It can be specified whether client or server mouse mode
+ to use for spice. The default is client which enables
+ passing mouse events via Spice agent.
+ The mouse mode is set by the <code>mouse<code/> element,
+ setting it's <code>mode<code/> attribute to one of
+ <code>server</code> or <code>client</code>.
+ </p>
</dd>
<dt><code>"rdp"</code></dt>
<dd>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 3908733..bb0df03 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -1776,6 +1776,17 @@
<empty/>
</element>
</optional>
+ <optional>
+ <element name="mouse">
+ <attribute name="mode">
+ <choice>
+ <value>server</value>
+ <value>client</value>
+ </choice>
+ </attribute>
+ <empty/>
+ </element>
+ </optional>
</interleave>
</group>
<group>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index f9654f1..b99e770 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -460,6 +460,12 @@ VIR_ENUM_IMPL(virDomainGraphicsSpicePlaybackCompression,
"on",
"off");
+VIR_ENUM_IMPL(virDomainGraphicsSpiceMouseMode,
+ VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_LAST,
+ "default",
+ "server",
+ "client");
+
VIR_ENUM_IMPL(virDomainGraphicsSpiceStreamingMode,
VIR_DOMAIN_GRAPHICS_SPICE_STREAMING_MODE_LAST,
"default",
@@ -5710,6 +5716,26 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
VIR_FREE(copypaste);
def->data.spice.copypaste = copypasteVal;
+ } else if (xmlStrEqual(cur->name, BAD_CAST "mouse")) {
+ const char *mode = virXMLPropString(cur, "mode");
+ int modeVal;
+
+ if (!mode) {
+ virDomainReportError(VIR_ERR_XML_ERROR, "%s",
+ _("spice mouse missing mode"));
+ goto error;
+ }
+
+ if ((modeVal =
+
virDomainGraphicsSpiceMouseModeTypeFromString(mode)) <= 0) {
+ virDomainReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unknown mouse mode value
'%s'"), mode);
+ VIR_FREE(mode);
+ goto error;
+ }
+ VIR_FREE(mode);
+
+ def->data.spice.mousemode = modeVal;
}
}
cur = cur->next;
@@ -11401,7 +11427,8 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
}
if (!children && (def->data.spice.image || def->data.spice.jpeg ||
def->data.spice.zlib || def->data.spice.playback ||
- def->data.spice.streaming ||
def->data.spice.copypaste)) {
+ def->data.spice.streaming ||
def->data.spice.copypaste ||
+ def->data.spice.mousemode)) {
virBufferAddLit(buf, ">\n");
children = 1;
}
@@ -11420,6 +11447,9 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
if (def->data.spice.streaming)
virBufferAsprintf(buf, " <streaming mode='%s'/>\n",
virDomainGraphicsSpiceStreamingModeTypeToString(def->data.spice.streaming));
+ if (def->data.spice.mousemode)
+ virBufferAsprintf(buf, " <mouse mode='%s'/>\n",
+
virDomainGraphicsSpiceMouseModeTypeToString(def->data.spice.mousemode));
if (def->data.spice.copypaste)
virBufferAsprintf(buf, " <clipboard copypaste='%s'/>\n",
virDomainGraphicsSpiceClipboardCopypasteTypeToString(def->data.spice.copypaste));
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 596be4d..a9c118a 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1003,6 +1003,14 @@ enum virDomainGraphicsSpicePlaybackCompression {
VIR_DOMAIN_GRAPHICS_SPICE_PLAYBACK_COMPRESSION_LAST
};
+enum virDomainGraphicsSpiceMouseMode {
+ VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_DEFAULT = 0,
+ VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_SERVER,
+ VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_CLIENT,
+
+ VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_LAST
+};
+
enum virDomainGraphicsSpiceStreamingMode {
VIR_DOMAIN_GRAPHICS_SPICE_STREAMING_MODE_DEFAULT = 0,
VIR_DOMAIN_GRAPHICS_SPICE_STREAMING_MODE_FILTER,
@@ -1072,6 +1080,7 @@ struct _virDomainGraphicsDef {
struct {
int port;
int tlsPort;
+ int mousemode;
char *keymap;
virDomainGraphicsAuthDef auth;
unsigned int autoport :1;
@@ -2061,6 +2070,7 @@ VIR_ENUM_DECL(virDomainGraphicsSpiceZlibCompression)
VIR_ENUM_DECL(virDomainGraphicsSpicePlaybackCompression)
VIR_ENUM_DECL(virDomainGraphicsSpiceStreamingMode)
VIR_ENUM_DECL(virDomainGraphicsSpiceClipboardCopypaste)
+VIR_ENUM_DECL(virDomainGraphicsSpiceMouseMode)
VIR_ENUM_DECL(virDomainNumatuneMemMode)
VIR_ENUM_DECL(virDomainSnapshotState)
/* from libvirt.h */
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index b9baf9a..ccaa72d 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -252,6 +252,8 @@ virDomainChrDefFree;
virDomainChrDefNew;
virDomainChrSourceDefCopy;
virDomainChrSourceDefFree;
+virDomainGraphicsSpiceMouseModeTypeFromString;
+virDomainGraphicsSpiceMouseModeTypeToString;
virDomainChrSpicevmcTypeFromString;
virDomainChrSpicevmcTypeToString;
virDomainChrTcpProtocolTypeFromString;
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 64a4546..2bbc077 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -154,6 +154,7 @@ VIR_ENUM_IMPL(qemuCaps, QEMU_CAPS_LAST,
"drive-iotune", /* 85 */
"system_wakeup",
"scsi-disk.channel",
+ "spice-agent-mouse",
);
struct qemu_feature_flags {
@@ -1049,8 +1050,13 @@ qemuCapsComputeCmdFlags(const char *help,
if ((p = strstr(p, "|none")) && p < nl)
qemuCapsSet(flags, QEMU_CAPS_VGA_NONE);
}
- if (strstr(help, "-spice"))
+ if (strstr(help, "-spice")) {
qemuCapsSet(flags, QEMU_CAPS_SPICE);
+
+ /* If SPICE is avail, agent-mouse option will be avail for qemu,
+ * although 'qemu --help' doesn't show it. */
+ qemuCapsSet(flags, QEMU_CAPS_SPICE_AGENTMOUSE);
+ }
if (strstr(help, "boot=on"))
qemuCapsSet(flags, QEMU_CAPS_DRIVE_BOOT);
if (strstr(help, "serial=s"))
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index db584ce..2e9faba 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -122,6 +122,7 @@ enum qemuCapsFlags {
QEMU_CAPS_DRIVE_IOTUNE = 85, /* -drive bps= and friends */
QEMU_CAPS_WAKEUP = 86, /* system_wakeup monitor command */
QEMU_CAPS_SCSI_DISK_CHANNEL = 87, /* Is scsi-disk.channel available? */
+ QEMU_CAPS_SPICE_AGENTMOUSE = 88, /* -spice agent-mouse=on|off */
QEMU_CAPS_LAST, /* this must always be the last item */
};
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 01adf0d..b5fc5b1 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5391,6 +5391,23 @@ qemuBuildCommandLine(virConnectPtr conn,
VIR_FREE(netAddr);
+ int mm = def->graphics[0]->data.spice.mousemode;
+ if (mm) {
+ if (!qemuCapsGet(qemuCaps, QEMU_CAPS_SPICE_AGENTMOUSE)) {
+ qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("spice agent-mouse is not supported
with this QEMU"));
+ goto error;
+ }
+ switch (mm) {
+ case VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_SERVER:
+ virBufferAsprintf(&opt, ",agent-mouse=off");
+ break;
+ case VIR_DOMAIN_GRAPHICS_SPICE_MOUSE_MODE_CLIENT:
+ virBufferAsprintf(&opt, ",agent-mouse=on");
+ break;
+ }
+ }
+
/* In the password case we set it via monitor command, to avoid
* making it visible on CLI, so there's no use of password=XXX
* in this bit of the code */
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-spice-agentmouse.args
b/tests/qemuxml2argvdata/qemuxml2argv-spice-agentmouse.args
new file mode 100644
index 0000000..46be6d8
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-spice-agentmouse.args
@@ -0,0 +1,19 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test
QEMU_AUDIO_DRV=spice \
+/usr/bin/qemu -S -M pc -m 214 -smp 1 -nodefconfig -nodefaults \
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -device \
+virtio-serial-pci,id=virtio-serial1,bus=pci.0,addr=0xa -hda \
+/dev/HostVG/QEMUGuest1 -chardev spicevmc,id=charchannel0,name=vdagent -device \
+virtserialport,bus=virtio-serial1.0,nr=3,chardev=charchannel0,id=channel0\
+,name=com.redhat.spice.0 -usb -spice port=5903,tls-port=5904,addr=127.0.0.1,\
+agent-mouse=off,x509-dir=/etc/pki/libvirt-spice,tls-channel=main -device \
+virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
+
+#LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test
QEMU_AUDIO_DRV=spice \
+/usr/bin/qemu -S -M pc -m 214 -smp 1 -nodefconfig -nodefaults \
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -device \
+virtio-serial-pci,id=virtio-serial1,bus=pci.0,addr=0xa -hda \
+/dev/HostVG/QEMUGuest1 -chardev spicevmc,id=charchannel0,name=vdagent -device \
+virtserialport,bus=virtio-serial1.0,nr=3,chardev=charchannel0,id=channel0\
+,name=com.redhat.spice.0 -usb -spice port=5903,tls-port=5904,addr=127.0.0.1,\
+agent-mouse=on,x509-dir=/etc/pki/libvirt-spice,tls-channel=main -device \
+virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-spice-agentmouse.xml
b/tests/qemuxml2argvdata/qemuxml2argv-spice-agentmouse.xml
new file mode 100644
index 0000000..5ab7c5e
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-spice-agentmouse.xml
@@ -0,0 +1,40 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory>219136</memory>
+ <vcpu cpuset='1-4,8-20,525'>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</emulator>
+ <disk type='block' device='disk'>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+ </disk>
+ <controller type='usb' index='0'/>
+ <controller type='ide' index='0'/>
+ <controller type='virtio-serial' index='1'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x0a'
function='0x0'/>
+ </controller>
+<!--
+ <graphics type='spice' port='5903' tlsPort='5904' autoport='no'
listen='127.0.0.1'>
+ <mouse mode='client'/>
+-->
+ <graphics type='spice' port='5903' tlsPort='5904' autoport='no'
listen='127.0.0.1'>
+ <mouse mode='server'/>
+ <channel name='main' mode='secure'/>
+ </graphics>
+ <channel type='spicevmc'>
+ <target type='virtio' name='com.redhat.spice.0'/>
+ <address type='virtio-serial' controller='1' bus='0' port='3'/>
+ </channel>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index fcffc27..9a27333 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -514,6 +514,10 @@ mymain(void)
DO_TEST("graphics-spice-compression", false,
QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL,
QEMU_CAPS_DEVICE, QEMU_CAPS_SPICE);
+ DO_TEST("graphics-spice-agentmouse", false,
+ QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL,
+ QEMU_CAPS_DEVICE, QEMU_CAPS_SPICE,
+ QEMU_CAPS_SPICE_AGENTMOUSE);
DO_TEST("graphics-spice-timeout", false,
QEMU_CAPS_DRIVE,
QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL,
--
Zhou Peng
12 years, 7 months
[libvirt] [PATCH v2] virsh: Use option alias for outmoded "--persistent"
by Osier Yang
Since VIR_DOMAIN_AFFECT_{LIVE,CONFIG,CURRENT} was created,
all new virsh commands use "--config" to represents the
persistent changing. This patch add "--config" option
for the old commands which still use "--persistent",
and "--persistent" is now alias of "--config".
tools/virsh.c: (use "--config", and "--persistent" is
alias of "--config" now).
cmdDomIfSetLink, cmdDomIfGetLink, cmdAttachDevice,
cmdDetachDevice, cmdUpdateDevice, cmdAttachInterface,
cmdDetachInterface, cmdAttachDisk, cmdDetachDisk
toos/virsh.pod: Update docs of the changed commands, and
add some missed docs for "--config" (detach-interface,
detach-disk, and detach-device).
---
tools/virsh.c | 51 ++++++++++++++++++++++++++++-------------------
tools/virsh.pod | 59 ++++++++++++++++++++++++++++++++++++------------------
2 files changed, 69 insertions(+), 41 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index ee8ff31..9a16ef8 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -1643,7 +1643,8 @@ static const vshCmdOptDef opts_domif_setlink[] = {
{"domain", VSH_OT_DATA, VSH_OFLAG_REQ, N_("domain name, id or uuid")},
{"interface", VSH_OT_DATA, VSH_OFLAG_REQ, N_("interface device (MAC Address)")},
{"state", VSH_OT_DATA, VSH_OFLAG_REQ, N_("new state of the device")},
- {"persistent", VSH_OT_BOOL, 0, N_("persist interface state")},
+ {"persistent", VSH_OT_ALIAS, 0, "config"},
+ {"config", VSH_OT_BOOL, 0, N_("affect next boot")},
{NULL, 0, 0, NULL}
};
@@ -1658,7 +1659,7 @@ cmdDomIfSetLink (vshControl *ctl, const vshCmd *cmd)
unsigned char macaddr[VIR_MAC_BUFLEN];
const char *element;
const char *attr;
- bool persistent;
+ bool config;
bool ret = false;
unsigned int flags = 0;
int i;
@@ -1680,7 +1681,7 @@ cmdDomIfSetLink (vshControl *ctl, const vshCmd *cmd)
if (vshCommandOptString(cmd, "state", &state) <= 0)
goto cleanup;
- persistent = vshCommandOptBool(cmd, "persistent");
+ config = vshCommandOptBool(cmd, "config");
if (STRNEQ(state, "up") && STRNEQ(state, "down")) {
vshError(ctl, _("invalid link state '%s'"), state);
@@ -1688,13 +1689,13 @@ cmdDomIfSetLink (vshControl *ctl, const vshCmd *cmd)
}
/* get persistent or live description of network device */
- desc = virDomainGetXMLDesc(dom, persistent?VIR_DOMAIN_XML_INACTIVE:0);
+ desc = virDomainGetXMLDesc(dom, config ? VIR_DOMAIN_XML_INACTIVE : 0);
if (desc == NULL) {
vshError(ctl, _("Failed to get domain description xml"));
goto cleanup;
}
- if (persistent)
+ if (config)
flags = VIR_DOMAIN_AFFECT_CONFIG;
else
flags = VIR_DOMAIN_AFFECT_LIVE;
@@ -1818,7 +1819,8 @@ static const vshCmdInfo info_domif_getlink[] = {
static const vshCmdOptDef opts_domif_getlink[] = {
{"domain", VSH_OT_DATA, VSH_OFLAG_REQ, N_("domain name, id or uuid")},
{"interface", VSH_OT_DATA, VSH_OFLAG_REQ, N_("interface device (MAC Address)")},
- {"persistent", VSH_OT_BOOL, 0, N_("Get persistent interface state")},
+ {"persistent", VSH_OT_ALIAS, 0, "config"},
+ {"config", VSH_OT_BOOL, 0, N_("Get persistent interface state")},
{NULL, 0, 0, NULL}
};
@@ -1852,7 +1854,7 @@ cmdDomIfGetLink (vshControl *ctl, const vshCmd *cmd)
return false;
}
- if (vshCommandOptBool(cmd, "persistent"))
+ if (vshCommandOptBool(cmd, "config"))
flags = VIR_DOMAIN_XML_INACTIVE;
desc = virDomainGetXMLDesc(dom, flags);
@@ -13460,7 +13462,8 @@ static const vshCmdInfo info_attach_device[] = {
static const vshCmdOptDef opts_attach_device[] = {
{"domain", VSH_OT_DATA, VSH_OFLAG_REQ, N_("domain name, id or uuid")},
{"file", VSH_OT_DATA, VSH_OFLAG_REQ, N_("XML file")},
- {"persistent", VSH_OT_BOOL, 0, N_("persist device attachment")},
+ {"persistent", VSH_OT_ALIAS, 0, "config"},
+ {"config", VSH_OT_BOOL, 0, N_("affect next boot")},
{NULL, 0, 0, NULL}
};
@@ -13490,7 +13493,7 @@ cmdAttachDevice(vshControl *ctl, const vshCmd *cmd)
return false;
}
- if (vshCommandOptBool(cmd, "persistent")) {
+ if (vshCommandOptBool(cmd, "config")) {
flags = VIR_DOMAIN_AFFECT_CONFIG;
if (virDomainIsActive(dom) == 1)
flags |= VIR_DOMAIN_AFFECT_LIVE;
@@ -13771,7 +13774,8 @@ static const vshCmdInfo info_detach_device[] = {
static const vshCmdOptDef opts_detach_device[] = {
{"domain", VSH_OT_DATA, VSH_OFLAG_REQ, N_("domain name, id or uuid")},
{"file", VSH_OT_DATA, VSH_OFLAG_REQ, N_("XML file")},
- {"persistent", VSH_OT_BOOL, 0, N_("persist device detachment")},
+ {"persistent", VSH_OT_ALIAS, 0, "config"},
+ {"config", VSH_OT_BOOL, 0, N_("affect next boot")},
{NULL, 0, 0, NULL}
};
@@ -13799,7 +13803,7 @@ cmdDetachDevice(vshControl *ctl, const vshCmd *cmd)
goto cleanup;
}
- if (vshCommandOptBool(cmd, "persistent")) {
+ if (vshCommandOptBool(cmd, "config")) {
flags = VIR_DOMAIN_AFFECT_CONFIG;
if (virDomainIsActive(dom) == 1)
flags |= VIR_DOMAIN_AFFECT_LIVE;
@@ -13835,7 +13839,8 @@ static const vshCmdInfo info_update_device[] = {
static const vshCmdOptDef opts_update_device[] = {
{"domain", VSH_OT_DATA, VSH_OFLAG_REQ, N_("domain name, id or uuid")},
{"file", VSH_OT_DATA, VSH_OFLAG_REQ, N_("XML file")},
- {"persistent", VSH_OT_BOOL, 0, N_("persist device update")},
+ {"persistent", VSH_OT_ALIAS, 0, "config"},
+ {"config", VSH_OT_BOOL, 0, N_("affect next boot")},
{"force", VSH_OT_BOOL, 0, N_("force device update")},
{NULL, 0, 0, NULL}
};
@@ -13866,7 +13871,7 @@ cmdUpdateDevice(vshControl *ctl, const vshCmd *cmd)
return false;
}
- if (vshCommandOptBool(cmd, "persistent")) {
+ if (vshCommandOptBool(cmd, "config")) {
flags = VIR_DOMAIN_AFFECT_CONFIG;
if (virDomainIsActive(dom) == 1)
flags |= VIR_DOMAIN_AFFECT_LIVE;
@@ -13910,7 +13915,8 @@ static const vshCmdOptDef opts_attach_interface[] = {
{"mac", VSH_OT_DATA, 0, N_("MAC address")},
{"script", VSH_OT_DATA, 0, N_("script used to bridge network interface")},
{"model", VSH_OT_DATA, 0, N_("model type")},
- {"persistent", VSH_OT_BOOL, 0, N_("persist interface attachment")},
+ {"persistent", VSH_OT_ALIAS, 0, "config"},
+ {"config", VSH_OT_BOOL, 0, N_("affect next boot")},
{"inbound", VSH_OT_DATA, VSH_OFLAG_NONE, N_("control domain's incoming traffics")},
{"outbound", VSH_OT_DATA, VSH_OFLAG_NONE, N_("control domain's outgoing traffics")},
{NULL, 0, 0, NULL}
@@ -14067,7 +14073,7 @@ cmdAttachInterface(vshControl *ctl, const vshCmd *cmd)
xml = virBufferContentAndReset(&buf);
- if (vshCommandOptBool(cmd, "persistent")) {
+ if (vshCommandOptBool(cmd, "config")) {
flags = VIR_DOMAIN_AFFECT_CONFIG;
if (virDomainIsActive(dom) == 1)
flags |= VIR_DOMAIN_AFFECT_LIVE;
@@ -14105,7 +14111,8 @@ static const vshCmdOptDef opts_detach_interface[] = {
{"domain", VSH_OT_DATA, VSH_OFLAG_REQ, N_("domain name, id or uuid")},
{"type", VSH_OT_DATA, VSH_OFLAG_REQ, N_("network interface type")},
{"mac", VSH_OT_STRING, 0, N_("MAC address")},
- {"persistent", VSH_OT_BOOL, 0, N_("persist interface detachment")},
+ {"persistent", VSH_OT_ALIAS, 0, "config"},
+ {"config", VSH_OT_BOOL, 0, N_("affect next boot")},
{NULL, 0, 0, NULL}
};
@@ -14199,7 +14206,7 @@ cmdDetachInterface(vshControl *ctl, const vshCmd *cmd)
goto cleanup;
}
- if (vshCommandOptBool(cmd, "persistent")) {
+ if (vshCommandOptBool(cmd, "config")) {
flags = VIR_DOMAIN_AFFECT_CONFIG;
if (virDomainIsActive(dom) == 1)
flags |= VIR_DOMAIN_AFFECT_LIVE;
@@ -14246,7 +14253,8 @@ static const vshCmdOptDef opts_attach_disk[] = {
{"cache", VSH_OT_STRING, 0, N_("cache mode of disk device")},
{"type", VSH_OT_STRING, 0, N_("target device type")},
{"mode", VSH_OT_STRING, 0, N_("mode of device reading and writing")},
- {"persistent", VSH_OT_BOOL, 0, N_("persist disk attachment")},
+ {"persistent", VSH_OT_ALIAS, 0, "config"},
+ {"config", VSH_OT_BOOL, 0, N_("affect next boot")},
{"sourcetype", VSH_OT_STRING, 0, N_("type of source (block|file)")},
{"serial", VSH_OT_STRING, 0, N_("serial of disk device")},
{"shareable", VSH_OT_BOOL, 0, N_("shareable between domains")},
@@ -14555,7 +14563,7 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
xml = virBufferContentAndReset(&buf);
- if (vshCommandOptBool(cmd, "persistent")) {
+ if (vshCommandOptBool(cmd, "config")) {
flags = VIR_DOMAIN_AFFECT_CONFIG;
if (virDomainIsActive(dom) == 1)
flags |= VIR_DOMAIN_AFFECT_LIVE;
@@ -14805,7 +14813,8 @@ static const vshCmdInfo info_detach_disk[] = {
static const vshCmdOptDef opts_detach_disk[] = {
{"domain", VSH_OT_DATA, VSH_OFLAG_REQ, N_("domain name, id or uuid")},
{"target", VSH_OT_DATA, VSH_OFLAG_REQ, N_("target of disk device")},
- {"persistent", VSH_OT_BOOL, 0, N_("persist disk detachment")},
+ {"persistent", VSH_OT_ALIAS, 0, "config"},
+ {"config", VSH_OT_BOOL, 0, N_("affect next boot")},
{NULL, 0, 0, NULL}
};
@@ -14841,7 +14850,7 @@ cmdDetachDisk(vshControl *ctl, const vshCmd *cmd)
VSH_PREPARE_DISK_XML_NONE)))
goto cleanup;
- if (vshCommandOptBool(cmd, "persistent")) {
+ if (vshCommandOptBool(cmd, "config")) {
flags = VIR_DOMAIN_AFFECT_CONFIG;
if (virDomainIsActive(dom) == 1)
flags |= VIR_DOMAIN_AFFECT_LIVE;
diff --git a/tools/virsh.pod b/tools/virsh.pod
index b4b8e85..64b00ee 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -551,17 +551,20 @@ B<Explanation of fields> (fields appear in the folowing order):
Get network interface stats for a running domain.
-=item B<domif-setlink> I<domain> I<interface-device> I<state> I<--persistent>
+=item B<domif-setlink> I<domain> I<interface-device> I<state> [I<--config>]
Modify link state of the domain's virtual interface. Possible values for
-state are "up" and "down. If --persistent is specified, only the persistent
-configuration of the domain is modified.
+state are "up" and "down. If I<--config> is specified, only the persistent
+configuration of the domain is modified, for compatibility purposes,
+I<--persistent> is alias of I<--config>.
I<interface-device> can be the interface's target name or the MAC address.
-=item B<domif-getlink> I<domain> I<interface-device> I<--persistent>
+=item B<domif-getlink> I<domain> I<interface-device> [I<--config>]
+
+Query link state of the domain's virtual interface. If I<--config>
+is specified, query the persistent configuration, for compatibility
+purposes, I<--persistent> is alias of I<--config>.
-Query link state of the domain's virtual interface. If --persistent
-is specified, query the persistent configuration.
I<interface-device> can be the interface's target name or the MAC address.
=item B<domiftune> I<domain> I<interface-device>
@@ -1475,10 +1478,13 @@ format of the device sections to get the most accurate set of accepted values.
=over 4
-=item B<attach-device> I<domain-id> I<FILE>
+=item B<attach-device> I<domain-id> I<FILE> [I<--config>]
Attach a device to the domain, using a device definition in an XML file.
See the documentation to learn about libvirt XML format for a device.
+If I<--config> is specified, alter persistent configuration, effect observed
+on next boot, for compatibility purposes, I<--persistent> is alias of
+I<--config>.
For cdrom and floppy devices, this command only replaces the media within
the single existing device; consider using B<update-device> for this usage.
For passthrough host devices, see also B<nodedev-detach>, needed if
@@ -1486,7 +1492,7 @@ the device does not use managed mode.
=item B<attach-disk> I<domain-id> I<source> I<target>
[I<--driver driver>] [I<--subdriver subdriver>] [I<--cache cache>]
-[I<--type type>] [I<--mode mode>] [I<--persistent>] [I<--sourcetype soucetype>]
+[I<--type type>] [I<--mode mode>] [I<--config>] [I<--sourcetype soucetype>]
[I<--serial serial>] [I<--shareable>] [I<--rawio>] [I<--address address>]
[I<--multifunction>]
@@ -1498,7 +1504,8 @@ I<type> can indicate I<cdrom> or I<floppy> as alternative to the disk default,
although this use only replaces the media within the existing virtual cdrom or
floppy device; consider using B<update-device> for this usage instead.
I<mode> can specify the two specific mode I<readonly> or I<shareable>.
-I<persistent> indicates the changes will affect the next boot of the domain.
+I<--config> indicates the changes will affect the next boot of the domain,
+for compatibility purposes, I<--persistent> is alias of I<--config>.
I<sourcetype> can indicate the type of source (block|file)
I<cache> can be one of "default", "none", "writethrough", "writeback",
"directsync" or "unsafe".
@@ -1512,7 +1519,7 @@ address.
=item B<attach-interface> I<domain-id> I<type> I<source>
[I<--target target>] [I<--mac mac>] [I<--script script>] [I<--model model>]
-[I<--persistent>] [I<--inbound average,peak,burst>] [I<--outbound average,peak,burst>]
+[I<--config>] [I<--inbound average,peak,burst>] [I<--outbound average,peak,burst>]
Attach a new network interface to the domain.
I<type> can be either I<network> to indicate a physical network device or
@@ -1523,7 +1530,8 @@ I<mac> allows to specify the MAC address of the network interface.
I<script> allows to specify a path to a script handling a bridge instead of
the default one.
I<model> allows to specify the model type.
-I<persistent> indicates the changes will affect the next boot of the domain.
+I<--config> indicates the changes will affect the next boot of the domain,
+for compatibility purposes, I<--persistent> is alias of I<--config>.
I<inbound> and I<outbound> control the bandwidth of the interface. I<peak>
and I<burst> are optional, so "average,peak", "average,,burst" and
"average" are also legal.
@@ -1532,34 +1540,45 @@ B<Note>: the optional target value is the name of a device to be created
as the back-end on the node. If not provided a device named "vnetN" or "vifN"
will be created automatically.
-=item B<detach-device> I<domain-id> I<FILE>
+=item B<detach-device> I<domain-id> I<FILE> [I<--config>]
Detach a device from the domain, takes the same kind of XML descriptions
as command B<attach-device>.
+If I<--config> is specified, alter persistent configuration, effect observed
+on next boot, for compatibility purposes, I<--persistent> is alias of
+I<--config>.
For passthrough host devices, see also B<nodedev-reattach>, needed if
the device does not use managed mode.
-=item B<detach-disk> I<domain-id> I<target>
+=item B<detach-disk> I<domain-id> I<target> [I<--config>]
Detach a disk device from a domain. The I<target> is the device as seen
from the domain.
+If I<--config> is specified, alter persistent configuration, effect observed
+on next boot, for compatibility purposes, I<--persistent> is alias of
+I<--config>.
-=item B<detach-interface> I<domain-id> I<type> [I<--mac mac>]
+=item B<detach-interface> I<domain-id> I<type> [I<--mac mac>] [I<--config>]
Detach a network interface from a domain.
I<type> can be either I<network> to indicate a physical network device or
I<bridge> to indicate a bridge to a device. It is recommended to use the
I<mac> option to distinguish between the interfaces if more than one are
present on the domain.
+If I<--config> is specified, alter persistent configuration, effect observed
+on next boot, for compatibility purposes, I<--persistent> is alias of
+I<--config>.
-=item B<update-device> I<domain-id> I<file> [I<--persistent>] [I<--force>]
+=item B<update-device> I<domain-id> I<file> [I<--config>] [I<--force>]
Update the characteristics of a device associated with I<domain-id>, based on
-the device definition in an XML I<file>. If the I<--persistent> option is
-used, the changes will affect the next boot of the domain. The I<--force>
-option can be used to force device update, e.g., to eject a CD-ROM even if it
-is locked/mounted in the domain. See the documentation to learn about libvirt
-XML format for a device.
+the device definition in an XML I<file>.
+If the I<--config> option is used, the changes will affect the next boot of
+the domain, for compatibility purposes, I<--persistent> is alias of
+I<--config>.
+The I<--force> option can be used to force device update, e.g., to eject a
+CD-ROM even if it is locked/mounted in the domain. See the documentation to
+learn about libvirt XML format for a device.
=item B<change-media> I<domain-id> I<path> [I<--eject>] [I<--insert>]
[I<--update>] [I<source>] [I<--force>] [[I<--live>] [I<--config>] | [I<--current>]]
--
1.7.1
12 years, 7 months
[libvirt] [PATCH] remove daemon/probes.h from .gitignore
by Laine Stump
The file daemon/probes.h used to be generated as part of a build, but
is no longer used. However, a stale copy of it lying around could
cause a build to fail. Removing it from .gitignore will make it more
likely someone will notice that they have it lying around.
---
Although this is a very simple change, I haven't used the trivial rule
to push it, just to make sure everyone notices it, and nobody
accidentally adds the file to git with "git add .".
.gitignore | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/.gitignore b/.gitignore
index 264a419..b35e863 100644
--- a/.gitignore
+++ b/.gitignore
@@ -54,7 +54,6 @@
/daemon/libvirtd.8
/daemon/libvirtd.8.in
/daemon/libvirtd.pod
-/daemon/probes.h
/docs/devhelp/libvirt.devhelp
/docs/hvsupport.html.in
/docs/libvirt-api.xml
--
1.7.7.6
12 years, 7 months
[libvirt] [PATCH] util: consolidate duplicated error messages in pci.c
by Laine Stump
This is nearly identical to an earlier patch for virnetlink.c (after
fixing it per Eric's recommendations).
There are special stub versions of all public functions in this file
that are compiled when the platform isn't linux. Each of these
functions had an almost identical message, differing only in the
function name included in the message. Since log messages already
contain the function name, we can just define a const char* with the
common part of the string, and use that same string for all the log
messages.
If nothing else, this at least makes for less strings that need
translating...
---
src/util/pci.c | 23 +++++++++--------------
1 files changed, 9 insertions(+), 14 deletions(-)
diff --git a/src/util/pci.c b/src/util/pci.c
index e7bfb92..7beeaee 100644
--- a/src/util/pci.c
+++ b/src/util/pci.c
@@ -2170,12 +2170,13 @@ cleanup:
}
#else
+static const char *unsupported = N_("not supported on non-linux platforms");
+
int
pciGetPhysicalFunction(const char *vf_sysfs_path ATTRIBUTE_UNUSED,
struct pci_config_address **physical_function ATTRIBUTE_UNUSED)
{
- pciReportError(VIR_ERR_INTERNAL_ERROR, _("pciGetPhysicalFunction is not "
- "supported on non-linux platforms"));
+ pciReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
return -1;
}
@@ -2184,16 +2185,14 @@ pciGetVirtualFunctions(const char *sysfs_path ATTRIBUTE_UNUSED,
struct pci_config_address ***virtual_functions ATTRIBUTE_UNUSED,
unsigned int *num_virtual_functions ATTRIBUTE_UNUSED)
{
- pciReportError(VIR_ERR_INTERNAL_ERROR, _("pciGetVirtualFunctions is not "
- "supported on non-linux platforms"));
+ pciReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
return -1;
}
int
pciDeviceIsVirtualFunction(const char *vf_sysfs_device_link ATTRIBUTE_UNUSED)
{
- pciReportError(VIR_ERR_INTERNAL_ERROR, _("pciDeviceIsVirtualFunction is "
- "not supported on non-linux platforms"));
+ pciReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
return -1;
}
@@ -2202,8 +2201,7 @@ pciGetVirtualFunctionIndex(const char *pf_sysfs_device_link ATTRIBUTE_UNUSED,
const char *vf_sysfs_device_link ATTRIBUTE_UNUSED,
int *vf_index ATTRIBUTE_UNUSED)
{
- pciReportError(VIR_ERR_INTERNAL_ERROR, _("pciGetVirtualFunctionIndex is "
- "not supported on non-linux platforms"));
+ pciReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
return -1;
}
@@ -2212,8 +2210,7 @@ int
pciConfigAddressToSysfsFile(struct pci_config_address *dev ATTRIBUTE_UNUSED,
char **pci_sysfs_device_link ATTRIBUTE_UNUSED)
{
- pciReportError(VIR_ERR_INTERNAL_ERROR, _("pciConfigAddressToSysfsFile is not "
- "supported on non-linux platforms"));
+ pciReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
return -1;
}
@@ -2221,8 +2218,7 @@ int
pciDeviceNetName(char *device_link_sysfs_path ATTRIBUTE_UNUSED,
char **netname ATTRIBUTE_UNUSED)
{
- pciReportError(VIR_ERR_INTERNAL_ERROR, _("pciDeviceNetName is not "
- "supported on non-linux platforms"));
+ pciReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
return -1;
}
@@ -2231,8 +2227,7 @@ pciDeviceGetVirtualFunctionInfo(const char *vf_sysfs_device_path ATTRIBUTE_UNUSE
char **pfname ATTRIBUTE_UNUSED,
int *vf_index ATTRIBUTE_UNUSED)
{
- pciReportError(VIR_ERR_INTERNAL_ERROR, _("pciDeviceGetVirtualFunctionInfo "
- "is not supported on non-linux platforms"));
+ pciReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
return -1;
}
#endif /* __linux__ */
--
1.7.7.6
12 years, 7 months
[libvirt] [PATCH v2] Attach vm-id to Open vSwitch interfaces.
by Ansis Atteka
This patch will allow OpenFlow controllers to identify which interface
belongs to a particular VM by using the Domain UUID.
ovs-vsctl get Interface vnet0 external_ids
{attached-mac="52:54:00:8C:55:2C", iface-id="83ce45d6-3639-096e-ab3c-21f66a05f7fa", iface-status=active, vm-id="142a90a7-0acc-ab92-511c-586f12da8851"}
V2 changes:
Replaced vm-uuid with vm-id. There was a discussion in Open vSwitch
mailinglist that we should stick with the same DB key postfixes for the
sake of consistency (e.g iface-id, vm-id ...).
---
src/lxc/lxc_driver.c | 3 ++-
src/network/bridge_driver.c | 2 +-
src/qemu/qemu_command.c | 3 ++-
src/uml/uml_conf.c | 3 ++-
src/util/virnetdevopenvswitch.c | 17 ++++++++++++++---
src/util/virnetdevopenvswitch.h | 1 +
src/util/virnetdevtap.c | 3 ++-
src/util/virnetdevtap.h | 1 +
8 files changed, 25 insertions(+), 8 deletions(-)
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index d9cbd9e..3a55983 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -1197,7 +1197,8 @@ static int lxcSetupInterfaceBridged(virConnectPtr conn,
goto cleanup;
if (vport && vport->virtPortType == VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH)
- ret = virNetDevOpenvswitchAddPort(brname, parentVeth, net->mac, vport);
+ ret = virNetDevOpenvswitchAddPort(brname, parentVeth, net->mac,
+ vm->uuid, vport);
else
ret = virNetDevBridgeAddPort(brname, parentVeth);
if (ret < 0)
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index cf75d26..d82212f 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -1766,7 +1766,7 @@ networkStartNetworkVirtual(struct network_driver *driver,
}
if (virNetDevTapCreateInBridgePort(network->def->bridge,
&macTapIfName, network->def->mac,
- NULL, NULL,
+ NULL, NULL, NULL,
VIR_NETDEV_TAP_CREATE_USE_MAC_FOR_BRIDGE) < 0) {
VIR_FREE(macTapIfName);
goto err0;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 867c460..87eebce 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -244,7 +244,8 @@ qemuNetworkIfaceConnect(virDomainDefPtr def,
tap_create_flags |= VIR_NETDEV_TAP_CREATE_VNET_HDR;
}
- err = virNetDevTapCreateInBridgePort(brname, &net->ifname, net->mac, &tapfd,
+ err = virNetDevTapCreateInBridgePort(brname, &net->ifname, net->mac,
+ def->uuid, &tapfd,
virDomainNetGetActualVirtPortProfile(net),
tap_create_flags);
virDomainAuditNetDevice(def, net, "/dev/net/tun", tapfd >= 0);
diff --git a/src/uml/uml_conf.c b/src/uml/uml_conf.c
index 397d332..eae67f9 100644
--- a/src/uml/uml_conf.c
+++ b/src/uml/uml_conf.c
@@ -138,7 +138,8 @@ umlConnectTapDevice(virConnectPtr conn,
template_ifname = true;
}
- if (virNetDevTapCreateInBridgePort(bridge, &net->ifname, net->mac, NULL,
+ if (virNetDevTapCreateInBridgePort(bridge, &net->ifname, net->mac,
+ vm->uuid, NULL,
virDomainNetGetActualVirtPortProfile(net),
VIR_NETDEV_TAP_CREATE_IFUP) < 0) {
if (template_ifname)
diff --git a/src/util/virnetdevopenvswitch.c b/src/util/virnetdevopenvswitch.c
index e427c94..1a61345 100644
--- a/src/util/virnetdevopenvswitch.c
+++ b/src/util/virnetdevopenvswitch.c
@@ -36,6 +36,7 @@
* @brname: the bridge name
* @ifname: the network interface name
* @macaddr: the mac address of the virtual interface
+ * @vmuuid: the Domain UUID that has this interface
* @ovsport: the ovs specific fields
*
* Add an interface to the OVS bridge
@@ -44,24 +45,31 @@
*/
int virNetDevOpenvswitchAddPort(const char *brname, const char *ifname,
const unsigned char *macaddr,
+ const unsigned char *vmuuid,
virNetDevVPortProfilePtr ovsport)
{
int ret = -1;
virCommandPtr cmd = NULL;
char macaddrstr[VIR_MAC_STRING_BUFLEN];
- char uuidstr[VIR_UUID_STRING_BUFLEN];
+ char ifuuidstr[VIR_UUID_STRING_BUFLEN];
+ char vmuuidstr[VIR_UUID_STRING_BUFLEN];
char *attachedmac_ex_id = NULL;
char *ifaceid_ex_id = NULL;
char *profile_ex_id = NULL;
+ char *vmid_ex_id = NULL;
virMacAddrFormat(macaddr, macaddrstr);
- virUUIDFormat(ovsport->u.openvswitch.interfaceID, uuidstr);
+ virUUIDFormat(ovsport->u.openvswitch.interfaceID, ifuuidstr);
+ virUUIDFormat(vmuuid, vmuuidstr);
if (virAsprintf(&attachedmac_ex_id, "external-ids:attached-mac=\"%s\"",
macaddrstr) < 0)
goto cleanup;
if (virAsprintf(&ifaceid_ex_id, "external-ids:iface-id=\"%s\"",
- uuidstr) < 0)
+ ifuuidstr) < 0)
+ goto cleanup;
+ if (virAsprintf(&vmid_ex_id, "external-ids:vm-id=\"%s\"",
+ vmuuidstr) < 0)
goto cleanup;
if (ovsport->u.openvswitch.profileID[0] != '\0') {
if (virAsprintf(&profile_ex_id, "external-ids:port-profile=\"%s\"",
@@ -75,6 +83,7 @@ int virNetDevOpenvswitchAddPort(const char *brname, const char *ifname,
brname, ifname,
"--", "set", "Interface", ifname, attachedmac_ex_id,
"--", "set", "Interface", ifname, ifaceid_ex_id,
+ "--", "set", "Interface", ifname, vmid_ex_id,
"--", "set", "Interface", ifname,
"external-ids:iface-status=active",
NULL);
@@ -83,6 +92,7 @@ int virNetDevOpenvswitchAddPort(const char *brname, const char *ifname,
brname, ifname,
"--", "set", "Interface", ifname, attachedmac_ex_id,
"--", "set", "Interface", ifname, ifaceid_ex_id,
+ "--", "set", "Interface", ifname, vmid_ex_id,
"--", "set", "Interface", ifname, profile_ex_id,
"--", "set", "Interface", ifname,
"external-ids:iface-status=active",
@@ -100,6 +110,7 @@ int virNetDevOpenvswitchAddPort(const char *brname, const char *ifname,
cleanup:
VIR_FREE(attachedmac_ex_id);
VIR_FREE(ifaceid_ex_id);
+ VIR_FREE(vmid_ex_id);
VIR_FREE(profile_ex_id);
virCommandFree(cmd);
return ret;
diff --git a/src/util/virnetdevopenvswitch.h b/src/util/virnetdevopenvswitch.h
index bca4c3e..8141780 100644
--- a/src/util/virnetdevopenvswitch.h
+++ b/src/util/virnetdevopenvswitch.h
@@ -32,6 +32,7 @@
int virNetDevOpenvswitchAddPort(const char *brname,
const char *ifname,
const unsigned char *macaddr,
+ const unsigned char *vmuuid,
virNetDevVPortProfilePtr ovsport)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
ATTRIBUTE_RETURN_CHECK;
diff --git a/src/util/virnetdevtap.c b/src/util/virnetdevtap.c
index fb0a8d2..84a8a1c 100644
--- a/src/util/virnetdevtap.c
+++ b/src/util/virnetdevtap.c
@@ -277,6 +277,7 @@ int virNetDevTapDelete(const char *ifname ATTRIBUTE_UNUSED)
int virNetDevTapCreateInBridgePort(const char *brname,
char **ifname,
const unsigned char *macaddr,
+ const unsigned char *vmuuid,
int *tapfd,
virNetDevVPortProfilePtr virtPortProfile,
unsigned int flags)
@@ -307,7 +308,7 @@ int virNetDevTapCreateInBridgePort(const char *brname,
goto error;
if (virtPortProfile) {
- if (virNetDevOpenvswitchAddPort(brname, *ifname, macaddr,
+ if (virNetDevOpenvswitchAddPort(brname, *ifname, macaddr, vmuuid,
virtPortProfile) < 0) {
goto error;
}
diff --git a/src/util/virnetdevtap.h b/src/util/virnetdevtap.h
index 971b166..d9a3593 100644
--- a/src/util/virnetdevtap.h
+++ b/src/util/virnetdevtap.h
@@ -47,6 +47,7 @@ typedef enum {
int virNetDevTapCreateInBridgePort(const char *brname,
char **ifname,
const unsigned char *macaddr,
+ const unsigned char *vmuuid,
int *tapfd,
virNetDevVPortProfilePtr virtPortProfile,
unsigned int flags)
--
1.7.9
12 years, 7 months
[libvirt] [PATCH 0/7] Various bugfixes related to device management
by Laine Stump
This series contains 7 patches that are mostly related by the face
that I noticed the problems they're solving while writing the
<interface type='hostdev'> code during the past couple weeks. After
that series was pushed, I sat down to fix everything I'd noticed
before I forgot about it. I'm sending it as a single series rather
than individual patches just to that they're easier to keep track of.
12 years, 7 months
[libvirt] [PATCH] util: add stub pciConfigAddressToSysfsFile for non-linux platforms
by Laine Stump
Absence of this stub function caused a build failure on mingw32.
---
Pushed under build breaker rule (I'm doing way too many of these - I
really need to start running autobuild before any push, instead of
just make check && make syntax-check.)
src/util/pci.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/src/util/pci.c b/src/util/pci.c
index a6212f2..e7bfb92 100644
--- a/src/util/pci.c
+++ b/src/util/pci.c
@@ -2209,6 +2209,15 @@ pciGetVirtualFunctionIndex(const char *pf_sysfs_device_link ATTRIBUTE_UNUSED,
}
int
+pciConfigAddressToSysfsFile(struct pci_config_address *dev ATTRIBUTE_UNUSED,
+ char **pci_sysfs_device_link ATTRIBUTE_UNUSED)
+{
+ pciReportError(VIR_ERR_INTERNAL_ERROR, _("pciConfigAddressToSysfsFile is not "
+ "supported on non-linux platforms"));
+ return -1;
+}
+
+int
pciDeviceNetName(char *device_link_sysfs_path ATTRIBUTE_UNUSED,
char **netname ATTRIBUTE_UNUSED)
{
--
1.7.7.6
12 years, 7 months
[libvirt] Build error on OSX in src/util/virnetlink.c
by Duncan Rance
Hi,
I'm building on OSX with no libnl. I had to do this to get src/util/virnetlink.c to compile:
diff --git a/src/util/virnetlink.c b/src/util/virnetlink.c
index 1575bad..59f3e39 100644
--- a/src/util/virnetlink.c
+++ b/src/util/virnetlink.c
@@ -545,9 +545,9 @@ int virNetlinkCommand(struct nl_msg *nl_msg ATTRIBUTE_UNUSED,
*/
int virNetlinkEventServiceStop(void)
{
+# if defined(__linux__) && !defined(HAVE_LIBNL)
netlinkError(VIR_ERR_INTERNAL_ERROR,
"%s",
-# if defined(__linux__) && !defined(HAVE_LIBNL)
_("virNetlinkEventServiceStop is not supported since libnl was not available"));
# endif
return 0;
Cheers
12 years, 7 months