[libvirt] [PATCH v5 0/9] qemu: Add quorum support to libvirt
by Matthias Gatto
The purpose of these patches is to introduce quorum for libvirt
I've try to follow this proposal:
http://www.redhat.com/archives/libvir-list/2014-May/msg00533.html
This feature ask for 6 task:
1) Allow a _virStorageSource to contain more than one backing store.
Because all the actual libvirt code use the backingStore field
as a pointer and we needs want to change that, I've decide to encapsulate
the backingStore field to simplifie the array manipulation.
2) Add the missing field a quorum need in _virStorageSource and
the VIR_STORAGE_TYPE_QUORUM and VIR_STORAGE_FILE_QUORUM in
their respectives enums.
3) Parse and format the xml
Because a quorum allows to have more than one backing store at the same level
we need to change virDomainDiskDefFormat and virDomainDiskDefParseXML
to call virDomainDiskBackingStoreFormat and virDomainDiskBackingStoreParse
in a loop.
virDomainDiskBackingStoreFormat and virDomainDiskBackingStoreParse can
call themself recursively in a loop because a quorum can contain another
quorum
4) Add nodename
We need to add nodename support in _virStorageSource because qemu
use them for their child.
5) Build qemu string
As for the xml, we have to call the function which create quorum recursively.
But this task have the problem explained here:
http://www.redhat.com/archives/libvir-list/2014-October/msg00529.html
The _virStorageSource missing some informations that can be passed to
a child, and therefore this version of quorum is incomplet.
6) Allow to hotplug/change a disk in a quorum
This part is not present in these patches because for this task
we have to use blockdev-add, and currently libvirt use
device_add for hotpluging that doesn't allow to hotplug quorum childs.
There is 3 way to handle this problem:
1) create a virDomainBlockDevAdd function in libvirt witch call
blockdev-add.
2) use blockdev-add instead of device_add in qemuMonitorJSONAddDevice
3) write a hack which uses blockdev-add when only attaching quorum
(but i'm pretty sure this solution is not the good one)
V2:
-Rebase on master
-Add Documentation
V3:
-Transforme the backingStore field in virStorageSource into
an array of pointer instead of a pointer
-Modify virStorageSourceSetBackingStore to allow it to expand
the backingStore size.
V4:
-Rebase on master
V5:
-Rebase on master
-patch 1-4/9: use patchs from John Ferlan
-patch 4/9: check return of virStorageSourceSetBackingStore
-patch 5/9: report type of error on virStorageSourceSetBackingStore
Matthias Gatto (9):
virstoragefile: Add virStorageSourceGetBackingStore
virstoragefile: Always use virStorageSourceGetBackingStore to get
backing store
virstoragefile: Add virStorageSourceSetBackingStore
virstoragefile: Always use virStorageSourceSetBackingStore to set
backing store
virstoragefile: change backingStore to backingStores.
virstoragefile: Add quorum in virstoragefile
domain_conf: Read and Write quorum config
qemu: Add quorum support in qemuBuildDriveDevStr
virstoragefile: Add node-name
docs/formatdomain.html.in | 30 +++++-
docs/schemas/domaincommon.rng | 26 ++++-
docs/schemas/storagecommon.rng | 1 +
docs/schemas/storagevol.rng | 1 +
src/conf/domain_conf.c | 195 ++++++++++++++++++++++++++--------
src/conf/storage_conf.c | 23 ++--
src/libvirt_private.syms | 2 +
src/qemu/qemu_cgroup.c | 4 +-
src/qemu/qemu_command.c | 114 ++++++++++++++++++++
src/qemu/qemu_domain.c | 2 +-
src/qemu/qemu_driver.c | 39 ++++---
src/qemu/qemu_migration.c | 1 +
src/qemu/qemu_monitor_json.c | 4 +-
src/security/security_dac.c | 2 +-
src/security/security_selinux.c | 4 +-
src/security/virt-aa-helper.c | 2 +-
src/storage/storage_backend.c | 22 ++--
src/storage/storage_backend_fs.c | 38 ++++---
src/storage/storage_backend_gluster.c | 11 +-
src/storage/storage_backend_logical.c | 15 ++-
src/storage/storage_driver.c | 3 +-
src/util/virstoragefile.c | 122 ++++++++++++++++++---
src/util/virstoragefile.h | 13 ++-
tests/virstoragetest.c | 18 ++--
24 files changed, 551 insertions(+), 141 deletions(-)
--
2.3.5
9 years, 6 months
[libvirt] [PATCH 0/2] lxc: allow using 802.11 wireless interfaces in LXC domains
by Lubomir Rintel
Hi,
I'm using libvirt-lxc with mac80211_hwsim to construct virtual wireless network
for NetworkManager testing. Currently, I have to move the interfaces to the
domains manually, as sharing wan 802.11 wireless link with a LXC namespace does
not work:
<hostdev mode='capabilities' type='net'>
<source><interface>wlan0</interface></source>
</hostdev>
The wireless links can only be associated to namespaces by moving the
underlying PHY instead of the network interface.
I'm following up with patches that fix the problem for me; please take a look.
Thank you
Lubo
9 years, 6 months
[libvirt] [RFC 0/7] Live Migration with Pass-through Devices proposal
by Chen Fan
backgrond:
Live migration is one of the most important features of virtualization technology.
With regard to recent virtualization techniques, performance of network I/O is critical.
Current network I/O virtualization (e.g. Para-virtualized I/O, VMDq) has a significant
performance gap with native network I/O. Pass-through network devices have near
native performance, however, they have thus far prevented live migration. No existing
methods solve the problem of live migration with pass-through devices perfectly.
There was an idea to solve the problem in website:
https://www.kernel.org/doc/ols/2008/ols2008v2-pages-261-267.pdf
Please refer to above document for detailed information.
So I think this problem maybe could be solved by using the combination of existing
technology. and the following steps are we considering to implement:
- before boot VM, we anticipate to specify two NICs for creating bonding device
(one plugged and one virtual NIC) in XML. here we can specify the NIC's mac addresses
in XML, which could facilitate qemu-guest-agent to find the network interfaces in guest.
- when qemu-guest-agent startup in guest it would send a notification to libvirt,
then libvirt will call the previous registered initialize callbacks. so through
the callback functions, we can create the bonding device according to the XML
configuration. and here we use netcf tool which can facilitate to create bonding device
easily.
- during migration, unplug the passthroughed NIC. then do native migration.
- on destination side, check whether need to hotplug new NIC according to specified XML.
usually, we use migrate "--xml" command option to specify the destination host NIC mac
address to hotplug a new NIC, because source side passthrough NIC mac address is different,
then hotplug the deivce according to the destination XML configuration.
TODO:
1. when hot add a new NIC in destination side after migration finished, the NIC device
need to re-enslave on bonding device in guest. otherwise, it is offline. maybe
we should consider bonding driver to support add interfaces dynamically.
This is an example on how this might work, so I want to hear some voices about this scenario.
Thanks,
Chen
Chen Fan (7):
qemu-agent: add agent init callback when detecting guest setup
qemu: add guest init event callback to do the initialize work for
guest
hostdev: add a 'bond' type element in <hostdev> element
qemu-agent: add qemuAgentCreateBond interface
hostdev: add parse ip and route for bond configure
migrate: hot remove hostdev at perform phase for bond device
migrate: add hostdev migrate status to support hostdev migration
docs/schemas/basictypes.rng | 6 ++
docs/schemas/domaincommon.rng | 37 ++++++++
src/conf/domain_conf.c | 195 ++++++++++++++++++++++++++++++++++++++---
src/conf/domain_conf.h | 40 +++++++--
src/conf/networkcommon_conf.c | 17 ----
src/conf/networkcommon_conf.h | 17 ++++
src/libvirt_private.syms | 1 +
src/qemu/qemu_agent.c | 196 +++++++++++++++++++++++++++++++++++++++++-
src/qemu/qemu_agent.h | 12 +++
src/qemu/qemu_command.c | 3 +
src/qemu/qemu_domain.c | 70 +++++++++++++++
src/qemu/qemu_domain.h | 14 +++
src/qemu/qemu_driver.c | 38 ++++++++
src/qemu/qemu_hotplug.c | 8 +-
src/qemu/qemu_migration.c | 91 ++++++++++++++++++++
src/qemu/qemu_migration.h | 4 +
src/qemu/qemu_process.c | 32 +++++++
src/util/virhostdev.c | 3 +
18 files changed, 745 insertions(+), 39 deletions(-)
--
1.9.3
9 years, 7 months
[libvirt] Libvirt now using Zanata for translation
by Daniel P. Berrange
As of current GIT master, libvirt is fully using Zanata for po file
translation
After some trouble with the zanata python client, I have now successfully
refreshed & pushed the current libvirt.pot file, and synchronized all
the translation po files back down to GIT master.
For ongoing refreshes of the libvirt.pot, it can be rebuild & pushed
to zanata and .po files resynchonized using
# cd po
# rm libvirt.pot
# make libvirt.pot
# zanata-cli push
# zanata-cli pull
Where 'zanata-cli' is the *JAVA* client, not the python client. I strongly
recommend against use of the python client for the libvirt project as it
doesn't handle the size of the libvirt.pot/.po files well resulting in
unexplained data loss. Even the java client has problems pushing the
.po files to the server due to poorly designed rate limiting in the
zanata server.
Fortunately this is not something we need do again, now we have imported
the existing .po file. The java client has been troublefree wrt to pushing
the .pot file and pulling .po files, which is all we need for ongoing work
now.
Currently myself & Daniel Veillard are setup as admins of the libvirt
project in Zanata & we can add further people as required.
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
9 years, 7 months
[libvirt] [PATCH 0/4] Enable support for s390 crypto key mgmt operations
by akrowiak@linux.vnet.ibm.com
From: Tony Krowiak <akrowiak(a)linux.vnet.ibm.com>
The IBM System z Central Processor Assist for Cryptographic Functions (CPACF)
hardware provides a set of CPU instructions for use in clear-key encryption,
pseudo random number generation, hash functions, and protected-key encryption.
The CPACF protected key cryptographic functions operate with a protected key
which is encrypted under a unique wrapping key that is stored in the Hardware
System Area (HSA) of the machine and can only be accessed by firmware. The
wrapping key cannot be accessed by the operating system or application
programs. There are two wrapping keys: One for wrapping AES keys and one for
wrapping DES/TDES keys. This patch set enables the support for encrypting
clear keys under the AES and DES/TDES wrapping keys for guests started on hosts
running on s390 hardware that supports key wrapping.
Tony Krowiak (4):
libvirt: docs: XML to enable/disable protected key mgmt ops
libvirt: conf: parse XML for protected key management ops
libvirt: qemu: enable/disable protected key management ops
libvirt: tests: test protected key mgmt ops support
9 years, 7 months
[libvirt] [PATCH] Fix build --without-network
by Martin Kletzander
In order not to bring in any link dependencies, bridge driver doesn't
use the usual stubs as other conditionally-built code does. However,
having the function as a macro imposes a problem with possibly unused
variables if just defined as "0". This was worked around by using
(dom=dom, iface=iface, 0) which should act like a 0 if used in a
condition. However, gcc still bugs about that, so I came up with
another way how to fix that.
Using static inline functions in the header won't collide with anything,
it fixes the bug and does one thing that the macro didn't do. It checks
whenther passed variables are pointers of compatible type. It has only
one downside, and that is that we need to either a) define it with
ATTRIBUTE_UNUSED, which needs an exception in cfg.mk or b) do something
like ignore_value(variable); in the function body. I went with the
first variant.
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
Notes:
I can go with the version (b) if that's the preferred one.
cfg.mk | 4 ++--
src/network/bridge_driver.h | 19 ++++++++++++++++---
2 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/cfg.mk b/cfg.mk
index 9ba2134..796ed80 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -1,5 +1,5 @@
# Customize Makefile.maint. -*- makefile -*-
-# Copyright (C) 2008-2014 Red Hat, Inc.
+# Copyright (C) 2008-2015 Red Hat, Inc.
# Copyright (C) 2003-2008 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
@@ -1184,7 +1184,7 @@ exclude_file_name_regexp--sc_prohibit_getenv = \
^tests/.*\.[ch]$$
exclude_file_name_regexp--sc_avoid_attribute_unused_in_header = \
- ^src/util/virlog\.h$$
+ ^(src/util/virlog\.h|src/network/bridge_driver\.h)$$
exclude_file_name_regexp--sc_prohibit_mixed_case_abbreviations = \
^src/(vbox/vbox_CAPI.*.h|esx/esx_vi.(c|h)|esx/esx_storage_backend_iscsi.c)$$
diff --git a/src/network/bridge_driver.h b/src/network/bridge_driver.h
index 2f801ee..513ccf7 100644
--- a/src/network/bridge_driver.h
+++ b/src/network/bridge_driver.h
@@ -1,7 +1,7 @@
/*
* bridge_driver.h: core driver methods for managing networks
*
- * Copyright (C) 2006-2013 Red Hat, Inc.
+ * Copyright (C) 2006-2015 Red Hat, Inc.
* Copyright (C) 2006 Daniel P. Berrange
*
* This library is free software; you can redistribute it and/or
@@ -55,11 +55,24 @@ int networkDnsmasqConfContents(virNetworkObjPtr network,
# else
/* Define no-op replacements that don't drag in any link dependencies. */
# define networkAllocateActualDevice(dom, iface) 0
-# define networkNotifyActualDevice(dom, iface) (dom=dom, iface=iface, 0)
-# define networkReleaseActualDevice(dom, iface) (dom=dom, iface=iface, 0)
# define networkGetNetworkAddress(netname, netaddr) (-2)
# define networkDnsmasqConfContents(network, pidfile, configstr, \
dctx, caps) 0
+
+static inline int
+networkNotifyActualDevice(virDomainDefPtr dom ATTRIBUTE_UNUSED,
+ virDomainNetDefPtr iface ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+static inline int
+networkReleaseActualDevice(virDomainDefPtr dom ATTRIBUTE_UNUSED,
+ virDomainNetDefPtr iface ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
# endif
typedef char *(*networkDnsmasqLeaseFileNameFunc)(const char *netname);
--
2.3.6
9 years, 7 months
[libvirt] [PATCH] libxl: Disallow save or migrate when host devices are assigned to a guest.
by Konrad Rzeszutek Wilk
It is unhealthy. If the device is not doing any DMA operations
it would work - but if you are saving and there are DMA operations
happening the chance of corruption (outstanding DMAs) increase.
As such re-use the check migration used.
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk(a)oracle.com>
---
src/libxl/libxl_domain.c | 19 +++++++++++++++++++
src/libxl/libxl_domain.h | 3 +++
src/libxl/libxl_driver.c | 6 ++++++
src/libxl/libxl_migration.c | 15 +--------------
4 files changed, 29 insertions(+), 14 deletions(-)
diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index 5e0ab56..c038989 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -178,6 +178,25 @@ libxlDomainObjEndJob(libxlDriverPrivatePtr driver ATTRIBUTE_UNUSED,
return virObjectUnref(obj);
}
+/*
+ * Checks whether the domain has host devices (PCIe) to disallow
+ * migration or saving of guest - unless they are detached.
+ *
+ * Returns true if the domain has host devices, otherwise false.
+ */
+bool
+libxlDomainHasHostDevices(virDomainDefPtr def)
+{
+ /* Migration is not allowed if definition contains any hostdevs */
+ if (def->nhostdevs > 0) {
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("domain has assigned host devices"));
+ return true;
+ }
+
+ return false;
+}
+
static void *
libxlDomainObjPrivateAlloc(void)
{
diff --git a/src/libxl/libxl_domain.h b/src/libxl/libxl_domain.h
index aa647b8..76c0c8d 100644
--- a/src/libxl/libxl_domain.h
+++ b/src/libxl/libxl_domain.h
@@ -95,6 +95,9 @@ char *
libxlDomainManagedSavePath(libxlDriverPrivatePtr driver,
virDomainObjPtr vm);
+bool
+libxlDomainHasHostDevices(virDomainDefPtr def);
+
int
libxlDomainSaveImageOpen(libxlDriverPrivatePtr driver,
libxlDriverConfigPtr cfg,
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 9eb071e..b9faba8 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -1650,6 +1650,9 @@ libxlDomainSaveFlags(virDomainPtr dom, const char *to, const char *dxml,
goto endjob;
}
+ if (libxlDomainHasHostDevices(vm->def))
+ goto endjob;
+
if (libxlDoDomainSave(driver, vm, to) < 0)
goto endjob;
@@ -1876,6 +1879,9 @@ libxlDomainManagedSave(virDomainPtr dom, unsigned int flags)
goto endjob;
}
+ if (libxlDomainHasHostDevices(vm->def))
+ goto endjob;
+
name = libxlDomainManagedSavePath(driver, vm);
if (name == NULL)
goto endjob;
diff --git a/src/libxl/libxl_migration.c b/src/libxl/libxl_migration.c
index 4010506..aaed448c 100644
--- a/src/libxl/libxl_migration.c
+++ b/src/libxl/libxl_migration.c
@@ -209,19 +209,6 @@ libxlDoMigrateSend(libxlDriverPrivatePtr driver,
return ret;
}
-static bool
-libxlDomainMigrationIsAllowed(virDomainDefPtr def)
-{
- /* Migration is not allowed if definition contains any hostdevs */
- if (def->nhostdevs > 0) {
- virReportError(VIR_ERR_OPERATION_INVALID, "%s",
- _("domain has assigned host devices"));
- return false;
- }
-
- return true;
-}
-
char *
libxlDomainMigrationBegin(virConnectPtr conn,
virDomainObjPtr vm,
@@ -251,7 +238,7 @@ libxlDomainMigrationBegin(virConnectPtr conn,
def = vm->def;
}
- if (!libxlDomainMigrationIsAllowed(def))
+ if (libxlDomainHasHostDevices(def))
goto endjob;
xml = virDomainDefFormat(def, VIR_DOMAIN_DEF_FORMAT_SECURE);
--
2.1.0
9 years, 7 months
[libvirt] [PATCH 0/6] Refactor critical section in virDomainListAllDomains and fix qemuConnectGetAllDomainStats
by Peter Krempa
Peter Krempa (6):
util: Make the virDomainListFree helper more universal
conf: Extract code to filter domain list into a separate function
conf: Rename virDomainObjListFilter type to virDomainObjListACLFilter
conf: Refactor domain list collection critical section
conf: Add helper to convert list of virDomains to a list of
virDomainObjs
qemu: Convert qemuConnectGetAllDomainStats to use new helpers
daemon/remote.c | 2 +-
src/conf/domain_conf.c | 258 ++++++++++++++++++++++++++++---------------
src/conf/domain_conf.h | 29 +++--
src/libvirt_private.syms | 5 +-
src/qemu/qemu_driver.c | 86 +++++++--------
src/util/virobject.c | 41 +++++++
src/util/virobject.h | 2 +
tools/virsh-domain-monitor.c | 2 +-
8 files changed, 275 insertions(+), 150 deletions(-)
--
2.3.5
9 years, 7 months
[libvirt] [PATCH 0/3] Few more memory hotplug related fixes
by Peter Krempa
Peter Krempa (3):
conf: Always truncate balloon size to maximum memory size
conf: Fix up balloon size after removing a memory device from def
qemu: Fix balloon size handling with memory hot(un)plug
src/conf/domain_conf.c | 27 +++++++--------------------
src/qemu/qemu_driver.c | 3 +++
src/qemu/qemu_hotplug.c | 10 ++++++++++
3 files changed, 20 insertions(+), 20 deletions(-)
--
2.3.5
9 years, 7 months
[libvirt] [PATCH] libxl: support vscsi
by Olaf Hering
This uses the API version of the proposed vscsi support in libxl (v4):
http://lists.xenproject.org/archives/html/xen-devel/2015-04/msg01949.html
Is there anything else that needs to be done in libvirt? Right now libvirt scsi
support is very simple minded, no support at all to describe host devices with
persistant names.
This patch got very little runtime testing up to now...
Signed-off-by: Olaf Hering <olaf(a)aepfle.de>
---
src/libxl/libxl_conf.c | 59 +++++++++++++++++
src/libxl/libxl_conf.h | 1 +
src/libxl/libxl_domain.c | 2 +-
src/libxl/libxl_driver.c | 167 +++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 228 insertions(+), 1 deletion(-)
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index f9bb5ed..7964e8b 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -1591,6 +1591,61 @@ libxlMakePCIList(virDomainDefPtr def, libxl_domain_config *d_config)
}
static int
+libxlMakeVscsiList(libxl_ctx *ctx,
+ XLU_Config *xlu,
+ virDomainDefPtr def,
+ libxl_domain_config *d_config)
+{
+ virDomainHostdevDefPtr *l_hostdevs = def->hostdevs;
+ size_t i, nhostdevs = def->nhostdevs;
+ virDomainHostdevDefPtr hostdev;
+ virDomainHostdevSubsysSCSIPtr scsisrc;
+ char *str;
+ int rc = 0;
+
+ if (nhostdevs == 0)
+ return 0;
+
+ for (i = 0; i < nhostdevs; i++) {
+ hostdev = l_hostdevs[i];
+ if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS)
+ continue;
+ if (hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI)
+ continue;
+ scsisrc = &hostdev->source.subsys.u.scsi;
+ if (scsisrc->protocol == VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI)
+ continue;
+#if defined(LIBXL_HAVE_VSCSI)
+ if (virAsprintf(&str, "%s:%u:%u:%u,%u:%u:%u:%u%s",
+ scsisrc->u.host.adapter + strlen("scsi_host"),
+ scsisrc->u.host.bus,
+ scsisrc->u.host.target,
+ scsisrc->u.host.unit,
+ hostdev->info->addr.drive.controller,
+ hostdev->info->addr.drive.bus,
+ hostdev->info->addr.drive.target,
+ hostdev->info->addr.drive.unit,
+ scsisrc->rawio == VIR_TRISTATE_BOOL_YES ? ",feature-host" : "") < 0) {
+ goto error;
+ };
+ rc = xlu_vscsi_config_add(xlu, ctx, str, &d_config->num_vscsis, &d_config->vscsis);
+ VIR_FREE(str);
+ if (rc)
+ goto error;
+#else
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("This version of libxenlight does not support vscsi"));
+ goto error;
+#endif
+ }
+
+ return 0;
+
+ error:
+ return -1;
+}
+
+static int
libxlMakeVideo(virDomainDefPtr def, libxl_domain_config *d_config)
{
@@ -1724,6 +1779,7 @@ int
libxlBuildDomainConfig(virPortAllocatorPtr graphicsports,
virDomainDefPtr def,
libxl_ctx *ctx,
+ XLU_Config *xlu,
libxl_domain_config *d_config)
{
libxl_domain_config_init(d_config);
@@ -1746,6 +1802,9 @@ libxlBuildDomainConfig(virPortAllocatorPtr graphicsports,
if (libxlMakePCIList(def, d_config) < 0)
return -1;
+ if (libxlMakeVscsiList(ctx, xlu, def, d_config) < 0)
+ return -1;
+
/*
* Now that any potential VFBs are defined, update the build info with
* the data of the primary display. Some day libxl might implicitely do
diff --git a/src/libxl/libxl_conf.h b/src/libxl/libxl_conf.h
index bdc68d4..94a3046 100644
--- a/src/libxl/libxl_conf.h
+++ b/src/libxl/libxl_conf.h
@@ -205,6 +205,7 @@ int
libxlBuildDomainConfig(virPortAllocatorPtr graphicsports,
virDomainDefPtr def,
libxl_ctx *ctx,
+ XLU_Config *xlu,
libxl_domain_config *d_config);
static inline void
diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c
index 3039427..537e370 100644
--- a/src/libxl/libxl_domain.c
+++ b/src/libxl/libxl_domain.c
@@ -950,7 +950,7 @@ libxlDomainStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
}
if (libxlBuildDomainConfig(driver->reservedVNCPorts, vm->def,
- cfg->ctx, &d_config) < 0)
+ cfg->ctx, cfg->xlu, &d_config) < 0)
goto cleanup;
if (cfg->autoballoon && libxlDomainFreeMem(cfg->ctx, &d_config) < 0)
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index f915f91..424150f 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -2943,6 +2943,97 @@ libxlDomainAttachHostPCIDevice(libxlDriverPrivatePtr driver,
}
static int
+libxlDomainAttachHostSCSIDevice(libxlDriverPrivatePtr driver,
+ virDomainObjPtr vm,
+ virDomainHostdevDefPtr hostdev)
+{
+#if defined(LIBXL_HAVE_VSCSI)
+ libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver);
+ libxl_device_vscsi vscsidev;
+ virDomainHostdevDefPtr found;
+ virHostdevManagerPtr hostdev_mgr = driver->hostdevMgr;
+ virDomainHostdevSubsysSCSIPtr scsisrc = &hostdev->source.subsys.u.scsi;
+ char *str = NULL;
+ int ret = -1;
+
+ if (scsisrc->protocol == VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI)
+ return -1;
+
+ libxl_device_vscsi_init(&vscsidev);
+
+ if (virDomainHostdevFind(vm->def, hostdev, &found) >= 0) {
+ virReportError(VIR_ERR_OPERATION_FAILED,
+ _("target scsi device %u:%u:%u:%u already exists"),
+ hostdev->info->addr.drive.controller,
+ hostdev->info->addr.drive.bus,
+ hostdev->info->addr.drive.target,
+ hostdev->info->addr.drive.unit);
+ goto cleanup;
+ }
+
+ if (VIR_REALLOC_N(vm->def->hostdevs, vm->def->nhostdevs + 1) < 0)
+ goto cleanup;
+
+ if (virHostdevPrepareSCSIDevices(hostdev_mgr, LIBXL_DRIVER_NAME,
+ vm->def->name, &hostdev, 1) < 0)
+ goto cleanup;
+
+ if (virAsprintf(&str, "%s:%u:%u:%u,%u:%u:%u:%u%s",
+ scsisrc->u.host.adapter + strlen("scsi_host"),
+ scsisrc->u.host.bus,
+ scsisrc->u.host.target,
+ scsisrc->u.host.unit,
+ hostdev->info->addr.drive.controller,
+ hostdev->info->addr.drive.bus,
+ hostdev->info->addr.drive.target,
+ hostdev->info->addr.drive.unit,
+ scsisrc->rawio == VIR_TRISTATE_BOOL_YES ?
+ ",feature-host" : "") < 0) {
+ goto error;
+ };
+
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", str);
+
+ if (xlu_vscsi_get_host(cfg->xlu, cfg->ctx, vm->def->id, str, &vscsidev) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("libxutil failed to parse scsi device %u:%u:%u:%u"),
+ hostdev->info->addr.drive.controller,
+ hostdev->info->addr.drive.bus,
+ hostdev->info->addr.drive.target,
+ hostdev->info->addr.drive.unit);
+ }
+
+ if (libxl_device_vscsi_add(cfg->ctx, vm->def->id, &vscsidev, NULL) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("libxenlight failed to attach scsi device %u:%u:%u:%u"),
+ hostdev->info->addr.drive.controller,
+ hostdev->info->addr.drive.bus,
+ hostdev->info->addr.drive.target,
+ hostdev->info->addr.drive.unit);
+ goto error;
+ }
+
+ vm->def->hostdevs[vm->def->nhostdevs++] = hostdev;
+ ret = 0;
+ goto cleanup;
+
+ error:
+ virHostdevReAttachSCSIDevices(hostdev_mgr, LIBXL_DRIVER_NAME,
+ vm->def->name, &hostdev, 1);
+
+ cleanup:
+ VIR_FREE(str);
+ virObjectUnref(cfg);
+ libxl_device_vscsi_dispose(&vscsidev);
+ return ret;
+#else
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("This version of libxenlight does not support vscsi"));
+ return -1;
+#endif
+}
+
+static int
libxlDomainAttachHostDevice(libxlDriverPrivatePtr driver,
virDomainObjPtr vm,
virDomainHostdevDefPtr hostdev)
@@ -2960,6 +3051,11 @@ libxlDomainAttachHostDevice(libxlDriverPrivatePtr driver,
return -1;
break;
+ case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI:
+ if (libxlDomainAttachHostSCSIDevice(driver, vm, hostdev) < 0)
+ return -1;
+ break;
+
default:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("hostdev subsys type '%s' not supported"),
@@ -3284,6 +3380,74 @@ libxlDomainDetachHostPCIDevice(libxlDriverPrivatePtr driver,
}
static int
+libxlDomainDetachHostSCSIDevice(libxlDriverPrivatePtr driver,
+ virDomainObjPtr vm,
+ virDomainHostdevDefPtr hostdev)
+{
+#if defined(LIBXL_HAVE_VSCSI)
+ libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver);
+ virDomainHostdevDefPtr detach;
+ int idx;
+ virHostdevManagerPtr hostdev_mgr = driver->hostdevMgr;
+ virDomainHostdevSubsysSCSIPtr scsisrc = &hostdev->source.subsys.u.scsi;
+ int ret = -1;
+ char *str = NULL;
+
+ if (scsisrc->protocol == VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI)
+ return -1;
+
+ idx = virDomainHostdevFind(vm->def, hostdev, &detach);
+ if (idx < 0) {
+ virReportError(VIR_ERR_OPERATION_FAILED,
+ _("target scsi device %u:%u:%u:%u not found"),
+ hostdev->info->addr.drive.controller,
+ hostdev->info->addr.drive.bus,
+ hostdev->info->addr.drive.target,
+ hostdev->info->addr.drive.unit);
+ goto cleanup;
+ }
+
+ if (virAsprintf(&str, "%u:%u:%u:%u",
+ hostdev->info->addr.drive.controller,
+ hostdev->info->addr.drive.bus,
+ hostdev->info->addr.drive.target,
+ hostdev->info->addr.drive.unit) < 0) {
+ goto error;
+ };
+
+ if (xlu_vscsi_detach(cfg->xlu, cfg->ctx, vm->def->id, str) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("libxenlight failed to detach pci device %u:%u:%u:%u"),
+ hostdev->info->addr.drive.controller,
+ hostdev->info->addr.drive.bus,
+ hostdev->info->addr.drive.target,
+ hostdev->info->addr.drive.unit);
+ goto error;
+ }
+
+
+ virDomainHostdevRemove(vm->def, idx);
+
+ virHostdevReAttachPCIDevices(hostdev_mgr, LIBXL_DRIVER_NAME,
+ vm->def->name, &hostdev, 1, NULL);
+
+ ret = 0;
+
+ error:
+ VIR_FREE(str);
+ virDomainHostdevDefFree(detach);
+
+ cleanup:
+ virObjectUnref(cfg);
+ return ret;
+#else
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("This version of libxenlight does not support vscsi"));
+ return -1;
+#endif
+}
+
+static int
libxlDomainDetachHostDevice(libxlDriverPrivatePtr driver,
virDomainObjPtr vm,
virDomainHostdevDefPtr hostdev)
@@ -3301,6 +3465,9 @@ libxlDomainDetachHostDevice(libxlDriverPrivatePtr driver,
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
return libxlDomainDetachHostPCIDevice(driver, vm, hostdev);
+ case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI:
+ return libxlDomainDetachHostSCSIDevice(driver, vm, hostdev);
+
default:
virReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected hostdev type %d"), subsys->type);
9 years, 7 months