[libvirt] [PATCH] Fix python error reporting for some storage operations
by Cole Robinson
In the python bindings, all vir* classes expect to be
passed a virConnect object when instantiated. Before
the storage stuff, these classes were only instantiated
in virConnect methods, so the generator is hardcoded to
pass 'self' as the connection instance to these classes.
Problem is there are some methods that return pool or vol
instances which aren't called from virConnect: you can
lookup a storage volume's associated pool, and can lookup
volumes from a pool. In these cases passing 'self' doesn't
give the vir* instance a connection, so when it comes time
to raise an exception crap hits the fan.
Rather than rework the generator to accomodate this edge
case, I just fixed the init functions for virStorage* to
pull the associated connection out of the passed value
if it's not a virConnect instance.
Thanks,
Cole
diff --git a/python/generator.py b/python/generator.py
index 01a17da..c706b19 100755
--- a/python/generator.py
+++ b/python/generator.py
@@ -962,8 +962,12 @@ def buildWrappers():
list = reference_keepers[classname]
for ref in list:
classes.write(" self.%s = None\n" % ref[1])
- if classname in [ "virDomain", "virNetwork", "virStoragePool", "virStorageVol" ]:
+ if classname in [ "virDomain", "virNetwork" ]:
classes.write(" self._conn = conn\n")
+ elif classname in [ "virStorageVol", "virStoragePool" ]:
+ classes.write(" self._conn = conn\n" + \
+ " if not isinstance(conn, virConnect):\n" + \
+ " self._conn = conn._conn\n")
classes.write(" if _obj != None:self._o = _obj;return\n")
classes.write(" self._o = None\n\n");
destruct=None
16 years, 4 months
[libvirt] Announcement of a companion project the "UnifiedSessionsManager"
by acue
Hello,
I would like to announce the unifiedSessionsManager(GPL3, including the
claimed inventions), which is based
for Xen on the virsh-tool, but basically uses a different approach. I
guess it could be a quite usable companion
of libvirt for advanced usage and enhanced customizabelity of the
handling of huge amounts of virtual and
physical machines in a distributed environment. It is targeting on test,
development and productive
environments.
This requirement will particularly arise, when "bulk-core-CPUs" enter
the market, providing for independently
executed bulks of virtual machines, which may be logically designed as
stacked and nested VMs, founding a
tree like multi-layered structure of VM clusters.
The design-preview as estimated by the unifiedSessionsManager is here
the v-component, what could be seen as
the extensin of the slogan/concept of a so called virtual appliance,
where a full scale VM including it's inherent
GuestOS is handeled as a virtual software component. V-Compoents are
foreseen to be grouped into clusters of
VMs, arranged within a nested VMSTACK and managed - e.g. suspended - as
a group of services, founding a
combined service by their self.
In case this preview becomes reality, this may have an impact on the
basic design, particularly the interface
design of each of it's components to be stack-aware, thus for libvirt
too. For example providing the shutdown
of a stack of VMs, including the suspension of machines containing upper
VMs, might require some kind of
communications and propagation..
The usage of multilayered VMSTACKs is already supported by the
unifiedSessionsManager. Particularly
MACRO and GROUP features support for handling of the number of entities
required to be handled for a
VMSTACK. Whereas much of the required functionality from the VMs is
simulated, particularly by
utilizing a recursive Stack-Propagation based on native access to
GuestOSs with SSO-accounts.
The concrete supported products of current version 01_07_001b02 are:
- GuestOS and HostOS on physical machines: CentOS, Fedora, debian,
OpenSUSE, Ubuntu,
OpenBSD, Solaris10(limited)
- Hypervisors/Emulators: QEMU, Xn, VMware(workstation,server,player)
Future Plans are, mostly for the next version already:
-Planned-OS: FreeBSD, NetBSD, Solaris10(complete), OpenSolaris,
ScientificLinux
-Planned-OS: eCos(?), uCLinux(several ARCH), SkyEye, ...
-Planned-VM: VirtualBOX(evaluation first), OpenVZ(evaluation first)
.Introduction of a LDAP based nameservice for VMs.
-Evaluation of:Cygwin
The Idea was the easy to adapt utilization of a
minimalistic-bash-scripts only implementation for setting
up a unified wrapper interface customizable for almost any kind of user
sessions by almost anyone. Even
though I would prefer now at least Perl or for specific parts full
scale C/C++ code and Java/JavaScript
for some administrative parts.
The managed user environment comprises sessions to VMs which could be
allocated in a nested multilayered
VMSTACK as well as within a PM, which are physical machines - layer-0
entities. Also HOSTs sessions as
native access to GuestOSs are integrated.
Additionally a simple implemented but with sophisticated functionally
equipped cache database is introduced
in order to support for hundreds and thousands of virtual machines to be
managed, with an average
query-response-time for single-level-filters of less than 1second.
Results are measured with an average of
0.3-0.8seconds in the ref.-env., even though bash and awk is mainly used
only with an Office-Compatible
record format.
Information could be found within the User-Manual, which has more than
600pages, and within the sources
of more than 110.000LinesOfCode.
The following sites provide downloads:
http://www.heise.de/software/download/unified_sessions_manager_ctys/51630
http://www.unifiedsessionsmanager.org
http://www.unifiedsessionsmanager.eu
http://sourceforge.net/projects/ctys (sourceforge not yet complete)
(berlios follows)
There are basically three reasons for sending this Mail:
1. Announcing a new supplemental project focusing on usage of
distributed and stacked VMs
2. Getting some feedback and ideas for the future direction of the
development of libvirt and the
unifiedSessionsManager.
3. Probably initiation of setting up a common overall concept for the
future vision of an IT environment
and it's integrated handling of VMs.
And of course, I would appreciate, if the current version already is of
some benefit for the OpenSource
community.
Yours Sincerely
Arno-Can Uestuensoez
--
----------------------------------------------------------------------------
Arno-Can Uestuensoez
www.i4p.de / www.i4p.com
16 years, 4 months
[libvirt] [PATCH/RFC]: hostdev passthrough support
by Guido Günther
Hi,
attached is some basic support for host device passthrough. It enables
you to passthrough usb devices in qemu/kvm via:
<devices>
<hostdev type='usb' vendor='0204' product='6025'/>
<hostdev type='usb' bus='001' device='007'/>
</devices>
I didn't implement unplug yet since this needs some modifications to
qemu/kvm to be able to identify the correct device to unplug.
Does this look reasonable?
-- Guido
16 years, 4 months
[libvirt] [PATCH] fix MinGW compilation(200808)
by Atsushi SAKAI
Hi,
Currently, compilation for MinGW is broken.
Here is the patch.
But configure script option for MinGW is changed from previous posting.
https://www.redhat.com/archives/libvir-list/2008-June/msg00145.html
Currently, it should do
# ./configure --without-xen --without-qemu --without-sasl --without-lxc --without-openvz --without-libvirtd --without-test
currently following 3 make works,
make
make install
make check
I do not know why syntax-check is not exist on Makefile on MinGW.
src/domain_conf.c | 2 ++
src/network_conf.c | 2 ++
src/virsh.c | 8 ++++++++
tests/testutilsxen.c | 2 ++
4 files changed, 14 insertions(+)
Thanks
Atsushi SAKAI
16 years, 4 months
[libvirt] [PATCH] make sure we call the freshly build libvirtd
by Guido Guenther
...not the one in $PATH. I was wondering why this test kept failing...
-- Guido
---
tests/daemon-conf | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/tests/daemon-conf b/tests/daemon-conf
index db1f0d3..4a42d1e 100755
--- a/tests/daemon-conf
+++ b/tests/daemon-conf
@@ -1,6 +1,8 @@
#!/bin/sh
# Get coverage of libvirtd's config-parsing code.
+LIBVIRTD=$abs_top_builddir/qemud/libvirtd
+
# Boilerplate code to set up a test directory, cd into it,
# and to ensure we remove it upon completion.
this_test_() { echo "./$0" | sed 's,.*/,,'; }
@@ -27,7 +29,7 @@ while :; do
# Change an RHS that starts with '"' or '[' to "3".
# Change an RHS that starts with 0 or 1 to the string '"foo"'.
sed "$i"'s/ = [["].*/ = 3/;'"$i"'s/ = [01].*/ = "foo"/' tmp.conf > $f
- libvirtd --config=$f 2> err && fail=1
+ $LIBVIRTD --config=$f 2> err && fail=1
case $rhs in
# '"'*) msg='should be a string';;
'"'*) msg='invalid type: got long; expected string';;
@@ -48,7 +50,7 @@ while :; do
done
# Run with the unmodified config file.
-libvirtd --config=tmp.conf > log 2>&1 & pid=$!
+$LIBVIRTD --config=tmp.conf > log 2>&1 & pid=$!
sleep 2
kill $pid
--
1.5.6.3
16 years, 4 months
[libvirt] /var/run/libvirt
by Stefan de Konink
It is a trivial error, but i wonder if:
Failed to change group ownership of /var/run/libvirt
Failed to bind socket to '/var/run/libvirt/libvirt-sock': No such file or
directory
This could be corrected to:
/var/run/libvirt doesn't exist
or an mkdir is done on the directory...
Stefan
16 years, 4 months
[libvirt] virStoragePoolRefresh (costs)
by Stefan de Konink
Could anyone elaborate on the cost of running virStoragePoolRefresh on the
different backends. I recall one of the Daniels here suggested it was
expensive for some backends could anyone elaborate on it?
Stefan
16 years, 4 months
[libvirt] [ANNOUNCE] virt-mem tools version 0.2.8 released
by Richard W.M. Jones
I'm pleased to announce the latest release of the virt-mem tools,
version 0.2.8.
These are tools for system administrators which let you find things
like kernel messages, process lists and network information of your
guests.
For example:
virt-uname
'uname' command, shows OS version, architecture, etc.
virt-dmesg
'dmesg' command, shows kernel messages
virt-ps
'ps' command, shows process list
Nothing needs to be installed in the guest for this to work, and the
tools are specifically designed to allow easy scripting and
integration with databases and monitoring systems.
Source is available from the web page here:
http://et.redhat.com/~rjones/virt-mem/
The latest version (0.2.8) reworks the internals substantially so that
we have direct access to basically any kernel structure, and this will
allow us to quickly add the remaining features that people have asked
for (memory usage information, lists of network interfaces and so on).
As usual, patches, feedback, suggestions etc. are very welcome!
Binaries will be available in Fedora 10 (Rawhide) at some point soon.
Rich.
--
Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top
16 years, 4 months
[libvirt] PATCH: Fix const-ness for virRun/virExec
by Daniel P. Berrange
The exec() family of UNIX functions have broken const-ness in the argv[]
parameter. For inexplicable reasons, I followed this brokeness when
originally doing the virRun/virExec functions. So every caller is either
using wrong const-ness, or having to cast when calling them. This patch
fixes the virRun/virExec API const-ness, so we only need apply a cast
at the time we finally call exec()
src/iptables.c | 12 ++++++------
src/lxc_driver.c | 2 +-
src/openvz_driver.c | 34 +++++++++++++++++-----------------
src/qemu_conf.c | 4 ++--
src/qemu_conf.h | 2 +-
src/qemu_driver.c | 6 +++---
src/storage_backend.c | 4 ++--
src/storage_backend_disk.c | 4 ++--
src/storage_backend_fs.c | 8 ++++----
src/storage_backend_iscsi.c | 6 +++---
src/storage_backend_logical.c | 12 ++++++------
src/util.c | 16 ++++++++--------
src/util.h | 6 +++---
src/veth.c | 8 ++++----
tests/qemuxml2argvtest.c | 2 +-
15 files changed, 63 insertions(+), 63 deletions(-)
Daniel
diff -r cc63ab958867 src/iptables.c
--- a/src/iptables.c Thu Aug 07 15:00:21 2008 +0100
+++ b/src/iptables.c Thu Aug 07 22:59:08 2008 +0100
@@ -57,7 +57,7 @@
typedef struct
{
char *rule;
- char **argv;
+ const char **argv;
int command_idx;
} iptRule;
@@ -91,7 +91,7 @@
const char *path)
{
char arg[PATH_MAX];
- char *argv[4];
+ const char *argv[4];
snprintf(arg, sizeof(arg), "--custom-rules=ipv4:%s:%s", table, path);
@@ -278,7 +278,7 @@
static int
iptRulesAppend(iptRules *rules,
char *rule,
- char **argv,
+ const char **argv,
int command_idx)
{
if (VIR_REALLOC_N(rules->rules, rules->nrules+1) < 0) {
@@ -385,7 +385,7 @@
}
static char *
-argvToString(char **argv)
+argvToString(const char *const *argv)
{
int len, i;
char *ret, *p;
@@ -415,7 +415,7 @@
{
va_list args;
int retval = ENOMEM;
- char **argv;
+ const char **argv;
char *rule = NULL;
const char *s;
int n, command_idx;
@@ -571,7 +571,7 @@
for (i = 0; i < rules->nrules; i++) {
iptRule *rule = &rules->rules[i];
- char *orig;
+ const char *orig;
orig = rule->argv[rule->command_idx];
rule->argv[rule->command_idx] = (char *) "--delete";
diff -r cc63ab958867 src/lxc_driver.c
--- a/src/lxc_driver.c Thu Aug 07 15:00:21 2008 +0100
+++ b/src/lxc_driver.c Thu Aug 07 22:59:08 2008 +0100
@@ -1288,7 +1288,7 @@
int user_netns = 0;
int kern_netns = 0;
- if (virRun(NULL, (char **)argv, &ip_rc) == 0)
+ if (virRun(NULL, argv, &ip_rc) == 0)
user_netns = WIFEXITED(ip_rc) && (WEXITSTATUS(ip_rc) != 255);
if (lxcCheckContainerSupport(CLONE_NEWNET) == 0)
diff -r cc63ab958867 src/openvz_driver.c
--- a/src/openvz_driver.c Thu Aug 07 15:00:21 2008 +0100
+++ b/src/openvz_driver.c Thu Aug 07 22:59:08 2008 +0100
@@ -91,13 +91,13 @@
unsigned int flags ATTRIBUTE_UNUSED);
static int openvzDomainUndefine(virDomainPtr dom);
-static void cmdExecFree(char *cmdExec[]);
+static void cmdExecFree(const char *cmdExec[]);
static int openvzGetProcessInfo(unsigned long long *cpuTime, int vpsid);
struct openvz_driver ovz_driver;
-static void cmdExecFree(char *cmdExec[])
+static void cmdExecFree(const char *cmdExec[])
{
int i=-1;
while(cmdExec[++i])
@@ -111,7 +111,7 @@
0 - OK
*/
static int openvzDomainDefineCmd(virConnectPtr conn,
- char *args[],
+ const char *args[],
int maxarg,
struct openvz_vm_def *vmdef)
{
@@ -287,7 +287,7 @@
return -1;
}
- if (virRun(dom->conn, (char **)prog, NULL) < 0) {
+ if (virRun(dom->conn, prog, NULL) < 0) {
openvzError(dom->conn, VIR_ERR_INTERNAL_ERROR,
_("Could not exec %s"), VZCTL);
return -1;
@@ -319,7 +319,7 @@
return -1;
}
- if (virRun(dom->conn, (char **)prog, NULL) < 0) {
+ if (virRun(dom->conn, prog, NULL) < 0) {
openvzError(dom->conn, VIR_ERR_INTERNAL_ERROR,
_("Could not exec %s"), VZCTL);
return -1;
@@ -333,7 +333,7 @@
virDomainNetDefPtr net)
{
int rc = 0, narg;
- char *prog[OPENVZ_MAX_ARG];
+ const char *prog[OPENVZ_MAX_ARG];
char *mac = NULL;
#define ADD_ARG_LIT(thisarg) \
@@ -391,7 +391,7 @@
if (prog[0] != NULL){
ADD_ARG_LIT("--save");
- if (virRun(conn, (char **)prog, NULL) < 0) {
+ if (virRun(conn, prog, NULL) < 0) {
openvzError(conn, VIR_ERR_INTERNAL_ERROR,
_("Could not exec %s"), VZCTL);
rc = -1;
@@ -427,7 +427,7 @@
struct openvz_vm_def *vmdef = NULL;
struct openvz_vm *vm = NULL;
virDomainPtr dom = NULL;
- char *prog[OPENVZ_MAX_ARG];
+ const char *prog[OPENVZ_MAX_ARG];
prog[0] = NULL;
if ((vmdef = openvzParseVMDef(conn, xml, NULL)) == NULL)
@@ -453,7 +453,7 @@
//TODO: set number virtual CPUs
//TODO: set quota
- if (virRun(conn, (char **)prog, NULL) < 0) {
+ if (virRun(conn, prog, NULL) < 0) {
openvzError(conn, VIR_ERR_INTERNAL_ERROR,
_("Could not exec %s"), VZCTL);
goto exit;
@@ -489,7 +489,7 @@
virDomainPtr dom = NULL;
struct openvz_driver *driver = (struct openvz_driver *) conn->privateData;
const char *progstart[] = {VZCTL, "--quiet", "start", NULL, NULL};
- char *progcreate[OPENVZ_MAX_ARG];
+ const char *progcreate[OPENVZ_MAX_ARG];
progcreate[0] = NULL;
if (!(vmdef = openvzParseVMDef(conn, xml, NULL)))
@@ -514,7 +514,7 @@
goto exit;
}
- if (virRun(conn, (char **)progcreate, NULL) < 0) {
+ if (virRun(conn, progcreate, NULL) < 0) {
openvzError(conn, VIR_ERR_INTERNAL_ERROR,
_("Could not exec %s"), VZCTL);
goto exit;
@@ -534,7 +534,7 @@
progstart[3] = vmdef->name;
- if (virRun(conn, (char **)progstart, NULL) < 0) {
+ if (virRun(conn, progstart, NULL) < 0) {
openvzError(conn, VIR_ERR_INTERNAL_ERROR,
_("Could not exec %s"), VZCTL);
goto exit;
@@ -572,7 +572,7 @@
return -1;
}
- if (virRun(dom->conn, (char **)prog, NULL) < 0) {
+ if (virRun(dom->conn, prog, NULL) < 0) {
openvzError(dom->conn, VIR_ERR_INTERNAL_ERROR,
_("Could not exec %s"), VZCTL);
return -1;
@@ -604,7 +604,7 @@
return -1;
}
- if (virRun(conn, (char **)prog, NULL) < 0) {
+ if (virRun(conn, prog, NULL) < 0) {
openvzError(conn, VIR_ERR_INTERNAL_ERROR,
_("Could not exec %s"), VZCTL);
return -1;
@@ -629,7 +629,7 @@
return -1;
}
- if (virRun(conn, (char **)prog, NULL) < 0) {
+ if (virRun(conn, prog, NULL) < 0) {
openvzError(conn, VIR_ERR_INTERNAL_ERROR, _("Could not exec %s"), VZCTL);
return -1;
}
@@ -742,7 +742,7 @@
char *endptr;
const char *cmd[] = {VZLIST, "-ovpsid", "-H" , NULL};
- ret = virExec(conn, (char **)cmd, &pid, -1, &outfd, &errfd);
+ ret = virExec(conn, cmd, &pid, -1, &outfd, &errfd);
if(ret == -1) {
openvzError(conn, VIR_ERR_INTERNAL_ERROR,
_("Could not exec %s"), VZLIST);
@@ -779,7 +779,7 @@
const char *cmd[] = {VZLIST, "-ovpsid", "-H", "-S", NULL};
/* the -S options lists only stopped domains */
- ret = virExec(conn, (char **)cmd, &pid, -1, &outfd, &errfd);
+ ret = virExec(conn, cmd, &pid, -1, &outfd, &errfd);
if(ret == -1) {
openvzError(conn, VIR_ERR_INTERNAL_ERROR,
_("Could not exec %s"), VZLIST);
diff -r cc63ab958867 src/qemu_conf.c
--- a/src/qemu_conf.c Thu Aug 07 15:00:21 2008 +0100
+++ b/src/qemu_conf.c Thu Aug 07 22:59:08 2008 +0100
@@ -711,7 +711,7 @@
struct qemud_driver *driver,
virDomainObjPtr vm,
int qemuCmdFlags,
- char ***retargv,
+ const char ***retargv,
int **tapfds,
int *ntapfds,
const char *migrateFrom) {
@@ -728,7 +728,7 @@
struct utsname ut;
int disableKQEMU = 0;
int qargc = 0, qarga = 0;
- char **qargv = NULL;
+ const char **qargv = NULL;
uname(&ut);
diff -r cc63ab958867 src/qemu_conf.h
--- a/src/qemu_conf.h Thu Aug 07 15:00:21 2008 +0100
+++ b/src/qemu_conf.h Thu Aug 07 22:59:08 2008 +0100
@@ -95,7 +95,7 @@
struct qemud_driver *driver,
virDomainObjPtr dom,
int qemuCmdFlags,
- char ***argv,
+ const char ***argv,
int **tapfds,
int *ntapfds,
const char *migrateFrom);
diff -r cc63ab958867 src/qemu_driver.c
--- a/src/qemu_driver.c Thu Aug 07 15:00:21 2008 +0100
+++ b/src/qemu_driver.c Thu Aug 07 22:59:08 2008 +0100
@@ -842,7 +842,7 @@
struct qemud_driver *driver,
virDomainObjPtr vm,
const char *migrateFrom) {
- char **argv = NULL, **tmp;
+ const char **argv = NULL, **tmp;
int i, ret;
char logfile[PATH_MAX];
struct stat sb;
@@ -1087,7 +1087,7 @@
static int
qemudBuildDnsmasqArgv(virConnectPtr conn,
virNetworkObjPtr network,
- char ***argv) {
+ const char ***argv) {
int i, len, r;
char buf[PATH_MAX];
@@ -1184,7 +1184,7 @@
dhcpStartDhcpDaemon(virConnectPtr conn,
virNetworkObjPtr network)
{
- char **argv;
+ const char **argv;
int ret, i;
if (network->def->ipAddress == NULL) {
diff -r cc63ab958867 src/storage_backend.c
--- a/src/storage_backend.c Thu Aug 07 15:00:21 2008 +0100
+++ b/src/storage_backend.c Thu Aug 07 22:59:08 2008 +0100
@@ -403,7 +403,7 @@
/* Run the program and capture its output */
- if (virExec(conn, (char**)prog, &child, -1, &fd, NULL) < 0) {
+ if (virExec(conn, prog, &child, -1, &fd, NULL) < 0) {
goto cleanup;
}
@@ -537,7 +537,7 @@
v[i] = NULL;
/* Run the program and capture its output */
- if (virExec(conn, (char**)prog, &child, -1, &fd, NULL) < 0) {
+ if (virExec(conn, prog, &child, -1, &fd, NULL) < 0) {
goto cleanup;
}
diff -r cc63ab958867 src/storage_backend_disk.c
--- a/src/storage_backend_disk.c Thu Aug 07 15:00:21 2008 +0100
+++ b/src/storage_backend_disk.c Thu Aug 07 22:59:08 2008 +0100
@@ -410,7 +410,7 @@
NULL,
};
- if (virRun(conn, (char**)prog, NULL) < 0)
+ if (virRun(conn, prog, NULL) < 0)
return -1;
return 0;
@@ -469,7 +469,7 @@
snprintf(end, sizeof(end)-1, "%lluB", endOffset);
end[sizeof(end)-1] = '\0';
- if (virRun(conn, (char**)cmdargv, NULL) < 0)
+ if (virRun(conn, cmdargv, NULL) < 0)
return -1;
/* Blow away free extent info, as we're about to re-populate it */
diff -r cc63ab958867 src/storage_backend_fs.c
--- a/src/storage_backend_fs.c Thu Aug 07 15:00:21 2008 +0100
+++ b/src/storage_backend_fs.c Thu Aug 07 22:59:08 2008 +0100
@@ -571,7 +571,7 @@
}
mntargv[source_index] = src;
- if (virRun(conn, (char**)mntargv, NULL) < 0) {
+ if (virRun(conn, mntargv, NULL) < 0) {
VIR_FREE(src);
return -1;
}
@@ -625,7 +625,7 @@
mntargv[1] = pool->def->target.path;
mntargv[2] = NULL;
- if (virRun(conn, (char**)mntargv, NULL) < 0) {
+ if (virRun(conn, mntargv, NULL) < 0) {
return -1;
}
return 0;
@@ -940,7 +940,7 @@
imgargv[5] = size;
imgargv[6] = NULL;
- if (virRun(conn, (char **)imgargv, NULL) < 0) {
+ if (virRun(conn, imgargv, NULL) < 0) {
unlink(vol->target.path);
return -1;
}
@@ -975,7 +975,7 @@
imgargv[2] = vol->target.path;
imgargv[3] = NULL;
- if (virRun(conn, (char **)imgargv, NULL) < 0) {
+ if (virRun(conn, imgargv, NULL) < 0) {
unlink(vol->target.path);
return -1;
}
diff -r cc63ab958867 src/storage_backend_iscsi.c
--- a/src/storage_backend_iscsi.c Thu Aug 07 15:00:21 2008 +0100
+++ b/src/storage_backend_iscsi.c Thu Aug 07 22:59:08 2008 +0100
@@ -158,7 +158,7 @@
"--targetname", pool->def->source.devices[0].path, action, NULL
};
- if (virRun(conn, (char **)cmdargv, NULL) < 0)
+ if (virRun(conn, cmdargv, NULL) < 0)
return -1;
return 0;
@@ -507,7 +507,7 @@
ISCSIADM, "--mode", "session", "-r", session, "-R", NULL,
};
- if (virRun(conn, (char **)cmdargv, NULL) < 0)
+ if (virRun(conn, cmdargv, NULL) < 0)
return -1;
return 0;
@@ -524,7 +524,7 @@
"--portal", portal, NULL
};
- if (virRun(conn, (char **)cmdsendtarget, NULL) < 0)
+ if (virRun(conn, cmdsendtarget, NULL) < 0)
return -1;
return virStorageBackendISCSIConnection(conn, pool, portal, "--login");
diff -r cc63ab958867 src/storage_backend_logical.c
--- a/src/storage_backend_logical.c Thu Aug 07 15:00:21 2008 +0100
+++ b/src/storage_backend_logical.c Thu Aug 07 22:59:08 2008 +0100
@@ -83,7 +83,7 @@
cmdargv[2] = pool->def->name;
cmdargv[3] = NULL;
- if (virRun(conn, (char**)cmdargv, NULL) < 0)
+ if (virRun(conn, cmdargv, NULL) < 0)
return -1;
return 0;
@@ -324,14 +324,14 @@
*/
vgargv[n++] = pool->def->source.devices[i].path;
pvargv[1] = pool->def->source.devices[i].path;
- if (virRun(conn, (char**)pvargv, NULL) < 0)
+ if (virRun(conn, pvargv, NULL) < 0)
goto cleanup;
}
vgargv[n++] = NULL;
/* Now create the volume group itself */
- if (virRun(conn, (char**)vgargv, NULL) < 0)
+ if (virRun(conn, vgargv, NULL) < 0)
goto cleanup;
VIR_FREE(vgargv);
@@ -422,7 +422,7 @@
VGREMOVE, "-f", pool->def->name, NULL
};
- if (virRun(conn, (char**)cmdargv, NULL) < 0)
+ if (virRun(conn, cmdargv, NULL) < 0)
return -1;
/* XXX clear the PVs too ? ie pvremove ? probably ought to */
@@ -453,7 +453,7 @@
snprintf(size, sizeof(size)-1, "%lluK", vol->capacity/1024);
size[sizeof(size)-1] = '\0';
- if (virRun(conn, (char**)cmdargv, NULL) < 0)
+ if (virRun(conn, cmdargv, NULL) < 0)
return -1;
if ((fd = open(vol->target.path, O_RDONLY)) < 0) {
@@ -514,7 +514,7 @@
LVREMOVE, "-f", vol->target.path, NULL
};
- if (virRun(conn, (char**)cmdargv, NULL) < 0)
+ if (virRun(conn, cmdargv, NULL) < 0)
return -1;
return 0;
diff -r cc63ab958867 src/util.c
--- a/src/util.c Thu Aug 07 15:00:21 2008 +0100
+++ b/src/util.c Thu Aug 07 22:59:08 2008 +0100
@@ -102,8 +102,8 @@
static int
_virExec(virConnectPtr conn,
- char **argv,
- int *retpid, int infd, int *outfd, int *errfd, int non_block) {
+ const char *const*argv,
+ int *retpid, int infd, int *outfd, int *errfd, int non_block) {
int pid, null;
int pipeout[2] = {-1,-1};
int pipeerr[2] = {-1,-1};
@@ -185,7 +185,7 @@
if (pipeerr[1] > 0)
close(pipeerr[1]);
- execvp(argv[0], argv);
+ execvp(argv[0], (char **) argv);
_exit(1);
@@ -207,16 +207,16 @@
int
virExec(virConnectPtr conn,
- char **argv,
- int *retpid, int infd, int *outfd, int *errfd) {
+ const char *const*argv,
+ int *retpid, int infd, int *outfd, int *errfd) {
return(_virExec(conn, argv, retpid, infd, outfd, errfd, 0));
}
int
virExecNonBlock(virConnectPtr conn,
- char **argv,
- int *retpid, int infd, int *outfd, int *errfd) {
+ const char *const*argv,
+ int *retpid, int infd, int *outfd, int *errfd) {
return(_virExec(conn, argv, retpid, infd, outfd, errfd, 1));
}
@@ -238,7 +238,7 @@
*/
int
virRun(virConnectPtr conn,
- char **argv,
+ const char *const*argv,
int *status) {
int childpid, exitstatus, ret;
diff -r cc63ab958867 src/util.h
--- a/src/util.h Thu Aug 07 15:00:21 2008 +0100
+++ b/src/util.h Thu Aug 07 22:59:08 2008 +0100
@@ -27,11 +27,11 @@
#include "util-lib.h"
#include "verify.h"
-int virExec(virConnectPtr conn, char **argv, int *retpid,
+int virExec(virConnectPtr conn, const char *const*argv, int *retpid,
int infd, int *outfd, int *errfd);
-int virExecNonBlock(virConnectPtr conn, char **argv, int *retpid,
+int virExecNonBlock(virConnectPtr conn, const char *const*argv, int *retpid,
int infd, int *outfd, int *errfd);
-int virRun(virConnectPtr conn, char **argv, int *status);
+int virRun(virConnectPtr conn, const char *const*argv, int *status);
int __virFileReadAll(const char *path,
int maxlen,
diff -r cc63ab958867 src/veth.c
--- a/src/veth.c Thu Aug 07 15:00:21 2008 +0100
+++ b/src/veth.c Thu Aug 07 22:59:08 2008 +0100
@@ -104,7 +104,7 @@
}
DEBUG("veth1: %s veth2: %s", veth1, veth2);
- rc = virRun(NULL, (char**)argv, &cmdResult);
+ rc = virRun(NULL, argv, &cmdResult);
if (0 == rc) {
rc = cmdResult;
@@ -137,7 +137,7 @@
DEBUG("veth: %s", veth);
- rc = virRun(NULL, (char**)argv, &cmdResult);
+ rc = virRun(NULL, argv, &cmdResult);
if (0 == rc) {
rc = cmdResult;
@@ -172,7 +172,7 @@
else
argv[2] = "up";
- rc = virRun(NULL, (char**)argv, &cmdResult);
+ rc = virRun(NULL, argv, &cmdResult);
if (0 == rc) {
rc = cmdResult;
@@ -210,7 +210,7 @@
goto error_out;
argv[5] = pid;
- rc = virRun(NULL, (char**)argv, &cmdResult);
+ rc = virRun(NULL, argv, &cmdResult);
if (0 == rc)
rc = cmdResult;
diff -r cc63ab958867 tests/qemuxml2argvtest.c
--- a/tests/qemuxml2argvtest.c Thu Aug 07 15:00:21 2008 +0100
+++ b/tests/qemuxml2argvtest.c Thu Aug 07 22:59:08 2008 +0100
@@ -26,7 +26,7 @@
char argvData[MAX_FILE];
char *expectargv = &(argvData[0]);
char *actualargv = NULL;
- char **argv = NULL;
+ const char **argv = NULL;
char **tmp = NULL;
int ret = -1, len, flags;
virDomainDefPtr vmdef = NULL;
--
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
16 years, 4 months