[libvirt] [PATCH 0/2] Set hostname in lxc containers
by Cédric Bosdonnat
Hey there,
Here are two commits to set a transient hostname on lxc containers based
on the guest name.
Cédric Bosdonnat (2):
Add virStringFilterChars() string utility
lxc: set a hostname based on the container name
src/libvirt_private.syms | 1 +
src/lxc/lxc_container.c | 35 +++++++++++++++++++++++++++++++++++
src/util/virstring.c | 24 ++++++++++++++++++++++++
src/util/virstring.h | 1 +
tests/virstringtest.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 107 insertions(+)
--
2.15.1
6 years, 11 months
[libvirt] [PATCH] blockjob: Fix error checking of blockjob status
by Jie Wang
when the blockjob return status:"BLOCK_JOB_COMPLETED" with error:
"File descriptor in bad state", "offset" and "len" are equal to zero,
but the blockjob event should be "VIR_DOMAIN_BLOCK_JOB_FAILED"
---
src/qemu/qemu_monitor_json.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index e45868b..943360a 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -886,7 +886,7 @@ qemuMonitorJSONHandleBlockJobImpl(qemuMonitorPtr mon,
case VIR_DOMAIN_BLOCK_JOB_COMPLETED:
error = virJSONValueObjectGetString(data, "error");
/* Make sure the whole device has been processed */
- if (offset != len)
+ if (offset != len || offset == 0)
event = VIR_DOMAIN_BLOCK_JOB_FAILED;
break;
case VIR_DOMAIN_BLOCK_JOB_CANCELED:
--
1.8.3.1
6 years, 11 months
[libvirt] error: operation failed: domain save job: unexpectedly failed
by Oscar Segarra
Hi,
For any unkown reason the virsh save raises an error in my environment
Centos 7.2:
[root@vdicnode02 ~]# virsh list
Id Name State
----------------------------------------------------
2 vdicsunstone01 running
3 one-27 running
[root@vdicnode02 ~]# export LIBVIRT_DEBUG=0
[root@vdicnode02 ~]# export LIBVIRT_LOG_OUTPUTS="1:file:virsh.log"
[root@vdicnode02 ~]# virsh --debug 0 --connect qemu:///system save one-27
/var/lib/one//datastores/100/27/checkpoint
save: domain(optdata): one-27
save: file(optdata): /var/lib/one//datastores/100/27/checkpoint
save: found option <domain>: one-27
save: <domain> trying as domain NAME
save: found option <domain>: one-27
save: <domain> trying as domain NAME
error: Failed to save domain one-27 to
/var/lib/one//datastores/100/27/checkpoint
error: operation failed: domain save job: unexpectedly failed
[root@vdicnode02 ~]# cat virsh.log
2017-12-27 21:56:26.676+0000: 86761: info : libvirt version: 3.2.0,
package: 14.el7_4.5 (CentOS BuildSystem <http://bugs.centos.org>,
2017-12-07-15:37:23, c1bm.rdu2.centos.org)
2017-12-27 21:56:26.676+0000: 86761: info : hostname: vdicnode02
2017-12-27 21:56:26.676+0000: 86761: error :
virNetClientProgramDispatchError:177 : operation failed: domain save job:
unexpectedly failed
[root@vdicnode02 ~]#
Versions:
[root@vdicnode02 ~]# /usr/libexec/qemu-kvm --version
QEMU emulator version 1.5.3 (qemu-kvm-1.5.3-141.el7_4.4), Copyright (c)
2003-2008 Fabrice Bellard
[root@vdicnode02 ~]# libvirtd --version
libvirtd (libvirt) 3.2.0
The process:
[root@vdicnode02 ~]# ps -defa | grep one-27
oneadmin 59956 1 56 20:36 ? 01:20:27 /usr/libexec/qemu-kvm
-name one-27 -S -machine
pc-i440fx-rhel7.0.0,accel=kvm,usb=off,dump-guest-core=off -cpu SandyBridge
-m 1024 -realtime mlock=off -smp 2,sockets=2,cores=1,threads=1 -uuid
f3d850ce-25cb-446f-a017-0564751514a1 -no-user-config -nodefaults -chardev
socket,id=charmonitor,path=/var/lib/libvirt/qemu/domain-3-one-27/monitor.sock,server,nowait
-mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown
-boot strict=on -device nec-usb-xhci,id=usb,bus=pci.0,addr=0x5 -device
virtio-scsi-pci,id=scsi0,num_queues=4,bus=pci.0,addr=0x6 -device
virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x7 -device
usb-hub,id=hub0,bus=usb.0,port=1 -drive
file=rbd:vdicvmpool-ssd/one-2-27-0:id=libvirt:key=AQDE5KVZeuJlIBAAiRDxHOGcbtioGTnBVECyrQ==:auth_supported=cephx\;none:mon_host=vdicnode01\:6789\;vdicnode02\:6789,format=raw,if=none,id=drive-virtio-disk0,cache=writeback
-device
virtio-blk-pci,scsi=off,bus=pci.0,addr=0x8,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1
-drive
file=/var/lib/one//datastores/100/27/disk.1,format=raw,if=none,id=drive-ide0-0-0,readonly=on
-device ide-cd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 -netdev
tap,fd=27,id=hostnet0,vhost=on,vhostfd=30 -device
virtio-net-pci,netdev=hostnet0,id=net0,mac=02:00:2f:4e:9c:3e,bus=pci.0,addr=0x3
-chardev spicevmc,id=charchannel0,name=vdagent -device
virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=com.redhat.spice.0
-chardev
socket,id=charchannel1,path=/var/lib/libvirt/qemu/channel/target/domain-3-one-27/org.qemu.guest_agent.0,server,nowait
-device
virtserialport,bus=virtio-serial0.0,nr=2,chardev=charchannel1,id=channel1,name=org.qemu.guest_agent.0
-device usb-tablet,id=input0,bus=usb.0,port=2 -spice
port=5927,addr=0.0.0.0,disable-ticketing,seamless-migration=on -k es -vga
qxl -global qxl-vga.ram_size=67108864 -global qxl-vga.vram_size=67108864
-global qxl-vga.vgamem_mb=64 -global qxl-vga.max_outputs=1 -device
intel-hda,id=sound0,bus=pci.0,addr=0x4 -device
hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0 -chardev
spicevmc,id=charredir0,name=usbredir -device
usb-redir,chardev=charredir0,id=redir0,bus=usb.0,port=3 -chardev
spicevmc,id=charredir1,name=usbredir -device
usb-redir,chardev=charredir1,id=redir1,bus=usb.0,port=4 -chardev
spicevmc,id=charredir2,name=usbredir -device
usb-redir,chardev=charredir2,id=redir2,bus=usb.0,port=1.1 -chardev
spicevmc,id=charredir3,name=usbredir -device
usb-redir,chardev=charredir3,id=redir3,bus=usb.0,port=1.2 -device
virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x9 -msg timestamp=on
Any help will be welcome!
Thanks a lot.
6 years, 12 months
[libvirt] error: qemu unexpectedly closed the monitor: load of migration failed
by Oscar Segarra
Hi,
For any unkown reason the virsh migrate raises an error in my environment
Centos 7.2:
[root@vdicnode02 ~]# virsh list
Id Name State
----------------------------------------------------
2 vdicsunstone01 running
3 one-27 running
[root@vdicnode02 ~]# export LIBVIRT_DEBUG=0
[root@vdicnode02 ~]# export LIBVIRT_LOG_OUTPUTS="1:file:virsh.log"
[root@vdicnode02 ~]# virsh --debug 0 --connect=qemu:///system --quiet
migrate --live one-27 qemu+ssh://vdicnode01/system
migrate: live(bool): (none)
migrate: domain(optdata): one-27
migrate: desturi(optdata): qemu+ssh://vdicnode01/system
migrate: found option <domain>: one-27
migrate: <domain> trying as domain NAME
migrate: found option <domain>: one-27
migrate: <domain> trying as domain NAME
error: internal error: qemu unexpectedly closed the monitor: load of
migration failed
[root@vdicnode02 ~]# cat virsh.log
2017-12-27 22:01:34.211+0000: 92553: info : libvirt version: 3.2.0,
package: 14.el7_4.5 (CentOS BuildSystem <http://bugs.centos.org>,
2017-12-07-15:37:23, c1bm.rdu2.centos.org)
2017-12-27 22:01:34.211+0000: 92553: info : hostname: vdicnode02
2017-12-27 22:01:34.211+0000: 92553: error :
virNetClientProgramDispatchError:177 : operation failed: migration job:
unexpectedly failed
2017-12-27 22:01:34.435+0000: 92553: error :
virNetClientProgramDispatchError:177 : internal error: qemu unexpectedly
closed the monitor: load of migration failed
[root@vdicnode02 ~]#
Versions:
[root@vdicnode02 ~]# /usr/libexec/qemu-kvm --version
QEMU emulator version 1.5.3 (qemu-kvm-1.5.3-141.el7_4.4), Copyright (c)
2003-2008 Fabrice Bellard
[root@vdicnode02 ~]# libvirtd --version
libvirtd (libvirt) 3.2.0
The process:
[root@vdicnode02 ~]# ps -defa | grep one-27
oneadmin 59956 1 56 20:36 ? 01:20:27 /usr/libexec/qemu-kvm
-name one-27 -S -machine
pc-i440fx-rhel7.0.0,accel=kvm,usb=off,dump-guest-core=off
-cpu SandyBridge -m 1024 -realtime mlock=off -smp
2,sockets=2,cores=1,threads=1 -uuid f3d850ce-25cb-446f-a017-0564751514a1
-no-user-config -nodefaults -chardev socket,id=charmonitor,path=/
var/lib/libvirt/qemu/domain-3-one-27/monitor.sock,server,nowait -mon
chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown
-boot strict=on -device nec-usb-xhci,id=usb,bus=pci.0,addr=0x5 -device
virtio-scsi-pci,id=scsi0,num_queues=4,bus=pci.0,addr=0x6 -device
virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x7 -device
usb-hub,id=hub0,bus=usb.0,port=1 -drive file=rbd:vdicvmpool-ssd/one-2-
27-0:id=libvirt:key=AQDE5KVZeuJlIBAAiRDxHOGcbtioGTnBVECyrQ==:auth_supported=
cephx\;none:mon_host=vdicnode01\:6789\;vdicnode02\:
6789,format=raw,if=none,id=drive-virtio-disk0,cache=writeback -device
virtio-blk-pci,scsi=off,bus=pci.0,addr=0x8,drive=drive-
virtio-disk0,id=virtio-disk0,bootindex=1 -drive
file=/var/lib/one//datastores/100/27/disk.1,format=raw,if=
none,id=drive-ide0-0-0,readonly=on -device
ide-cd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0
-netdev tap,fd=27,id=hostnet0,vhost=on,vhostfd=30 -device
virtio-net-pci,netdev=hostnet0,id=net0,mac=02:00:2f:4e:9c:3e,bus=pci.0,addr=0x3
-chardev spicevmc,id=charchannel0,name=vdagent -device
virtserialport,bus=virtio-serial0.0,nr=1,chardev=
charchannel0,id=channel0,name=com.redhat.spice.0 -chardev
socket,id=charchannel1,path=/var/lib/libvirt/qemu/channel/
target/domain-3-one-27/org.qemu.guest_agent.0,server,nowait -device
virtserialport,bus=virtio-serial0.0,nr=2,chardev=
charchannel1,id=channel1,name=org.qemu.guest_agent.0 -device
usb-tablet,id=input0,bus=usb.0,port=2 -spice port=5927,addr=0.0.0.0,
disable-ticketing,seamless-migration=on -k es -vga qxl -global
qxl-vga.ram_size=67108864 -global qxl-vga.vram_size=67108864 -global
qxl-vga.vgamem_mb=64 -global qxl-vga.max_outputs=1 -device
intel-hda,id=sound0,bus=pci.0,addr=0x4 -device
hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0
-chardev spicevmc,id=charredir0,name=usbredir -device
usb-redir,chardev=charredir0,id=redir0,bus=usb.0,port=3 -chardev
spicevmc,id=charredir1,name=usbredir -device
usb-redir,chardev=charredir1,id=redir1,bus=usb.0,port=4
-chardev spicevmc,id=charredir2,name=usbredir -device
usb-redir,chardev=charredir2,id=redir2,bus=usb.0,port=1.1 -chardev
spicevmc,id=charredir3,name=usbredir -device
usb-redir,chardev=charredir3,id=redir3,bus=usb.0,port=1.2
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x9 -msg timestamp=on
Any help will be welcome!
Thanks a lot.
7 years
[libvirt] [PATCH v5 0/3] daemon: fix termination/reload issues
by John Ferlan
v4: https://www.redhat.com/archives/libvir-list/2017-October/msg01249.html
Difference to v4 - inserted a patch to handle the Unref possibilities
in virLockDaemonNew when either the @srv is placed into the daemon
net server hash table or if virNetDaemonNew fails.
Patch 3 has a minor change (from previous review) to not set
dmn->servers = NULL allowing the virHashFree in virNetDaemonDispose.
John Ferlan (1):
lockd: Need to Unref @srv when done with it.
Nikolay Shirokovskiy (2):
virtlogd: add missing netserver refcount increment on reload
libvirtd: fix crash on termination
src/locking/lock_daemon.c | 4 ++++
src/rpc/virnetdaemon.c | 2 ++
2 files changed, 6 insertions(+)
--
2.13.6
7 years
[libvirt] [PATCH v2 00/14] Fix race on srv->nclients_unauth and some other changes
by Marc Hartmayer
This patch series fixes some locking issues, a memory leak, some other
cosmetic changes, and it fixes a bug that led to a libvirtd which
doesn't accept new connections.
Changelog:
v1->v2:
+ Added r-b's
+ Patch 2: Replaced the patch with a new fix for the memory leak
+ Patch 5: Introduce *Locked and simplified the function as John suggested
+ Patch 7: Fixed coding style issues, merged in the former patch 9, reworded commit message
+ Patch 9: (former patch 10) reworded the commit message and fixed coding style issues
+ Patch 10: (former patch 11) Fixed coding style issues, moved check
to ExecRestart, reworded function description of
virNetServerSetClientAuthCompletedLocked
+ New patch 14: Add locking around the critical section in remoteSASLFinish
Marc Hartmayer (14):
rpc: Remove duplicate declaration of virNetServerAddClient
tests: virnetserverclienttest: Fix memory leak @client
rpc: Use the enum value instead of a numerical value
rpc: Add typedef for the anonymous enum used for authentication
methods
rpc: Be more precise in which cases the authentication is needed and
introduce *Locked
rpc: First test if authentication is required
rpc: Refactor the condition whether a client needs authentication
rpc: Correct locking and simplify the function
rpc: Introduce virNetServerSetClientAuthenticated
rpc: virnetserver: Fix race on srv->nclients_unauth
tests: virnetdaemontest: Enable testing for 'auth_pending'
rpc: Remove virNetServerClientNeedAuthLocked
rpc: Replace virNetServerClientNeedAuth with
virNetServerClientIsAuthenticated
remote: add locking around the critical section in remoteSASLFinish
daemon/remote.c | 33 +++---
src/libvirt_remote.syms | 14 +--
src/rpc/virnetserver.c | 82 +++++++++-----
src/rpc/virnetserver.h | 6 +-
src/rpc/virnetserverclient.c | 118 ++++++++++++++++-----
src/rpc/virnetserverclient.h | 11 +-
src/rpc/virnetserverprogram.c | 9 +-
src/rpc/virnetserverservice.h | 4 +-
.../input-data-client-auth-pending-failure.json | 44 ++++++++
.../input-data-client-auth-pending.json | 70 ++++++++++++
.../virnetdaemondata/output-data-admin-nomdns.json | 4 +
.../output-data-admin-server-names.json | 4 +
.../virnetdaemondata/output-data-anon-clients.json | 2 +
...s.json => output-data-client-auth-pending.json} | 4 +-
tests/virnetdaemondata/output-data-client-ids.json | 2 +
.../output-data-client-timestamp.json | 2 +
.../output-data-initial-nomdns.json | 2 +
tests/virnetdaemondata/output-data-initial.json | 2 +
.../output-data-no-keepalive-required.json | 4 +
tests/virnetdaemontest.c | 2 +
tests/virnetserverclienttest.c | 1 +
21 files changed, 331 insertions(+), 89 deletions(-)
create mode 100644 tests/virnetdaemondata/input-data-client-auth-pending-failure.json
create mode 100644 tests/virnetdaemondata/input-data-client-auth-pending.json
copy tests/virnetdaemondata/{output-data-client-ids.json => output-data-client-auth-pending.json} (94%)
--
2.13.4
7 years
Re: [libvirt] RFC: Introduce a dlm-corosync for Lock manager plugin
by Lin Fu
> How are locks acquired by libdlm scoped ? The reason we have virtlockd is
> that the fcntl() locks need to be held by a running process, and we wanted
> them to persist across libvirtd restarts. This required holding them in a
> separate process.
Locks are managed by 'dlm_controld' daemon. There is a flag marked as
`LKF_PERSISTENT` could archive the purpose that locks still exist after
restarting libvirtd. And within my current cognition, lock would only
disappear after rebooting OS, (not release the locks manually); at the
same time, other nodes in clusters could recovery the lock context.
> Are libdlm locks automatically released when the process that acquired
> them dies, or is a manual release action required ? If they always require
> a manual release, then there would be no need to use virtlockd - the plugin
> can just take care of acquire & release, and still cope with lbivirtd
> restarts.
So why do I talk about virtlockd? It about the lockid. And what is lockid?
In dlm, there are concepts about 'lockspace', 'resource' and 'lockid'. The
relationship: multiple locks could be associated with the same resource,
one lockspace could be added in multiple resource. When acquire a lock for
the resource, lockid is returned by acquiring API call.
Question: How could I know that which lockid is associated with the clear
resource? After all, all lockid information will be lost after rebooting
libvirtd in generally.
I think about some resolution: one is using virtlockd to maintain those
information, another is use some ways(such as share memory, write it to
disk) to persistent information Fortunately, maybe I don't have to use
virtlockd. LVM project also use the dlm, I could to refer it's implements.
-----
>> The first half of 2017, QEMU introduced the `share-rw` and `file.locking` to
>> handle a problem: https://bugzilla.redhat.com/show_bug.cgi?id=1080152 ,
link correction: https://bugzilla.redhat.com/show_bug.cgi?id=1378241
--
Regards
River
7 years
[libvirt] [PATCH] add support of iSER transport type in qemu with libiscsi
by lichstor@gmail.com
From: zhangshengyu <zhangshengyu(a)fusionstack.cn>
---
docs/schemas/domaincommon.rng | 28 +++++++++++++
src/conf/domain_conf.c | 8 ++++
src/qemu/qemu_block.c | 24 ++++++++++-
src/qemu/qemu_command.c | 3 ++
src/qemu/qemu_parse_command.c | 10 ++++-
src/storage/storage_backend_gluster.c | 1 +
src/util/virstoragefile.c | 3 +-
src/util/virstoragefile.h | 1 +
.../disk-drive-network-iser-auth.args | 25 ++++++++++++
.../disk-drive-network-iser-auth.xml | 44 ++++++++++++++++++++
.../qemuargv2xmldata/disk-drive-network-iser.args | 25 ++++++++++++
tests/qemuargv2xmldata/disk-drive-network-iser.xml | 41 +++++++++++++++++++
tests/qemuargv2xmltest.c | 2 +
...-drive-network-iser-auth-secrettype-invalid.xml | 33 +++++++++++++++
...sk-drive-network-iser-auth-wrong-secrettype.xml | 33 +++++++++++++++
.../disk-drive-network-iser-auth.args | 31 ++++++++++++++
.../disk-drive-network-iser-auth.xml | 43 ++++++++++++++++++++
.../disk-drive-network-iser-lun.args | 27 +++++++++++++
.../disk-drive-network-iser-lun.xml | 28 +++++++++++++
.../qemuxml2argvdata/disk-drive-network-iser.args | 29 +++++++++++++
tests/qemuxml2argvdata/disk-drive-network-iser.xml | 37 +++++++++++++++++
tests/qemuxml2argvtest.c | 1 +
.../disk-drive-network-iser-auth.xml | 47 ++++++++++++++++++++++
.../qemuxml2xmloutdata/disk-drive-network-iser.xml | 41 +++++++++++++++++++
tests/qemuxml2xmltest.c | 1 +
25 files changed, 562 insertions(+), 4 deletions(-)
create mode 100644 tests/qemuargv2xmldata/disk-drive-network-iser-auth.args
create mode 100644 tests/qemuargv2xmldata/disk-drive-network-iser-auth.xml
create mode 100644 tests/qemuargv2xmldata/disk-drive-network-iser.args
create mode 100644 tests/qemuargv2xmldata/disk-drive-network-iser.xml
create mode 100644 tests/qemuxml2argvdata/disk-drive-network-iser-auth-secrettype-invalid.xml
create mode 100644 tests/qemuxml2argvdata/disk-drive-network-iser-auth-wrong-secrettype.xml
create mode 100644 tests/qemuxml2argvdata/disk-drive-network-iser-auth.args
create mode 100644 tests/qemuxml2argvdata/disk-drive-network-iser-auth.xml
create mode 100644 tests/qemuxml2argvdata/disk-drive-network-iser-lun.args
create mode 100644 tests/qemuxml2argvdata/disk-drive-network-iser-lun.xml
create mode 100644 tests/qemuxml2argvdata/disk-drive-network-iser.args
create mode 100644 tests/qemuxml2argvdata/disk-drive-network-iser.xml
create mode 100644 tests/qemuxml2xmloutdata/disk-drive-network-iser-auth.xml
create mode 100644 tests/qemuxml2xmloutdata/disk-drive-network-iser.xml
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index f22c932f6..819a8791d 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -1534,6 +1534,7 @@
<choice>
<value>tcp</value>
<value>rdma</value>
+ <value>iser</value>
</choice>
</attribute>
</optional>
@@ -1613,6 +1614,15 @@
<optional>
<ref name="encryption"/>
</optional>
+ <optional>
+ <attribute name="transport">
+ <choice>
+ <value>tcp</value>
+ <value>rdma</value>
+ <value>iser</value>
+ </choice>
+ </attribute>
+ </optional>
</element>
</define>
@@ -4386,6 +4396,15 @@
<attribute name="name">
<text/>
</attribute>
+ <optional>
+ <attribute name="transport">
+ <choice>
+ <value>tcp</value>
+ <value>rdma</value>
+ <value>iser</value>
+ </choice>
+ </attribute>
+ </optional>
<interleave>
<oneOrMore>
<element name='host'>
@@ -4397,6 +4416,15 @@
<ref name="PortNumber"/>
</attribute>
</optional>
+ <optional>
+ <attribute name="transport">
+ <choice>
+ <value>tcp</value>
+ <value>rdma</value>
+ <value>iser</value>
+ </choice>
+ </attribute>
+ </optional>
<empty/>
</element>
</oneOrMore>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 9a62bc472..4c71855b4 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -7080,6 +7080,7 @@ virDomainStorageNetworkParseHosts(xmlNodePtr node,
virStorageNetHostDefPtr *hosts,
size_t *nhosts)
{
+ char *transport = NULL;
xmlNodePtr child;
for (child = node->children; child; child = child->next) {
@@ -7091,6 +7092,9 @@ virDomainStorageNetworkParseHosts(xmlNodePtr node,
}
}
+ if ((*hosts) && (transport = virXMLPropString(node, "transport")))
+ (*hosts)->transport = virStorageNetHostTransportTypeFromString(transport);
+
return 0;
}
@@ -8495,6 +8499,7 @@ virDomainDiskSourceNetworkParse(xmlNodePtr node,
if (virDomainStorageNetworkParseHosts(node, &src->hosts, &src->nhosts) < 0)
goto cleanup;
+
virStorageSourceNetworkAssignDefaultPorts(src);
ret = 0;
@@ -22364,6 +22369,9 @@ virDomainDiskSourceFormatNetwork(virBufferPtr attrBuf,
VIR_FREE(path);
+ if (src->hosts && src->hosts->transport == VIR_STORAGE_NET_HOST_TRANS_ISER)
+ virBufferEscapeString(attrBuf, " transport='%s'", "iser");
+
if (src->haveTLS != VIR_TRISTATE_BOOL_ABSENT &&
!(flags & VIR_DOMAIN_DEF_FORMAT_MIGRATABLE &&
src->tlsFromConfig))
diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
index 585f0255e..49837205f 100644
--- a/src/qemu/qemu_block.c
+++ b/src/qemu/qemu_block.c
@@ -433,6 +433,12 @@ qemuBlockStorageSourceGetURI(virStorageSourcePtr src)
if (VIR_STRDUP(uri->scheme,
virStorageNetProtocolTypeToString(src->protocol)) < 0)
goto cleanup;
+ } else if (src->hosts->transport == VIR_STORAGE_NET_HOST_TRANS_ISER) {
+ uri->port = src->hosts->port;
+
+ if (VIR_STRDUP(uri->scheme,
+ virStorageNetHostTransportTypeToString(src->hosts->transport)) < 0)
+ goto cleanup;
} else {
if (virAsprintf(&uri->scheme, "%s+%s",
virStorageNetProtocolTypeToString(src->protocol),
@@ -506,6 +512,19 @@ qemuBlockStorageSourceBuildJSONSocketAddress(virStorageNetHostDefPtr host,
goto cleanup;
break;
+ case VIR_STORAGE_NET_HOST_TRANS_ISER:
+ transport = "iser";
+ if (virAsprintf(&port, "%u", host->port) < 0)
+ goto cleanup;
+
+ if (virJSONValueObjectCreate(&server,
+ "s:type", transport,
+ "s:host", host->name,
+ "s:port", port,
+ NULL) < 0)
+ goto cleanup;
+ break;
+
case VIR_STORAGE_NET_HOST_TRANS_UNIX:
if (virJSONValueObjectCreate(&server,
"s:type", "unix",
@@ -590,7 +609,8 @@ qemuBlockStorageSourceBuildJSONInetSocketAddress(virStorageNetHostDefPtr host)
virJSONValuePtr ret = NULL;
char *port = NULL;
- if (host->transport != VIR_STORAGE_NET_HOST_TRANS_TCP) {
+ if (host->transport != VIR_STORAGE_NET_HOST_TRANS_TCP &&
+ host->transport != VIR_STORAGE_NET_HOST_TRANS_ISER) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("only TCP protocol can be converted to InetSocketAddress"));
return NULL;
@@ -831,7 +851,7 @@ qemuBlockStorageSourceGetISCSIProps(virStorageSourcePtr src)
"s:portal", portal,
"s:target", target,
"u:lun", lun,
- "s:transport", "tcp",
+ "s:transport", virStorageNetHostTransportTypeToString(src->hosts->transport),
"S:user", username,
"S:password-secret", objalias,
NULL));
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 4d0c141e5..eb482097f 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -883,6 +883,8 @@ qemuBuildNetworkDriveStr(virStorageSourcePtr src,
if (!((src->hosts->name && strchr(src->hosts->name, ':')) ||
(src->hosts->transport == VIR_STORAGE_NET_HOST_TRANS_TCP &&
!src->hosts->name) ||
+ (src->hosts->transport == VIR_STORAGE_NET_HOST_TRANS_ISER &&
+ !src->hosts->name) ||
(src->hosts->transport == VIR_STORAGE_NET_HOST_TRANS_UNIX &&
src->hosts->socket &&
src->hosts->socket[0] != '/'))) {
@@ -891,6 +893,7 @@ qemuBuildNetworkDriveStr(virStorageSourcePtr src,
switch (src->hosts->transport) {
case VIR_STORAGE_NET_HOST_TRANS_TCP:
+ case VIR_STORAGE_NET_HOST_TRANS_ISER:
virBufferAsprintf(&buf, "%s:%u",
src->hosts->name, src->hosts->port);
break;
diff --git a/src/qemu/qemu_parse_command.c b/src/qemu/qemu_parse_command.c
index 5fe3f97d0..d376af208 100644
--- a/src/qemu/qemu_parse_command.c
+++ b/src/qemu/qemu_parse_command.c
@@ -70,7 +70,9 @@ qemuParseDriveURIString(virDomainDiskDefPtr def, virURIPtr uri,
if (transp)
*transp++ = 0;
- if (STRNEQ(uri->scheme, scheme)) {
+ if (STREQ(uri->scheme, "iser")) {
+ transp = (char *)"iser";
+ } else if (STRNEQ(uri->scheme, scheme)) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Invalid transport/scheme '%s'"), uri->scheme);
goto error;
@@ -709,6 +711,12 @@ qemuParseCommandLineDisk(virDomainXMLOptionPtr xmlopt,
if (qemuParseISCSIString(def) < 0)
goto error;
+ } else if (STRPREFIX(def->src->path, "iser:")) {
+ def->src->type = VIR_STORAGE_TYPE_NETWORK;
+ def->src->protocol = VIR_STORAGE_NET_PROTOCOL_ISCSI;
+
+ if (qemuParseISCSIString(def) < 0)
+ goto error;
} else if (STRPREFIX(def->src->path, "sheepdog:")) {
char *p = def->src->path;
char *port, *vdi;
diff --git a/src/storage/storage_backend_gluster.c b/src/storage/storage_backend_gluster.c
index 5eea84f16..1452fa0cd 100644
--- a/src/storage/storage_backend_gluster.c
+++ b/src/storage/storage_backend_gluster.c
@@ -608,6 +608,7 @@ virStorageFileBackendGlusterInitServer(virStorageFileBackendGlusterPrivPtr priv,
hoststr = host->socket;
break;
+ case VIR_STORAGE_NET_HOST_TRANS_ISER:
case VIR_STORAGE_NET_HOST_TRANS_LAST:
break;
}
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 5780180a9..63253a9c4 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -92,7 +92,8 @@ VIR_ENUM_IMPL(virStorageNetProtocol, VIR_STORAGE_NET_PROTOCOL_LAST,
VIR_ENUM_IMPL(virStorageNetHostTransport, VIR_STORAGE_NET_HOST_TRANS_LAST,
"tcp",
"unix",
- "rdma")
+ "rdma",
+ "iser")
VIR_ENUM_IMPL(virStorageSourcePoolMode,
VIR_STORAGE_SOURCE_POOL_MODE_LAST,
diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
index ecd806c93..5a6ec7776 100644
--- a/src/util/virstoragefile.h
+++ b/src/util/virstoragefile.h
@@ -147,6 +147,7 @@ typedef enum {
VIR_STORAGE_NET_HOST_TRANS_TCP,
VIR_STORAGE_NET_HOST_TRANS_UNIX,
VIR_STORAGE_NET_HOST_TRANS_RDMA,
+ VIR_STORAGE_NET_HOST_TRANS_ISER,
VIR_STORAGE_NET_HOST_TRANS_LAST
} virStorageNetHostTransport;
diff --git a/tests/qemuargv2xmldata/disk-drive-network-iser-auth.args b/tests/qemuargv2xmldata/disk-drive-network-iser-auth.args
new file mode 100644
index 000000000..aaf10d8c8
--- /dev/null
+++ b/tests/qemuargv2xmldata/disk-drive-network-iser-auth.args
@@ -0,0 +1,25 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-i686 \
+-name QEMUGuest1 \
+-S \
+-M pc \
+-m 214 \
+-smp 1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-nographic \
+-monitor unix:/tmp/test-monitor,server,nowait \
+-no-acpi \
+-boot c \
+-usb \
+-drive file=iser://myname:AQCVn5hO6HzFAhAAq0NCv8jtJcIcE+HOBlMQ1A@example.org:\
+6000/iqn.1992-01.com.example%3Astorage/1,format=raw,if=virtio \
+-drive file=iser://example.org:6000/iqn.1992-01.com.example%3Astorage/2,\
+format=raw,if=virtio \
+-net none \
+-serial none \
+-parallel none
diff --git a/tests/qemuargv2xmldata/disk-drive-network-iser-auth.xml b/tests/qemuargv2xmldata/disk-drive-network-iser-auth.xml
new file mode 100644
index 000000000..7226443fb
--- /dev/null
+++ b/tests/qemuargv2xmldata/disk-drive-network-iser-auth.xml
@@ -0,0 +1,44 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</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-i686</emulator>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <auth username='myname'>
+ <secret type='iscsi' usage='qemuargv2xml_usage'/>
+ </auth>
+ <source protocol='iscsi' name='iqn.1992-01.com.example:storage/1' transport='iser'>
+ <host name='example.org' port='6000' transport='iser'/>
+ </source>
+ <target dev='vda' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+ </disk>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <source protocol='iscsi' name='iqn.1992-01.com.example:storage/2' transport='iser'>
+ <host name='example.org' port='6000' transport='iser'/>
+ </source>
+ <target dev='vdb' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+ </disk>
+ <controller type='usb' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+ </controller>
+ <controller type='pci' index='0' model='pci-root'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuargv2xmldata/disk-drive-network-iser.args b/tests/qemuargv2xmldata/disk-drive-network-iser.args
new file mode 100644
index 000000000..c476e759e
--- /dev/null
+++ b/tests/qemuargv2xmldata/disk-drive-network-iser.args
@@ -0,0 +1,25 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-i686 \
+-name QEMUGuest1 \
+-S \
+-M pc \
+-m 214 \
+-smp 1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-nographic \
+-monitor unix:/tmp/test-monitor,server,nowait \
+-no-acpi \
+-boot c \
+-usb \
+-drive file=iser://example.org:6000/iqn.1992-01.com.example,format=raw,\
+if=virtio \
+-drive file=iser://example.org:6000/iqn.1992-01.com.example/1,format=raw,\
+if=virtio \
+-net none \
+-serial none \
+-parallel none
diff --git a/tests/qemuargv2xmldata/disk-drive-network-iser.xml b/tests/qemuargv2xmldata/disk-drive-network-iser.xml
new file mode 100644
index 000000000..88f043f66
--- /dev/null
+++ b/tests/qemuargv2xmldata/disk-drive-network-iser.xml
@@ -0,0 +1,41 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</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-i686</emulator>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <source protocol='iscsi' name='iqn.1992-01.com.example/0' transport='iser'>
+ <host name='example.org' port='6000' transport='iser'/>
+ </source>
+ <target dev='vda' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+ </disk>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <source protocol='iscsi' name='iqn.1992-01.com.example/1' transport='iser'>
+ <host name='example.org' port='6000' transport='iser'/>
+ </source>
+ <target dev='vdb' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+ </disk>
+ <controller type='usb' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+ </controller>
+ <controller type='pci' index='0' model='pci-root'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuargv2xmltest.c b/tests/qemuargv2xmltest.c
index cb010268c..59b26c647 100644
--- a/tests/qemuargv2xmltest.c
+++ b/tests/qemuargv2xmltest.c
@@ -213,6 +213,8 @@ mymain(void)
DO_TEST("disk-drive-network-nbd-unix");
DO_TEST("disk-drive-network-iscsi");
DO_TEST("disk-drive-network-iscsi-auth");
+ DO_TEST("disk-drive-network-iser");
+ DO_TEST("disk-drive-network-iser-auth");
DO_TEST("disk-drive-network-gluster");
DO_TEST("disk-drive-network-rbd");
DO_TEST("disk-drive-network-rbd-auth");
diff --git a/tests/qemuxml2argvdata/disk-drive-network-iser-auth-secrettype-invalid.xml b/tests/qemuxml2argvdata/disk-drive-network-iser-auth-secrettype-invalid.xml
new file mode 100644
index 000000000..dbcf484dc
--- /dev/null
+++ b/tests/qemuxml2argvdata/disk-drive-network-iser-auth-secrettype-invalid.xml
@@ -0,0 +1,33 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</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-i686</emulator>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <auth username='myname'>
+ <secret usage='mycluster_myname'/>
+ </auth>
+ <source protocol='iscsi' name='iqn.1992-01.com.example:storage/1' transport='iser'>
+ <host name='example.org' port='6000' transport='iser'/>
+ </source>
+ <target dev='vda' bus='virtio'/>
+ </disk>
+ <controller type='usb' index='0'/>
+ <controller type='pci' index='0' model='pci-root'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/disk-drive-network-iser-auth-wrong-secrettype.xml b/tests/qemuxml2argvdata/disk-drive-network-iser-auth-wrong-secrettype.xml
new file mode 100644
index 000000000..5525e9d86
--- /dev/null
+++ b/tests/qemuxml2argvdata/disk-drive-network-iser-auth-wrong-secrettype.xml
@@ -0,0 +1,33 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</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-i686</emulator>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <auth username='myname'>
+ <secret type='ceph' usage='mycluster_myname'/>
+ </auth>
+ <source protocol='iscsi' name='iqn.1992-01.com.example:storage/1' transport='iser'>
+ <host name='example.org' port='6000' transport='iser'/>
+ </source>
+ <target dev='vda' bus='virtio'/>
+ </disk>
+ <controller type='usb' index='0'/>
+ <controller type='pci' index='0' model='pci-root'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/disk-drive-network-iser-auth.args b/tests/qemuxml2argvdata/disk-drive-network-iser-auth.args
new file mode 100644
index 000000000..5fa7a04bb
--- /dev/null
+++ b/tests/qemuxml2argvdata/disk-drive-network-iser-auth.args
@@ -0,0 +1,31 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-i686 \
+-name QEMUGuest1 \
+-S \
+-M pc \
+-m 214 \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-nographic \
+-nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
+server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=readline \
+-no-acpi \
+-boot c \
+-usb \
+-drive file=iser://myname:AQCVn5hO6HzFAhAAq0NCv8jtJcIcE+HOBlMQ1A@example.org:\
+6000/iqn.1992-01.com.example%3Astorage/1,format=raw,if=none,\
+id=drive-virtio-disk0 \
+-device virtio-blk-pci,bus=pci.0,addr=0x3,drive=drive-virtio-disk0,\
+id=virtio-disk0 \
+-drive file=iser://myname:AQCVn5hO6HzFAhAAq0NCv8jtJcIcE+HOBlMQ1A@example.org:\
+6000/iqn.1992-01.com.example%3Astorage/2,format=raw,if=none,\
+id=drive-virtio-disk1 \
+-device virtio-blk-pci,bus=pci.0,addr=0x4,drive=drive-virtio-disk1,\
+id=virtio-disk1
diff --git a/tests/qemuxml2argvdata/disk-drive-network-iser-auth.xml b/tests/qemuxml2argvdata/disk-drive-network-iser-auth.xml
new file mode 100644
index 000000000..fbcb6b4f1
--- /dev/null
+++ b/tests/qemuxml2argvdata/disk-drive-network-iser-auth.xml
@@ -0,0 +1,43 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</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-i686</emulator>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <auth username='myname'>
+ <secret type='iscsi' usage='mycluster_myname'/>
+ </auth>
+ <source protocol='iscsi' name='iqn.1992-01.com.example:storage/1' transport='iser'>
+ <host name='example.org' port='6000' transport='iser'/>
+ </source>
+ <target dev='vda' bus='virtio'/>
+ </disk>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <auth username='myname'>
+ <secret type='iscsi' usage='mycluster_myname'/>
+ </auth>
+ <source protocol='iscsi' name='iqn.1992-01.com.example:storage/2' transport='iser'>
+ <host name='example.org' port='6000' transport='iser'/>
+ </source>
+ <target dev='vdb' bus='virtio'/>
+ </disk>
+ <controller type='usb' index='0'/>
+ <controller type='pci' index='0' model='pci-root'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/disk-drive-network-iser-lun.args b/tests/qemuxml2argvdata/disk-drive-network-iser-lun.args
new file mode 100644
index 000000000..d9428533b
--- /dev/null
+++ b/tests/qemuxml2argvdata/disk-drive-network-iser-lun.args
@@ -0,0 +1,27 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-i686 \
+-name QEMUGuest1 \
+-S \
+-M pc \
+-m 214 \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-nographic \
+-nodefconfig \
+-nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
+server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=readline \
+-no-acpi \
+-boot c \
+-device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x3 \
+-usb \
+-drive file=iser://example.org:3260/iqn.1992-01.com.example/0,format=raw,\
+if=none,id=drive-scsi0-0-0-0 \
+-device scsi-block,bus=scsi0.0,channel=0,scsi-id=0,lun=0,\
+drive=drive-scsi0-0-0-0,id=scsi0-0-0-0
diff --git a/tests/qemuxml2argvdata/disk-drive-network-iser-lun.xml b/tests/qemuxml2argvdata/disk-drive-network-iser-lun.xml
new file mode 100644
index 000000000..25fa76140
--- /dev/null
+++ b/tests/qemuxml2argvdata/disk-drive-network-iser-lun.xml
@@ -0,0 +1,28 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</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-i686</emulator>
+ <disk type='network' device='lun'>
+ <driver name='qemu' type='raw'/>
+ <source protocol='iscsi' name='iqn.1992-01.com.example' transport='iser'>
+ <host name='example.org' port='3260' transport='iser'/>
+ </source>
+ <target dev='sda' bus='scsi'/>
+ </disk>
+ <controller type='usb' index='0'/>
+ <controller type='scsi' index='0' model='virtio-scsi'/>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/disk-drive-network-iser.args b/tests/qemuxml2argvdata/disk-drive-network-iser.args
new file mode 100644
index 000000000..49ea467ff
--- /dev/null
+++ b/tests/qemuxml2argvdata/disk-drive-network-iser.args
@@ -0,0 +1,29 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-i686 \
+-name QEMUGuest1 \
+-S \
+-M pc \
+-m 214 \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-nographic \
+-nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
+server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=readline \
+-no-acpi \
+-boot c \
+-usb \
+-drive file=iser://example.org:6000/iqn.1992-01.com.example/0,format=raw,\
+if=none,id=drive-virtio-disk0 \
+-device virtio-blk-pci,bus=pci.0,addr=0x3,drive=drive-virtio-disk0,\
+id=virtio-disk0 \
+-drive file=iser://example.org:6000/iqn.1992-01.com.example/1,format=raw,\
+if=none,id=drive-virtio-disk1 \
+-device virtio-blk-pci,bus=pci.0,addr=0x4,drive=drive-virtio-disk1,\
+id=virtio-disk1
diff --git a/tests/qemuxml2argvdata/disk-drive-network-iser.xml b/tests/qemuxml2argvdata/disk-drive-network-iser.xml
new file mode 100644
index 000000000..b1634555c
--- /dev/null
+++ b/tests/qemuxml2argvdata/disk-drive-network-iser.xml
@@ -0,0 +1,37 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</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-i686</emulator>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <source protocol='iscsi' name='iqn.1992-01.com.example' transport='iser'>
+ <host name='example.org' port='6000'/>
+ </source>
+ <target dev='vda' bus='virtio'/>
+ </disk>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <source protocol='iscsi' name='iqn.1992-01.com.example/1' transport='iser'>
+ <host name='example.org' port='6000'/>
+ </source>
+ <target dev='vdb' bus='virtio'/>
+ </disk>
+ <controller type='usb' index='0'/>
+ <controller type='pci' index='0' model='pci-root'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index ca24e0bbb..accfdaf4b 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -936,6 +936,7 @@ mymain(void)
DO_TEST("disk-drive-network-iscsi-lun",
QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_VIRTIO_SCSI,
QEMU_CAPS_SCSI_BLOCK);
+ DO_TEST("disk-drive-network-iser", NONE);
DO_TEST("disk-drive-network-gluster",
QEMU_CAPS_GLUSTER_DEBUG_LEVEL);
DO_TEST("disk-drive-network-rbd", NONE);
diff --git a/tests/qemuxml2xmloutdata/disk-drive-network-iser-auth.xml b/tests/qemuxml2xmloutdata/disk-drive-network-iser-auth.xml
new file mode 100644
index 000000000..1b27fdea2
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/disk-drive-network-iser-auth.xml
@@ -0,0 +1,47 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</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-i686</emulator>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <auth username='myname'>
+ <secret type='iscsi' usage='mycluster_myname'/>
+ </auth>
+ <source protocol='iscsi' name='iqn.1992-01.com.example:storage/1' transport='iser'>
+ <host name='example.org' port='6000' transport='iser'/>
+ </source>
+ <target dev='vda' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+ </disk>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <auth username='myname'>
+ <secret type='iscsi' usage='mycluster_myname'/>
+ </auth>
+ <source protocol='iscsi' name='iqn.1992-01.com.example:storage/2' transport='iser'>
+ <host name='example.org' port='6000' transport='iser'/>
+ </source>
+ <target dev='vdb' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+ </disk>
+ <controller type='usb' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+ </controller>
+ <controller type='pci' index='0' model='pci-root'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/disk-drive-network-iser.xml b/tests/qemuxml2xmloutdata/disk-drive-network-iser.xml
new file mode 100644
index 000000000..88f043f66
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/disk-drive-network-iser.xml
@@ -0,0 +1,41 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</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-i686</emulator>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <source protocol='iscsi' name='iqn.1992-01.com.example/0' transport='iser'>
+ <host name='example.org' port='6000' transport='iser'/>
+ </source>
+ <target dev='vda' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+ </disk>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <source protocol='iscsi' name='iqn.1992-01.com.example/1' transport='iser'>
+ <host name='example.org' port='6000' transport='iser'/>
+ </source>
+ <target dev='vdb' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+ </disk>
+ <controller type='usb' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+ </controller>
+ <controller type='pci' index='0' model='pci-root'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 2be8eb2c1..23f9292c4 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -515,6 +515,7 @@ mymain(void)
DO_TEST("disk-drive-network-nbd-unix", NONE);
DO_TEST("disk-drive-network-iscsi", NONE);
DO_TEST("disk-drive-network-iscsi-auth", NONE);
+ DO_TEST("disk-drive-network-iser", NONE);
DO_TEST("disk-drive-network-gluster", NONE);
DO_TEST("disk-drive-network-rbd", NONE);
DO_TEST("disk-drive-network-rbd-auth", NONE);
--
2.13.6 (Apple Git-96)
7 years
[libvirt] [BUG] We can hot plug more than one vhost-user nics with the same chardev backend
by linzhecheng
We use virsh attach-device to hot-plug vhost-user nic with the following xml:
<interface type='vhostuser'>
<mac address='52:54:01:3b:83:a5'/>
<source type='unix' path='/var/run/vhost-user/port1' mode='client'/>
<target dev='port1'/>
<model type='virtio'/>
<driver queues='4'/>
</interface>
We can successfully hot plug more than one vhost-user nics with
the same unix path ('/var/run/vhost-user/port1') which is a chardev backend.
However, only one nic attached can work, because the unix path can only pair with
one front-end of nic. So should we do something to forbid this operation?
7 years
[libvirt] [PATCH] qemu: Introduce qemuDomainDelChardevTLSObjects
by John Ferlan
Let's make a comment deletion helper similar to the Add helper
that can be called after the ExitMonitor.
The modify qemuDomainRemoveChrDevice and qemuDomainRemoveRNGDevice
to call the helper instead of inlining the copy and pasted code.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
An offshoot of the redirdev hot unplug patches from Chen Hanxiao.
Let's create a helper that can remove the TLS chardev objects for
the specific devices that may have used them.
src/qemu/qemu_hotplug.c | 107 +++++++++++++++++++++++-------------------------
1 file changed, 52 insertions(+), 55 deletions(-)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 7de04c85a..85f47bee2 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1562,6 +1562,47 @@ qemuDomainAddChardevTLSObjects(virConnectPtr conn,
}
+static int
+qemuDomainDelChardevTLSObjects(virQEMUDriverPtr driver,
+ virDomainObjPtr vm,
+ const char *inAlias)
+{
+ int ret = -1;
+ virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
+ qemuDomainObjPrivatePtr priv = vm->privateData;
+ char *tlsAlias = NULL;
+ char *secAlias = NULL;
+
+ if (!(tlsAlias = qemuAliasTLSObjFromSrcAlias(inAlias)))
+ goto cleanup;
+
+ /* Best shot at this as the secinfo is destroyed after process launch
+ * and this path does not recreate it. Thus, if the config has the
+ * secret UUID and we have a serial TCP chardev, then formulate a
+ * secAlias which we'll attempt to destroy. */
+ if (cfg->chardevTLSx509secretUUID &&
+ !(secAlias = qemuDomainGetSecretAESAlias(inAlias, false)))
+ goto cleanup;
+
+ qemuDomainObjEnterMonitor(driver, vm);
+
+ ignore_value(qemuMonitorDelObject(priv->mon, tlsAlias));
+ if (secAlias)
+ ignore_value(qemuMonitorDelObject(priv->mon, secAlias));
+
+ if (qemuDomainObjExitMonitor(driver, vm) < 0)
+ goto cleanup;
+
+ ret = 0;
+
+ cleanup:
+ VIR_FREE(tlsAlias);
+ VIR_FREE(secAlias);
+ virObjectUnref(cfg);
+ return ret;
+}
+
+
int qemuDomainAttachRedirdevDevice(virConnectPtr conn,
virQEMUDriverPtr driver,
virDomainObjPtr vm,
@@ -4120,10 +4161,7 @@ qemuDomainRemoveChrDevice(virQEMUDriverPtr driver,
virDomainChrDefPtr chr)
{
virObjectEventPtr event;
- virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
char *charAlias = NULL;
- char *tlsAlias = NULL;
- char *secAlias = NULL;
qemuDomainObjPrivatePtr priv = vm->privateData;
int ret = -1;
int rc;
@@ -4134,34 +4172,18 @@ qemuDomainRemoveChrDevice(virQEMUDriverPtr driver,
if (!(charAlias = qemuAliasChardevFromDevAlias(chr->info.alias)))
goto cleanup;
- if (chr->source->type == VIR_DOMAIN_CHR_TYPE_TCP &&
- chr->source->data.tcp.haveTLS == VIR_TRISTATE_BOOL_YES) {
-
- if (!(tlsAlias = qemuAliasTLSObjFromSrcAlias(charAlias)))
- goto cleanup;
-
- /* Best shot at this as the secinfo is destroyed after process launch
- * and this path does not recreate it. Thus, if the config has the
- * secret UUID and we have a serial TCP chardev, then formulate a
- * secAlias which we'll attempt to destroy. */
- if (cfg->chardevTLSx509secretUUID &&
- !(secAlias = qemuDomainGetSecretAESAlias(charAlias, false)))
- goto cleanup;
- }
-
qemuDomainObjEnterMonitor(driver, vm);
rc = qemuMonitorDetachCharDev(priv->mon, charAlias);
- if (rc == 0) {
- if (tlsAlias)
- ignore_value(qemuMonitorDelObject(priv->mon, tlsAlias));
- if (secAlias)
- ignore_value(qemuMonitorDelObject(priv->mon, secAlias));
- }
-
if (qemuDomainObjExitMonitor(driver, vm) < 0)
goto cleanup;
+ if (chr->source->type == VIR_DOMAIN_CHR_TYPE_TCP &&
+ chr->source->data.tcp.haveTLS == VIR_TRISTATE_BOOL_YES &&
+ rc == 0 &&
+ qemuDomainDelChardevTLSObjects(driver, vm, charAlias) < 0)
+ goto cleanup;
+
virDomainAuditChardev(vm, chr, NULL, "detach", rc == 0);
if (rc < 0)
@@ -4185,9 +4207,6 @@ qemuDomainRemoveChrDevice(virQEMUDriverPtr driver,
cleanup:
VIR_FREE(charAlias);
- VIR_FREE(tlsAlias);
- VIR_FREE(secAlias);
- virObjectUnref(cfg);
return ret;
}
@@ -4198,11 +4217,8 @@ qemuDomainRemoveRNGDevice(virQEMUDriverPtr driver,
virDomainRNGDefPtr rng)
{
virObjectEventPtr event;
- virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
char *charAlias = NULL;
char *objAlias = NULL;
- char *tlsAlias = NULL;
- char *secAlias = NULL;
qemuDomainObjPrivatePtr priv = vm->privateData;
ssize_t idx;
int ret = -1;
@@ -4218,34 +4234,18 @@ qemuDomainRemoveRNGDevice(virQEMUDriverPtr driver,
if (!(charAlias = qemuAliasChardevFromDevAlias(rng->info.alias)))
goto cleanup;
- if (rng->backend == VIR_DOMAIN_RNG_BACKEND_EGD) {
- if (!(tlsAlias = qemuAliasTLSObjFromSrcAlias(charAlias)))
- goto cleanup;
-
- /* Best shot at this as the secinfo is destroyed after process launch
- * and this path does not recreate it. Thus, if the config has the
- * secret UUID and we have a serial TCP chardev, then formulate a
- * secAlias which we'll attempt to destroy. */
- if (cfg->chardevTLSx509secretUUID &&
- !(secAlias = qemuDomainGetSecretAESAlias(charAlias, false)))
- goto cleanup;
- }
-
qemuDomainObjEnterMonitor(driver, vm);
rc = qemuMonitorDelObject(priv->mon, objAlias);
- if (rc == 0 && rng->backend == VIR_DOMAIN_RNG_BACKEND_EGD) {
- ignore_value(qemuMonitorDetachCharDev(priv->mon, charAlias));
- if (tlsAlias)
- ignore_value(qemuMonitorDelObject(priv->mon, tlsAlias));
- if (secAlias)
- ignore_value(qemuMonitorDelObject(priv->mon, secAlias));
- }
-
if (qemuDomainObjExitMonitor(driver, vm) < 0)
goto cleanup;
+ if (rng->backend == VIR_DOMAIN_RNG_BACKEND_EGD &&
+ rc == 0 &&
+ qemuDomainDelChardevTLSObjects(driver, vm, charAlias) < 0)
+ goto cleanup;
+
virDomainAuditRNG(vm, rng, NULL, "detach", rc == 0);
if (rc < 0)
@@ -4269,9 +4269,6 @@ qemuDomainRemoveRNGDevice(virQEMUDriverPtr driver,
cleanup:
VIR_FREE(charAlias);
VIR_FREE(objAlias);
- VIR_FREE(tlsAlias);
- VIR_FREE(secAlias);
- virObjectUnref(cfg);
return ret;
}
--
2.13.6
7 years