[libvirt] [REPOST 0/8] storage_scsi: Stable SCSI host addressing
by John Ferlan
Reposting of a series from last month changing only the span version
in the docs from 1.2.6 to 1.2.7. Previous posting here:
http://www.redhat.com/archives/libvir-list/2014-June/msg00448.html
The concept still remains the same - rather than rely on the hostNN
numbers for the scsi_host to remain stable and unique across host reboots
and/or kernel rebuilds, allow use a combination of the scsi_host's PCI
address and the value from the hostNN's 'unique_id' file.
John Ferlan (6):
getAdapterName: check for SCSI_HOST
scsi_backend: Use existing LINUX_SYSFS_SCSI_HOST_PREFIX definition
virutil: Introduce virReadSCSIUniqueId
Add unique_id to nodedev output
scsi_host: Introduce virFindSCSIHostByPCI
getAdapterName: Lookup stable scsi_host
Osier Yang (2):
virStoragePoolSourceAdapter: Refine the SCSI_HOST adapter name
storage: Introduce parentaddr into virStoragePoolSourceAdapter
docs/formatnode.html.in | 11 +
docs/formatstorage.html.in | 143 ++++++++--
docs/schemas/basictypes.rng | 24 +-
docs/schemas/nodedev.rng | 6 +
src/conf/node_device_conf.c | 23 +-
src/conf/node_device_conf.h | 1 +
src/conf/storage_conf.c | 111 +++++++-
src/conf/storage_conf.h | 8 +-
src/libvirt_private.syms | 2 +
src/node_device/node_device_linux_sysfs.c | 6 +
src/phyp/phyp_driver.c | 8 +-
src/storage/storage_backend_scsi.c | 53 +++-
src/test/test_driver.c | 5 +-
src/util/virutil.c | 154 +++++++++++
src/util/virutil.h | 8 +
tests/Makefile.am | 7 +
.../pci_8086_27c5_scsi_host_0_unique_id.xml | 8 +
tests/nodedevxml2xmltest.c | 1 +
tests/scsihosttest.c | 308 +++++++++++++++++++++
.../pool-scsi-type-scsi-host-stable.xml | 19 ++
.../pool-scsi-type-scsi-host-stable.xml | 22 ++
tests/storagepoolxml2xmltest.c | 1 +
22 files changed, 868 insertions(+), 61 deletions(-)
create mode 100644 tests/nodedevschemadata/pci_8086_27c5_scsi_host_0_unique_id.xml
create mode 100644 tests/scsihosttest.c
create mode 100644 tests/storagepoolxml2xmlin/pool-scsi-type-scsi-host-stable.xml
create mode 100644 tests/storagepoolxml2xmlout/pool-scsi-type-scsi-host-stable.xml
--
1.9.3
10 years, 4 months
[libvirt] [PATCH] schema: pool: netfs: Don't enforce slash in glusterfs pool source
by Peter Krempa
Gluster volumes don't start with a leading slash. Our schema for netfs
gluster pools enforces it though. Luckily mount.glusterfs skips it.
Allow a slashless volume name for glusterfs netfs mounts in the schema.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1101999
---
docs/schemas/basictypes.rng | 6 +++
docs/schemas/storagepool.rng | 44 +++++++++++++++++-----
.../pool-netfs-gluster-without-slash.xml | 12 ++++++
3 files changed, 53 insertions(+), 9 deletions(-)
create mode 100644 tests/storagepoolxml2xmlin/pool-netfs-gluster-without-slash.xml
diff --git a/docs/schemas/basictypes.rng b/docs/schemas/basictypes.rng
index 5fe3a97..9c9419f 100644
--- a/docs/schemas/basictypes.rng
+++ b/docs/schemas/basictypes.rng
@@ -231,6 +231,12 @@
</data>
</define>
+ <define name="dirPath">
+ <data type="string">
+ <param name="pattern">[a-zA-Z0-9_\.\+\-\\&"'<>/%]*</param>
+ </data>
+ </define>
+
<define name="absFilePath">
<data type="string">
<param name="pattern">/[a-zA-Z0-9_\.\+\-\\&"'<>/%,]+</param>
diff --git a/docs/schemas/storagepool.rng b/docs/schemas/storagepool.rng
index 8d7a94d..b2d1473 100644
--- a/docs/schemas/storagepool.rng
+++ b/docs/schemas/storagepool.rng
@@ -327,6 +327,15 @@
</element>
</define>
+ <define name='sourceinfonetfsgluster'>
+ <element name='dir'>
+ <attribute name='path'>
+ <ref name='dirPath'/>
+ </attribute>
+ <empty/>
+ </element>
+ </define>
+
<define name='sourceinfoname'>
<element name='name'>
<text/>
@@ -394,7 +403,6 @@
<value>auto</value>
<value>nfs</value>
<value>cifs</value>
- <value>glusterfs</value>
</choice>
</attribute>
</element>
@@ -468,14 +476,32 @@
<define name='sourcenetfs'>
<element name='source'>
- <interleave>
- <ref name='sourceinfohost'/>
- <ref name='sourceinfodir'/>
- <ref name='sourcefmtnetfs'/>
- <optional>
- <ref name='sourceinfovendor'/>
- </optional>
- </interleave>
+ <choice>
+ <group>
+ <interleave>
+ <ref name='sourceinfohost'/>
+ <ref name='sourceinfodir'/>
+ <ref name='sourcefmtnetfs'/>
+ <optional>
+ <ref name='sourceinfovendor'/>
+ </optional>
+ </interleave>
+ </group>
+ <group>
+ <interleave>
+ <ref name='sourceinfohost'/>
+ <ref name='sourceinfonetfsgluster'/>
+ <element name='format'>
+ <attribute name='type'>
+ <value>glusterfs</value>
+ </attribute>
+ </element>
+ <optional>
+ <ref name='sourceinfovendor'/>
+ </optional>
+ </interleave>
+ </group>
+ </choice>
</element>
</define>
diff --git a/tests/storagepoolxml2xmlin/pool-netfs-gluster-without-slash.xml b/tests/storagepoolxml2xmlin/pool-netfs-gluster-without-slash.xml
new file mode 100644
index 0000000..69a2c6d
--- /dev/null
+++ b/tests/storagepoolxml2xmlin/pool-netfs-gluster-without-slash.xml
@@ -0,0 +1,12 @@
+<pool type='netfs'>
+ <source>
+ <host name='example.com'/>
+ <format type='glusterfs'/>
+ <dir path='volume'/>
+ </source>
+ <name>netfs-gluster</name>
+ <uuid>d5609ced-94b1-489e-b218-eff35c30336a</uuid>
+ <target>
+ <path>/mnt/gluster</path>
+ </target>
+</pool>
--
2.0.0
10 years, 4 months
[libvirt] [PATCH] doc: Explicitly specify how to override spice channel mode
by Peter Krempa
Be more clear that the "<channel mode=" attribute overrides the default
set by "defaultMode".
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1033704
---
docs/formatdomain.html.in | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index bb6f710..8950959 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -4191,7 +4191,13 @@ qemu-kvm -net nic,model=? /dev/null
configured, it can be desirable to restrict what
channels can be run on each port. This is achieved by
adding one or more <channel> elements inside the
- main <graphics> element. Valid channel names
+ main <graphics> element and setting the <code>mode</code>
+ attribute to either <code>secure</code> or <code>insecure</code>.
+ Setting the mode attribute overrides the default value as set
+ by the <code>defaultMode</code> attribute. (Note that specifying
+ <code>any</code> as mode discards the entry as the channel would
+ inherit the default mode anyways)
+ Valid channel names
include <code>main</code>, <code>display</code>,
<code>inputs</code>, <code>cursor</code>,
<code>playback</code>, <code>record</code>
--
2.0.0
10 years, 4 months
[libvirt] [PATCH] domtop: Fix build on mingw
by Michal Privoznik
Firstly, there's no sigaction() nor struct sigaction on mingw. We have
to use the one implemented by gnulib (and hence link with gnulib).
Then, for some reason one header file from windows defines ERROR
symbol. Yes it does. Sigh.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
examples/domtop/Makefile.am | 6 ++++--
examples/domtop/domtop.c | 17 +++++++++++++++++
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/examples/domtop/Makefile.am b/examples/domtop/Makefile.am
index c5cb6c7..dbebb46 100644
--- a/examples/domtop/Makefile.am
+++ b/examples/domtop/Makefile.am
@@ -16,9 +16,11 @@
## License along with this library. If not, see
## <http://www.gnu.org/licenses/>.
-INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include
+INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
+ -I$(top_builddir)/gnulib/lib -I$(top_srcdir)/gnulib/lib \
+ -I$(top_srcdir)
LDADDS = $(STATIC_BINARIES) $(WARN_CFLAGS) $(top_builddir)/src/libvirt.la \
- $(COVERAGE_LDFLAGS)
+ $(top_builddir)/gnulib/lib/libgnu.la $(COVERAGE_LDFLAGS)
noinst_PROGRAMS=domtop
diff --git a/examples/domtop/domtop.c b/examples/domtop/domtop.c
index 4ac7889..af5da46 100644
--- a/examples/domtop/domtop.c
+++ b/examples/domtop/domtop.c
@@ -20,6 +20,8 @@
* Author: Michal Privoznik <mprivozn(a)redhat.com>
*/
+#include <config.h>
+
#include <errno.h>
#include <getopt.h>
#include <libvirt/libvirt.h>
@@ -35,6 +37,21 @@
static bool debug;
static bool run_top;
+/* On mingw, there's a header file that poisons the well:
+ *
+ *
+ * CC domtop.o
+ *domtop.c:40:0: warning: "ERROR" redefined [enabled by default]
+ * #define ERROR(...) \
+ * ^
+ *In file included from /usr/i686-w64-mingw32/sys-root/mingw/include/windows.h:71:0,
+ * from /usr/i686-w64-mingw32/sys-root/mingw/include/winsock2.h:23,
+ * from ../../gnulib/lib/unistd.h:48,
+ * from domtop.c:35:
+ * /usr/i686-w64-mingw32/sys-root/mingw/include/wingdi.h:75:0: note: this is the location of the previous definition
+ * #define ERROR 0
+ */
+#undef ERROR
#define ERROR(...) \
do { \
fprintf(stderr, "ERROR %s:%d : ", __FUNCTION__, __LINE__); \
--
1.8.5.5
10 years, 4 months
[libvirt] [PATCH] node_device: HAL: Ignore return value of virStrToLong_ui
by Peter Krempa
Commit 5df813177c3b609a8cf5db26ae94b26d4a40063d forgot to adjust a few
callers of virStrToLong_ui to ignore the returned value in some ancient
parts of the code.
---
Notes:
Pushed under build-braker rule as HAL enabled hosts fail to compile.
src/node_device/node_device_hal.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/node_device/node_device_hal.c b/src/node_device/node_device_hal.c
index 8656b5d..cd7d399 100644
--- a/src/node_device/node_device_hal.c
+++ b/src/node_device/node_device_hal.c
@@ -151,10 +151,10 @@ gather_pci_cap(LibHalContext *ctx, const char *udi,
if (get_str_prop(ctx, udi, "pci.linux.sysfs_path", &sysfs_path) == 0) {
char *p = strrchr(sysfs_path, '/');
if (p) {
- (void)virStrToLong_ui(p+1, &p, 16, &d->pci_dev.domain);
- (void)virStrToLong_ui(p+1, &p, 16, &d->pci_dev.bus);
- (void)virStrToLong_ui(p+1, &p, 16, &d->pci_dev.slot);
- (void)virStrToLong_ui(p+1, &p, 16, &d->pci_dev.function);
+ ignore_value(virStrToLong_ui(p+1, &p, 16, &d->pci_dev.domain));
+ ignore_value(virStrToLong_ui(p+1, &p, 16, &d->pci_dev.bus));
+ ignore_value(virStrToLong_ui(p+1, &p, 16, &d->pci_dev.slot));
+ ignore_value(virStrToLong_ui(p+1, &p, 16, &d->pci_dev.function));
}
if (!virPCIGetPhysicalFunction(sysfs_path,
--
2.0.0
10 years, 4 months
[libvirt] [PATCH 0/7] Fix domain state handling when reverting snapshots in PMSUSPENDED state
by Peter Krempa
Unfortunately qemu behaves strangely so it probably can't be fully verified :/
Peter Krempa (7):
event: Add transition reason for PMSUSPENDED state from snapshot ops
lib: Add reason for a domain reaching the PMSUSPENDED state
qemu: snapshot: Convert if-else switch to switch statement
qemu: snapshot: Reject revertion from clearly bad states
qemu: snapshot: Add helper to generate lifecycle events
qemu: snapshot: Refactor event creation when reverting snapshots
qemu: snapshot: Correctly revert snapshots in PMSUSPENDED state
examples/object-events/event-test.c | 3 +
include/libvirt/libvirt.h.in | 6 +
src/conf/domain_conf.c | 3 +-
src/qemu/qemu_driver.c | 301 +++++++++++++++++++++++++-----------
tools/virsh-domain-monitor.c | 3 +-
tools/virsh-domain.c | 3 +-
6 files changed, 228 insertions(+), 91 deletions(-)
--
2.0.0
10 years, 4 months
[libvirt] [PATCH 0/3] Resolve a few coverity issues
by Peter Krempa
Mostly introduced by the "domtop" program.
Peter Krempa (3):
examples: domtop: Fix uninitialized variable use
examples: domtop: Avoid leaking memory
util: Check return value from virStrToLong* functions
examples/domtop/domtop.c | 10 +++-------
src/util/virsexpr.c | 6 +++---
src/util/virstring.h | 30 ++++++++++++++++++++----------
src/vbox/vbox_tmpl.c | 4 ++--
src/xen/xs_internal.c | 2 +-
src/xenxs/xen_xm.c | 9 +++++++--
6 files changed, 36 insertions(+), 25 deletions(-)
--
2.0.0
10 years, 4 months
[libvirt] KVM Reset Password
by Farzad Zarasvand
Hi,
I am using KVM with libvirt and openstack.
I try to reset an instance password. but I received error 501 not implemented. how do I change instance password?
thnx
10 years, 4 months
Re: [libvirt] Enable kvm on aarch64, Cleanup F-16/18 conditionals
by Eric Blake
On 07/15/2014 04:29 PM, Peter Robinson wrote:
>> Doing an out-of-the-box build on RHEL 5 is the oldest configuration
>> still actively (if marginally) supported, ideally for as long as RHEL 5
>> remains a live platform (several more years to go). We have build-bots
>> that ensure that we can build on RHEL 5, although I'm not sure if those
>> buildbots are exercising 'make rpm' to test the older parts of the spec
>> file. Historically, RHEL 5.10 is based off of libvirt-0.8.2, and that
>> was the release in use during Fedora 13. So it's _definitely_ worth
>> culling any conditionals older than F13; but stuff between F13 and F18
>> might be shared with RHEL 5, and therefore more effort to cull the
>> Fedora side while still leaving the RHEL side intact.
>
> Yes, and you'll note in my change that I didn't change anything that
> affected EL based releases. In terms of F-13 style tags you should be
> capturing that in appropriate and equivalent EL tags to ensure you get
> right and consistent conditionals for the appropriate release as
> opposed to relying on a translation as you have EL conditionals there
> already.... why mix the two.
Not sure I follow you here; a patch may be worth more than words (and
I'm planning on posting a tentative patch soon).
>> Anyone else on the libvirt list have an opinion on how far back we can
>> clean without annoying people that are slow on the upgrade to modern Fedora?
>
> You have known users that are actively upgrading to the latest libvirt
> and no other components on old versions of Fedora?
I don't honestly know - which is why I'm asking the list if anyone
reading here would care if we pruned F18 code.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
10 years, 4 months
[libvirt] [PATCH libvirt-tck] bhyve: reconnect to domains after libvirtd restart
by Roman Bogorodskiy
Try to reconnect to the running domains after libvirtd restart. To
achieve that, do:
* Save domain state
- Modify virBhyveProcessStart() to save domain state to the state
dir
- Modify virBhyveProcessStop() to cleanup the pidfile and the state
* Detect if the state information loaded from the driver's state
dir matches the actual state. Consider domain active if:
- PID it points to exist
- Process title of this PID matches the expected one with the
domain name
Otherwise, mark the domain as shut off.
Note: earlier development bhyve versions before FreeBSD 10.0-RELEASE
didn't set proctitle we expect, so the current code will not detect
it. I don't plan adding support for this unless somebody requests
this.
---
src/bhyve/bhyve_driver.c | 18 ++++++++++
src/bhyve/bhyve_process.c | 91 +++++++++++++++++++++++++++++++++++++++++++++++
src/bhyve/bhyve_process.h | 2 ++
3 files changed, 111 insertions(+)
diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
index eb5fc95..4c7596e 100644
--- a/src/bhyve/bhyve_driver.c
+++ b/src/bhyve/bhyve_driver.c
@@ -1151,6 +1151,8 @@ bhyveStateInitialize(bool priveleged ATTRIBUTE_UNUSED,
virStateInhibitCallback callback ATTRIBUTE_UNUSED,
void *opaque ATTRIBUTE_UNUSED)
{
+ virConnectPtr conn = NULL;
+
if (!priveleged) {
VIR_INFO("Not running priveleged, disabling driver");
return 0;
@@ -1199,6 +1201,15 @@ bhyveStateInitialize(bool priveleged ATTRIBUTE_UNUSED,
}
if (virDomainObjListLoadAllConfigs(bhyve_driver->domains,
+ BHYVE_STATE_DIR,
+ NULL, 1,
+ bhyve_driver->caps,
+ bhyve_driver->xmlopt,
+ 1 << VIR_DOMAIN_VIRT_BHYVE,
+ NULL, NULL) < 0)
+ goto cleanup;
+
+ if (virDomainObjListLoadAllConfigs(bhyve_driver->domains,
BHYVE_CONFIG_DIR,
BHYVE_AUTOSTART_DIR, 0,
bhyve_driver->caps,
@@ -1207,9 +1218,16 @@ bhyveStateInitialize(bool priveleged ATTRIBUTE_UNUSED,
NULL, NULL) < 0)
goto cleanup;
+ conn = virConnectOpen("bhyve:///system");
+
+ virBhyveProcessReconnectAll(conn, bhyve_driver);
+
+ virObjectUnref(conn);
+
return 0;
cleanup:
+ virObjectUnref(conn);
bhyveStateCleanup();
return -1;
}
diff --git a/src/bhyve/bhyve_process.c b/src/bhyve/bhyve_process.c
index f3898f5..ea5ac9b 100644
--- a/src/bhyve/bhyve_process.c
+++ b/src/bhyve/bhyve_process.c
@@ -185,6 +185,11 @@ virBhyveProcessStart(virConnectPtr conn,
vm->def->id = vm->pid;
virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, reason);
+ if (virDomainSaveStatus(driver->xmlopt,
+ BHYVE_STATE_DIR,
+ vm) < 0)
+ goto cleanup;
+
ret = 0;
cleanup:
@@ -257,6 +262,10 @@ virBhyveProcessStop(bhyveConnPtr driver,
cleanup:
virCommandFree(cmd);
+
+ virPidFileDelete(BHYVE_STATE_DIR, vm->def->name);
+ virDomainDeleteConfig(BHYVE_STATE_DIR, NULL, vm);
+
return ret;
}
@@ -295,3 +304,85 @@ virBhyveGetDomainTotalCpuStats(virDomainObjPtr vm,
return ret;
}
+
+struct bhyveProcessReconnectData {
+ virConnectPtr conn;
+ bhyveConnPtr driver;
+ kvm_t *kd;
+};
+
+static int
+virBhyveProcessReconnect(virDomainObjPtr vm,
+ void *opaque)
+{
+ struct bhyveProcessReconnectData *data = opaque;
+ struct kinfo_proc *kp;
+ int nprocs;
+ char **proc_argv;
+ char *expected_proctitle = NULL;
+ int ret = -1;
+
+ if (!virDomainObjIsActive(vm))
+ return 0;
+
+ if (!vm->pid)
+ return 0;
+
+ virObjectLock(vm);
+
+ kp = kvm_getprocs(data->kd, KERN_PROC_PID, vm->pid, &nprocs);
+ if (kp == NULL || nprocs != 1)
+ goto cleanup;
+
+ if (virAsprintf(&expected_proctitle, "bhyve: %s", vm->def->name) < 0)
+ goto cleanup;
+
+ proc_argv = kvm_getargv(data->kd, kp, 0);
+ if (proc_argv && proc_argv[0])
+ if (STREQ(expected_proctitle, proc_argv[0]))
+ ret = 0;
+
+ cleanup:
+ if (ret < 0) {
+ /* If VM is reported to be in active state, but we cannot find
+ * its PID, then we clear information about the PID and
+ * set state to 'shutdown' */
+ vm->pid = 0;
+ vm->def->id = -1;
+ virDomainObjSetState(vm, VIR_DOMAIN_SHUTOFF,
+ VIR_DOMAIN_SHUTOFF_UNKNOWN);
+ ignore_value(virDomainSaveStatus(data->driver->xmlopt,
+ BHYVE_STATE_DIR,
+ vm));
+ }
+
+ virObjectUnlock(vm);
+ VIR_FREE(expected_proctitle);
+
+ return ret;
+}
+
+void
+virBhyveProcessReconnectAll(virConnectPtr conn,
+ bhyveConnPtr driver)
+{
+ kvm_t *kd;
+ struct bhyveProcessReconnectData data;
+ char errbuf[_POSIX2_LINE_MAX];
+
+ if ((kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, errbuf)) == NULL) {
+ virReportError(VIR_ERR_SYSTEM_ERROR,
+ _("Unable to get kvm descriptor: %s"),
+ errbuf);
+ return;
+
+ }
+
+ data.conn = conn;
+ data.driver = driver;
+ data.kd = kd;
+
+ virDomainObjListForEach(driver->domains, virBhyveProcessReconnect, &data);
+
+ kvm_close(kd);
+}
diff --git a/src/bhyve/bhyve_process.h b/src/bhyve/bhyve_process.h
index 3049ad0..006a5ae 100644
--- a/src/bhyve/bhyve_process.h
+++ b/src/bhyve/bhyve_process.h
@@ -37,6 +37,8 @@ int virBhyveProcessStop(bhyveConnPtr driver,
int virBhyveGetDomainTotalCpuStats(virDomainObjPtr vm,
unsigned long long *cpustats);
+void virBhyveProcessReconnectAll(virConnectPtr conn, bhyveConnPtr driver);
+
typedef enum {
VIR_BHYVE_PROCESS_START_AUTODESTROY = 1 << 0,
} bhyveProcessStartFlags;
--
1.9.0
10 years, 4 months