[libvirt] [PATCH RFC 0/7] Run qemu under its own namespace
by Michal Privoznik
This is just an proof of concept of what has been agreed on here:
https://www.redhat.com/archives/libvir-list/2016-November/msg00285.html
There is still a lot of to be done:
- set up seclabels
- implement hot(un-)plug
- implement other devices, not just disks
I'm sending these in a hope that somebody will at least take a quick look. I'm
not looking for a code cleanliness (but if you find some issues feel free to
raise them), more than design confirmation. If I'm going in wrong direction I'd
rather stop now before digging any deeper.
Michal Privoznik (7):
virprocess: Introduce virProcessSetupPrivateNS
virfile: Introduce virFilePopulateDevices
virfile: Introduce virFileSetupDev
virfile: Introduce virFileSetupDevPTS
virfile: Introduce virFileBindMountDevice
qemu: Spawn qemu under mount namespace
qemu: Prepare disks when starting a domain
src/libvirt_private.syms | 5 +
src/lxc/lxc_container.c | 20 +---
src/lxc/lxc_controller.c | 82 +++----------
src/qemu/qemu_domain.c | 306 +++++++++++++++++++++++++++++++++++++++++++++++
src/qemu/qemu_domain.h | 12 ++
src/qemu/qemu_process.c | 13 ++
src/util/virfile.c | 116 ++++++++++++++++++
src/util/virfile.h | 21 ++++
src/util/virprocess.c | 24 ++++
src/util/virprocess.h | 2 +
10 files changed, 517 insertions(+), 84 deletions(-)
--
2.8.4
8 years
[libvirt] [PATCH v1] RFC Generating Qemu parameter -cpu features
by Collin L. Walling
I'm working on the CPU model checking support in libvirt for s390x and I've
found when generating the -cpu +feature,-feature command, Qemu does not like
the ± syntax when adding cpu features for s390x machines and expects us to
use key=value pairs (e.g. feature=on,feature=off).
Since x86 Qemu code supports both the ± and key=value methods of enabling CPU
features, could we switch to just using key=value syntax in libvirt or do we
need to maintain the ± format as well? I assume we could do something more
sophisticated than wrapping the check in an if cpu->arch == VIR_ARCH_S390X?
Another option would be to just change Qemu to support both formats, but I
suspect we would get push back as key=value seems to be the preferred interface.
Thanks for your time.
- Collin
Collin L. Walling (1):
qemu: command: rework cpu feature argument support
src/qemu/qemu_command.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--
2.7.4
8 years
[libvirt] vhostuser and openvswitch interface statistics
by Mehdi Abaakouk
Hi,
I'm looking for interface statistics for a vhostuser network interface
(that uses ovs-dpdk on the other socket side).
The "virsh domifstat <domain> <ifname>" obviously don't works because it
looks at "/proc/net/dev" for statistics. When we use vhostuser, we
don't create network interface on the host but a socket.
Many tools currently rely on the domainInterfaceStats() API to retrieve
this kind of information.
So I would like to known if their is a plan to support ovs as network
interface statistics source (with something like
"ovs-vsctl get Interface <ifname> statistics") ?
I have started to write a PoC code that fallback to OVS in virNetInterfaceStats()
when we don't found the interface in /proc/net/dev.
Does this kind of contribution is welcome/match your plan ?
Regards,
--
Mehdi Abaakouk
mail: sileht(a)sileht.net
irc: sileht
8 years
[libvirt] [PATCH for-2.9] qmp: Report QOM type name on query-cpu-definitions
by Eduardo Habkost
The new typename attribute on query-cpu-definitions will be used
to help management software use device-list-properties to check
which properties can be set using -cpu or -global for the CPU
model.
Signed-off-by: Eduardo Habkost <ehabkost(a)redhat.com>
---
qapi-schema.json | 4 +++-
target-arm/helper.c | 1 +
target-i386/cpu.c | 1 +
target-ppc/translate_init.c | 1 +
target-s390x/cpu_models.c | 1 +
5 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/qapi-schema.json b/qapi-schema.json
index b0b4bf6..9a3bdd4 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -3216,6 +3216,8 @@
# @unavailable-features: #optional List of properties that prevent
# the CPU model from running in the current
# host. (since 2.8)
+# @typename: Type name that can be used as argument to @device-list-properties,
+# to introspect properties configurable using -cpu or -global.
#
# @unavailable-features is a list of QOM property names that
# represent CPU model attributes that prevent the CPU from running.
@@ -3237,7 +3239,7 @@
##
{ 'struct': 'CpuDefinitionInfo',
'data': { 'name': 'str', '*migration-safe': 'bool', 'static': 'bool',
- '*unavailable-features': [ 'str' ] } }
+ '*unavailable-features': [ 'str' ], 'typename': 'str' } }
##
# @query-cpu-definitions:
diff --git a/target-arm/helper.c b/target-arm/helper.c
index b5b65ca..3fc01b5 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -5207,6 +5207,7 @@ static void arm_cpu_add_definition(gpointer data, gpointer user_data)
info = g_malloc0(sizeof(*info));
info->name = g_strndup(typename,
strlen(typename) - strlen("-" TYPE_ARM_CPU));
+ info->q_typename = g_strdup(typename);
entry = g_malloc0(sizeof(*entry));
entry->value = info;
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 6eec5dc..725f6cb 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -2239,6 +2239,7 @@ static void x86_cpu_definition_entry(gpointer data, gpointer user_data)
info->name = x86_cpu_class_get_model_name(cc);
x86_cpu_class_check_missing_features(cc, &info->unavailable_features);
info->has_unavailable_features = true;
+ info->q_typename = g_strdup(object_class_get_name(oc));
entry = g_malloc0(sizeof(*entry));
entry->value = info;
diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
index 208fa1e..42b9274 100644
--- a/target-ppc/translate_init.c
+++ b/target-ppc/translate_init.c
@@ -10305,6 +10305,7 @@ CpuDefinitionInfoList *arch_query_cpu_definitions(Error **errp)
info = g_malloc0(sizeof(*info));
info->name = g_strdup(alias->alias);
+ info->q_typename = g_strdup(object_class_get_name(oc));
entry = g_malloc0(sizeof(*entry));
entry->value = info;
diff --git a/target-s390x/cpu_models.c b/target-s390x/cpu_models.c
index c1e729d..5b66d33 100644
--- a/target-s390x/cpu_models.c
+++ b/target-s390x/cpu_models.c
@@ -290,6 +290,7 @@ static void create_cpu_model_list(ObjectClass *klass, void *opaque)
info->has_migration_safe = true;
info->migration_safe = scc->is_migration_safe;
info->q_static = scc->is_static;
+ info->q_typename = g_strdup(object_class_get_name(klass));
entry = g_malloc0(sizeof(*entry));
--
2.7.4
8 years
[libvirt] fix for recent gnutls behavior change
by Christian Ehrhardt
TL;DR: please think if more needs to be changed to follow new gnutls behavior
Hi,
I found that recently our builds broke with these errors:
TEST: virnettlssessiontest
[...]
10) TLS Session servercertreq.filename + clientcertreq.filename ...
FAILED
11) TLS Session servercertreq.filename + clientcertreq.filename ...
FAILED
12) TLS Session servercertreq.filename + clientcertreq.filename ...
OK
13) TLS Session servercertreq.filename + clientcertreq.filename ...
FAILED
14) TLS Session servercertreq.filename + clientcertreq.filename ...
FAILED
15) TLS Session servercertlevel3areq.filename + clientcertlevel2breq.filename
... OK
FAIL virnettlssessiontest (exit status: 1)
I was able to track that down to a change in gnutls which can be read at
https://gitlab.com/gnutls/gnutls/issues/111 which changed the behavior of dname
en- and decoding to follow RFC4514.
More details on the debugging - if anyone want to reproduce - can be found on
https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1641615
But the primary purpose of the cover letter is a call to everybody to think if
that change could imply the need for more changes in libvirt than just to make
the tests work again.
Christian Ehrhardt (1):
tests: adapt to gnutls change in dname en-/decoding
tests/virnettlssessiontest.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
--
2.7.4
8 years
[libvirt] [PATCH v3 00/18] Use mode PCIe less legacy PCI
by Laine Stump
(this time with auto-root-port-add goodness!)
Last month I posted a short patch series that attempted to auto-assign
addresses on PCI Express controllers to devices that were PCI Express
devices.
https://www.redhat.com/archives/libvir-list/2016-August/msg00732.html
In particular, it would assign PCI virtio-1.0 devices, e1000e network
devices, and nec-usb-xhci devices to hotpluggable PCIe express ports
*if any were available*. However, a basic PCIe machine doesn't have
any hotpluggable PCIe ports, and the patchset I sent had no provision
for automatically adding any.
This new patchset takes care of that limitation by automatically
adding pci-root-ports as they are needed, and also automatically adds
a dmi-to-pci-bridge device (to create a legacy PCI bus hierarchy) when
needed so that we can do away with the code that *always* adds one
(and there is a patch that *does* do away with that code :-).
Once all of that was done, it turned out that virt-manager could
create an *almost* legacy-PCI-free Q35 domain config - the only legacy
PCI device was the sound device. Since the ich9 sound device is
integrated into the Intel ich9 chip (which is part of real Q35
hardware), as a curiousity I made an RFC patch that attempts to place
any ich9 audio device at 00:1B.0, which is the address where real Q35
hardware puts this device. With that patch in place, all you have to
do to get a legacy-free Q35 config out of virt-manager is switch the
sound device model from ich6 to ich9. (I don't expect that patch will
be pushed, but it's nice to see this result).
Although Andrea had ACKed most of the patches in the last patchset, I
hadn't wanted to push them without accompanying patches to auto-add
the pcie-root-ports (since doing so would render virt-manager +
new libvirt unusable for Q35 domains). Since then I've decided on a
cleaner manner for setting device connectFlags, so all but Patch 1 of
the last set was discarded and re-written from scratch.
Although there are still a couple more things I'd like to do, these
patches can be pushed without a serious regression in functionality
for Q35 domains:
1) currently I put each new pcie-root-port on its own slot, rather
than putting 8 of them on the different functions of a single
slot. This means you can only get ~30 devices before you have to start
manually adding pcie controllers. That will be remedied soon.
2) I don't have a patch yet to read a PCI device's capabilities to see
whether or not it is an Express device and change the connectFlags
accordingly. In the meantime if you want to plug in a vfio assigned
device, you'll either need to manually address it to a PCIe port, or
you'll need to manually add a pci-bridge device to the config.
3) I don't do anything to assure there are any unused pcie-root-ports
available for hotplug. We need to fix that, but I'm not sure how many
to "reserve". Suggestions I've heard have been "1", "2", "4", and
"just add pcie-root-ports 8 at a time and you'll have 'something
between 1 and 8' available".
Laine Stump (18):
conf: restrict what type of buses will accept a pci-bridge
qemu: replace a lot of "def->controllers[i]" with equivalent "cont"
qemu: new functions qemuDomainMachineHasPCI[e]Root()
qemu: new functions qemuDomainDeviceConnectFlags*()
conf: new function virDomainPCIAddressReserveNextAddr()
qemu: use virDomainPCIAddressReserveNextAddr in
qemuDomainAssignDevicePCISlots
conf: make virDomainPCIAddressGetNextSlot() a local static function
qemu: replace calls to virDomainPCIAddressReserveNext*() with static
function
qemu: set/use info->pciConnectFlags during
qemuDomainAssignDevicePCISlots
qemu: set/use proper pciConnectFlags during hotplug
qemu: assign virtio devices to PCIe slot when appropriate
qemu: assign e1000e network devices to PCIe slots when appropriate
qemu: assign nec-xhci (USB3) controller to a PCIe address when
appropriate
qemu: only force an available legacy-PCI slot on domains with pci-root
qemu: auto-add pcie-root-port/dmi-to-pci-bridge controllers as needed
qemu: don't force-add a dmi-to-pci-bridge just on principle
qemu: add a USB3 controller to Q35 domains by default
[RFC] qemu: try to put ich9 sound device at 00:1B.0
src/conf/device_conf.h | 5 +
src/conf/domain_addr.c | 180 ++++-
src/conf/domain_addr.h | 15 +-
src/libvirt_private.syms | 2 +-
src/qemu/qemu_domain.c | 50 +-
src/qemu/qemu_domain.h | 2 +
src/qemu/qemu_domain_address.c | 802 +++++++++++++++------
src/qemu/qemu_domain_address.h | 4 +
src/qemu/qemu_hotplug.c | 25 +-
tests/qemuxml2argvdata/qemuxml2argv-autoindex.args | 10 +-
tests/qemuxml2argvdata/qemuxml2argv-pcie-root.args | 3 +-
.../qemuxml2argv-q35-default-devices-only.args | 22 +
.../qemuxml2argv-q35-default-devices-only.xml | 18 +
.../qemuxml2argv-q35-pcie-autoadd.args | 56 ++
.../qemuxml2argv-q35-pcie-autoadd.xml | 51 ++
tests/qemuxml2argvdata/qemuxml2argv-q35-pcie.args | 58 ++
tests/qemuxml2argvdata/qemuxml2argv-q35-pcie.xml | 67 ++
.../qemuxml2argv-q35-virt-manager-basic.args | 56 ++
.../qemuxml2argv-q35-virt-manager-basic.xml | 76 ++
.../qemuxml2argv-q35-virtio-pci.args | 58 ++
.../qemuxml2argv-q35-virtio-pci.xml | 1 +
tests/qemuxml2argvtest.c | 123 ++++
.../qemuxml2xmlout-autoindex.xml | 10 +-
.../qemuxml2xmlout-pcie-root.xml | 4 -
.../qemuxml2xmlout-q35-default-devices-only.xml | 40 +
.../qemuxml2xmlout-q35-pcie-autoadd.xml | 143 ++++
.../qemuxml2xmloutdata/qemuxml2xmlout-q35-pcie.xml | 152 ++++
.../qemuxml2xmlout-q35-virt-manager-basic.xml | 116 +++
.../qemuxml2xmlout-q35-virtio-pci.xml | 152 ++++
tests/qemuxml2xmltest.c | 108 +++
30 files changed, 2117 insertions(+), 292 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-q35-default-devices-only.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-q35-default-devices-only.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-q35-pcie-autoadd.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-q35-pcie-autoadd.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-q35-pcie.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-q35-pcie.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-q35-virt-manager-basic.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-q35-virt-manager-basic.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-q35-virtio-pci.args
create mode 120000 tests/qemuxml2argvdata/qemuxml2argv-q35-virtio-pci.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-default-devices-only.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-pcie-autoadd.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-pcie.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-virt-manager-basic.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-virtio-pci.xml
--
2.7.4
8 years
[libvirt] [PATCH v2] logical: Check for existing vgname before building
by John Ferlan
https://bugzilla.redhat.com/show_bug.cgi?id=1373711
Add a check for an existing volume group name before trying to build
the volume group. Since the process of building a vg involves wiping
the first 512 bytes and using pvcreate on each source device path before
creating the vg - we could conceivably overwrite something that we
shouldn't be. Also, once a pv is part of a vg, the pvcreate would fail
unless we chose to overwrite the volume.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
Difference w/ v2 is that I'm taking a different approach - disallow the
second pool-build since the vg already exists. NB: libvirt has no API
to extend an existing vg - that's left to an admin anyway.
src/storage/storage_backend_logical.c | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_backend_logical.c
index ca05fe1..b241495 100644
--- a/src/storage/storage_backend_logical.c
+++ b/src/storage/storage_backend_logical.c
@@ -682,14 +682,31 @@ virStorageBackendLogicalBuildPool(virConnectPtr conn ATTRIBUTE_UNUSED,
virStoragePoolObjPtr pool,
unsigned int flags)
{
- virCommandPtr vgcmd;
+ virCommandPtr vgcmd = NULL;
int fd;
char zeros[PV_BLANK_SECTOR_SIZE];
int ret = -1;
size_t i;
+ virStoragePoolSourceList sourceList;
virCheckFlags(0, -1);
+ /* Let's make sure the about to be created vg doesn't already exist */
+ memset(&sourceList, 0, sizeof(sourceList));
+ sourceList.type = VIR_STORAGE_POOL_LOGICAL;
+
+ if (virStorageBackendLogicalGetPoolSources(&sourceList) < 0)
+ return -1;
+
+ for (i = 0; i < sourceList.nsources; i++) {
+ if (STREQ(sourceList.sources[i].name, pool->def->source.name)) {
+ virReportError(VIR_ERR_STORAGE_POOL_BUILT,
+ _("volume group with name '%s' already exists"),
+ pool->def->source.name);
+ goto cleanup;
+ }
+ }
+
memset(zeros, 0, sizeof(zeros));
vgcmd = virCommandNewArgList(VGCREATE, pool->def->source.name, NULL);
@@ -751,6 +768,9 @@ virStorageBackendLogicalBuildPool(virConnectPtr conn ATTRIBUTE_UNUSED,
ret = 0;
cleanup:
+ for (i = 0; i < sourceList.nsources; i++)
+ virStoragePoolSourceClear(&sourceList.sources[i]);
+ VIR_FREE(sourceList.sources);
virCommandFree(vgcmd);
return ret;
}
--
2.7.4
8 years
[libvirt] [PATCH] logical: Allow [no]overwrite option for poolBuild
by John Ferlan
https://bugzilla.redhat.com/show_bug.cgi?id=1373711
When using pool-create --build or pool-define and pool-build to create/define
and build/initialize the logical pool, the 'pvcreate' command could fail if
some previous attempt had been used on the source path previously.
So add support for the --override option in order to force usage of the
magic override option "-ff" and the option "-y" in order to force creation
and answer any questions with yes.
NB: Although the reality is part of the process of building the logical
pool involves wiping out the first 512 bytes of the disk block to be
added (e.g. the partition table) because pvcreate requires that. So, to
a degree the device being added is already altered. I suspect the knowlege
of whether the disk was in a vg already could be contained outside the
range of the first 512 bytes.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/storage/storage_backend_logical.c | 26 +++++++++++++++++++++-----
1 file changed, 21 insertions(+), 5 deletions(-)
diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_backend_logical.c
index ca05fe1..9c76156 100644
--- a/src/storage/storage_backend_logical.c
+++ b/src/storage/storage_backend_logical.c
@@ -682,13 +682,18 @@ virStorageBackendLogicalBuildPool(virConnectPtr conn ATTRIBUTE_UNUSED,
virStoragePoolObjPtr pool,
unsigned int flags)
{
- virCommandPtr vgcmd;
+ virCommandPtr vgcmd = NULL;
int fd;
char zeros[PV_BLANK_SECTOR_SIZE];
int ret = -1;
size_t i;
- virCheckFlags(0, -1);
+ virCheckFlags(VIR_STORAGE_POOL_BUILD_OVERWRITE |
+ VIR_STORAGE_POOL_BUILD_NO_OVERWRITE, ret);
+
+ VIR_EXCLUSIVE_FLAGS_GOTO(VIR_STORAGE_POOL_BUILD_OVERWRITE,
+ VIR_STORAGE_POOL_BUILD_NO_OVERWRITE,
+ cleanup);
memset(zeros, 0, sizeof(zeros));
@@ -731,10 +736,21 @@ virStorageBackendLogicalBuildPool(virConnectPtr conn ATTRIBUTE_UNUSED,
/*
* Initialize the physical volume because vgcreate is not
* clever enough todo this for us :-(
+ *
+ * If this API is called twice for the same device, then because
+ * vgcmd adds the device to the volume group, the pvcreate will
+ * fail since the pv is already part of the vg. Allow use of the
+ * override option inorder to overrule!
*/
- pvcmd = virCommandNewArgList(PVCREATE,
- pool->def->source.devices[i].path,
- NULL);
+ if (flags & VIR_STORAGE_POOL_BUILD_OVERWRITE)
+ pvcmd = virCommandNewArgList(PVCREATE,
+ "-ff", "-y",
+ pool->def->source.devices[i].path,
+ NULL);
+ else
+ pvcmd = virCommandNewArgList(PVCREATE,
+ pool->def->source.devices[i].path,
+ NULL);
if (virCommandRun(pvcmd, NULL) < 0) {
virCommandFree(pvcmd);
goto cleanup;
--
2.7.4
8 years
[libvirt] [PATCH RFC] Rework existing code for scsi hostdev scsi_host protocol
by Eric Farman
In review feedback for my vhost-scsi series[1], we encountered a conflict
where existing structs/functions are named "...SCSIHost..." to represent
a hostdev type='scsi' protocol='scsi_host' element. This is somewhat of
an abbreviation, but jives well with the other elements for this hostdev.
Specifically, a hostdev type='scsi' protocol='iscsi' uses structs and
functions named "...SCSIiSCSI..."
As my series is intending to add a hostdev type='scsi_host', the phrase
"SCSIHost" had to be avoided to prevent conflicts with existing code,
which means the abbreviation gets propogated in new and unplesant ways.
Let's remove this abbreviation and change the existing code from "SCSIHost"
to "SCSISCSIHost" so that a new hostdev type can be added without conflict.
The intention being "<type><protocol>" being used going forward.
[1] End of https://www.redhat.com/archives/libvir-list/2016-November/msg00738.html
Signed-off-by: Eric Farman <farman(a)linux.vnet.ibm.com>
---
src/conf/domain_audit.c | 2 +-
src/conf/domain_conf.c | 20 ++++++++---------
src/conf/domain_conf.h | 8 +++----
src/qemu/qemu_cgroup.c | 2 +-
src/qemu/qemu_command.c | 6 ++---
src/qemu/qemu_conf.c | 2 +-
src/qemu/qemu_hotplug.c | 4 ++--
src/security/security_apparmor.c | 2 +-
src/security/security_dac.c | 4 ++--
src/security/security_selinux.c | 4 ++--
src/util/virhostdev.c | 47 ++++++++++++++++++++++------------------
11 files changed, 53 insertions(+), 48 deletions(-)
diff --git a/src/conf/domain_audit.c b/src/conf/domain_audit.c
index 2decf02..164debb 100644
--- a/src/conf/domain_audit.c
+++ b/src/conf/domain_audit.c
@@ -432,7 +432,7 @@ virDomainAuditHostdev(virDomainObjPtr vm, virDomainHostdevDefPtr hostdev,
*/
goto cleanup;
} else {
- virDomainHostdevSubsysSCSIHostPtr scsihostsrc =
+ virDomainHostdevSubsysSCSISCSIHostPtr scsihostsrc =
&scsisrc->u.host;
if (virAsprintfQuiet(&address, "%s:%u:%u:%llu",
scsihostsrc->adapter, scsihostsrc->bus,
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 6e008e2..c985e21 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -5907,14 +5907,14 @@ virDomainStorageHostParse(xmlNodePtr node,
}
static int
-virDomainHostdevSubsysSCSIHostDefParseXML(xmlNodePtr sourcenode,
- virDomainHostdevSubsysSCSIPtr scsisrc)
+virDomainHostdevSubsysSCSISCSIHostDefParseXML(xmlNodePtr sourcenode,
+ virDomainHostdevSubsysSCSIPtr scsisrc)
{
int ret = -1;
bool got_address = false, got_adapter = false;
xmlNodePtr cur;
char *bus = NULL, *target = NULL, *unit = NULL;
- virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
+ virDomainHostdevSubsysSCSISCSIHostPtr scsihostsrc = &scsisrc->u.host;
cur = sourcenode->children;
while (cur != NULL) {
@@ -6081,7 +6081,7 @@ virDomainHostdevSubsysSCSIDefParseXML(xmlNodePtr sourcenode,
if (scsisrc->protocol == VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI)
ret = virDomainHostdevSubsysSCSIiSCSIDefParseXML(sourcenode, scsisrc);
else
- ret = virDomainHostdevSubsysSCSIHostDefParseXML(sourcenode, scsisrc);
+ ret = virDomainHostdevSubsysSCSISCSIHostDefParseXML(sourcenode, scsisrc);
cleanup:
VIR_FREE(protocol);
@@ -13846,12 +13846,12 @@ virDomainHostdevMatchSubsysPCI(virDomainHostdevDefPtr first,
}
static int
-virDomainHostdevMatchSubsysSCSIHost(virDomainHostdevDefPtr first,
- virDomainHostdevDefPtr second)
+virDomainHostdevMatchSubsysSCSISCSIHost(virDomainHostdevDefPtr first,
+ virDomainHostdevDefPtr second)
{
- virDomainHostdevSubsysSCSIHostPtr first_scsihostsrc =
+ virDomainHostdevSubsysSCSISCSIHostPtr first_scsihostsrc =
&first->source.subsys.u.scsi.u.host;
- virDomainHostdevSubsysSCSIHostPtr second_scsihostsrc =
+ virDomainHostdevSubsysSCSISCSIHostPtr second_scsihostsrc =
&second->source.subsys.u.scsi.u.host;
if (STREQ(first_scsihostsrc->adapter, second_scsihostsrc->adapter) &&
@@ -13898,7 +13898,7 @@ virDomainHostdevMatchSubsys(virDomainHostdevDefPtr a,
VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI)
return virDomainHostdevMatchSubsysSCSIiSCSI(a, b);
else
- return virDomainHostdevMatchSubsysSCSIHost(a, b);
+ return virDomainHostdevMatchSubsysSCSISCSIHost(a, b);
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST:
return 0;
}
@@ -20808,7 +20808,7 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf,
virDomainHostdevSubsysUSBPtr usbsrc = &def->source.subsys.u.usb;
virDomainHostdevSubsysPCIPtr pcisrc = &def->source.subsys.u.pci;
virDomainHostdevSubsysSCSIPtr scsisrc = &def->source.subsys.u.scsi;
- virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
+ virDomainHostdevSubsysSCSISCSIHostPtr scsihostsrc = &scsisrc->u.host;
virDomainHostdevSubsysSCSIiSCSIPtr iscsisrc = &scsisrc->u.iscsi;
if (def->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI &&
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 541b600..4303d0e 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -338,9 +338,9 @@ struct _virDomainHostdevSubsysPCI {
int backend; /* enum virDomainHostdevSubsysPCIBackendType */
};
-typedef struct _virDomainHostdevSubsysSCSIHost virDomainHostdevSubsysSCSIHost;
-typedef virDomainHostdevSubsysSCSIHost *virDomainHostdevSubsysSCSIHostPtr;
-struct _virDomainHostdevSubsysSCSIHost {
+typedef struct _virDomainHostdevSubsysSCSISCSIHost virDomainHostdevSubsysSCSISCSIHost;
+typedef virDomainHostdevSubsysSCSISCSIHost *virDomainHostdevSubsysSCSISCSIHostPtr;
+struct _virDomainHostdevSubsysSCSISCSIHost {
char *adapter;
unsigned bus;
unsigned target;
@@ -363,7 +363,7 @@ struct _virDomainHostdevSubsysSCSI {
int sgio; /* enum virDomainDeviceSGIO */
int rawio; /* enum virTristateBool */
union {
- virDomainHostdevSubsysSCSIHost host;
+ virDomainHostdevSubsysSCSISCSIHost host;
virDomainHostdevSubsysSCSIiSCSI iscsi;
} u;
};
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index 1443f7e..462f74d 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -357,7 +357,7 @@ qemuSetupHostdevCgroup(virDomainObjPtr vm,
VIR_DEBUG("Not updating cgroups for hostdev iSCSI path '%s'",
iscsisrc->path);
} else {
- virDomainHostdevSubsysSCSIHostPtr scsihostsrc =
+ virDomainHostdevSubsysSCSISCSIHostPtr scsihostsrc =
&scsisrc->u.host;
if ((scsi = virSCSIDeviceNew(NULL,
scsihostsrc->adapter,
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 4a5fce3..37ce596 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4706,10 +4706,10 @@ qemuBuildHubCommandLine(virCommandPtr cmd,
static char *
-qemuBuildSCSIHostHostdevDrvStr(virDomainHostdevDefPtr dev)
+qemuBuildSCSISCSIHostHostdevDrvStr(virDomainHostdevDefPtr dev)
{
virDomainHostdevSubsysSCSIPtr scsisrc = &dev->source.subsys.u.scsi;
- virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
+ virDomainHostdevSubsysSCSISCSIHostPtr scsihostsrc = &scsisrc->u.host;
return virSCSIDeviceGetSgName(NULL,
scsihostsrc->adapter,
@@ -4754,7 +4754,7 @@ qemuBuildSCSIHostdevDrvStr(virDomainHostdevDefPtr dev)
goto error;
virBufferAsprintf(&buf, "file=%s,if=none,format=raw", source);
} else {
- if (!(source = qemuBuildSCSIHostHostdevDrvStr(dev)))
+ if (!(source = qemuBuildSCSISCSIHostHostdevDrvStr(dev)))
goto error;
virBufferAsprintf(&buf, "file=/dev/%s,if=none", source);
}
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 0ed88f5..169467f 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1198,7 +1198,7 @@ static char *
qemuGetHostdevPath(virDomainHostdevDefPtr hostdev)
{
virDomainHostdevSubsysSCSIPtr scsisrc = &hostdev->source.subsys.u.scsi;
- virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
+ virDomainHostdevSubsysSCSISCSIHostPtr scsihostsrc = &scsisrc->u.host;
char *dev_name = NULL;
char *dev_path = NULL;
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 6b3a068..a3acda6 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -2355,7 +2355,7 @@ qemuDomainAttachHostSCSIDevice(virConnectPtr conn,
_("Unable to prepare scsi hostdev for iSCSI: %s"),
iscsisrc->path);
} else {
- virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
+ virDomainHostdevSubsysSCSISCSIHostPtr scsihostsrc = &scsisrc->u.host;
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Unable to prepare scsi hostdev: %s:%u:%u:%llu"),
scsihostsrc->adapter, scsihostsrc->bus,
@@ -4583,7 +4583,7 @@ int qemuDomainDetachHostDevice(virQEMUDriverPtr driver,
_("host scsi iSCSI path %s not found"),
iscsisrc->path);
} else {
- virDomainHostdevSubsysSCSIHostPtr scsihostsrc =
+ virDomainHostdevSubsysSCSISCSIHostPtr scsihostsrc =
&scsisrc->u.host;
virReportError(VIR_ERR_OPERATION_FAILED,
_("host scsi device %s:%u:%u.%llu not found"),
diff --git a/src/security/security_apparmor.c b/src/security/security_apparmor.c
index beddf6d..521df8e 100644
--- a/src/security/security_apparmor.c
+++ b/src/security/security_apparmor.c
@@ -893,7 +893,7 @@ AppArmorSetSecurityHostdevLabel(virSecurityManagerPtr mgr,
}
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI: {
- virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
+ virDomainHostdevSubsysSCSISCSIHostPtr scsihostsrc = &scsisrc->u.host;
virSCSIDevicePtr scsi =
virSCSIDeviceNew(NULL,
scsihostsrc->adapter, scsihostsrc->bus,
diff --git a/src/security/security_dac.c b/src/security/security_dac.c
index fd74e8b..e3a01ae 100644
--- a/src/security/security_dac.c
+++ b/src/security/security_dac.c
@@ -658,7 +658,7 @@ virSecurityDACSetHostdevLabel(virSecurityManagerPtr mgr,
}
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI: {
- virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
+ virDomainHostdevSubsysSCSISCSIHostPtr scsihostsrc = &scsisrc->u.host;
virSCSIDevicePtr scsi =
virSCSIDeviceNew(NULL,
scsihostsrc->adapter, scsihostsrc->bus,
@@ -789,7 +789,7 @@ virSecurityDACRestoreHostdevLabel(virSecurityManagerPtr mgr,
}
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI: {
- virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
+ virDomainHostdevSubsysSCSISCSIHostPtr scsihostsrc = &scsisrc->u.host;
virSCSIDevicePtr scsi =
virSCSIDeviceNew(NULL,
scsihostsrc->adapter, scsihostsrc->bus,
diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
index 89c93dc..c916028 100644
--- a/src/security/security_selinux.c
+++ b/src/security/security_selinux.c
@@ -1479,7 +1479,7 @@ virSecuritySELinuxSetHostdevSubsysLabel(virSecurityManagerPtr mgr,
}
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI: {
- virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
+ virDomainHostdevSubsysSCSISCSIHostPtr scsihostsrc = &scsisrc->u.host;
virSCSIDevicePtr scsi =
virSCSIDeviceNew(NULL,
@@ -1684,7 +1684,7 @@ virSecuritySELinuxRestoreHostdevSubsysLabel(virSecurityManagerPtr mgr,
}
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI: {
- virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
+ virDomainHostdevSubsysSCSISCSIHostPtr scsihostsrc = &scsisrc->u.host;
virSCSIDevicePtr scsi =
virSCSIDeviceNew(NULL,
scsihostsrc->adapter, scsihostsrc->bus,
diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c
index 9c2262e..13ee522 100644
--- a/src/util/virhostdev.c
+++ b/src/util/virhostdev.c
@@ -1044,13 +1044,13 @@ virHostdevUpdateActiveUSBDevices(virHostdevManagerPtr mgr,
}
static int
-virHostdevUpdateActiveSCSIHostDevices(virHostdevManagerPtr mgr,
- virDomainHostdevDefPtr hostdev,
- virDomainHostdevSubsysSCSIPtr scsisrc,
- const char *drv_name,
- const char *dom_name)
+virHostdevUpdateActiveSCSISCSIHostDevices(virHostdevManagerPtr mgr,
+ virDomainHostdevDefPtr hostdev,
+ virDomainHostdevSubsysSCSIPtr scsisrc,
+ const char *drv_name,
+ const char *dom_name)
{
- virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
+ virDomainHostdevSubsysSCSISCSIHostPtr scsihostsrc = &scsisrc->u.host;
virSCSIDevicePtr scsi = NULL;
virSCSIDevicePtr tmp = NULL;
int ret = -1;
@@ -1107,8 +1107,11 @@ virHostdevUpdateActiveSCSIDevices(virHostdevManagerPtr mgr,
if (scsisrc->protocol == VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI) {
continue; /* Not supported for iSCSI */
} else {
- if (virHostdevUpdateActiveSCSIHostDevices(mgr, hostdev, scsisrc,
- drv_name, dom_name) < 0)
+ if (virHostdevUpdateActiveSCSISCSIHostDevices(mgr,
+ hostdev,
+ scsisrc,
+ drv_name,
+ dom_name) < 0)
goto cleanup;
}
}
@@ -1340,11 +1343,11 @@ virHostdevPrepareUSBDevices(virHostdevManagerPtr mgr,
}
static int
-virHostdevPrepareSCSIHostDevices(virDomainHostdevDefPtr hostdev,
- virDomainHostdevSubsysSCSIPtr scsisrc,
- virSCSIDeviceListPtr list)
+virHostdevPrepareSCSISCSIHostDevices(virDomainHostdevDefPtr hostdev,
+ virDomainHostdevSubsysSCSIPtr scsisrc,
+ virSCSIDeviceListPtr list)
{
- virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
+ virDomainHostdevSubsysSCSISCSIHostPtr scsihostsrc = &scsisrc->u.host;
virSCSIDevicePtr scsi;
int ret = -1;
@@ -1406,7 +1409,9 @@ virHostdevPrepareSCSIDevices(virHostdevManagerPtr mgr,
if (scsisrc->protocol == VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI) {
continue; /* Not supported for iSCSI */
} else {
- if (virHostdevPrepareSCSIHostDevices(hostdev, scsisrc, list) < 0)
+ if (virHostdevPrepareSCSISCSIHostDevices(hostdev,
+ scsisrc,
+ list) < 0)
goto cleanup;
}
}
@@ -1533,13 +1538,13 @@ virHostdevReAttachUSBDevices(virHostdevManagerPtr mgr,
}
static void
-virHostdevReAttachSCSIHostDevices(virHostdevManagerPtr mgr,
- virDomainHostdevDefPtr hostdev,
- virDomainHostdevSubsysSCSIPtr scsisrc,
- const char *drv_name,
- const char *dom_name)
+virHostdevReAttachSCSISCSIHostDevices(virHostdevManagerPtr mgr,
+ virDomainHostdevDefPtr hostdev,
+ virDomainHostdevSubsysSCSIPtr scsisrc,
+ const char *drv_name,
+ const char *dom_name)
{
- virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
+ virDomainHostdevSubsysSCSISCSIHostPtr scsihostsrc = &scsisrc->u.host;
virSCSIDevicePtr scsi;
virSCSIDevicePtr tmp;
@@ -1598,8 +1603,8 @@ virHostdevReAttachSCSIDevices(virHostdevManagerPtr mgr,
if (scsisrc->protocol == VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI)
continue; /* Not supported for iSCSI */
else
- virHostdevReAttachSCSIHostDevices(mgr, hostdev, scsisrc,
- drv_name, dom_name);
+ virHostdevReAttachSCSISCSIHostDevices(mgr, hostdev, scsisrc,
+ drv_name, dom_name);
}
virObjectUnlock(mgr->activeSCSIHostdevs);
}
--
1.9.1
8 years
[libvirt] [PATCH] fs: Add proper switch to create filesystem with overwrite
by John Ferlan
https://bugzilla.redhat.com/show_bug.cgi?id=1366460
When using the --overwrite switch on a pool-build or pool-create, the
The mkfs.ext{2|3|4} commands use mke2fs which requires using the '-F' switch
in order to force overwriting the current filesystem on the whole disk.
Likewise, the mkfs.vfat command uses mkfs.fat which requires using the '-I'
switch in order to force overwriting the current filesystem on the whole disk.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/storage/storage_backend_fs.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
index 6c8bae2..de0e8d5 100644
--- a/src/storage/storage_backend_fs.c
+++ b/src/storage/storage_backend_fs.c
@@ -712,9 +712,17 @@ virStorageBackendExecuteMKFS(const char *device,
cmd = virCommandNewArgList(MKFS, "-t", format, NULL);
- /* use the force, otherwise mkfs.xfs won't overwrite existing fs */
+ /* use the force, otherwise mkfs.xfs won't overwrite existing fs.
+ * Similarly mkfs.ext2, mkfs.ext3, and mkfs.ext4 require supplying -F
+ * and mkfs.vfat uses -I */
if (STREQ(format, "xfs"))
virCommandAddArg(cmd, "-f");
+ else if (STREQ(format, "ext2") ||
+ STREQ(format, "ext3") ||
+ STREQ(format, "ext4"))
+ virCommandAddArg(cmd, "-F");
+ else if (STREQ(format, "vfat"))
+ virCommandAddArg(cmd, "-I");
virCommandAddArg(cmd, device);
--
2.7.4
8 years