[libvirt] [PATCH 0/2] qemu and lxc: remove duplicate code and move some definitions to domain_conf
by Ilias Stamatis
Ilias Stamatis (2):
domain_conf: move DomainParseBlkioDeviceStr out of QEMU and LXC
drivers
domain_conf: move DomainMergeBlkioDevice out of QEMU and LXC drivers
src/conf/domain_conf.c | 185 ++++++++++++++++++++++++++++++++++
src/conf/domain_conf.h | 13 +++
src/libvirt_private.syms | 2 +
src/lxc/lxc_driver.c | 184 +---------------------------------
src/qemu/qemu_driver.c | 207 +++------------------------------------
5 files changed, 218 insertions(+), 373 deletions(-)
--
2.22.0
5 years, 5 months
[libvirt] [PATCH] storage: Add iscsi-direct pool list type flag
by Han Han
Add pool list type flag VIR_CONNECT_LIST_STORAGE_POOLS_ISCSI_DIRECT,
which was forgotten when introducing iscsi-direct pool at f0bf1be3.
https://bugzilla.redhat.com/show_bug.cgi?id=1726609
Signed-off-by: Han Han <hhan(a)redhat.com>
---
include/libvirt/libvirt-storage.h | 1 +
src/conf/storage_conf.h | 3 ++-
src/conf/virstorageobj.c | 4 +++-
src/libvirt-storage.c | 1 +
tools/virsh-pool.c | 2 +-
tools/virsh.pod | 2 +-
6 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/include/libvirt/libvirt-storage.h b/include/libvirt/libvirt-storage.h
index 5a95b2b139..089e1e0bd1 100644
--- a/include/libvirt/libvirt-storage.h
+++ b/include/libvirt/libvirt-storage.h
@@ -244,6 +244,7 @@ typedef enum {
VIR_CONNECT_LIST_STORAGE_POOLS_GLUSTER = 1 << 16,
VIR_CONNECT_LIST_STORAGE_POOLS_ZFS = 1 << 17,
VIR_CONNECT_LIST_STORAGE_POOLS_VSTORAGE = 1 << 18,
+ VIR_CONNECT_LIST_STORAGE_POOLS_ISCSI_DIRECT = 1 << 19,
} virConnectListAllStoragePoolsFlags;
int virConnectListAllStoragePools(virConnectPtr conn,
diff --git a/src/conf/storage_conf.h b/src/conf/storage_conf.h
index 338e70244d..f399ac6192 100644
--- a/src/conf/storage_conf.h
+++ b/src/conf/storage_conf.h
@@ -484,7 +484,8 @@ VIR_ENUM_DECL(virStoragePartedFs);
VIR_CONNECT_LIST_STORAGE_POOLS_SHEEPDOG | \
VIR_CONNECT_LIST_STORAGE_POOLS_GLUSTER | \
VIR_CONNECT_LIST_STORAGE_POOLS_ZFS | \
- VIR_CONNECT_LIST_STORAGE_POOLS_VSTORAGE)
+ VIR_CONNECT_LIST_STORAGE_POOLS_VSTORAGE | \
+ VIR_CONNECT_LIST_STORAGE_POOLS_ISCSI_DIRECT)
#define VIR_CONNECT_LIST_STORAGE_POOLS_FILTERS_ALL \
(VIR_CONNECT_LIST_STORAGE_POOLS_FILTERS_ACTIVE | \
diff --git a/src/conf/virstorageobj.c b/src/conf/virstorageobj.c
index 31b5af8e9e..0ac128c4bc 100644
--- a/src/conf/virstorageobj.c
+++ b/src/conf/virstorageobj.c
@@ -1967,7 +1967,9 @@ virStoragePoolObjMatch(virStoragePoolObjPtr obj,
(MATCH(VIR_CONNECT_LIST_STORAGE_POOLS_ZFS) &&
(obj->def->type == VIR_STORAGE_POOL_ZFS)) ||
(MATCH(VIR_CONNECT_LIST_STORAGE_POOLS_VSTORAGE) &&
- (obj->def->type == VIR_STORAGE_POOL_VSTORAGE))))
+ (obj->def->type == VIR_STORAGE_POOL_VSTORAGE)) ||
+ (MATCH(VIR_CONNECT_LIST_STORAGE_POOLS_ISCSI_DIRECT) &&
+ (obj->def->type == VIR_STORAGE_POOL_ISCSI_DIRECT))))
return false;
}
diff --git a/src/libvirt-storage.c b/src/libvirt-storage.c
index 3bd61dc986..24e28083ed 100644
--- a/src/libvirt-storage.c
+++ b/src/libvirt-storage.c
@@ -93,6 +93,7 @@ virStoragePoolGetConnect(virStoragePoolPtr pool)
* VIR_CONNECT_LIST_STORAGE_POOLS_MPATH
* VIR_CONNECT_LIST_STORAGE_POOLS_RBD
* VIR_CONNECT_LIST_STORAGE_POOLS_SHEEPDOG
+ * VIR_CONNECT_LIST_STORAGE_POOLS_ISCSI_DIRECT
*
* Returns the number of storage pools found or -1 and sets @pools to
* NULL in case of error. On success, the array stored into @pools is
diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c
index c56ab2d90a..510d41b508 100644
--- a/tools/virsh-pool.c
+++ b/tools/virsh-pool.c
@@ -1205,7 +1205,7 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
flags |= VIR_CONNECT_LIST_STORAGE_POOLS_ISCSI;
break;
case VIR_STORAGE_POOL_ISCSI_DIRECT:
- flags |= VIR_CONNECT_LIST_STORAGE_POOLS_ISCSI;
+ flags |= VIR_CONNECT_LIST_STORAGE_POOLS_ISCSI_DIRECT;
break;
case VIR_STORAGE_POOL_SCSI:
flags |= VIR_CONNECT_LIST_STORAGE_POOLS_SCSI;
diff --git a/tools/virsh.pod b/tools/virsh.pod
index dbcac24292..62ffd43ba9 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -4093,7 +4093,7 @@ I<--uuid> and I<--name>.
You may also want to list pools with specified types using I<type>, the
pool types must be separated by comma, e.g. --type dir,disk. The valid pool
types include 'dir', 'fs', 'netfs', 'logical', 'disk', 'iscsi', 'scsi',
-'mpath', 'rbd', 'sheepdog' and 'gluster'.
+'mpath', 'rbd', 'sheepdog', 'gluster', 'iscsi-direct'.
The I<--details> option instructs virsh to additionally
display pool persistence and capacity related information where available.
--
2.20.1
5 years, 5 months
[libvirt] [PATCH 0/8] more snapshot improvements [incremental backup saga]
by Eric Blake
Various things that I've tweaked while working on addressing Peter's
comments about my v8.5 checkpoint series. I'm less certain about
patches 7 and 8 (as having multiple ways to spell an operation, but
where one way fails with older servers, can be confusing), we may want
to drop those two and just take the first 6.
Eric Blake (8):
snapshot: Rename qemu domain snapshot test files
snapshot: Fix virDomainUndefineFlags docs regarding snapshots
snapshot: Add internal option to validate XML against schema
snapshot: Add VIR_DOMAIN_SNAPSHOT_CREATE_VALIDATE flag
snapshot: Factor out redefine cycle validation
backup: Add support for filtering based on current moment
snapshot: Add ListAll filters for current snapshot
snapshot: Expose new filter flags in virsh
include/libvirt/libvirt-domain-snapshot.h | 7 +++
src/conf/snapshot_conf.h | 1 +
src/conf/virdomainmomentobjlist.h | 14 ++++-
src/conf/virdomainsnapshotobjlist.h | 10 +++-
src/conf/snapshot_conf.c | 54 +++++++------------
src/conf/virdomainmomentobjlist.c | 49 ++++++++++++++++-
src/conf/virdomainsnapshotobjlist.c | 13 +++++
src/libvirt-domain-snapshot.c | 17 +++++-
src/libvirt-domain.c | 9 ++--
src/qemu/qemu_driver.c | 6 ++-
src/test/test_driver.c | 6 ++-
src/vbox/vbox_common.c | 11 ++--
src/vz/vz_driver.c | 5 +-
tests/Makefile.am | 14 ++---
.../description_only.xml | 0
.../disk-invalid.xml | 0
.../disk-network-seclabel-invalid.xml | 0
.../disk-seclabel.xml | 0
.../disk_driver_name_null.xml | 0
.../disk_snapshot.xml | 0
.../empty.xml | 0
.../external_vm.xml | 0
.../name_and_description.xml | 0
.../name_only.xml | 0
.../noparent.xml | 0
.../all_parameters.xml | 0
.../disk-seclabel.xml | 0
.../disk_driver_name_null.xml | 0
.../disk_snapshot.xml | 0
.../disk_snapshot_redefine.xml | 0
.../empty.xml | 0
.../external_vm.xml | 0
.../external_vm_redefine.xml | 0
.../full_domain.xml | 0
.../metadata.xml | 0
.../name_and_description.xml | 0
.../noparent.xml | 0
.../noparent_nodescription.xml | 0
.../noparent_nodescription_noactive.xml | 0
...test.c => qemudomainsnapshotxml2xmltest.c} | 15 +++---
tests/virschematest.c | 4 +-
tests/virsh-snapshot | 16 ++++--
tools/virsh-snapshot.c | 25 ++++++++-
tools/virsh.pod | 14 +++--
44 files changed, 213 insertions(+), 77 deletions(-)
rename tests/{domainsnapshotxml2xmlin => qemudomainsnapshotxml2xmlin}/description_only.xml (100%)
rename tests/{domainsnapshotxml2xmlin => qemudomainsnapshotxml2xmlin}/disk-invalid.xml (100%)
rename tests/{domainsnapshotxml2xmlin => qemudomainsnapshotxml2xmlin}/disk-network-seclabel-invalid.xml (100%)
rename tests/{domainsnapshotxml2xmlin => qemudomainsnapshotxml2xmlin}/disk-seclabel.xml (100%)
rename tests/{domainsnapshotxml2xmlin => qemudomainsnapshotxml2xmlin}/disk_driver_name_null.xml (100%)
rename tests/{domainsnapshotxml2xmlin => qemudomainsnapshotxml2xmlin}/disk_snapshot.xml (100%)
rename tests/{domainsnapshotxml2xmlin => qemudomainsnapshotxml2xmlin}/empty.xml (100%)
rename tests/{domainsnapshotxml2xmlin => qemudomainsnapshotxml2xmlin}/external_vm.xml (100%)
rename tests/{domainsnapshotxml2xmlin => qemudomainsnapshotxml2xmlin}/name_and_description.xml (100%)
rename tests/{domainsnapshotxml2xmlin => qemudomainsnapshotxml2xmlin}/name_only.xml (100%)
rename tests/{domainsnapshotxml2xmlin => qemudomainsnapshotxml2xmlin}/noparent.xml (100%)
rename tests/{domainsnapshotxml2xmlout => qemudomainsnapshotxml2xmlout}/all_parameters.xml (100%)
rename tests/{domainsnapshotxml2xmlout => qemudomainsnapshotxml2xmlout}/disk-seclabel.xml (100%)
rename tests/{domainsnapshotxml2xmlout => qemudomainsnapshotxml2xmlout}/disk_driver_name_null.xml (100%)
rename tests/{domainsnapshotxml2xmlout => qemudomainsnapshotxml2xmlout}/disk_snapshot.xml (100%)
rename tests/{domainsnapshotxml2xmlout => qemudomainsnapshotxml2xmlout}/disk_snapshot_redefine.xml (100%)
rename tests/{domainsnapshotxml2xmlout => qemudomainsnapshotxml2xmlout}/empty.xml (100%)
rename tests/{domainsnapshotxml2xmlout => qemudomainsnapshotxml2xmlout}/external_vm.xml (100%)
rename tests/{domainsnapshotxml2xmlout => qemudomainsnapshotxml2xmlout}/external_vm_redefine.xml (100%)
rename tests/{domainsnapshotxml2xmlout => qemudomainsnapshotxml2xmlout}/full_domain.xml (100%)
rename tests/{domainsnapshotxml2xmlout => qemudomainsnapshotxml2xmlout}/metadata.xml (100%)
rename tests/{domainsnapshotxml2xmlout => qemudomainsnapshotxml2xmlout}/name_and_description.xml (100%)
rename tests/{domainsnapshotxml2xmlout => qemudomainsnapshotxml2xmlout}/noparent.xml (100%)
rename tests/{domainsnapshotxml2xmlout => qemudomainsnapshotxml2xmlout}/noparent_nodescription.xml (100%)
rename tests/{domainsnapshotxml2xmlout => qemudomainsnapshotxml2xmlout}/noparent_nodescription_noactive.xml (100%)
rename tests/{domainsnapshotxml2xmltest.c => qemudomainsnapshotxml2xmltest.c} (91%)
--
2.20.1
5 years, 5 months
[libvirt] [PATCH v3 00/21] Add support for vTPM state encryption
by Stefan Berger
This series of patches addresses the RFE in BZ 172830:
https://bugzilla.redhat.com/show_bug.cgi?id=1728030
This series of patches adds support for vTPM state encryption by passing
the read-end of a pipe's file descriptor to 'swtpm_setup' and 'swtpm'
where they can read a passphrase from and derive a key from that passphrase.
The TPM's domain XML looks to enable state encryption looks like this:
<tpm model='tpm-tis'>
<backend type='emulator' version='1.2'>
<encryption format='vtpm'>
<secret type='passphrase' uuid='2c9ceaba-c6ef-4f38-86fd-6e3adb2df5cd'/>
</encryption>
</backend>
<alias name='tpm0'/>
</tpm>
The vTPM secret holding the passphrase looks like this:
<secret ephemeral='no' private='yes'>
<uuid>2c9ceaba-c6ef-4f38-86fd-6e3adb2df5cd</uuid>
<description>vTPM passphrase example</description>
<usage type='vtpm'>
<name>vtpm_example</name>
</usage>
</secret>
The swtpm v0.2 (upcoming) is needed that supports the command line option
--print-capabilities returning a JSON object that identifies features added
since v0.1. One such features is the possibility to pass a passphrase via a
file descriptor.
The patches do some refactoring of existing code on the way.
Stefan
v1->v2:
- Added Marc-André's R-bs
- Addressed comments
- Added patches to extend virCommand to be able to write contents of multiple
buffers to file descriptors for a spawned process to read from
v2->v3:
- Fixed some pointer issues following conversion to use VIR_AUTOFREE
Stefan Berger (21):
secret: Add support for usage type vTPM, extend schema and test case
tests: Add already existing test case tpm-emulator-tpm2
util: Add VIR_STORAGE_ENCRYPTION_FORMAT_VTPM
conf: Extend TPM XML parser with encryption support
schema: Extend the TPM XML schema with support for encryption
tests: Add test for TPM XML encryption parser and formatter
tests: Add tests for QEMU command line generation with encrypted TPM
tpm: Move virtpm.c from utils dir to own tpm dir
tpm: Move qemuTPMEmulatorInit to virTPMEmulatorInit in virtpm.c
tpm: Refactor virTPMEmulatorInit to use loop
tpm: Check whether previously found executables were updated
tpm: Parse the capabilities supported by swtpm and swtpm_setup
utils: Implement function to pass a buffer to send via a fd to
virCommand
utils: Convert pollfd array to be allocated
utils: Write a maximum of MAX_PIPE_FEED_BYTES into a pipe
utils: Extend virCommandProcessIO to include the send buffers
tpm: Use fd to pass password to swtpm_setup and swtpm
tpm: Pass migration key passphrase via fd to swtpm
tpm: Check TPM XML device configuration changes after edit
docs: Extend Secret XML documentation with vtpm usage type
docs: Extend TPM docs with new encryption element
docs/formatdomain.html.in | 16 +
docs/formatsecret.html.in | 61 +++-
docs/schemas/domaincommon.rng | 30 ++
docs/schemas/secret.rng | 10 +
include/libvirt/libvirt-secret.h | 1 +
po/POTFILES | 2 +-
src/Makefile.am | 1 +
src/conf/Makefile.inc.am | 7 +
src/conf/domain_conf.c | 96 +++++-
src/conf/domain_conf.h | 5 +
src/conf/secret_conf.c | 13 +
src/conf/virtpm_conf.c | 36 ++
src/conf/virtpm_conf.h | 36 ++
src/libvirt_private.syms | 21 +-
src/qemu/Makefile.inc.am | 1 +
src/qemu/qemu_block.c | 1 +
src/qemu/qemu_driver.c | 28 ++
src/qemu/qemu_extdevice.c | 2 +-
src/qemu/qemu_extdevice.h | 3 +
src/qemu/qemu_tpm.c | 196 ++++++-----
src/security/Makefile.inc.am | 1 +
src/tpm/Makefile.inc.am | 20 ++
src/tpm/virtpm.c | 326 ++++++++++++++++++
src/{util => tpm}/virtpm.h | 8 +
src/util/Makefile.inc.am | 2 -
src/util/vircommand.c | 139 +++++++-
src/util/vircommand.h | 5 +
src/util/virsecret.c | 2 +-
src/util/virstorageencryption.c | 2 +-
src/util/virstorageencryption.h | 1 +
src/util/virtpm.c | 74 ----
tests/Makefile.am | 1 +
.../tpm-emulator-tpm2-enc.x86_64-latest.args | 35 ++
.../tpm-emulator-tpm2-enc.xml | 34 ++
tests/qemuxml2argvtest.c | 1 +
.../tpm-emulator-tpm2-enc.xml | 38 ++
tests/qemuxml2xmltest.c | 2 +
tests/secretxml2xmlin/usage-vtpm.xml | 7 +
tests/secretxml2xmltest.c | 1 +
39 files changed, 1099 insertions(+), 166 deletions(-)
create mode 100644 src/conf/virtpm_conf.c
create mode 100644 src/conf/virtpm_conf.h
create mode 100644 src/tpm/Makefile.inc.am
create mode 100644 src/tpm/virtpm.c
rename src/{util => tpm}/virtpm.h (77%)
delete mode 100644 src/util/virtpm.c
create mode 100644 tests/qemuxml2argvdata/tpm-emulator-tpm2-enc.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/tpm-emulator-tpm2-enc.xml
create mode 100644 tests/qemuxml2xmloutdata/tpm-emulator-tpm2-enc.xml
create mode 100644 tests/secretxml2xmlin/usage-vtpm.xml
--
2.20.1
5 years, 5 months
[libvirt] [PATCH 00/12] introduce locking into every driver
by Daniel P. Berrangé
As part of the proposal to introduce an embedded driver feature, we
decided we ought to have each driver acquire a lock against the virtual
root it is configured to use. This will prevent two apps from running an
embedded driver with the same root.
https://www.redhat.com/archives/libvir-list/2019-May/msg00467.html
It turns out that this will also be useful for the per-driver split
daemons work I am working on. In that case libvirtd will exist as a
monolithic daemon running all drivers, and we'll also have per-driver
daemons like virtqemud, virtnetworkd, etc. It is only valid to run in
one setup on the host. ie you must choose libvirtd, or choose per-driver
daemons, never both.
The per-driver locking will provide very useful protection against
mistakes in this respect.
Since the locking is functionally independant of both patch series, I'm
sending it now.
Daniel P. Berrangé (12):
qemu: acquire a pidfile in the driver root directory
secrets: acquire a pidfile in the driver root directory
network: acquire a pidfile in the driver root directory
storage: acquire a pidfile in the driver root directory
nodedev: acquire a pidfile in the driver root directory
interface: acquire a pidfile in the driver root directory
nwfilter: acquire a pidfile in the driver root directory
libxl: remove obsolete check for xend during driver startup
libxl: acquire a pidfile in the driver root directory
lxc: acquire a pidfile in the driver root directory
vz: acquire a pidfile in the driver root directory
bhyve: acquire a pidfile in the driver root directory
src/bhyve/bhyve_driver.c | 9 +++++
src/bhyve/bhyve_utils.h | 3 ++
src/conf/virnodedeviceobj.h | 5 +++
src/conf/virnwfilterobj.h | 4 +++
src/conf/virstorageobj.h | 3 ++
src/interface/interface_backend_netcf.c | 45 +++++++++++++++++++++++--
src/interface/interface_backend_udev.c | 44 +++++++++++++++++++++++-
src/libxl/libxl_conf.h | 3 ++
src/libxl/libxl_driver.c | 37 ++++++++------------
src/lxc/lxc_conf.h | 3 ++
src/lxc/lxc_driver.c | 9 +++++
src/network/bridge_driver.c | 10 ++++++
src/network/bridge_driver_platform.h | 3 ++
src/node_device/node_device_hal.c | 31 +++++++++++++++++
src/node_device/node_device_udev.c | 32 ++++++++++++++++++
src/nwfilter/nwfilter_driver.c | 19 +++++++++++
src/qemu/qemu_conf.h | 3 ++
src/qemu/qemu_driver.c | 9 +++++
src/secret/secret_driver.c | 44 +++++++++++++++++++-----
src/storage/storage_driver.c | 11 ++++++
src/vz/vz_driver.c | 40 +++++++++++++++++++---
21 files changed, 327 insertions(+), 40 deletions(-)
--
2.21.0
5 years, 5 months
[libvirt] [PATCH 0/6] virDomainFlagsUndefine cleanups
by Eric Blake
Pointed out by Peter in response to:
https://www.redhat.com/archives/libvir-list/2019-July/msg00277.html
Patches 1-5 fix a pre-existing problem in several drivers, then
provides a way to ensure we don't encounter it again. Patch 6 is an
example of what I plan to do to all the drivers that have
virDomainUndefineFlags but not snapshot support.
Eric Blake (6):
bhyve: Add various vir*Flags API
esx: Add various vir*Flags API
phyp: Add various vir*Flags API
test: Add various vir*Flags API
libvirt: Ensure modern APIs are implemented
bhyve: Ignore no-op flags during virDomainUndefine
src/bhyve/bhyve_driver.c | 41 +++++++++++++++++++++++++++++++++------
src/esx/esx_driver.c | 13 ++++++++++++-
src/libvirt.c | 42 ++++++++++++++++++++++++++++++++++++----
src/phyp/phyp_driver.c | 24 +++++++++++++++++++++--
src/test/test_driver.c | 34 ++++++++++++++++++++++++++------
5 files changed, 135 insertions(+), 19 deletions(-)
--
2.20.1
5 years, 5 months
[libvirt] [dockerfiles PATCH 0/3] Various updates
by Andrea Bolognani
All patches pushed under the Dockerfiles refresh and trivial rule.
Andrea Bolognani (3):
Refresh after recent changes
Re-introduce Ubuntu 16.04 Dockerfile
Add Debian 10 Dockerfiles
buildenv-centos-7.Dockerfile | 151 ++++++-------
buildenv-debian-10-cross-aarch64.Dockerfile | 100 +++++++++
buildenv-debian-10-cross-armv6l.Dockerfile | 98 ++++++++
buildenv-debian-10-cross-armv7l.Dockerfile | 99 ++++++++
buildenv-debian-10-cross-i686.Dockerfile | 99 ++++++++
buildenv-debian-10-cross-mips.Dockerfile | 99 ++++++++
buildenv-debian-10-cross-mips64el.Dockerfile | 99 ++++++++
buildenv-debian-10-cross-mipsel.Dockerfile | 99 ++++++++
buildenv-debian-10-cross-ppc64le.Dockerfile | 99 ++++++++
buildenv-debian-10-cross-s390x.Dockerfile | 99 ++++++++
buildenv-debian-10.Dockerfile | 89 ++++++++
buildenv-fedora-29.Dockerfile | 173 +++++++-------
buildenv-fedora-30.Dockerfile | 173 +++++++-------
buildenv-fedora-rawhide.Dockerfile | 223 ++++++++++---------
buildenv-ubuntu-16.Dockerfile | 91 ++++++++
15 files changed, 1433 insertions(+), 358 deletions(-)
create mode 100644 buildenv-debian-10-cross-aarch64.Dockerfile
create mode 100644 buildenv-debian-10-cross-armv6l.Dockerfile
create mode 100644 buildenv-debian-10-cross-armv7l.Dockerfile
create mode 100644 buildenv-debian-10-cross-i686.Dockerfile
create mode 100644 buildenv-debian-10-cross-mips.Dockerfile
create mode 100644 buildenv-debian-10-cross-mips64el.Dockerfile
create mode 100644 buildenv-debian-10-cross-mipsel.Dockerfile
create mode 100644 buildenv-debian-10-cross-ppc64le.Dockerfile
create mode 100644 buildenv-debian-10-cross-s390x.Dockerfile
create mode 100644 buildenv-debian-10.Dockerfile
create mode 100644 buildenv-ubuntu-16.Dockerfile
--
2.21.0
5 years, 5 months
[libvirt] [PATCH v2] libvirt: support block device storage type in virshParseSnapshotDiskspec
by Liu Dayu
virsh snapshot-create-as supports 'file' storage type in --diskspec by default.
But it doesn't support 'block' storage type in the virshParseSnapshotDiskspec().
So if a snapshot on a block device (e.g. LV) was created, the type of
current running storage source in dumpxml is inconsistent with the actual
backend storage source. It will check file-system type mismatch failed
and return an error message of 'Migration without shared storage is unsafe'
when VM performs a live migration after this snapshot.
Considering virsh has to be able to work remotely that recognizing a block device
by prefix /dev/ or by stat() may be not suitable, so adding a "stype" field
for the --diskspec string which will be either "file" or "block".
e.g. --diskspec vda,snapshot=external,driver=qcow2,stype=block,file=/dev/xxx.
Signed-off-by: Liu Dayu <liu.dayu(a)zte.com.cn>
---
Patch v1:
https://www.redhat.com/archives/libvir-list/2019-June/msg01248.html
Changes in v2:
- Adding a "stype" field for the --diskspec string which will indicate a "file" or "block" storage type.
---
tools/virsh-snapshot.c | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c
index e9f0ee0..ec965b2 100644
--- a/tools/virsh-snapshot.c
+++ b/tools/virsh-snapshot.c
@@ -251,10 +251,12 @@ virshParseSnapshotDiskspec(vshControl *ctl, virBufferPtr buf, const char *str)
const char *name = NULL;
const char *snapshot = NULL;
const char *driver = NULL;
+ const char *stype = NULL;
const char *file = NULL;
char **array = NULL;
int narray;
size_t i;
+ bool isFile = true;
narray = vshStringToArray(str, &array);
if (narray <= 0)
@@ -266,6 +268,8 @@ virshParseSnapshotDiskspec(vshControl *ctl, virBufferPtr buf, const char *str)
snapshot = array[i] + strlen("snapshot=");
else if (!driver && STRPREFIX(array[i], "driver="))
driver = array[i] + strlen("driver=");
+ else if (!stype && STRPREFIX(array[i], "stype="))
+ stype = array[i] + strlen("stype=");
else if (!file && STRPREFIX(array[i], "file="))
file = array[i] + strlen("file=");
else
@@ -275,13 +279,26 @@ virshParseSnapshotDiskspec(vshControl *ctl, virBufferPtr buf, const char *str)
virBufferEscapeString(buf, "<disk name='%s'", name);
if (snapshot)
virBufferAsprintf(buf, " snapshot='%s'", snapshot);
+ if (stype) {
+ if (STREQ(stype, "block")) {
+ isFile = false;
+ } else if (STRNEQ(stype, "file")) {
+ vshError(ctl, _("Unknown storage type: '%s'"), stype);
+ goto cleanup;
+ }
+ virBufferAsprintf(buf, " type='%s'", stype);
+ }
if (driver || file) {
virBufferAddLit(buf, ">\n");
virBufferAdjustIndent(buf, 2);
if (driver)
virBufferAsprintf(buf, "<driver type='%s'/>\n", driver);
- if (file)
- virBufferEscapeString(buf, "<source file='%s'/>\n", file);
+ if (file) {
+ if (isFile)
+ virBufferEscapeString(buf, "<source file='%s'/>\n", file);
+ else
+ virBufferEscapeString(buf, "<source dev='%s'/>\n", file);
+ }
virBufferAdjustIndent(buf, -2);
virBufferAddLit(buf, "</disk>\n");
} else {
@@ -351,7 +368,7 @@ static const vshCmdOptDef opts_snapshot_create_as[] = {
},
{.name = "diskspec",
.type = VSH_OT_ARGV,
- .help = N_("disk attributes: disk[,snapshot=type][,driver=type][,file=name]")
+ .help = N_("disk attributes: disk[,snapshot=type][,driver=type][,stype=type][,file=name]")
},
{.name = NULL}
};
--
1.8.3.1
5 years, 5 months
[libvirt] [PATCH] vz: fix typo that lost the '#' in '#define'
by Daniel P. Berrangé
Previous commit:
commit faceedaf7170903065807e2c37dd0d1bd06a6ef5
Author: Jonathon Jongsma <jjongsma(a)redhat.com>
Date: Tue Jun 18 11:13:12 2019 -0500
src/vz: use #pragma once in headers
accidentally chomped the "#" in a "#define" when re-indenting
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
src/vz/vz_utils.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/vz/vz_utils.h b/src/vz/vz_utils.h
index d9e3ebc30a..f116f9dd1f 100644
--- a/src/vz/vz_utils.h
+++ b/src/vz/vz_utils.h
@@ -145,7 +145,7 @@ vzGetDefaultSCSIModel(vzDriverPtr driver,
int vzCheckUnsupportedGraphics(virDomainGraphicsDefPtr gr);
- define PARALLELS_BLOCK_STATS_FOREACH(OP) \
+#define PARALLELS_BLOCK_STATS_FOREACH(OP) \
OP(rd_req, VIR_DOMAIN_BLOCK_STATS_READ_REQ, "read_requests") \
OP(rd_bytes, VIR_DOMAIN_BLOCK_STATS_READ_BYTES, "read_total") \
OP(wr_req, VIR_DOMAIN_BLOCK_STATS_WRITE_REQ, "write_requests") \
--
2.21.0
5 years, 5 months
[libvirt] [PATCH] rpc: always pass "-T -e none" args to ssh
by Daniel P. Berrangé
Way back in the past, the "no_tty=1" option was added for the remote
driver to disable local password prompting by disabling use of the local
tty:
commit b32f42984994a397441a1c48f1a002e906624c51
Author: Daniel P. Berrange <berrange(a)redhat.com>
Date: Fri Sep 21 20:17:09 2007 +0000
Added a no_tty param to remote URIs to stop SSH prompting for password
This was done by adding "-T -o BatchMode=yes -e none" args to ssh. This
achieved the desired results but is none the less semantically flawed
because it is mixing up config parameters for the local tty vs the
remote tty.
The "-T" arg stops allocation of a TTY on the remote host. This is good
for all libvirt SSH tunnels as we never require a TTY for our usage
model, so we should have just passed this unconditionally.
The "-e none" option disables the escape character for sessions with a
TTY. If we pass "-T" this is not required, but it also not harmful to
add it, so we should just pass it unconditionally too.
Only the "-o BatchMode=yes" option is related to disabling local
password prompts and thus needs control via the no_tty URI param.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
src/rpc/virnetsocket.c | 4 ++--
tests/virnetsockettest.c | 34 ++++++++++++++++++----------------
2 files changed, 20 insertions(+), 18 deletions(-)
diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
index bfa1952989..aa46b83da6 100644
--- a/src/rpc/virnetsocket.c
+++ b/src/rpc/virnetsocket.c
@@ -854,9 +854,9 @@ int virNetSocketNewConnectSSH(const char *nodename,
virCommandAddArgList(cmd, "-l", username, NULL);
if (keyfile)
virCommandAddArgList(cmd, "-i", keyfile, NULL);
+ virCommandAddArgList(cmd, "-T", "-e", "none", NULL);
if (noTTY)
- virCommandAddArgList(cmd, "-T", "-o", "BatchMode=yes",
- "-e", "none", NULL);
+ virCommandAddArgList(cmd, "-o", "BatchMode=yes", NULL);
if (noVerify)
virCommandAddArgList(cmd, "-o", "StrictHostKeyChecking=no", NULL);
diff --git a/tests/virnetsockettest.c b/tests/virnetsockettest.c
index 9c14989287..bb8357f7cd 100644
--- a/tests/virnetsockettest.c
+++ b/tests/virnetsockettest.c
@@ -571,12 +571,13 @@ mymain(void)
struct testSSHData sshData1 = {
.nodename = "somehost",
.path = "/tmp/socket",
- .expectOut = "-- somehost sh -c 'if 'nc' -q 2>&1 | grep \"requires an argument\" >/dev/null 2>&1; then "
- "ARG=-q0;"
- "else "
- "ARG=;"
- "fi;"
- "'nc' $ARG -U /tmp/socket'\n",
+ .expectOut = "-T -e none -- somehost sh -c '"
+ "if 'nc' -q 2>&1 | grep \"requires an argument\" >/dev/null 2>&1; then "
+ "ARG=-q0;"
+ "else "
+ "ARG=;"
+ "fi;"
+ "'nc' $ARG -U /tmp/socket'\n",
};
if (virTestRun("SSH test 1", testSocketSSH, &sshData1) < 0)
ret = -1;
@@ -589,7 +590,7 @@ mymain(void)
.noTTY = true,
.noVerify = false,
.path = "/tmp/socket",
- .expectOut = "-p 9000 -l fred -T -o BatchMode=yes -e none -- somehost sh -c '"
+ .expectOut = "-p 9000 -l fred -T -e none -o BatchMode=yes -- somehost sh -c '"
"if 'netcat' -q 2>&1 | grep \"requires an argument\" >/dev/null 2>&1; then "
"ARG=-q0;"
"else "
@@ -608,7 +609,7 @@ mymain(void)
.noTTY = false,
.noVerify = true,
.path = "/tmp/socket",
- .expectOut = "-p 9000 -l fred -o StrictHostKeyChecking=no -- somehost sh -c '"
+ .expectOut = "-p 9000 -l fred -T -e none -o StrictHostKeyChecking=no -- somehost sh -c '"
"if 'netcat' -q 2>&1 | grep \"requires an argument\" >/dev/null 2>&1; then "
"ARG=-q0;"
"else "
@@ -630,7 +631,7 @@ mymain(void)
struct testSSHData sshData5 = {
.nodename = "crashyhost",
.path = "/tmp/socket",
- .expectOut = "-- crashyhost sh -c "
+ .expectOut = "-T -e none -- crashyhost sh -c "
"'if 'nc' -q 2>&1 | grep \"requires an argument\" >/dev/null 2>&1; then "
"ARG=-q0;"
"else "
@@ -647,7 +648,7 @@ mymain(void)
.path = "/tmp/socket",
.keyfile = "/root/.ssh/example_key",
.noVerify = true,
- .expectOut = "-i /root/.ssh/example_key -o StrictHostKeyChecking=no -- example.com sh -c '"
+ .expectOut = "-i /root/.ssh/example_key -T -e none -o StrictHostKeyChecking=no -- example.com sh -c '"
"if 'nc' -q 2>&1 | grep \"requires an argument\" >/dev/null 2>&1; then "
"ARG=-q0;"
"else "
@@ -662,12 +663,13 @@ mymain(void)
.nodename = "somehost",
.netcat = "nc -4",
.path = "/tmp/socket",
- .expectOut = "-- somehost sh -c 'if ''nc -4'' -q 2>&1 | grep \"requires an argument\" >/dev/null 2>&1; then "
- "ARG=-q0;"
- "else "
- "ARG=;"
- "fi;"
- "''nc -4'' $ARG -U /tmp/socket'\n",
+ .expectOut = "-T -e none -- somehost sh -c '"
+ "if ''nc -4'' -q 2>&1 | grep \"requires an argument\" >/dev/null 2>&1; then "
+ "ARG=-q0;"
+ "else "
+ "ARG=;"
+ "fi;"
+ "''nc -4'' $ARG -U /tmp/socket'\n",
};
if (virTestRun("SSH test 7", testSocketSSH, &sshData7) < 0)
ret = -1;
--
2.21.0
5 years, 5 months