[libvirt] [PATCH] shutting down guest vms on host shutdown does not work
by Gerd v. Egidy
Hi,
I originally postet this into the Fedora bugzilla
https://bugzilla.redhat.com/show_bug.cgi?id=843836
but was asked by Eric to post it here for review.
Currently gracefully shutting down guest vms on host shutdown does not work on
Fedora 17, the guests are killed hard on system shutdown.
I use:
fedora-release-17-1.noarch
libvirt-client-0.9.11.4-3.fc17.x86_64
systemd-44-17.fc17.x86_64
But I have looked into current libvirt git and see the same code there so I
don't think it is any different with current git, but I have not verified this.
The reason is systemd considers libvirt-guests.service to be stopped when the
system is running:
$ systemctl status libvirt-guests.service
libvirt-guests.service - Suspend Active Libvirt Guests
Loaded: loaded (/usr/lib/systemd/system/libvirt-guests.service;
enabled)
Active: deactivating (stop) since Fri, 27 Jul 2012 15:47:31 +0200;
2min 48s ago
Process: 1085 ExecStart=/etc/init.d/libvirt-guests start
(code=exited, status=0/SUCCESS)
Control: 1150 (libvirt-guests)
CGroup: name=systemd:/system/libvirt-guests.service
└ control
├ 1150 /bin/sh /etc/init.d/libvirt-guests stop
└ 2257 sleep 1
libvirt-guests.service is defined as type "simple" in systemd (the default).
That means systemd will shut down the service when the start executable is
terminated after starting is done. Systemd will not call stop again on system
shutdown because it thinks it is already stopped.
The solution is to define it as type "oneshot" and set the flag
"RemainAfterExit". Then systemd will consider the service as active after
startup and will call the stop function on host shutdown.
With the attached patch everything works as expected. Please consider merging.
Kind regards,
Gerd
12 years, 3 months
[libvirt] [PATCH] daemon: Fix crash in virTypedParameterArrayClear
by Jiri Denemark
Daemon uses the following pattern when dispatching APIs with typed
parameters:
VIR_ALLOC_N(params, nparams);
virDomain*(dom, params, &nparams, flags);
virTypedParameterArrayClear(params, nparams);
In case nparams was originally set to 0, virDomain* API would fill it
with the number of typed parameters it can provide and we would use this
number (rather than zero) to clear params. Because VIR_ALLOC* returns
non-NULL pointer even if size is 0, the code would end up walking
through random memory. If we were lucky enough and the memory contained
7 (VIR_TYPED_PARAM_STRING) at the right place, we would try to free a
random pointer and crash.
Let's make sure params stays NULL when nparams is 0.
---
daemon/remote.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/daemon/remote.c b/daemon/remote.c
index 80626a2..d25717c 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -989,7 +989,7 @@ remoteDispatchDomainGetSchedulerParameters(virNetServerPtr server ATTRIBUTE_UNUS
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
goto cleanup;
}
- if (VIR_ALLOC_N(params, nparams) < 0)
+ if (nparams && VIR_ALLOC_N(params, nparams) < 0)
goto no_memory;
if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
@@ -1098,7 +1098,7 @@ remoteDispatchDomainGetSchedulerParametersFlags(virNetServerPtr server ATTRIBUTE
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
goto cleanup;
}
- if (VIR_ALLOC_N(params, nparams) < 0)
+ if (nparams && VIR_ALLOC_N(params, nparams) < 0)
goto no_memory;
if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
@@ -1279,7 +1279,7 @@ remoteDispatchDomainBlockStatsFlags(virNetServerPtr server ATTRIBUTE_UNUSED,
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
goto cleanup;
}
- if (VIR_ALLOC_N(params, nparams) < 0) {
+ if (nparams && VIR_ALLOC_N(params, nparams) < 0) {
virReportOOMError();
goto cleanup;
}
@@ -1753,7 +1753,7 @@ remoteDispatchDomainGetMemoryParameters(virNetServerPtr server ATTRIBUTE_UNUSED,
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
goto cleanup;
}
- if (VIR_ALLOC_N(params, nparams) < 0) {
+ if (nparams && VIR_ALLOC_N(params, nparams) < 0) {
virReportOOMError();
goto cleanup;
}
@@ -1818,7 +1818,7 @@ remoteDispatchDomainGetNumaParameters(virNetServerPtr server ATTRIBUTE_UNUSED,
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
goto cleanup;
}
- if (VIR_ALLOC_N(params, nparams) < 0) {
+ if (nparams && VIR_ALLOC_N(params, nparams) < 0) {
virReportOOMError();
goto cleanup;
}
@@ -1883,7 +1883,7 @@ remoteDispatchDomainGetBlkioParameters(virNetServerPtr server ATTRIBUTE_UNUSED,
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
goto cleanup;
}
- if (VIR_ALLOC_N(params, nparams) < 0) {
+ if (nparams && VIR_ALLOC_N(params, nparams) < 0) {
virReportOOMError();
goto cleanup;
}
@@ -2143,7 +2143,7 @@ remoteDispatchDomainGetBlockIoTune(virNetServerPtr server ATTRIBUTE_UNUSED,
goto cleanup;
}
- if (VIR_ALLOC_N(params, nparams) < 0) {
+ if (nparams && VIR_ALLOC_N(params, nparams) < 0) {
virReportOOMError();
goto cleanup;
}
@@ -3646,7 +3646,7 @@ remoteDispatchDomainGetInterfaceParameters(virNetServerPtr server ATTRIBUTE_UNUS
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("nparams too large"));
goto cleanup;
}
- if (VIR_ALLOC_N(params, nparams) < 0) {
+ if (nparams && VIR_ALLOC_N(params, nparams) < 0) {
virReportOOMError();
goto cleanup;
}
--
1.7.11.1
12 years, 3 months
[libvirt] [libivrt][PATCH v1] ESX: Add "Byte" datatype
by Ata E Husain Bohra
Updated as per Matthias comment.
Ata E Husain Bohra (1):
ESX: Add "Byte" datatype
src/esx/esx_vi_generator.py | 1 +
src/esx/esx_vi_types.c | 57 +++++++++++++++++++++++++++++++++++++++++++
src/esx/esx_vi_types.h | 29 ++++++++++++++++++++++
3 files changed, 87 insertions(+)
--
1.7.9.5
12 years, 3 months
[libvirt] [PATCH] ESX: Add "Byte" datatype
by Ata E Husain Bohra
Append "Byte" to set of predefined object data types.
Signed-off-by: Ata E Husain Bohra <ata.husain(a)hotmail.com>
---
src/esx/esx_vi_generator.py | 1 +
src/esx/esx_vi_types.c | 57 +++++++++++++++++++++++++++++++++++++++++++
src/esx/esx_vi_types.h | 28 +++++++++++++++++++++
3 files changed, 86 insertions(+)
diff --git a/src/esx/esx_vi_generator.py b/src/esx/esx_vi_generator.py
index 910478c..af2d57e 100755
--- a/src/esx/esx_vi_generator.py
+++ b/src/esx/esx_vi_generator.py
@@ -1496,6 +1496,7 @@ def open_and_print(filename):
predefined_enums = ["Boolean"]
predefined_objects = ["AnyType",
+ "Byte",
"Int",
"Long",
"String",
diff --git a/src/esx/esx_vi_types.c b/src/esx/esx_vi_types.c
index 708aeda..b287c22 100644
--- a/src/esx/esx_vi_types.c
+++ b/src/esx/esx_vi_types.c
@@ -777,6 +777,9 @@ esxVI_Type_ToString(esxVI_Type type)
case esxVI_Type_Short:
return "xsd:short";
+ case esxVI_Type_Byte:
+ return "xsd:byte";
+
case esxVI_Type_Int:
return "xsd:int";
@@ -818,6 +821,8 @@ esxVI_Type_FromString(const char *type)
return esxVI_Type_String;
} else if (STREQ(type, "xsd:short")) {
return esxVI_Type_Short;
+ } else if (STREQ(type, "xsd:byte")) {
+ return esxVI_Type_Byte;
} else if (STREQ(type, "xsd:int")) {
return esxVI_Type_Int;
} else if (STREQ(type, "xsd:long")) {
@@ -946,6 +951,10 @@ esxVI_AnyType_DeepCopy(esxVI_AnyType **dest, esxVI_AnyType *src)
(*dest)->int16 = src->int16;
break;
+ case esxVI_Type_Byte:
+ (*dest)->int8 = src->int8;
+ break;
+
case esxVI_Type_Int:
(*dest)->int32 = src->int32;
break;
@@ -1063,6 +1072,10 @@ esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType)
_DESERIALIZE_NUMBER(Short, "xsd:short", int16, INT16_MIN, INT16_MAX);
break;
+ case esxVI_Type_Byte:
+ _DESERIALIZE_NUMBER(Byte, "xsd:byte", int8, INT8_MIN, INT8_MAX);
+ break;
+
case esxVI_Type_Int:
_DESERIALIZE_NUMBER(Int, "xsd:int", int32, INT32_MIN, INT32_MAX);
break;
@@ -1299,6 +1312,50 @@ esxVI_String_DeserializeValue(xmlNodePtr node, char **value)
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * XSD: Byte
+ */
+
+/* esxVI_Byte_Alloc */
+ESX_VI__TEMPLATE__ALLOC(Byte)
+
+/* esxVI_Byte_Free */
+ESX_VI__TEMPLATE__FREE(Byte,
+{
+ esxVI_Byte_Free(&item->_next);
+})
+
+/* esxVI_Byte_Validate */
+ESX_VI__TEMPLATE__VALIDATE(Byte,
+{
+})
+
+/* esxVI_Byte_AppendToList */
+ESX_VI__TEMPLATE__LIST__APPEND(Byte)
+
+/* esxVI_Byte_DeepCopy */
+ESX_VI__TEMPLATE__DEEP_COPY(Byte,
+{
+ (*dest)->value = src->value;
+})
+
+/* esxVI_Byte_DeepCopyList */
+ESX_VI__TEMPLATE__LIST__DEEP_COPY(Byte)
+
+/* esxVI_Byte_Serialize */
+ESX_VI__TEMPLATE__SERIALIZE(Byte,
+{
+ virBufferAsprintf(output, "%c", (int8_t)item->value);
+})
+
+/* esxVI_Byte_SerializeList */
+ESX_VI__TEMPLATE__LIST__SERIALIZE(Byte)
+
+/* esxVI_Byte_Deserialize */
+ESX_VI__TEMPLATE__DESERIALIZE_NUMBER(Byte, "xsd:byte", INT8_MIN, INT8_MAX);
+
+
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* XSD: Int
*/
diff --git a/src/esx/esx_vi_types.h b/src/esx/esx_vi_types.h
index dbcfee0..8298b4c 100644
--- a/src/esx/esx_vi_types.h
+++ b/src/esx/esx_vi_types.h
@@ -38,6 +38,7 @@ typedef struct _esxVI_ManagedObject esxVI_ManagedObject;
typedef enum _esxVI_Boolean esxVI_Boolean;
typedef struct _esxVI_AnyType esxVI_AnyType;
typedef struct _esxVI_String esxVI_String;
+typedef struct _esxVI_Byte esxVI_Byte;
typedef struct _esxVI_Int esxVI_Int;
typedef struct _esxVI_Long esxVI_Long;
typedef struct _esxVI_DateTime esxVI_DateTime;
@@ -74,6 +75,7 @@ enum _esxVI_Type {
esxVI_Type_AnyType,
esxVI_Type_String,
esxVI_Type_Short,
+ esxVI_Type_Byte,
esxVI_Type_Int,
esxVI_Type_Long,
esxVI_Type_DateTime,
@@ -146,6 +148,7 @@ struct _esxVI_AnyType {
union {
esxVI_Boolean boolean; /* optional */
char *string; /* optional */
+ int8_t int8; /* optional */
int16_t int16; /* optional */
int32_t int32; /* optional */
int64_t int64; /* optional */
@@ -197,6 +200,31 @@ int esxVI_String_DeserializeList(xmlNodePtr node, esxVI_String **stringList);
int esxVI_String_DeserializeValue(xmlNodePtr node, char **value);
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * XSD: Byte
+ */
+
+struct _esxVI_Byte {
+ esxVI_Byte *_next; /* optional */
+ esxVI_Type _type; /* required */
+
+ int8_t value; /* required */
+};
+
+int esxVI_Byte_Alloc(esxVI_Byte **number);
+void esxVI_Byte_Free(esxVI_Byte **numberList);
+int esxVI_Byte_Validate(esxVI_Byte *number);
+int esxVI_Byte_AppendToList(esxVI_Byte **numberList, esxVI_Byte *number);
+int esxVI_Byte_DeepCopy(esxVI_Byte **dest, esxVI_Byte *src);
+int esxVI_Byte_DeepCopyList(esxVI_Byte **destList, esxVI_Byte *srcList);
+int esxVI_Byte_Serialize(esxVI_Byte *number, const char *element,
+ virBufferPtr output);
+int esxVI_Byte_SerializeList(esxVI_Byte *numberList, const char *element,
+ virBufferPtr output);
+int esxVI_Byte_Deserialize(xmlNodePtr node, esxVI_Byte **number);
+
+
+
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* XSD: Int
--
1.7.9.5
12 years, 3 months
[libvirt] [PATCH] Fix rpm build failures
by Daniel Veillard
The 'make check' was rebuilding the binaries just overrided,
so for more safety also override the C program
Also daemon-conf isn't built anymore so remove it from the list
Pushed under the build breaker rule
Daniel
diff --git a/libvirt.spec.in b/libvirt.spec.in
index c642f80..2d86e3c 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1323,11 +1323,13 @@ rm -fr %{buildroot}
%check
cd tests
-# These 3 tests don't current work in a mock build root
-for i in nodeinfotest daemon-conf seclabeltest
+make
+# These tests don't current work in a mock build root
+for i in nodeinfotest seclabeltest
do
rm -f $i
- printf "#!/bin/sh\nexit 0\n" > $i
+ printf 'int main(void) { return(0); }' > $i.c
+ printf '#!/bin/sh\nexit 0\n' > $i
chmod +x $i
done
make check
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
daniel(a)veillard.com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
12 years, 3 months
[libvirt] [test-API][PATCH] Fix logical volume create problem
by Wayne Sun
* capacity should be int type
* delete unused capacity suffix convert
* fix xml param name
Signed-off-by: Wayne Sun <gsun(a)redhat.com>
---
repos/storage/create_logical_volume.py | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/repos/storage/create_logical_volume.py b/repos/storage/create_logical_volume.py
index 170bbf5..098c148 100644
--- a/repos/storage/create_logical_volume.py
+++ b/repos/storage/create_logical_volume.py
@@ -73,10 +73,8 @@ def create_logical_volume(params):
logger = params['logger']
poolname = params['poolname']
volname = params['volname']
- capacity = params['capacity']
- xmlstr = params['xmlstr']
-
- dicts = utils.get_capacity_suffix_size(capacity)
+ capacity = int(params['capacity'])
+ xmlstr = params['xml']
conn = sharedmod.libvirtobj['conn']
pool_names = conn.listDefinedStoragePools()
--
1.7.1
12 years, 3 months
[libvirt] [PATCH] gitignore: Reorder alphabetically
by Michal Privoznik
One of our latest patches added some files to .gitignore. However,
not in the right place leaving the file not sorted. Since my git
is set up to sort these files contents, fix this issue as it keeps
showing up in git status.
---
Pushing under trivial rule.
.gitignore | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/.gitignore b/.gitignore
index e4b3932..5ea281a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -104,11 +104,11 @@
/src/libvirt_lxc
/src/locking/qemu-sanlock.conf
/src/locking/test_libvirt_sanlock.aug
-/src/lxc/test_libvirtd_lxc.aug
/src/lxc/lxc_controller_dispatch.h
/src/lxc/lxc_monitor_dispatch.h
/src/lxc/lxc_protocol.c
/src/lxc/lxc_protocol.h
+/src/lxc/test_libvirtd_lxc.aug
/src/qemu/test_libvirtd_qemu.aug
/src/remote/*_client_bodies.h
/src/remote/*_protocol.[ch]
--
1.7.8.6
12 years, 3 months
[libvirt] [PATCH 0/3] Fix check-symfile test case & some linkage bugs
by Daniel P. Berrange
The check-symfile test case was causing problems for people
depending on how they configured libvirt. This turns out to
be mostly due to a flaw in linking the nwfilter, network and
secrets driver. Once those flaws are fixed, the symfile test
works in the same way regardless of whether driver modules
are enabled
12 years, 3 months
[libvirt] [PATCH] spec: Remove extra () with return statement
by Jiri Denemark
---
Pushed as trivial.
libvirt.spec.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 2d86e3c..67b955a 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1328,7 +1328,7 @@ make
for i in nodeinfotest seclabeltest
do
rm -f $i
- printf 'int main(void) { return(0); }' > $i.c
+ printf 'int main(void) { return 0; }' > $i.c
printf '#!/bin/sh\nexit 0\n' > $i
chmod +x $i
done
--
1.7.11.1
12 years, 3 months