[libvirt] [PATCH 1/2] virsh: make -h always give help
by Eric Blake
https://bugzilla.redhat.com/show_bug.cgi?id=817244 mentions that
unlike most other tools, where --help or --version prevent all
further parsing of all later options, virsh was strange in that
--version stopped parsing but --help tried to plow on to the end.
There was no rationale for this original implementation (since
2005!), so I think we can safely conform to common usage patterns.
* tools/virsh.c (main): Drop useless 'help' variable.
---
I think the intent might have been to someday allow:
virsh -h foo
to be short for
virsh help foo
but since that hasn't been implemented in 7 years, I think it
is smarter to be consistent with other tools instead.
tools/virsh.c | 15 ++-------------
1 files changed, 2 insertions(+), 13 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index e177684..7159744 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -20179,7 +20179,6 @@ vshAllowedEscapeChar(char c)
static bool
vshParseArgv(vshControl *ctl, int argc, char **argv)
{
- bool help = false;
int arg, len;
struct option opt[] = {
{"debug", required_argument, NULL, 'd'},
@@ -20206,7 +20205,8 @@ vshParseArgv(vshControl *ctl, int argc, char **argv)
}
break;
case 'h':
- help = true;
+ vshUsage();
+ exit(EXIT_SUCCESS);
break;
case 'q':
ctl->quiet = true;
@@ -20251,17 +20251,6 @@ vshParseArgv(vshControl *ctl, int argc, char **argv)
}
}
- if (help) {
- if (optind < argc) {
- vshError(ctl, _("extra argument '%s'. See --help."), argv[optind]);
- exit(EXIT_FAILURE);
- }
-
- /* list all command */
- vshUsage();
- exit(EXIT_SUCCESS);
- }
-
if (argc > optind) {
/* parse command */
ctl->imode = false;
--
1.7.7.6
12 years, 7 months
[libvirt] [libvirt-glib] Add some tests for new capabilities APIs
by Zeeshan Ali (Khattak)
From: "Zeeshan Ali (Khattak)" <zeeshanak(a)gnome.org>
---
libvirt-gconfig/tests/Makefile.am | 4 +-
libvirt-gconfig/tests/test-capabilities-parse.c | 159 +++++++++++
libvirt-gconfig/tests/test-capabilities-parse.xml | 294 +++++++++++++++++++++
3 files changed, 456 insertions(+), 1 deletions(-)
create mode 100644 libvirt-gconfig/tests/test-capabilities-parse.c
create mode 100644 libvirt-gconfig/tests/test-capabilities-parse.xml
diff --git a/libvirt-gconfig/tests/Makefile.am b/libvirt-gconfig/tests/Makefile.am
index 5061fd9..4d1a564 100644
--- a/libvirt-gconfig/tests/Makefile.am
+++ b/libvirt-gconfig/tests/Makefile.am
@@ -1,4 +1,4 @@
-noinst_PROGRAMS = test-domain-create test-domain-parse
+noinst_PROGRAMS = test-domain-create test-domain-parse test-capabilities-parse
AM_CFLAGS = \
$(GOBJECT2_CFLAGS) \
@@ -14,3 +14,5 @@ LDADD = \
test_domain_create_SOURCES = test-domain-create.c
test_domain_parse_SOURCES = test-domain-parse.c
+
+test_capabilities_parse_SOURCES = test-capabilities-parse.c
diff --git a/libvirt-gconfig/tests/test-capabilities-parse.c b/libvirt-gconfig/tests/test-capabilities-parse.c
new file mode 100644
index 0000000..87d2790
--- /dev/null
+++ b/libvirt-gconfig/tests/test-capabilities-parse.c
@@ -0,0 +1,159 @@
+/*
+ * test-capabilities-parse.c: test libvirt-gconfig capabilities parsing
+ *
+ * Copyright (C) 2011-2012 Red Hat, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * The Software is provided "as is", without warranty of any kind, express
+ * or implied, including but not limited to the warranties of
+ * merchantability, fitness for a particular purpose and noninfringement.
+ * In no event shall the authors or copyright holders be liable for any
+ * claim, damages or other liability, whether in an action of contract,
+ * tort or otherwise, arising from, out of or in connection with the
+ * software or the use or other dealings in the Software.
+ *
+ * Authors: Zeeshan Ali <zeenix(a)redhat.com>
+ * Christophe Fergeau <cfergeau(a)redhat.com>
+ */
+
+#include <config.h>
+
+#include <string.h>
+#include <libvirt-gconfig/libvirt-gconfig.h>
+
+static void verify_host_caps(GVirConfigCapabilitiesHost *host_caps)
+{
+ GVirConfigCapabilitiesCPU *cpu_caps;
+ GList *features, *iter;
+ const char *str;
+
+ g_assert(host_caps != NULL);
+ str = gvir_config_capabilities_host_get_uuid(host_caps);
+ g_assert(g_strcmp0(str, "cd6a24b3-46f8-01aa-bb39-c39aa2123730") == 0);
+ cpu_caps = gvir_config_capabilities_host_get_cpu(host_caps);
+ g_assert(cpu_caps != NULL);
+ str = gvir_config_capabilities_cpu_get_arch(cpu_caps);
+ g_assert(g_strcmp0(str, "x86_64") == 0);
+
+ features = gvir_config_capabilities_cpu_get_features(cpu_caps);
+ for (iter = features; iter != NULL; iter = iter->next) {
+ g_assert(iter->data != NULL);
+ g_object_unref(G_OBJECT(iter->data));
+ }
+ g_list_free(features);
+}
+
+static void verify_guest_caps(GVirConfigCapabilitiesGuest *guest_caps)
+{
+ GVirConfigCapabilitiesCPUArch *arch_caps;
+ GList *features, *domains, *iter;
+ const char *str;
+
+ g_assert(guest_caps != NULL);
+ g_assert(gvir_config_capabilities_guest_get_os_type(guest_caps) ==
+ GVIR_CONFIG_DOMAIN_OS_TYPE_HVM);
+
+ features = gvir_config_capabilities_guest_get_cpu_features(guest_caps);
+ for (iter = features; iter != NULL; iter = iter->next) {
+ GVirConfigCapabilitiesCPUFeature *feature_caps;
+
+ feature_caps = GVIR_CONFIG_CAPABILITIES_CPU_FEATURE(iter->data);
+ g_assert(feature_caps != NULL);
+ str = gvir_config_capabilities_cpu_feature_get_name(feature_caps);
+ g_assert(str != NULL);
+ g_object_unref(G_OBJECT(feature_caps));
+ }
+ g_list_free(features);
+
+ arch_caps = gvir_config_capabilities_guest_get_cpu_arch(guest_caps);
+ g_assert(arch_caps != NULL);
+ str = gvir_config_capabilities_cpu_arch_get_name(arch_caps);
+ g_assert(str != NULL);
+ str = gvir_config_capabilities_cpu_arch_get_emulator(arch_caps);
+ g_assert(str != NULL);
+
+ domains = gvir_config_capabilities_cpu_arch_get_domains(arch_caps);
+ for (iter = domains; iter != NULL; iter = iter->next) {
+ GVirConfigCapabilitiesDomain *domain_caps;
+ GVirConfigDomainVirtType virt_type;
+
+ domain_caps = GVIR_CONFIG_CAPABILITIES_DOMAIN(iter->data);
+ g_assert(domain_caps != NULL);
+ virt_type = gvir_config_capabilities_domain_get_virt_type(domain_caps);
+ str = gvir_config_capabilities_domain_get_emulator(domain_caps);
+ g_assert((virt_type == GVIR_CONFIG_DOMAIN_VIRT_QEMU && str == NULL) ||
+ (virt_type == GVIR_CONFIG_DOMAIN_VIRT_KVM &&
+ g_strcmp0(str, "/usr/bin/qemu-kvm") == 0));
+ g_object_unref(G_OBJECT(domain_caps));
+ }
+ g_list_free(features);
+}
+
+int main(int argc, char **argv)
+{
+ GVirConfigCapabilities *caps;
+ GVirConfigCapabilitiesHost *host_caps;
+ GList *guests_caps, *iter;
+ char *xml;
+ GError *error = NULL;
+
+ gvir_config_init(&argc, &argv);
+ if (argc != 2) {
+ g_print("Usage: %s filename\n", argv[0]);
+ g_print("Attempt to parse the libvirt XML definition from filename\n");
+ return 1;
+ }
+
+ g_file_get_contents(argv[1], &xml, NULL, &error);
+ if (error != NULL) {
+ g_print("Couldn't read %s: %s\n", argv[1], error->message);
+ return 2;
+ }
+
+ g_type_init();
+
+ caps = gvir_config_capabilities_new_from_xml(xml, &error);
+ if (error != NULL) {
+ g_print("Couldn't parse %s: %s\n", argv[1], error->message);
+ return 3;
+ }
+ g_assert(caps != NULL);
+ gvir_config_object_validate(GVIR_CONFIG_OBJECT(caps), &error);
+ if (error != NULL) {
+ g_print("%s format is invalid: %s\n", argv[1], error->message);
+ g_clear_error(&error);
+ }
+
+ host_caps = gvir_config_capabilities_get_host(caps);
+ verify_host_caps(host_caps);
+ g_object_unref(G_OBJECT(host_caps));
+
+ guests_caps = gvir_config_capabilities_get_guests(caps);
+ for (iter = guests_caps; iter != NULL; iter = iter->next) {
+ GVirConfigCapabilitiesGuest *guest_caps;
+
+ guest_caps = GVIR_CONFIG_CAPABILITIES_GUEST(iter->data);
+ verify_guest_caps(guest_caps);
+ g_object_unref(G_OBJECT(guest_caps));
+ }
+ g_list_free(guests_caps);
+
+ g_free(xml);
+
+ xml = gvir_config_object_to_xml(GVIR_CONFIG_OBJECT(caps));
+ g_print("%s\n", xml);
+ g_free(xml);
+ g_object_unref(G_OBJECT(caps));
+
+ return 0;
+}
diff --git a/libvirt-gconfig/tests/test-capabilities-parse.xml b/libvirt-gconfig/tests/test-capabilities-parse.xml
new file mode 100644
index 0000000..796c81d
--- /dev/null
+++ b/libvirt-gconfig/tests/test-capabilities-parse.xml
@@ -0,0 +1,294 @@
+<capabilities>
+
+ <host>
+ <uuid>cd6a24b3-46f8-01aa-bb39-c39aa2123730</uuid>
+ <cpu>
+ <arch>x86_64</arch>
+ <model>Westmere</model>
+ <vendor>Intel</vendor>
+ <topology sockets="1" cores="2" threads="2"/>
+ <feature name="rdtscp"/>
+ <feature name="pdcm"/>
+ <feature name="xtpr"/>
+ <feature name="tm2"/>
+ <feature name="est"/>
+ <feature name="smx"/>
+ <feature name="vmx"/>
+ <feature name="ds_cpl"/>
+ <feature name="monitor"/>
+ <feature name="dtes64"/>
+ <feature name="pclmuldq"/>
+ <feature name="pbe"/>
+ <feature name="tm"/>
+ <feature name="ht"/>
+ <feature name="ss"/>
+ <feature name="acpi"/>
+ <feature name="ds"/>
+ <feature name="vme"/>
+ </cpu>
+ <power_management>
+ <suspend_mem/>
+ <suspend_disk/>
+ </power_management>
+ <migration_features>
+ <live/>
+ <uri_transports>
+ <uri_transport>tcp</uri_transport>
+ </uri_transports>
+ </migration_features>
+ <secmodel>
+ <model>selinux</model>
+ <doi>0</doi>
+ </secmodel>
+ </host>
+
+ <guest>
+ <os_type>hvm</os_type>
+ <arch name="i686">
+ <wordsize>32</wordsize>
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
+ <machine>pc-1.1</machine>
+ <machine canonical="pc-1.1">pc</machine>
+ <machine>pc-1.0</machine>
+ <machine>pc-0.15</machine>
+ <machine>pc-0.14</machine>
+ <machine>pc-0.13</machine>
+ <machine>pc-0.12</machine>
+ <machine>pc-0.11</machine>
+ <machine>pc-0.10</machine>
+ <machine>isapc</machine>
+ <domain type="qemu">
+ </domain>
+ <domain type="kvm">
+ <emulator>/usr/bin/qemu-kvm</emulator>
+ <machine>pc-1.1</machine>
+ <machine canonical="pc-1.1">pc</machine>
+ <machine>pc-1.0</machine>
+ <machine>pc-0.15</machine>
+ <machine>pc-0.14</machine>
+ <machine>pc-0.13</machine>
+ <machine>pc-0.12</machine>
+ <machine>pc-0.11</machine>
+ <machine>pc-0.10</machine>
+ <machine>isapc</machine>
+ </domain>
+ </arch>
+ <features>
+ <cpuselection/>
+ <pae/>
+ <nonpae/>
+ <acpi default="on" toggle="yes"/>
+ <apic default="on" toggle="no"/>
+ </features>
+ </guest>
+
+ <guest>
+ <os_type>hvm</os_type>
+ <arch name="x86_64">
+ <wordsize>64</wordsize>
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
+ <machine>pc-1.1</machine>
+ <machine canonical="pc-1.1">pc</machine>
+ <machine>pc-1.0</machine>
+ <machine>pc-0.15</machine>
+ <machine>pc-0.14</machine>
+ <machine>pc-0.13</machine>
+ <machine>pc-0.12</machine>
+ <machine>pc-0.11</machine>
+ <machine>pc-0.10</machine>
+ <machine>isapc</machine>
+ <domain type="qemu">
+ </domain>
+ <domain type="kvm">
+ <emulator>/usr/bin/qemu-kvm</emulator>
+ <machine>pc-1.1</machine>
+ <machine canonical="pc-1.1">pc</machine>
+ <machine>pc-1.0</machine>
+ <machine>pc-0.15</machine>
+ <machine>pc-0.14</machine>
+ <machine>pc-0.13</machine>
+ <machine>pc-0.12</machine>
+ <machine>pc-0.11</machine>
+ <machine>pc-0.10</machine>
+ <machine>isapc</machine>
+ </domain>
+ </arch>
+ <features>
+ <cpuselection/>
+ <acpi default="on" toggle="yes"/>
+ <apic default="on" toggle="no"/>
+ </features>
+ </guest>
+
+ <guest>
+ <os_type>hvm</os_type>
+ <arch name="arm">
+ <wordsize>32</wordsize>
+ <emulator>/usr/bin/qemu-system-arm</emulator>
+ <machine>integratorcp</machine>
+ <machine>collie</machine>
+ <machine>nuri</machine>
+ <machine>smdkc210</machine>
+ <machine>connex</machine>
+ <machine>verdex</machine>
+ <machine>highbank</machine>
+ <machine>mainstone</machine>
+ <machine>musicpal</machine>
+ <machine>n800</machine>
+ <machine>n810</machine>
+ <machine>sx1</machine>
+ <machine>sx1-v1</machine>
+ <machine>cheetah</machine>
+ <machine>realview-eb</machine>
+ <machine>realview-eb-mpcore</machine>
+ <machine>realview-pb-a8</machine>
+ <machine>realview-pbx-a9</machine>
+ <machine>akita</machine>
+ <machine>spitz</machine>
+ <machine>borzoi</machine>
+ <machine>terrier</machine>
+ <machine>lm3s811evb</machine>
+ <machine>lm3s6965evb</machine>
+ <machine>tosa</machine>
+ <machine>versatilepb</machine>
+ <machine>versatileab</machine>
+ <machine>vexpress-a9</machine>
+ <machine>vexpress-a15</machine>
+ <machine>xilinx-zynq-a9</machine>
+ <machine>z2</machine>
+ <domain type="qemu">
+ </domain>
+ </arch>
+ </guest>
+
+ <guest>
+ <os_type>hvm</os_type>
+ <arch name="microblaze">
+ <wordsize>32</wordsize>
+ <emulator>/usr/bin/qemu-system-microblaze</emulator>
+ <machine>petalogix-s3adsp1800</machine>
+ <machine>petalogix-ml605</machine>
+ <domain type="qemu">
+ </domain>
+ </arch>
+ </guest>
+
+ <guest>
+ <os_type>hvm</os_type>
+ <arch name="microblazeel">
+ <wordsize>32</wordsize>
+ <emulator>/usr/bin/qemu-system-microblazeel</emulator>
+ <machine>petalogix-s3adsp1800</machine>
+ <machine>petalogix-ml605</machine>
+ <domain type="qemu">
+ </domain>
+ </arch>
+ </guest>
+
+ <guest>
+ <os_type>hvm</os_type>
+ <arch name="mips">
+ <wordsize>32</wordsize>
+ <emulator>/usr/bin/qemu-system-mips</emulator>
+ <machine>malta</machine>
+ <machine>magnum</machine>
+ <machine>pica61</machine>
+ <machine>mipssim</machine>
+ <machine>mips</machine>
+ <domain type="qemu">
+ </domain>
+ </arch>
+ </guest>
+
+ <guest>
+ <os_type>hvm</os_type>
+ <arch name="mipsel">
+ <wordsize>32</wordsize>
+ <emulator>/usr/bin/qemu-system-mipsel</emulator>
+ <machine>malta</machine>
+ <machine>magnum</machine>
+ <machine>pica61</machine>
+ <machine>mipssim</machine>
+ <machine>mips</machine>
+ <domain type="qemu">
+ </domain>
+ </arch>
+ </guest>
+
+ <guest>
+ <os_type>hvm</os_type>
+ <arch name="sparc">
+ <wordsize>32</wordsize>
+ <emulator>/usr/bin/qemu-system-sparc</emulator>
+ <machine>SS-5</machine>
+ <machine>leon3_generic</machine>
+ <machine>SS-10</machine>
+ <machine>SS-600MP</machine>
+ <machine>SS-20</machine>
+ <machine>Voyager</machine>
+ <machine>LX</machine>
+ <machine>SS-4</machine>
+ <machine>SPARCClassic</machine>
+ <machine>SPARCbook</machine>
+ <machine>SS-1000</machine>
+ <machine>SS-2000</machine>
+ <machine>SS-2</machine>
+ <domain type="qemu">
+ </domain>
+ </arch>
+ </guest>
+
+ <guest>
+ <os_type>hvm</os_type>
+ <arch name="ppc">
+ <wordsize>32</wordsize>
+ <emulator>/usr/bin/qemu-system-ppc</emulator>
+ <machine>g3beige</machine>
+ <machine>ref405ep</machine>
+ <machine>taihu</machine>
+ <machine>bamboo</machine>
+ <machine>mac99</machine>
+ <machine>prep</machine>
+ <machine>mpc8544ds</machine>
+ <machine>virtex-ml507</machine>
+ <domain type="qemu">
+ </domain>
+ </arch>
+ </guest>
+
+ <guest>
+ <os_type>hvm</os_type>
+ <arch name="ppc64">
+ <wordsize>64</wordsize>
+ <emulator>/usr/bin/qemu-system-ppc64</emulator>
+ <machine>mac99</machine>
+ <machine>ref405ep</machine>
+ <machine>taihu</machine>
+ <machine>bamboo</machine>
+ <machine>g3beige</machine>
+ <machine>prep</machine>
+ <machine>mpc8544ds</machine>
+ <machine>virtex-ml507</machine>
+ <domain type="qemu">
+ </domain>
+ </arch>
+ <features>
+ <cpuselection/>
+ </features>
+ </guest>
+
+ <guest>
+ <os_type>hvm</os_type>
+ <arch name="s390x">
+ <wordsize>64</wordsize>
+ <emulator>/usr/bin/qemu-system-s390x</emulator>
+ <machine>s390-virtio</machine>
+ <machine canonical="s390-virtio">s390</machine>
+ <domain type="qemu">
+ </domain>
+ </arch>
+ </guest>
+
+</capabilities>
+
+
--
1.7.7.6
12 years, 7 months
[libvirt] [PATCH] util: fix crash when starting macvtap interfaces
by Laine Stump
This patch resolves https://bugzilla.redhat.com/show_bug.cgi?id=815270
The function virNetDevMacVLanVPortProfileRegisterCallback() takes an
arg "virtPortProfile", and was checking it for non-NULL before using
it. However, the prototype for
virNetDevMacVLanPortProfileRegisterCallback had marked that arg with
ATTRIBUTE_NONNULL(). Contrary to what one may think,
ATTRIBUTE_NONNULL() does not provide any guarantee that an arg marked
as such really is always non-null; the only effect to the code
generated by gcc, is that gcc *assumes* it is non-NULL; this results
in, for example, the check for a non-NULL value being optimized out.
(Unfortunately, this code removal only occurs when optimization is
enabled, and I am in the habit of doing local builds with optimization
off to ease debugging, so the bug didn't show up in my earlier local
testing).
In general, virPortProfile might always be NULL, so it shouldn't be
marked as ATTRIBUTE_NONNULL. One other function prototype made this
same error, so this patch fixes it as well.
---
src/util/virnetdevmacvlan.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/util/virnetdevmacvlan.h b/src/util/virnetdevmacvlan.h
index 2299f1d..07d54e2 100644
--- a/src/util/virnetdevmacvlan.h
+++ b/src/util/virnetdevmacvlan.h
@@ -82,7 +82,7 @@ int virNetDevMacVLanRestartWithVPortProfile(const char *cr_ifname,
virNetDevVPortProfilePtr virtPortProfile,
enum virNetDevVPortProfileOp vmOp)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
- ATTRIBUTE_NONNULL(4) ATTRIBUTE_NONNULL(5) ATTRIBUTE_RETURN_CHECK;
+ ATTRIBUTE_NONNULL(4) ATTRIBUTE_RETURN_CHECK;
int virNetDevMacVLanVPortProfileRegisterCallback(const char *ifname,
const unsigned char *macaddress ,
@@ -91,5 +91,5 @@ int virNetDevMacVLanVPortProfileRegisterCallback(const char *ifname,
virNetDevVPortProfilePtr virtPortProfile,
enum virNetDevVPortProfileOp vmOp)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
-ATTRIBUTE_NONNULL(4) ATTRIBUTE_NONNULL(5) ATTRIBUTE_RETURN_CHECK;
+ATTRIBUTE_NONNULL(4) ATTRIBUTE_RETURN_CHECK;
#endif /* __UTIL_MACVTAP_H__ */
--
1.7.10
12 years, 7 months
[libvirt] [PATCH v2 RESEND] qemu: change rbd auth_supported separation character to ;
by Josh Durgin
This works with newer qemu that doesn't allow escaping spaces.
It's backwards compatible as well.
Signed-off-by: Josh Durgin <josh.durgin(a)dreamhost.com>
---
src/qemu/qemu_command.c | 2 +-
.../qemuxml2argv-disk-drive-network-rbd-auth.args | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 45cd417..070d13e 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1674,7 +1674,7 @@ qemuBuildRBDString(virConnectPtr conn,
goto error;
}
virBufferEscape(opt, '\\', ":",
- ":key=%s:auth_supported=cephx none",
+ ":key=%s:auth_supported=cephx\\;none",
base64);
VIR_FREE(base64);
} else {
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd-auth.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd-auth.args
index 1500672..b323e91 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd-auth.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-network-rbd-auth.args
@@ -5,6 +5,6 @@ file=/dev/HostVG/QEMUGuest1,if=ide,bus=0,unit=0 -drive \
file=rbd:pool/image:\
id=myname:\
key=QVFDVm41aE82SHpGQWhBQXEwTkN2OGp0SmNJY0UrSE9CbE1RMUE=:\
-auth_supported=cephx none:\
+auth_supported=cephx\;none:\
mon_host=mon1.example.org\:6321\;mon2.example.org\:6322\;mon3.example.org\:6322,\
if=virtio,format=raw -net none -serial none -parallel none -usb
--
1.7.5.4
12 years, 7 months
[libvirt] [PATCH RESEND] qemu: allow snapshotting of sheepdog and rbd disks
by Josh Durgin
Signed-off-by: Josh Durgin <josh.durgin(a)dreamhost.com>
---
src/qemu/qemu_driver.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 78899a4..86e82d6 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -9605,12 +9605,18 @@ qemuDomainSnapshotIsAllowed(virDomainObjPtr vm)
* that succeed as well
*/
for (i = 0; i < vm->def->ndisks; i++) {
- if ((vm->def->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_LUN) ||
- (vm->def->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_DISK &&
- STRNEQ_NULLABLE(vm->def->disks[i]->driverType, "qcow2"))) {
+ virDomainDiskDefPtr disk = vm->def->disks[i];
+ if (disk->type == VIR_DOMAIN_DISK_TYPE_NETWORK &&
+ (disk->protocol == VIR_DOMAIN_DISK_PROTOCOL_SHEEPDOG ||
+ disk->protocol == VIR_DOMAIN_DISK_PROTOCOL_RBD))
+ continue;
+
+ if ((disk->device == VIR_DOMAIN_DISK_DEVICE_LUN) ||
+ (disk->device == VIR_DOMAIN_DISK_DEVICE_DISK &&
+ STRNEQ_NULLABLE(disk->driverType, "qcow2"))) {
qemuReportError(VIR_ERR_OPERATION_INVALID,
_("Disk '%s' does not support snapshotting"),
- vm->def->disks[i]->src);
+ disk->src);
return false;
}
}
--
1.7.5.4
12 years, 7 months
[libvirt] [PATCH] maint: avoid false positives on unmarked diagnostics
by Eric Blake
Otherwise, a string such as _("Don't use \"" VAR "\".") would
complain about unmarked diagnostics.
* cfg.mk (sc_libvirt_unmarked_diagnostics): Handle \" in message.
---
I needed this patch to let me verify Stefan's DHCP Snooping series.
cfg.mk | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/cfg.mk b/cfg.mk
index fb4df2f..9935820 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -603,7 +603,7 @@ sc_libvirt_unmarked_diagnostics:
$(_sc_search_regexp)
@{ grep -nE '\<$(func_re) *\(.*;$$' $$($(VC_LIST_EXCEPT)); \
grep -A1 -nE '\<$(func_re) *\(.*,$$' $$($(VC_LIST_EXCEPT)); } \
- | sed 's/_("[^"][^"]*"//;s/[ ]"%s"//' \
+ | sed 's/_("\([^"]\|\\"\+\)*"//;s/[ ]"%s"//' \
| grep '[ ]"' && \
{ echo '$(ME): found unmarked diagnostic(s)' 1>&2; \
exit 1; } || :
--
1.7.7.6
12 years, 7 months
[libvirt] [PATCH V13 0/5] Add DHCP snooping support to nwfilter
by Stefan Berger
This series of patches adds DHCP snooping support to libvirt's
nwfilter subsystem.
DHCP snooping detects DHCP leases obtained by a VM and automatically
adjusts the network traffic filters to reflect the IP addresses
with which a VM may send its traffic, thus for example preventing
IP address spoofing.
Once leases on IP addresses expire or if a VM gives up on a
lease on an IP address, the filters are also adjusted.
All leases are persisted and automatically applied upon a VM's restart.
Leases are associated with the tuple of VM-UUID and interface MAC
address.
The following interface XML activates and uses the DHCP snooping:
<interface type='bridge'>
<source bridge='virbr0'/>
<filterref filter='clean-traffic'>
<parameter name='CTRL_IP_LEARNING' value='dhcp'/>
</filterref>
</interface>
Once an IP address has been detected on an interface, 'virsh dumpxml <vm>'
would show the IP address lease in the format <IP address>,<lease timeout
in seconds>:
<interface type='bridge'>
<source bridge='virbr0'/>
<filterref filter='clean-traffic'>
<parameter name='CTRL_IP_LEARNING' value='dhcp'/>
<parameter name='IP_LEASE' value='192.168.122.210,180'/>
</filterref>
</interface>
Regards,
David and Stefan
12 years, 7 months
[libvirt] [PATCH 0/3] usb devices with same vendor, productID hotplug support
by Guannan Ren
https://bugzilla.redhat.com/show_bug.cgi?id=815755
The set of patch tries to fix the issue when multiple usb devices with
same idVendor, idProduct are availible on host, the usb device with
lowest bus:device will be attached to guest if usb xml file is given like
this:
<hostdev mode='subsystem' type='usb' managed='yes'>
<source>
<vendor id='0x15e1'/>
<product id='0x2007'/>
</source>
</hostdev>
The reason is that the usb hotplug function searchs usb device in system files
to match vendor and product id, the file with lowest number is always found
first.
After fix, in this case, libvirt will report an error like:
At the same time, the usb part of domain initilization is also update in patch 2/3
# virsh attach-device rhel6u1 /tmp/usb.xml
error: Failed to attach device from /tmp/usb.xml
error: XML error: multiple USB deivces 15e1:2007, use <address> to specify one.
12 years, 7 months