[libvirt] [PATCHv2] bhyve: domainCreateXML
by Wojciech Macek
Review-fixes, changes since last time:
- persistent flag is not reset to 0 anymore
- dom->id =vm->def->id is moved after domain startup
- duplicate of start_flags |= VIR_BHYVE_PROCESS_START_AUTODESTROY removed
- flag VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE is used instead of zero
- virDomainObjListRemove is called for not persistent domains in case of failure
- unnecessary checkActive removed
======== DIFF BETWEEN PATCHv1 and PATCHv2 =================================
diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
index 1357e07..4ac89c1 100644
--- a/src/bhyve/bhyve_driver.c
+++ b/src/bhyve/bhyve_driver.c
@@ -1139,39 +1133,36 @@ bhyveDomainCreateXML(virConnectPtr conn,
if (!(vm = virDomainObjListAdd(privconn->domains, def,
privconn->xmlopt,
- 0, NULL)))
+ VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE, NULL)))
goto cleanup;
def = NULL;
- vm->persistent = 0;
dom = virGetDomain(conn, vm->def->name, vm->def->uuid);
if (!dom)
goto cleanup;
- dom->id = vm->def->id;
-
- if (flags & VIR_DOMAIN_START_AUTODESTROY)
- start_flags |= VIR_BHYVE_PROCESS_START_AUTODESTROY;
-
- if (virDomainObjIsActive(vm)) {
- virReportError(VIR_ERR_OPERATION_INVALID,
- "%s", _("Domain is already running"));
- goto cleanup;
- }
-
ret = virBhyveProcessStart(dom->conn, privconn, vm,
VIR_DOMAIN_RUNNING_BOOTED,
start_flags);
if (ret) {
virObjectUnref(dom);
dom = NULL;
+
+ /* If domain is not persistent, remove its data */
+ if (!vm->persistent) {
+ virDomainObjListRemove(privconn->domains, vm);
+ vm = NULL;
+ }
goto cleanup;
}
+ dom->id = vm->def->id;
+
cleanup:
virObjectUnref(caps);
virDomainDefFree(def);
- virObjectUnlock(vm);
+ if (vm)
+ virObjectUnlock(vm);
return dom;
}
======== END OF DIFF BETWEEN PATCHv1 and PATCHv2 =========================
Wojciech Macek (1):
bhyve: domainCreateXML
src/bhyve/bhyve_driver.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 67 insertions(+)
--
1.9.0
10 years, 7 months
[libvirt] [PATCH] virsh: Separate 'create'/'modify' message for secret-define
by Li Yang
The current message of secret-define always be:
Secret 09a9736f-eedb-449c-9983-80d0ab67393f created
even you just modify the secret, perhaps this may puzzle
uses. Now this patch make the modify action output message
like this:
Secret f2d1bafc-ac58-4a47-93e4-47723686fef5 modified
Signed-off-by: Li Yang <liyang.fnst(a)cn.fujitsu.com>
---
tools/virsh-secret.c | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/tools/virsh-secret.c b/tools/virsh-secret.c
index 10d5db3..d1cbe04 100644
--- a/tools/virsh-secret.c
+++ b/tools/virsh-secret.c
@@ -39,6 +39,7 @@
#include "virutil.h"
#include "virxml.h"
#include "conf/secret_conf.h"
+#include "viruuid.h"
static virSecretPtr
vshCommandOptSecret(vshControl *ctl, const vshCmd *cmd, const char **name)
@@ -96,6 +97,7 @@ cmdSecretDefine(vshControl *ctl, const vshCmd *cmd)
char *buffer;
virSecretPtr res;
char uuid[VIR_UUID_STRING_BUFLEN];
+ virSecretDefPtr new_attrs;
bool ret = false;
if (vshCommandOptStringReq(ctl, cmd, "file", &from) < 0)
@@ -104,6 +106,12 @@ cmdSecretDefine(vshControl *ctl, const vshCmd *cmd)
if (virFileReadAll(from, VSH_MAX_XML_FILE, &buffer) < 0)
return false;
+ new_attrs = virSecretDefParseString(buffer);
+ if (new_attrs == NULL){
+ VIR_FREE(buffer);
+ return false;
+ }
+
if (!(res = virSecretDefineXML(ctl->conn, buffer, 0))) {
vshError(ctl, _("Failed to set attributes from %s"), from);
goto cleanup;
@@ -114,10 +122,16 @@ cmdSecretDefine(vshControl *ctl, const vshCmd *cmd)
goto cleanup;
}
- vshPrint(ctl, _("Secret %s created\n"), uuid);
+ char uuidstr[VIR_UUID_STRING_BUFLEN];
+ virUUIDFormat(new_attrs->uuid, uuidstr);
+ if (memcmp(uuid, uuidstr, VIR_UUID_BUFLEN) == 0)
+ vshPrint(ctl, _("Secret %s modified\n"), uuid);
+ else
+ vshPrint(ctl, _("Secret %s created\n"), uuid);
ret = true;
cleanup:
+ VIR_FREE(new_attrs);
VIR_FREE(buffer);
if (res)
virSecretFree(res);
--
1.7.1
10 years, 7 months
[libvirt] [PATCH] Only set QEMU_CAPS_NO_HPET on x86
by Ján Tomko
QEMU only supports it on x86, but we've been assuming it for
all QEMUs when doing QMP capability detection.
https://bugzilla.redhat.com/show_bug.cgi?id=1066145
---
src/qemu/qemu_capabilities.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 381b3ec..60b56fc 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -2888,7 +2888,6 @@ virQEMUCapsInitQMPBasic(virQEMUCapsPtr qemuCaps)
virQEMUCapsSet(qemuCaps, QEMU_CAPS_NETDEV);
virQEMUCapsSet(qemuCaps, QEMU_CAPS_RTC);
virQEMUCapsSet(qemuCaps, QEMU_CAPS_VHOST_NET);
- virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_HPET);
virQEMUCapsSet(qemuCaps, QEMU_CAPS_NODEFCONFIG);
virQEMUCapsSet(qemuCaps, QEMU_CAPS_BOOT_MENU);
virQEMUCapsSet(qemuCaps, QEMU_CAPS_FSDEV);
@@ -2947,6 +2946,7 @@ virQEMUCapsInitArchQMPBasic(virQEMUCapsPtr qemuCaps,
qemuCaps->arch == VIR_ARCH_I686) {
virQEMUCapsSet(qemuCaps, QEMU_CAPS_PCI_MULTIBUS);
virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_ACPI);
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_HPET);
virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_KVM_PIT);
}
--
1.8.3.2
10 years, 7 months
[libvirt] [PATCH] Remove QEMU_CAPS_MACHINE_USB_OPT from ComputeCmdFlags
by Ján Tomko
The version check is for >1.3.0, but ComputeCmdFlags
is only called for QEMU older than 1.2.0.
---
src/qemu/qemu_capabilities.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 381b3ec..5814c7c 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -1143,10 +1143,6 @@ virQEMUCapsComputeCmdFlags(const char *help,
if (strstr(help, "-machine"))
virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_OPT);
- /* USB option is supported v1.3.0 onwards */
- if (qemuCaps->version >= 1003000)
- virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_USB_OPT);
-
/*
* Handling of -incoming arg with varying features
* -incoming tcp (kvm >= 79, qemu >= 0.10.0)
--
1.8.3.2
10 years, 7 months
[libvirt] [PATCH] Fix Memory Leak in virStorageFileGetMetadataRecurse()
by Nehal J Wani
While running virstoragetest, valgrind pointed out the following
memory leak:
==8142== 2 bytes in 1 blocks are definitely lost in loss record 1 of 92
==8142== at 0x4A069EE: malloc (vg_replace_malloc.c:270)
==8142== by 0x4E7B53E: mdir_name (dirname-lgpl.c:78)
==8142== by 0x4CBE2B0: virStorageFileGetMetadataInternal (virstoragefile.c:595)
==8142== by 0x4CBE651: virStorageFileGetMetadataFromFDInternal (virstoragefile.c:1086)
==8142== by 0x4CBEEB4: virStorageFileGetMetadataRecurse (virstoragefile.c:1175)
==8142== by 0x4CBF1DE: virStorageFileGetMetadata (virstoragefile.c:1270)
==8142== by 0x4028AD: testStorageChain (virstoragetest.c:275)
==8142== by 0x407B91: virtTestRun (testutils.c:201)
==8142== by 0x4039D7: mymain (virstoragetest.c:534)
==8142== by 0x40830D: virtTestMain (testutils.c:789)
==8142== by 0x3E6CE1ED1C: (below main) (libc-start.c:226)
...62 times
---
src/util/virstoragefile.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index ea80c1d..73cfef0 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -1213,6 +1213,7 @@ virStorageFileGetMetadataRecurse(const char *path, const char *canonPath,
meta->backingMeta = backing;
}
}
+ VIR_FREE(backingDirectory);
return ret;
}
--
1.7.1
10 years, 7 months
[libvirt] [PATCH] docs: document that vfio is default for hostdev networks too
by Laine Stump
When the default was changed from kvm to vfio, the documentation for
hostdev and interface was changed, but the documentation in <network>
was forgotten.
---
docs/formatnetwork.html.in | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/docs/formatnetwork.html.in b/docs/formatnetwork.html.in
index fc56b42..aeafbd9 100644
--- a/docs/formatnetwork.html.in
+++ b/docs/formatnetwork.html.in
@@ -282,16 +282,19 @@
definition. <span class="since"> Since 0.10.0</span>
<p>
- To use VFIO device assignment rather than
- traditional/legacy KVM device assignment (VFIO is a new
- method of device assignment that is compatible with UEFI
- Secure Boot), a <forward type='hostdev'> interface
- can have an optional <code>driver</code> sub-element
- with a <code>name</code> attribute set to "vfio". To use
- legacy KVM device assignment you can
- set <code>name</code> to "kvm" (or simply omit the
- <driver> element, since "kvm" is currently the
- default).
+ To force use of a particular type of device assignment,
+ a <forward type='hostdev'> interface can have an
+ optional <code>driver</code> sub-element with
+ a <code>name</code> attribute set to either "vfio" (VFIO
+ is a new method of device assignment that is compatible
+ with UEFI Secure Boot) or "kvm" (the legacy device
+ assignment handled directly by the KVM kernel
+ module). The default is "vfio" on systems where the VFIO
+ driver is available and loaded, and "kvm" on older
+ systems, or those where the VFIO driver hasn't been
+ loaded. When specified, device assignment will fail if
+ the requested method of device assignment isn't
+ available on the host.
<span class="since">Since 1.0.5 (QEMU and KVM only, requires kernel 3.6 or newer)</span>
</p>
--
1.9.0
10 years, 7 months
[libvirt] qemu: Unlock the NWFilter update lock by leaving via the cleanup label
by Stefan Berger
Fix a locking problem by leaving the function via the cleanup label.
Signed-off-by: Stefan Berger <stefanb(a)linux.vnet.ibm.com>
---
src/qemu/qemu_driver.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: libvirt-acl/src/qemu/qemu_driver.c
===================================================================
--- libvirt-acl.orig/src/qemu/qemu_driver.c
+++ libvirt-acl/src/qemu/qemu_driver.c
@@ -6140,7 +6140,7 @@ qemuDomainCreateWithFlags(virDomainPtr d
virNWFilterReadLockFilterUpdates();
if (!(vm = qemuDomObjFromDomain(dom)))
- return -1;
+ goto cleanup;
if (virDomainCreateWithFlagsEnsureACL(dom->conn, vm->def) < 0)
goto cleanup;
10 years, 7 months
[libvirt] what are the differences among disk cache attribute
by longguang.yue
hi,all
there are "default", "none", "writethrough", "writeback", "directsync", "unsafe" cache options
1.
could you explain what is default and none? exactly what it does and not does?
2.
what is the difference between unsafe and (default or none)?
3.
after a long time of running , it seems that vms will slow down? do you know why?
cache hit rate goes down or kernel takes time to flush cache?
thanks
10 years, 7 months
[libvirt] [PATCH 0/2] specify migration URI on setting file
by Chen Fan
Hi all,
Current virsh migrate command require specfying migration URI with
command option.
1) If user specifies --migrateuri on virsh migrate command, then the
command transfers the data to specified host.
2) If --migrateuri is not specified, the command transfers the data to host
whose name is resolved by DNS or /etc/hosts.
But we would like to specify it on setting file like file libvirt.conf of libvirt
host. the motivation is:
If user would like to increase their system's resource, and user add
one more NIC for each host. (One is for management LAN, another is for data LAN).
in this case, user would like to use "data LAN" for transfer migrate data.
Then, user can specify the NIC address for data LAN by migrateuri.
Though the migrateuri is usually stable, user must specify migrateuri
every migrate time. So, setting file for migrateuri is desirable.
in addition, if there are more KVM host, to change the migrateuri will
be too troublesome for user.
Chen Fan (2):
move virConnectGetConfigFile() to virconf.h
add default migrate uri in definition file
daemon/remote.c | 11 +++++++-
src/driver.h | 1 +
src/libvirt.c | 66 ++++++++------------------------------------
src/libvirt.conf | 7 +++++
src/libvirt_internal.h | 1 +
src/libvirt_private.syms | 2 +-
src/qemu/qemu_driver.c | 37 +++++++++++++++++++++++--
src/remote/remote_driver.c | 13 +++++++++
src/remote/remote_protocol.x | 1 +
src/util/virconf.c | 54 ++++++++++++++++++++++++++++++++++++
src/util/virconf.h | 1 +
11 files changed, 134 insertions(+), 60 deletions(-)
--
1.8.1.4
10 years, 7 months
[libvirt] [RFC PATCH] conf: Output disk backing store details in domain XML
by Jiri Denemark
The XML for quite a complicated backing chain is shown below:
<disk type='network' device='disk'>
<driver name='qemu' type='qcow2'/>
<source protocol='nbd' name='bar'>
<host transport='unix' socket='/var/run/nbdsock'/>
</source>
<backingStore type='block' index='1'>
<format type='qcow2'/>
<source dev='/dev/HostVG/QEMUGuest1'/>
<backingStore type='file' index='2'>
<format type='qcow2'/>
<source file='/tmp/image2.qcow'/>
<backingStore type='file' index='3'>
<format type='qcow2'/>
<source file='/tmp/image3.qcow'/>
<backingStore type='file' index='4'>
<format type='qcow2'/>
<source file='/tmp/image4.qcow'/>
<backingStore type='file' index='5'>
<format type='qcow2'/>
<source file='/tmp/image5.qcow'/>
<backingStore type='file' index='6'>
<format type='raw'/>
<source file='/tmp/Fedora-17-x86_64-Live-KDE.iso'/>
<backingStore/>
</backingStore>
</backingStore>
</backingStore>
</backingStore>
</backingStore>
</backingStore>
<target dev='vdb' bus='virtio'/>
</disk>
Various disk types and formats can be mixed in one chain. The
<backingStore/> empty element marks the end of the backing chain and it
is there mostly for future support of parsing the chain provided by a
user. If it's missing, we are supposed to probe for the rest of the
chain ourselves, otherwise complete chain was provided by the user. The
index attributes of backingStore elements can be used to unambiguously
identify a specific part of the image chain.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
docs/schemas/domaincommon.rng | 48 ++++++++++++++--
tests/domainschemadata/backing-chains.xml | 94 +++++++++++++++++++++++++++++++
2 files changed, 136 insertions(+), 6 deletions(-)
create mode 100644 tests/domainschemadata/backing-chains.xml
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index d2235e1..4249ed5 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -1196,10 +1196,51 @@
<optional>
<ref name="snapshot"/>
</optional>
- <ref name="diskSource"/>
+ <interleave>
+ <ref name="diskSource"/>
+ <ref name="storageSourceExtra"/>
+ <ref name="diskBackingChain"/>
+ </interleave>
+ </element>
+ </define>
+
+ <define name="diskBackingChain">
+ <choice>
+ <ref name="diskBackingStore"/>
+ <ref name="diskBackingStoreLast"/>
+ </choice>
+ </define>
+
+ <define name="diskBackingStore">
+ <element name="backingStore">
+ <attribute name="index">
+ <ref name="positiveInteger"/>
+ </attribute>
+ <interleave>
+ <ref name="diskSource"/>
+ <ref name="diskBackingChain"/>
+ <ref name="diskFormat"/>
+ </interleave>
+ </element>
+ </define>
+
+ <define name="diskFormat">
+ <element name="format">
+ <attribute name="type">
+ <ref name="storageFormat"/>
+ </attribute>
+ <empty/>
</element>
</define>
+ <define name="diskBackingStoreLast">
+ <optional>
+ <element name="backingStore">
+ <empty/>
+ </element>
+ </optional>
+ </define>
+
<define name="diskSource">
<choice>
<ref name="diskSourceFile"/>
@@ -1232,7 +1273,6 @@
</optional>
</element>
</optional>
- <ref name='storageSourceExtra'/>
</interleave>
</define>
@@ -1256,7 +1296,6 @@
</optional>
</element>
</optional>
- <ref name='storageSourceExtra'/>
</interleave>
</define>
@@ -1276,7 +1315,6 @@
<empty/>
</element>
</optional>
- <ref name='storageSourceExtra'/>
</interleave>
</define>
@@ -1340,7 +1378,6 @@
</zeroOrMore>
<empty/>
</element>
- <ref name='storageSourceExtra'/>
</interleave>
</define>
@@ -1373,7 +1410,6 @@
</optional>
</element>
</optional>
- <ref name='storageSourceExtra'/>
</interleave>
</define>
diff --git a/tests/domainschemadata/backing-chains.xml b/tests/domainschemadata/backing-chains.xml
new file mode 100644
index 0000000..b0bdd06
--- /dev/null
+++ b/tests/domainschemadata/backing-chains.xml
@@ -0,0 +1,94 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu</emulator>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <source protocol='gluster' name='Volume2/Image'>
+ <host transport='unix' socket='/path/to/sock'/>
+ </source>
+ <backingStore type='file' index='1'>
+ <format type='qcow2'/>
+ <source file='/tmp/missing-backing-store.qcow'/>
+ </backingStore>
+ <target dev='vda' bus='virtio'/>
+ </disk>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <source protocol='nbd' name='bar'>
+ <host transport='unix' socket='/var/run/nbdsock'/>
+ </source>
+ <backingStore type='block' index='1'>
+ <format type='qcow2'/>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <backingStore type='file' index='2'>
+ <format type='qcow2'/>
+ <source file='/tmp/image2.qcow'/>
+ <backingStore type='file' index='3'>
+ <format type='qcow2'/>
+ <source file='/tmp/image3.qcow'/>
+ <backingStore type='file' index='4'>
+ <format type='qcow2'/>
+ <source file='/tmp/image4.qcow'/>
+ <backingStore type='file' index='5'>
+ <source file='/tmp/image5.qcow'/>
+ <format type='qcow2'/>
+ <backingStore type='file' index='6'>
+ <format type='raw'/>
+ <source file='/tmp/Fedora-17-x86_64-Live-KDE.iso'/>
+ <backingStore/>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ </backingStore>
+ <target dev='vdb' bus='virtio'/>
+ </disk>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <backingStore/>
+ <source protocol='gluster' name='Volume1/Image'>
+ <host name='example.org' port='6000'/>
+ </source>
+ <target dev='vdc' bus='virtio'/>
+ </disk>
+ <disk type='network' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <auth username='myname'>
+ <secret type='ceph' usage='mycluster_myname'/>
+ </auth>
+ <source protocol='rbd' name='pool/image'>
+ <host name='mon1.example.org' port='6321'/>
+ <host name='mon2.example.org' port='6322'/>
+ <host name='mon3.example.org' port='6322'/>
+ </source>
+ <backingStore type='file' index='1'>
+ <source file='/tmp/image.qcow'/>
+ <backingStore/>
+ <format type='qcow2'/>
+ </backingStore>
+ <target dev='vdd' bus='virtio'/>
+ </disk>
+ <disk type='block' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <source dev='/dev/HostVG/QEMUGuest11'/>
+ <target dev='vde' bus='ide'/>
+ </disk>
+ <controller type='usb' index='0'/>
+ <controller type='pci' index='0' model='pci-root'/>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
--
1.9.2
10 years, 7 months