[libvirt] [PATCH] make distclean: remove generated source files
by Jim Meyering
"make distcheck" is failing because two generated source files
are left behind. It requires that all generated files be removed.
This fixes it:
>From a7f4c47140ed0e585f1135e0f7917bc32f145997 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Mon, 4 Aug 2008 16:10:03 +0200
Subject: [PATCH] make distclean: remove generated source files
* src/Makefile.am (DISTCLEANFILES): Define to $(BUILT_SOURCES)
so "make distcheck" passes.
---
src/Makefile.am | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index 556ad0a..5d238cd 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -189,3 +189,4 @@ install-exec-local:
$(MKDIR_P) $(DESTDIR)$(localstatedir)/cache/libvirt
CLEANFILES = *.gcov .libs/*.gcda .libs/*.gcno *.gcno *.gcda
+DISTCLEANFILES = $(BUILT_SOURCES)
--
1.6.0.rc1.36.g5ff70
16 years, 3 months
[libvirt] Question about virbr(dnsmasq)
by Nobuhiro Itou
Hi all.
I have the question about the option of dnsmasq that libvirt sets as a default virtual network.
Why does dnsmasq listen to all NICs as specified "--except-interface lo"?
And, at the following conditions, the message is output to /var/log/messages.
Do you know why it is output?
Conditions:
1) Dnsmasq is started by libvirt. And...
# ps -ef | grep dnsmasq
nobody 5877 5754 0 Jul30 ? 00:00:00 /usr/sbin/dnsmasq --keep-in-foreground --strict-order
--bind-interfaces --pid-file --conf-file --listen-address 192.168.122.1 --except-interface lo
--dhcp-leasefile=/var/lib/libvirt/dhcp-default.leases --dhcp-range 192.168.122.2,192.168.122.254
2) chenge the network address to '0.0.0.0'. And...
# ifconfig eth3 0 up
3) Dnsmasq recieves DHCPINFORM message from other DHCP servers.
Message:
dnsmasq[5877]: no address range available for DHCP request via eth3
Thank you
Nobuhiro Itou
16 years, 3 months
[libvirt] When are volumes 'detected' / refreshed
by Stefan de Konink
At what time are volumes currently detected on NetFS? I see there is
some sort of storage now going on, since deleting files from NFS doesn't
delete them from vol-list directly. (If this is fixed in a recent
version... I'm sorry to bother)
Stefan
16 years, 3 months
[libvirt] fully virtualized xen guest question
by Christoph Höger
Hi,
I am running XEN on an debian etch. For clustering purposes I wanted to
boot fedora as virtual machine.
That works (except for nfs mounts) fine using the paravortualization
features.
But fully virtulalized guests do not even boot, I do not get any
sensefull error message, my config file looks like:
<domain type='xen'>
<name>werewolf</name>
<os>
<type>hvm</type>
<loader>/usr/lib/xen-3.0.3-1/boot/hvmloader</loader>
<kernel>/data/virtual/kernel/kvm1/vmlinuz-2.6.18-6-amd64</kernel>
<initrd>/data/virtual/kernel/kvm1/initrd.img-2.6.18-6-amd64</initrd>
<cmdline>root=/dev/hda1</cmdline>
</os>
<memory>524M</memory>
<vcpu>1</vcpu>
<devices>
<emulator>/usr/bin/kvm</emulator>
<disk type='file'>
<source file='/tmp/werewolf.img.plb13810'/>
<target dev='hda1' bus='xen'/>
</disk>
<interface type='bridge'>
<source bridge='virbr1'/>
</interface>
</devices>
<features>
<acpi/>
</features>
</domain>
<domain type='xen'>
<name>werewolf</name>
<os>
<type>hvm</type>
<loader>/usr/lib/xen-3.0.3-1/boot/hvmloader</loader>
<kernel>/data/virtual/kernel/kvm1/vmlinuz-2.6.18-6-amd64</kernel>
<initrd>/data/virtual/kernel/kvm1/initrd.img-2.6.18-6-amd64</initrd>
<cmdline>root=/dev/hda1</cmdline>
</os>
<memory>524M</memory>
<vcpu>1</vcpu>
<devices>
<emulator>/usr/bin/kvm</emulator>
<disk type='file'>
<source file='/tmp/werewolf.img.plb13810'/>
<target dev='hda1' bus='xen'/>
</disk>
<interface type='bridge'>
<source bridge='virbr1'/>
</interface>
</devices>
<features>
<acpi/>
</features>
</domain>
all I get when tryin virsh create is:
xend_post: error from xen daemon: (xend.err "Error creating domain: (0,
'Error')")
Whats wrong?
16 years, 3 months
[libvirt] sexpr.c: reviving an old const-correct change
by Jim Meyering
I wrote this months ago and forgot about it:
diff --git a/src/xend_internal.c b/src/xend_internal.c
index 880a279..1e6e875 100644
--- a/src/xend_internal.c
+++ b/src/xend_internal.c
@@ -2171,7 +2171,7 @@ error:
*/
static virDomainDefPtr
xenDaemonParseSxpr(virConnectPtr conn,
- struct sexpr *root,
+ const struct sexpr *root,
int xendConfigVersion,
const char *cpus)
{
When you pull the thread (i.e., eliminate all resulting
warnings that arise from the above change), you end up with
the following additional const-adding changes:
(I'll squash the two into a single change set before committing)
>From 1d0fd10b999ab65c555d8cb5bcfc03bc5cad9e6e Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Fri, 1 Aug 2008 15:36:31 +0200
Subject: [PATCH] xend_internal.c, sexpr.c: const-correctness
---
src/sexpr.c | 2 +-
src/sexpr.h | 2 +-
src/xend_internal.c | 19 ++++++++++---------
3 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/src/sexpr.c b/src/sexpr.c
index 90c549c..b607e41 100644
--- a/src/sexpr.c
+++ b/src/sexpr.c
@@ -519,7 +519,7 @@ sexpr_lookup(const struct sexpr *sexpr, const char *node)
* Returns true if the key was found, false otherwise
*/
int
-sexpr_has(struct sexpr *sexpr, const char *node)
+sexpr_has(const struct sexpr *sexpr, const char *node)
{
struct sexpr *s = sexpr_lookup_key(sexpr, node);
diff --git a/src/sexpr.h b/src/sexpr.h
index 0559a27..c3d038e 100644
--- a/src/sexpr.h
+++ b/src/sexpr.h
@@ -51,5 +51,5 @@ int sexpr_node_copy(const struct sexpr *sexpr, const char *node, char **dst);
const char *sexpr_fmt_node(const struct sexpr *sexpr, const char *fmt, ...)
ATTRIBUTE_FORMAT(printf,2,3);
struct sexpr *sexpr_lookup(const struct sexpr *sexpr, const char *node);
-int sexpr_has(struct sexpr *sexpr, const char *node);
+int sexpr_has(const struct sexpr *sexpr, const char *node);
#endif
diff --git a/src/xend_internal.c b/src/xend_internal.c
index 1e6e875..e29702a 100644
--- a/src/xend_internal.c
+++ b/src/xend_internal.c
@@ -1180,7 +1180,8 @@ xend_detect_config_version(virConnectPtr conn) {
* Returns 0 in case of success and -1 in case of error
*/
static int
-xenDaemonParseSxprOS(virConnectPtr xend, struct sexpr *node,
+xenDaemonParseSxprOS(virConnectPtr xend,
+ const struct sexpr *node,
virDomainDefPtr def,
int hvm)
{
@@ -1640,11 +1641,11 @@ error:
static int
xenDaemonParseSxprDisks(virConnectPtr conn,
virDomainDefPtr def,
- struct sexpr *root,
+ const struct sexpr *root,
int hvm,
int xendConfigVersion)
{
- struct sexpr *cur, *node;
+ const struct sexpr *cur, *node;
virDomainDiskDefPtr disk = NULL, prev = def->disks;
for (cur = root; cur->kind == SEXPR_CONS; cur = cur->u.s.cdr) {
@@ -1803,10 +1804,10 @@ error:
static int
xenDaemonParseSxprNets(virConnectPtr conn,
virDomainDefPtr def,
- struct sexpr *root)
+ const struct sexpr *root)
{
virDomainNetDefPtr net = NULL, prev = def->nets;
- struct sexpr *cur, *node;
+ const struct sexpr *cur, *node;
const char *tmp;
int vif_index = 0;
@@ -1964,7 +1965,7 @@ error:
static int
xenDaemonParseSxprUSB(virConnectPtr conn,
virDomainDefPtr def,
- struct sexpr *root)
+ const struct sexpr *root)
{
virDomainInputDefPtr prev = def->inputs;
struct sexpr *cur, *node;
@@ -2007,7 +2008,7 @@ no_memory:
static int
xenDaemonParseSxprGraphicsOld(virConnectPtr conn,
virDomainDefPtr def,
- struct sexpr *root,
+ const struct sexpr *root,
int hvm,
int xendConfigVersion)
{
@@ -2085,10 +2086,10 @@ no_memory:
static int
xenDaemonParseSxprGraphicsNew(virConnectPtr conn,
virDomainDefPtr def,
- struct sexpr *root)
+ const struct sexpr *root)
{
virDomainGraphicsDefPtr graphics = NULL;
- struct sexpr *cur, *node;
+ const struct sexpr *cur, *node;
const char *tmp;
/* append network devices and framebuffer */
--
1.6.0.rc1.29.gf08e3
16 years, 3 months
[libvirt] virsh.c: more const-correctness
by Jim Meyering
One good turn deserves another ;-)
This also normalizes spacing around the "*" in declarations
of vshControl and vshCmd pointers.
Of course, this compiles with no warnings and passes "make syntax-check".
>From e0db0c0eb4a62eafe1f5790de6d7f9a9d5cb84a0 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Fri, 1 Aug 2008 14:00:20 +0200
Subject: [PATCH] virsh.c: more const-correctness
---
src/virsh.c | 266 +++++++++++++++++++++++++++++-----------------------------
1 files changed, 133 insertions(+), 133 deletions(-)
diff --git a/src/virsh.c b/src/virsh.c
index 620f103..d636301 100644
--- a/src/virsh.c
+++ b/src/virsh.c
@@ -182,7 +182,7 @@ typedef struct vshCmdOpt {
*/
typedef struct {
const char *name;
- int (*handler) (vshControl *, vshCmd *); /* command handler */
+ int (*handler) (vshControl *, const vshCmd *); /* command handler */
vshCmdOptDef *opts; /* definition of command options */
vshCmdInfo *info; /* details about command */
} vshCmdDef;
@@ -218,35 +218,35 @@ typedef struct __vshControl {
static vshCmdDef commands[];
-static void vshError(vshControl * ctl, int doexit, const char *format, ...)
+static void vshError(vshControl *ctl, int doexit, const char *format, ...)
ATTRIBUTE_FORMAT(printf, 3, 4);
-static int vshInit(vshControl * ctl);
-static int vshDeinit(vshControl * ctl);
-static void vshUsage(vshControl * ctl, const char *cmdname);
+static int vshInit(vshControl *ctl);
+static int vshDeinit(vshControl *ctl);
+static void vshUsage(vshControl *ctl, const char *cmdname);
static void vshOpenLogFile(vshControl *ctl);
static void vshOutputLogFile(vshControl *ctl, int log_level, const char *format, va_list ap);
static void vshCloseLogFile(vshControl *ctl);
-static int vshParseArgv(vshControl * ctl, int argc, char **argv);
+static int vshParseArgv(vshControl *ctl, int argc, char **argv);
static const char *vshCmddefGetInfo(vshCmdDef * cmd, const char *info);
static vshCmdDef *vshCmddefSearch(const char *cmdname);
-static int vshCmddefHelp(vshControl * ctl, const char *name, int withprog);
+static int vshCmddefHelp(vshControl *ctl, const char *name, int withprog);
-static vshCmdOpt *vshCommandOpt(vshCmd * cmd, const char *name);
-static int vshCommandOptInt(vshCmd * cmd, const char *name, int *found);
-static char *vshCommandOptString(vshCmd * cmd, const char *name,
+static vshCmdOpt *vshCommandOpt(const vshCmd *cmd, const char *name);
+static int vshCommandOptInt(const vshCmd *cmd, const char *name, int *found);
+static char *vshCommandOptString(const vshCmd *cmd, const char *name,
int *found);
#if 0
-static int vshCommandOptStringList(vshCmd * cmd, const char *name, char ***data);
+static int vshCommandOptStringList(const vshCmd *cmd, const char *name, char ***data);
#endif
-static int vshCommandOptBool(vshCmd * cmd, const char *name);
+static int vshCommandOptBool(const vshCmd *cmd, const char *name);
#define VSH_BYID (1 << 1)
#define VSH_BYUUID (1 << 2)
#define VSH_BYNAME (1 << 3)
-static virDomainPtr vshCommandOptDomainBy(vshControl * ctl, vshCmd * cmd,
+static virDomainPtr vshCommandOptDomainBy(vshControl *ctl, const vshCmd *cmd,
const char *optname, char **name, int flag);
/* default is lookup by Id, Name and UUID */
@@ -254,7 +254,7 @@ static virDomainPtr vshCommandOptDomainBy(vshControl * ctl, vshCmd * cmd,
vshCommandOptDomainBy(_ctl, _cmd, _optname, _name, \
VSH_BYID|VSH_BYUUID|VSH_BYNAME)
-static virNetworkPtr vshCommandOptNetworkBy(vshControl * ctl, vshCmd * cmd,
+static virNetworkPtr vshCommandOptNetworkBy(vshControl *ctl, const vshCmd *cmd,
const char *optname, char **name, int flag);
/* default is lookup by Name and UUID */
@@ -262,7 +262,7 @@ static virNetworkPtr vshCommandOptNetworkBy(vshControl * ctl, vshCmd * cmd,
vshCommandOptNetworkBy(_ctl, _cmd, _optname, _name, \
VSH_BYUUID|VSH_BYNAME)
-static virStoragePoolPtr vshCommandOptPoolBy(vshControl * ctl, vshCmd * cmd,
+static virStoragePoolPtr vshCommandOptPoolBy(vshControl *ctl, const vshCmd *cmd,
const char *optname, char **name, int flag);
/* default is lookup by Name and UUID */
@@ -270,7 +270,7 @@ static virStoragePoolPtr vshCommandOptPoolBy(vshControl * ctl, vshCmd * cmd,
vshCommandOptPoolBy(_ctl, _cmd, _optname, _name, \
VSH_BYUUID|VSH_BYNAME)
-static virStorageVolPtr vshCommandOptVolBy(vshControl * ctl, vshCmd * cmd,
+static virStorageVolPtr vshCommandOptVolBy(vshControl *ctl, const vshCmd *cmd,
const char *optname,
const char *pooloptname,
char **name, int flag);
@@ -280,9 +280,9 @@ static virStorageVolPtr vshCommandOptVolBy(vshControl * ctl, vshCmd * cmd,
vshCommandOptVolBy(_ctl, _cmd, _optname, _pooloptname, _name, \
VSH_BYUUID|VSH_BYNAME)
-static void vshPrintExtra(vshControl * ctl, const char *format, ...)
+static void vshPrintExtra(vshControl *ctl, const char *format, ...)
ATTRIBUTE_FORMAT(printf, 2, 3);
-static void vshDebug(vshControl * ctl, int level, const char *format, ...)
+static void vshDebug(vshControl *ctl, int level, const char *format, ...)
ATTRIBUTE_FORMAT(printf, 3, 4);
/* XXX: add batch support */
@@ -290,19 +290,19 @@ static void vshDebug(vshControl * ctl, int level, const char *format, ...)
static const char *vshDomainStateToString(int state);
static const char *vshDomainVcpuStateToString(int state);
-static int vshConnectionUsability(vshControl * ctl, virConnectPtr conn,
+static int vshConnectionUsability(vshControl *ctl, virConnectPtr conn,
int showerror);
-static void *_vshMalloc(vshControl * ctl, size_t sz, const char *filename, int line);
+static void *_vshMalloc(vshControl *ctl, size_t sz, const char *filename, int line);
#define vshMalloc(_ctl, _sz) _vshMalloc(_ctl, _sz, __FILE__, __LINE__)
-static void *_vshCalloc(vshControl * ctl, size_t nmemb, size_t sz, const char *filename, int line);
+static void *_vshCalloc(vshControl *ctl, size_t nmemb, size_t sz, const char *filename, int line);
#define vshCalloc(_ctl, _nmemb, _sz) _vshCalloc(_ctl, _nmemb, _sz, __FILE__, __LINE__)
-static void *_vshRealloc(vshControl * ctl, void *ptr, size_t sz, const char *filename, int line);
+static void *_vshRealloc(vshControl *ctl, void *ptr, size_t sz, const char *filename, int line);
#define vshRealloc(_ctl, _ptr, _sz) _vshRealloc(_ctl, _ptr, _sz, __FILE__, __LINE__)
-static char *_vshStrdup(vshControl * ctl, const char *s, const char *filename, int line);
+static char *_vshStrdup(vshControl *ctl, const char *s, const char *filename, int line);
#define vshStrdup(_ctl, _s) _vshStrdup(_ctl, _s, __FILE__, __LINE__)
@@ -346,7 +346,7 @@ static vshCmdOptDef opts_help[] = {
};
static int
-cmdHelp(vshControl * ctl, vshCmd * cmd)
+cmdHelp(vshControl *ctl, const vshCmd *cmd)
{
const char *cmdname = vshCommandOptString(cmd, "command", NULL);
@@ -380,7 +380,7 @@ static vshCmdOptDef opts_autostart[] = {
};
static int
-cmdAutostart(vshControl * ctl, vshCmd * cmd)
+cmdAutostart(vshControl *ctl, const vshCmd *cmd)
{
virDomainPtr dom;
char *name;
@@ -432,7 +432,7 @@ static vshCmdOptDef opts_connect[] = {
};
static int
-cmdConnect(vshControl * ctl, vshCmd * cmd)
+cmdConnect(vshControl *ctl, const vshCmd *cmd)
{
int ro = vshCommandOptBool(cmd, "readonly");
@@ -481,7 +481,7 @@ static vshCmdOptDef opts_console[] = {
#ifndef __MINGW32__
static int
-cmdConsole(vshControl * ctl, vshCmd * cmd)
+cmdConsole(vshControl *ctl, const vshCmd *cmd)
{
xmlDocPtr xml = NULL;
xmlXPathObjectPtr obj = NULL;
@@ -531,7 +531,7 @@ cmdConsole(vshControl * ctl, vshCmd * cmd)
#else /* __MINGW32__ */
static int
-cmdConsole(vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED)
+cmdConsole(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
{
vshError (ctl, FALSE, "%s", _("console not implemented on this platform"));
return FALSE;
@@ -557,7 +557,7 @@ static vshCmdOptDef opts_list[] = {
static int
-cmdList(vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED)
+cmdList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
{
int inactive = vshCommandOptBool(cmd, "inactive");
int all = vshCommandOptBool(cmd, "all");
@@ -673,7 +673,7 @@ static vshCmdOptDef opts_domstate[] = {
};
static int
-cmdDomstate(vshControl * ctl, vshCmd * cmd)
+cmdDomstate(vshControl *ctl, const vshCmd *cmd)
{
virDomainInfo info;
virDomainPtr dom;
@@ -711,7 +711,7 @@ static vshCmdOptDef opts_domblkstat[] = {
};
static int
-cmdDomblkstat (vshControl *ctl, vshCmd *cmd)
+cmdDomblkstat (vshControl *ctl, const vshCmd *cmd)
{
virDomainPtr dom;
char *name, *device;
@@ -768,7 +768,7 @@ static vshCmdOptDef opts_domifstat[] = {
};
static int
-cmdDomIfstat (vshControl *ctl, vshCmd *cmd)
+cmdDomIfstat (vshControl *ctl, const vshCmd *cmd)
{
virDomainPtr dom;
char *name, *device;
@@ -834,7 +834,7 @@ static vshCmdOptDef opts_suspend[] = {
};
static int
-cmdSuspend(vshControl * ctl, vshCmd * cmd)
+cmdSuspend(vshControl *ctl, const vshCmd *cmd)
{
virDomainPtr dom;
char *name;
@@ -873,7 +873,7 @@ static vshCmdOptDef opts_create[] = {
};
static int
-cmdCreate(vshControl * ctl, vshCmd * cmd)
+cmdCreate(vshControl *ctl, const vshCmd *cmd)
{
virDomainPtr dom;
char *from;
@@ -921,7 +921,7 @@ static vshCmdOptDef opts_define[] = {
};
static int
-cmdDefine(vshControl * ctl, vshCmd * cmd)
+cmdDefine(vshControl *ctl, const vshCmd *cmd)
{
virDomainPtr dom;
char *from;
@@ -969,7 +969,7 @@ static vshCmdOptDef opts_undefine[] = {
};
static int
-cmdUndefine(vshControl * ctl, vshCmd * cmd)
+cmdUndefine(vshControl *ctl, const vshCmd *cmd)
{
virDomainPtr dom;
int ret = TRUE;
@@ -1024,7 +1024,7 @@ static vshCmdOptDef opts_start[] = {
};
static int
-cmdStart(vshControl * ctl, vshCmd * cmd)
+cmdStart(vshControl *ctl, const vshCmd *cmd)
{
virDomainPtr dom;
int ret = TRUE;
@@ -1070,7 +1070,7 @@ static vshCmdOptDef opts_save[] = {
};
static int
-cmdSave(vshControl * ctl, vshCmd * cmd)
+cmdSave(vshControl *ctl, const vshCmd *cmd)
{
virDomainPtr dom;
char *name;
@@ -1115,7 +1115,7 @@ static vshCmdOptDef opts_schedinfo[] = {
};
static int
-cmdSchedinfo(vshControl * ctl, vshCmd * cmd)
+cmdSchedinfo(vshControl *ctl, const vshCmd *cmd)
{
char *schedulertype;
virDomainPtr dom;
@@ -1264,7 +1264,7 @@ static vshCmdOptDef opts_restore[] = {
};
static int
-cmdRestore(vshControl * ctl, vshCmd * cmd)
+cmdRestore(vshControl *ctl, const vshCmd *cmd)
{
char *from;
int found;
@@ -1303,7 +1303,7 @@ static vshCmdOptDef opts_dump[] = {
};
static int
-cmdDump(vshControl * ctl, vshCmd * cmd)
+cmdDump(vshControl *ctl, const vshCmd *cmd)
{
virDomainPtr dom;
char *name;
@@ -1347,7 +1347,7 @@ static vshCmdOptDef opts_resume[] = {
};
static int
-cmdResume(vshControl * ctl, vshCmd * cmd)
+cmdResume(vshControl *ctl, const vshCmd *cmd)
{
virDomainPtr dom;
int ret = TRUE;
@@ -1386,7 +1386,7 @@ static vshCmdOptDef opts_shutdown[] = {
};
static int
-cmdShutdown(vshControl * ctl, vshCmd * cmd)
+cmdShutdown(vshControl *ctl, const vshCmd *cmd)
{
virDomainPtr dom;
int ret = TRUE;
@@ -1425,7 +1425,7 @@ static vshCmdOptDef opts_reboot[] = {
};
static int
-cmdReboot(vshControl * ctl, vshCmd * cmd)
+cmdReboot(vshControl *ctl, const vshCmd *cmd)
{
virDomainPtr dom;
int ret = TRUE;
@@ -1464,7 +1464,7 @@ static vshCmdOptDef opts_destroy[] = {
};
static int
-cmdDestroy(vshControl * ctl, vshCmd * cmd)
+cmdDestroy(vshControl *ctl, const vshCmd *cmd)
{
virDomainPtr dom;
int ret = TRUE;
@@ -1503,7 +1503,7 @@ static vshCmdOptDef opts_dominfo[] = {
};
static int
-cmdDominfo(vshControl * ctl, vshCmd * cmd)
+cmdDominfo(vshControl *ctl, const vshCmd *cmd)
{
virDomainInfo info;
virDomainPtr dom;
@@ -1585,7 +1585,7 @@ static vshCmdOptDef opts_freecell[] = {
};
static int
-cmdFreecell(vshControl * ctl, vshCmd * cmd)
+cmdFreecell(vshControl *ctl, const vshCmd *cmd)
{
int ret;
int cell, cell_given;
@@ -1627,7 +1627,7 @@ static vshCmdOptDef opts_vcpuinfo[] = {
};
static int
-cmdVcpuinfo(vshControl * ctl, vshCmd * cmd)
+cmdVcpuinfo(vshControl *ctl, const vshCmd *cmd)
{
virDomainInfo info;
virDomainPtr dom;
@@ -1716,7 +1716,7 @@ static vshCmdOptDef opts_vcpupin[] = {
};
static int
-cmdVcpupin(vshControl * ctl, vshCmd * cmd)
+cmdVcpupin(vshControl *ctl, const vshCmd *cmd)
{
virDomainInfo info;
virDomainPtr dom;
@@ -1849,7 +1849,7 @@ static vshCmdOptDef opts_setvcpus[] = {
};
static int
-cmdSetvcpus(vshControl * ctl, vshCmd * cmd)
+cmdSetvcpus(vshControl *ctl, const vshCmd *cmd)
{
virDomainPtr dom;
int count;
@@ -1906,7 +1906,7 @@ static vshCmdOptDef opts_setmem[] = {
};
static int
-cmdSetmem(vshControl * ctl, vshCmd * cmd)
+cmdSetmem(vshControl *ctl, const vshCmd *cmd)
{
virDomainPtr dom;
virDomainInfo info;
@@ -1963,7 +1963,7 @@ static vshCmdOptDef opts_setmaxmem[] = {
};
static int
-cmdSetmaxmem(vshControl * ctl, vshCmd * cmd)
+cmdSetmaxmem(vshControl *ctl, const vshCmd *cmd)
{
virDomainPtr dom;
virDomainInfo info;
@@ -2017,7 +2017,7 @@ static vshCmdInfo info_nodeinfo[] = {
};
static int
-cmdNodeinfo(vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED)
+cmdNodeinfo(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
{
virNodeInfo info;
@@ -2051,7 +2051,7 @@ static vshCmdInfo info_capabilities[] = {
};
static int
-cmdCapabilities (vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED)
+cmdCapabilities (vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
{
char *caps;
@@ -2084,7 +2084,7 @@ static vshCmdOptDef opts_dumpxml[] = {
};
static int
-cmdDumpXML(vshControl * ctl, vshCmd * cmd)
+cmdDumpXML(vshControl *ctl, const vshCmd *cmd)
{
virDomainPtr dom;
int ret = TRUE;
@@ -2123,7 +2123,7 @@ static vshCmdOptDef opts_domname[] = {
};
static int
-cmdDomname(vshControl * ctl, vshCmd * cmd)
+cmdDomname(vshControl *ctl, const vshCmd *cmd)
{
virDomainPtr dom;
@@ -2153,7 +2153,7 @@ static vshCmdOptDef opts_domid[] = {
};
static int
-cmdDomid(vshControl * ctl, vshCmd * cmd)
+cmdDomid(vshControl *ctl, const vshCmd *cmd)
{
virDomainPtr dom;
unsigned int id;
@@ -2188,7 +2188,7 @@ static vshCmdOptDef opts_domuuid[] = {
};
static int
-cmdDomuuid(vshControl * ctl, vshCmd * cmd)
+cmdDomuuid(vshControl *ctl, const vshCmd *cmd)
{
virDomainPtr dom;
char uuid[VIR_UUID_STRING_BUFLEN];
@@ -2227,7 +2227,7 @@ static vshCmdOptDef opts_migrate[] = {
};
static int
-cmdMigrate (vshControl *ctl, vshCmd *cmd)
+cmdMigrate (vshControl *ctl, const vshCmd *cmd)
{
virDomainPtr dom = NULL;
const char *desturi;
@@ -2289,7 +2289,7 @@ static vshCmdOptDef opts_network_autostart[] = {
};
static int
-cmdNetworkAutostart(vshControl * ctl, vshCmd * cmd)
+cmdNetworkAutostart(vshControl *ctl, const vshCmd *cmd)
{
virNetworkPtr network;
char *name;
@@ -2338,7 +2338,7 @@ static vshCmdOptDef opts_network_create[] = {
};
static int
-cmdNetworkCreate(vshControl * ctl, vshCmd * cmd)
+cmdNetworkCreate(vshControl *ctl, const vshCmd *cmd)
{
virNetworkPtr network;
char *from;
@@ -2386,7 +2386,7 @@ static vshCmdOptDef opts_network_define[] = {
};
static int
-cmdNetworkDefine(vshControl * ctl, vshCmd * cmd)
+cmdNetworkDefine(vshControl *ctl, const vshCmd *cmd)
{
virNetworkPtr network;
char *from;
@@ -2434,7 +2434,7 @@ static vshCmdOptDef opts_network_destroy[] = {
};
static int
-cmdNetworkDestroy(vshControl * ctl, vshCmd * cmd)
+cmdNetworkDestroy(vshControl *ctl, const vshCmd *cmd)
{
virNetworkPtr network;
int ret = TRUE;
@@ -2474,7 +2474,7 @@ static vshCmdOptDef opts_network_dumpxml[] = {
};
static int
-cmdNetworkDumpXML(vshControl * ctl, vshCmd * cmd)
+cmdNetworkDumpXML(vshControl *ctl, const vshCmd *cmd)
{
virNetworkPtr network;
int ret = TRUE;
@@ -2516,7 +2516,7 @@ static vshCmdOptDef opts_network_list[] = {
};
static int
-cmdNetworkList(vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED)
+cmdNetworkList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
{
int inactive = vshCommandOptBool(cmd, "inactive");
int all = vshCommandOptBool(cmd, "all");
@@ -2638,7 +2638,7 @@ static vshCmdOptDef opts_network_name[] = {
};
static int
-cmdNetworkName(vshControl * ctl, vshCmd * cmd)
+cmdNetworkName(vshControl *ctl, const vshCmd *cmd)
{
virNetworkPtr network;
@@ -2670,7 +2670,7 @@ static vshCmdOptDef opts_network_start[] = {
};
static int
-cmdNetworkStart(vshControl * ctl, vshCmd * cmd)
+cmdNetworkStart(vshControl *ctl, const vshCmd *cmd)
{
virNetworkPtr network;
int ret = TRUE;
@@ -2709,7 +2709,7 @@ static vshCmdOptDef opts_network_undefine[] = {
};
static int
-cmdNetworkUndefine(vshControl * ctl, vshCmd * cmd)
+cmdNetworkUndefine(vshControl *ctl, const vshCmd *cmd)
{
virNetworkPtr network;
int ret = TRUE;
@@ -2747,7 +2747,7 @@ static vshCmdOptDef opts_network_uuid[] = {
};
static int
-cmdNetworkUuid(vshControl * ctl, vshCmd * cmd)
+cmdNetworkUuid(vshControl *ctl, const vshCmd *cmd)
{
virNetworkPtr network;
char uuid[VIR_UUID_STRING_BUFLEN];
@@ -2797,7 +2797,7 @@ static vshCmdOptDef opts_pool_autostart[] = {
};
static int
-cmdPoolAutostart(vshControl * ctl, vshCmd * cmd)
+cmdPoolAutostart(vshControl *ctl, const vshCmd *cmd)
{
virStoragePoolPtr pool;
char *name;
@@ -2846,7 +2846,7 @@ static vshCmdOptDef opts_pool_create[] = {
};
static int
-cmdPoolCreate(vshControl * ctl, vshCmd * cmd)
+cmdPoolCreate(vshControl *ctl, const vshCmd *cmd)
{
virStoragePoolPtr pool;
char *from;
@@ -2899,7 +2899,7 @@ static vshCmdOptDef opts_pool_create_as[] = {
static int
-cmdPoolCreateAs(vshControl * ctl, vshCmd * cmd)
+cmdPoolCreateAs(vshControl *ctl, const vshCmd *cmd)
{
virStoragePoolPtr pool;
int found;
@@ -2984,7 +2984,7 @@ static vshCmdOptDef opts_pool_define[] = {
};
static int
-cmdPoolDefine(vshControl * ctl, vshCmd * cmd)
+cmdPoolDefine(vshControl *ctl, const vshCmd *cmd)
{
virStoragePoolPtr pool;
char *from;
@@ -3038,7 +3038,7 @@ static vshCmdOptDef opts_pool_define_as[] = {
static int
-cmdPoolDefineAs(vshControl * ctl, vshCmd * cmd)
+cmdPoolDefineAs(vshControl *ctl, const vshCmd *cmd)
{
virStoragePoolPtr pool;
int found;
@@ -3122,7 +3122,7 @@ static vshCmdOptDef opts_pool_build[] = {
};
static int
-cmdPoolBuild(vshControl * ctl, vshCmd * cmd)
+cmdPoolBuild(vshControl *ctl, const vshCmd *cmd)
{
virStoragePoolPtr pool;
int ret = TRUE;
@@ -3162,7 +3162,7 @@ static vshCmdOptDef opts_pool_destroy[] = {
};
static int
-cmdPoolDestroy(vshControl * ctl, vshCmd * cmd)
+cmdPoolDestroy(vshControl *ctl, const vshCmd *cmd)
{
virStoragePoolPtr pool;
int ret = TRUE;
@@ -3202,7 +3202,7 @@ static vshCmdOptDef opts_pool_delete[] = {
};
static int
-cmdPoolDelete(vshControl * ctl, vshCmd * cmd)
+cmdPoolDelete(vshControl *ctl, const vshCmd *cmd)
{
virStoragePoolPtr pool;
int ret = TRUE;
@@ -3242,7 +3242,7 @@ static vshCmdOptDef opts_pool_refresh[] = {
};
static int
-cmdPoolRefresh(vshControl * ctl, vshCmd * cmd)
+cmdPoolRefresh(vshControl *ctl, const vshCmd *cmd)
{
virStoragePoolPtr pool;
int ret = TRUE;
@@ -3282,7 +3282,7 @@ static vshCmdOptDef opts_pool_dumpxml[] = {
};
static int
-cmdPoolDumpXML(vshControl * ctl, vshCmd * cmd)
+cmdPoolDumpXML(vshControl *ctl, const vshCmd *cmd)
{
virStoragePoolPtr pool;
int ret = TRUE;
@@ -3324,7 +3324,7 @@ static vshCmdOptDef opts_pool_list[] = {
};
static int
-cmdPoolList(vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED)
+cmdPoolList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
{
int inactive = vshCommandOptBool(cmd, "inactive");
int all = vshCommandOptBool(cmd, "all");
@@ -3467,7 +3467,7 @@ static vshCmdOptDef opts_pool_info[] = {
};
static int
-cmdPoolInfo(vshControl * ctl, vshCmd * cmd)
+cmdPoolInfo(vshControl *ctl, const vshCmd *cmd)
{
virStoragePoolInfo info;
virStoragePoolPtr pool;
@@ -3542,7 +3542,7 @@ static vshCmdOptDef opts_pool_name[] = {
};
static int
-cmdPoolName(vshControl * ctl, vshCmd * cmd)
+cmdPoolName(vshControl *ctl, const vshCmd *cmd)
{
virStoragePoolPtr pool;
@@ -3574,7 +3574,7 @@ static vshCmdOptDef opts_pool_start[] = {
};
static int
-cmdPoolStart(vshControl * ctl, vshCmd * cmd)
+cmdPoolStart(vshControl *ctl, const vshCmd *cmd)
{
virStoragePoolPtr pool;
int ret = TRUE;
@@ -3645,7 +3645,7 @@ static int cmdVolSize(const char *data, unsigned long long *val)
}
static int
-cmdVolCreateAs(vshControl * ctl, vshCmd * cmd)
+cmdVolCreateAs(vshControl *ctl, const vshCmd *cmd)
{
virStoragePoolPtr pool;
virStorageVolPtr vol;
@@ -3735,7 +3735,7 @@ static vshCmdOptDef opts_pool_undefine[] = {
};
static int
-cmdPoolUndefine(vshControl * ctl, vshCmd * cmd)
+cmdPoolUndefine(vshControl *ctl, const vshCmd *cmd)
{
virStoragePoolPtr pool;
int ret = TRUE;
@@ -3773,7 +3773,7 @@ static vshCmdOptDef opts_pool_uuid[] = {
};
static int
-cmdPoolUuid(vshControl * ctl, vshCmd * cmd)
+cmdPoolUuid(vshControl *ctl, const vshCmd *cmd)
{
virStoragePoolPtr pool;
char uuid[VIR_UUID_STRING_BUFLEN];
@@ -3813,7 +3813,7 @@ static vshCmdOptDef opts_vol_create[] = {
};
static int
-cmdVolCreate(vshControl * ctl, vshCmd * cmd)
+cmdVolCreate(vshControl *ctl, const vshCmd *cmd)
{
virStoragePoolPtr pool;
virStorageVolPtr vol;
@@ -3872,7 +3872,7 @@ static vshCmdOptDef opts_vol_delete[] = {
};
static int
-cmdVolDelete(vshControl * ctl, vshCmd * cmd)
+cmdVolDelete(vshControl *ctl, const vshCmd *cmd)
{
virStorageVolPtr vol;
int ret = TRUE;
@@ -3914,7 +3914,7 @@ static vshCmdOptDef opts_vol_info[] = {
};
static int
-cmdVolInfo(vshControl * ctl, vshCmd * cmd)
+cmdVolInfo(vshControl *ctl, const vshCmd *cmd)
{
virStorageVolInfo info;
virStorageVolPtr vol;
@@ -3966,7 +3966,7 @@ static vshCmdOptDef opts_vol_dumpxml[] = {
};
static int
-cmdVolDumpXML(vshControl * ctl, vshCmd * cmd)
+cmdVolDumpXML(vshControl *ctl, const vshCmd *cmd)
{
virStorageVolPtr vol;
int ret = TRUE;
@@ -4007,7 +4007,7 @@ static vshCmdOptDef opts_vol_list[] = {
};
static int
-cmdVolList(vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED)
+cmdVolList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
{
virStoragePoolPtr pool;
int maxactive = 0, i;
@@ -4085,7 +4085,7 @@ static vshCmdOptDef opts_vol_name[] = {
};
static int
-cmdVolName(vshControl * ctl, vshCmd * cmd)
+cmdVolName(vshControl *ctl, const vshCmd *cmd)
{
virStorageVolPtr vol;
@@ -4118,7 +4118,7 @@ static vshCmdOptDef opts_vol_key[] = {
};
static int
-cmdVolKey(vshControl * ctl, vshCmd * cmd)
+cmdVolKey(vshControl *ctl, const vshCmd *cmd)
{
virStorageVolPtr vol;
@@ -4152,7 +4152,7 @@ static vshCmdOptDef opts_vol_path[] = {
};
static int
-cmdVolPath(vshControl * ctl, vshCmd * cmd)
+cmdVolPath(vshControl *ctl, const vshCmd *cmd)
{
virStorageVolPtr vol;
@@ -4185,7 +4185,7 @@ static vshCmdInfo info_version[] = {
static int
-cmdVersion(vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED)
+cmdVersion(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
{
unsigned long hvVersion;
const char *hvType;
@@ -4263,7 +4263,7 @@ static vshCmdInfo info_hostname[] = {
};
static int
-cmdHostname (vshControl *ctl, vshCmd *cmd ATTRIBUTE_UNUSED)
+cmdHostname (vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
{
char *hostname;
@@ -4292,7 +4292,7 @@ static vshCmdInfo info_uri[] = {
};
static int
-cmdURI (vshControl *ctl, vshCmd *cmd ATTRIBUTE_UNUSED)
+cmdURI (vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
{
char *uri;
@@ -4327,7 +4327,7 @@ static vshCmdOptDef opts_vncdisplay[] = {
};
static int
-cmdVNCDisplay(vshControl * ctl, vshCmd * cmd)
+cmdVNCDisplay(vshControl *ctl, const vshCmd *cmd)
{
xmlDocPtr xml = NULL;
xmlXPathObjectPtr obj = NULL;
@@ -4403,7 +4403,7 @@ static vshCmdOptDef opts_ttyconsole[] = {
};
static int
-cmdTTYConsole(vshControl * ctl, vshCmd * cmd)
+cmdTTYConsole(vshControl *ctl, const vshCmd *cmd)
{
xmlDocPtr xml = NULL;
xmlXPathObjectPtr obj = NULL;
@@ -4465,7 +4465,7 @@ static vshCmdOptDef opts_attach_device[] = {
};
static int
-cmdAttachDevice(vshControl * ctl, vshCmd * cmd)
+cmdAttachDevice(vshControl *ctl, const vshCmd *cmd)
{
virDomainPtr dom;
char *from;
@@ -4522,7 +4522,7 @@ static vshCmdOptDef opts_detach_device[] = {
};
static int
-cmdDetachDevice(vshControl * ctl, vshCmd * cmd)
+cmdDetachDevice(vshControl *ctl, const vshCmd *cmd)
{
virDomainPtr dom;
char *from;
@@ -4583,7 +4583,7 @@ static vshCmdOptDef opts_attach_interface[] = {
};
static int
-cmdAttachInterface(vshControl * ctl, vshCmd * cmd)
+cmdAttachInterface(vshControl *ctl, const vshCmd *cmd)
{
virDomainPtr dom = NULL;
char *mac, *target, *script, *type, *source;
@@ -4694,7 +4694,7 @@ static vshCmdOptDef opts_detach_interface[] = {
};
static int
-cmdDetachInterface(vshControl * ctl, vshCmd * cmd)
+cmdDetachInterface(vshControl *ctl, const vshCmd *cmd)
{
virDomainPtr dom = NULL;
xmlDocPtr xml = NULL;
@@ -4817,7 +4817,7 @@ static vshCmdOptDef opts_attach_disk[] = {
};
static int
-cmdAttachDisk(vshControl * ctl, vshCmd * cmd)
+cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
{
virDomainPtr dom = NULL;
char *source, *target, *driver, *subdriver, *type, *mode;
@@ -4975,7 +4975,7 @@ static vshCmdOptDef opts_detach_disk[] = {
};
static int
-cmdDetachDisk(vshControl * ctl, vshCmd * cmd)
+cmdDetachDisk(vshControl *ctl, const vshCmd *cmd)
{
xmlDocPtr xml = NULL;
xmlXPathObjectPtr obj=NULL;
@@ -5079,7 +5079,7 @@ static vshCmdInfo info_quit[] = {
};
static int
-cmdQuit(vshControl * ctl, vshCmd * cmd ATTRIBUTE_UNUSED)
+cmdQuit(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
{
ctl->imode = FALSE;
return TRUE;
@@ -5226,7 +5226,7 @@ vshCmddefGetData(vshCmdDef * cmd, int data_ct)
* Checks for required options
*/
static int
-vshCommandCheckOpts(vshControl * ctl, vshCmd * cmd)
+vshCommandCheckOpts(vshControl *ctl, vshCmd *cmd)
{
vshCmdDef *def = cmd->def;
vshCmdOptDef *d;
@@ -5268,7 +5268,7 @@ vshCmddefSearch(const char *cmdname)
}
static int
-vshCmddefHelp(vshControl * ctl, const char *cmdname, int withprog)
+vshCmddefHelp(vshControl *ctl, const char *cmdname, int withprog)
{
vshCmdDef *def = vshCmddefSearch(cmdname);
@@ -5337,7 +5337,7 @@ vshCommandOptFree(vshCmdOpt * arg)
}
static void
-vshCommandFree(vshCmd * cmd)
+vshCommandFree(vshCmd *cmd)
{
vshCmd *c = cmd;
@@ -5356,7 +5356,7 @@ vshCommandFree(vshCmd * cmd)
* Returns option by name
*/
static vshCmdOpt *
-vshCommandOpt(vshCmd * cmd, const char *name)
+vshCommandOpt(const vshCmd *cmd, const char *name)
{
vshCmdOpt *opt = cmd->opts;
@@ -5372,7 +5372,7 @@ vshCommandOpt(vshCmd * cmd, const char *name)
* Returns option as INT
*/
static int
-vshCommandOptInt(vshCmd * cmd, const char *name, int *found)
+vshCommandOptInt(const vshCmd *cmd, const char *name, int *found)
{
vshCmdOpt *arg = vshCommandOpt(cmd, name);
int res = 0, num_found = FALSE;
@@ -5394,7 +5394,7 @@ vshCommandOptInt(vshCmd * cmd, const char *name, int *found)
* Returns option as STRING
*/
static char *
-vshCommandOptString(vshCmd * cmd, const char *name, int *found)
+vshCommandOptString(const vshCmd *cmd, const char *name, int *found)
{
vshCmdOpt *arg = vshCommandOpt(cmd, name);
@@ -5406,7 +5406,7 @@ vshCommandOptString(vshCmd * cmd, const char *name, int *found)
#if 0
static int
-vshCommandOptStringList(vshCmd * cmd, const char *name, char ***data)
+vshCommandOptStringList(const vshCmd *cmd, const char *name, char ***data)
{
vshCmdOpt *arg = cmd->opts;
char **val = NULL;
@@ -5434,14 +5434,14 @@ vshCommandOptStringList(vshCmd * cmd, const char *name, char ***data)
* Returns TRUE/FALSE if the option exists
*/
static int
-vshCommandOptBool(vshCmd * cmd, const char *name)
+vshCommandOptBool(const vshCmd *cmd, const char *name)
{
return vshCommandOpt(cmd, name) ? TRUE : FALSE;
}
static virDomainPtr
-vshCommandOptDomainBy(vshControl * ctl, vshCmd * cmd, const char *optname,
+vshCommandOptDomainBy(vshControl *ctl, const vshCmd *cmd, const char *optname,
char **name, int flag)
{
virDomainPtr dom = NULL;
@@ -5487,7 +5487,7 @@ vshCommandOptDomainBy(vshControl * ctl, vshCmd * cmd, const char *optname,
}
static virNetworkPtr
-vshCommandOptNetworkBy(vshControl * ctl, vshCmd * cmd, const char *optname,
+vshCommandOptNetworkBy(vshControl *ctl, const vshCmd *cmd, const char *optname,
char **name, int flag)
{
virNetworkPtr network = NULL;
@@ -5524,7 +5524,7 @@ vshCommandOptNetworkBy(vshControl * ctl, vshCmd * cmd, const char *optname,
}
static virStoragePoolPtr
-vshCommandOptPoolBy(vshControl * ctl, vshCmd * cmd, const char *optname,
+vshCommandOptPoolBy(vshControl *ctl, const vshCmd *cmd, const char *optname,
char **name, int flag)
{
virStoragePoolPtr pool = NULL;
@@ -5561,7 +5561,7 @@ vshCommandOptPoolBy(vshControl * ctl, vshCmd * cmd, const char *optname,
}
static virStorageVolPtr
-vshCommandOptVolBy(vshControl * ctl, vshCmd * cmd,
+vshCommandOptVolBy(vshControl *ctl, const vshCmd *cmd,
const char *optname,
const char *pooloptname,
char **name, int flag)
@@ -5620,7 +5620,7 @@ vshCommandOptVolBy(vshControl * ctl, vshCmd * cmd,
* Executes command(s) and returns return code from last command
*/
static int
-vshCommandRun(vshControl * ctl, vshCmd * cmd)
+vshCommandRun(vshControl *ctl, const vshCmd *cmd)
{
int ret = TRUE;
@@ -5659,7 +5659,7 @@ vshCommandRun(vshControl * ctl, vshCmd * cmd)
#define VSH_TK_END 3
static int
-vshCommandGetToken(vshControl * ctl, char *str, char **end, char **res)
+vshCommandGetToken(vshControl *ctl, char *str, char **end, char **res)
{
int tk = VSH_TK_NONE;
int quote = FALSE;
@@ -5730,7 +5730,7 @@ vshCommandGetToken(vshControl * ctl, char *str, char **end, char **res)
}
static int
-vshCommandParse(vshControl * ctl, char *cmdstr)
+vshCommandParse(vshControl *ctl, char *cmdstr)
{
char *str;
char *tkdata = NULL;
@@ -5915,7 +5915,7 @@ vshDomainVcpuStateToString(int state)
}
static int
-vshConnectionUsability(vshControl * ctl, virConnectPtr conn, int showerror)
+vshConnectionUsability(vshControl *ctl, virConnectPtr conn, int showerror)
{
/* TODO: use something like virConnectionState() to
* check usability of the connection
@@ -5929,7 +5929,7 @@ vshConnectionUsability(vshControl * ctl, virConnectPtr conn, int showerror)
}
static void
-vshDebug(vshControl * ctl, int level, const char *format, ...)
+vshDebug(vshControl *ctl, int level, const char *format, ...)
{
va_list ap;
@@ -5946,7 +5946,7 @@ vshDebug(vshControl * ctl, int level, const char *format, ...)
}
static void
-vshPrintExtra(vshControl * ctl, const char *format, ...)
+vshPrintExtra(vshControl *ctl, const char *format, ...)
{
va_list ap;
@@ -5960,7 +5960,7 @@ vshPrintExtra(vshControl * ctl, const char *format, ...)
static void
-vshError(vshControl * ctl, int doexit, const char *format, ...)
+vshError(vshControl *ctl, int doexit, const char *format, ...)
{
va_list ap;
@@ -5987,7 +5987,7 @@ vshError(vshControl * ctl, int doexit, const char *format, ...)
}
static void *
-_vshMalloc(vshControl * ctl, size_t size, const char *filename, int line)
+_vshMalloc(vshControl *ctl, size_t size, const char *filename, int line)
{
void *x;
@@ -5999,7 +5999,7 @@ _vshMalloc(vshControl * ctl, size_t size, const char *filename, int line)
}
static void *
-_vshCalloc(vshControl * ctl, size_t nmemb, size_t size, const char *filename, int line)
+_vshCalloc(vshControl *ctl, size_t nmemb, size_t size, const char *filename, int line)
{
void *x;
@@ -6011,7 +6011,7 @@ _vshCalloc(vshControl * ctl, size_t nmemb, size_t size, const char *filename, in
}
static void *
-_vshRealloc(vshControl * ctl, void *ptr, size_t size, const char *filename, int line)
+_vshRealloc(vshControl *ctl, void *ptr, size_t size, const char *filename, int line)
{
void *x;
@@ -6024,7 +6024,7 @@ _vshRealloc(vshControl * ctl, void *ptr, size_t size, const char *filename, int
}
static char *
-_vshStrdup(vshControl * ctl, const char *s, const char *filename, int line)
+_vshStrdup(vshControl *ctl, const char *s, const char *filename, int line)
{
char *x;
@@ -6041,7 +6041,7 @@ _vshStrdup(vshControl * ctl, const char *s, const char *filename, int line)
* Initialize connection.
*/
static int
-vshInit(vshControl * ctl)
+vshInit(vshControl *ctl)
{
if (ctl->conn)
return FALSE;
@@ -6357,7 +6357,7 @@ vshReadline (vshControl *ctl, const char *prompt)
* Deinitialize virsh
*/
static int
-vshDeinit(vshControl * ctl)
+vshDeinit(vshControl *ctl)
{
vshCloseLogFile(ctl);
free(ctl->name);
@@ -6377,7 +6377,7 @@ vshDeinit(vshControl * ctl)
* Print usage
*/
static void
-vshUsage(vshControl * ctl, const char *cmdname)
+vshUsage(vshControl *ctl, const char *cmdname)
{
vshCmdDef *cmd;
@@ -6413,7 +6413,7 @@ vshUsage(vshControl * ctl, const char *cmdname)
*
*/
static int
-vshParseArgv(vshControl * ctl, int argc, char **argv)
+vshParseArgv(vshControl *ctl, int argc, char **argv)
{
char *last = NULL;
int i, end = 0, help = 0;
--
1.6.0.rc1.29.gf08e3
16 years, 3 months
[libvirt] PATCH: Support container XML enhancements
by Daniel P. Berrange
This is something I previously submitted as part of one of the LXC
patches, but I figure it makes sense on its own, since OpenVZ needs
this now too.
This adds two new XML elements to the domain XML format:
- An <init> block within <os> allowing specification of the path for
a binary to run when starting the container - aka 'init' by any other
name. First we also specify that all containers will use an OS
type of 'exe' - as in executable - the container equivalent of 'hvm'
<os>
<type>exe</type>
<init>/sbin/init</init>
</os>
- An <filesystem> element for specifying how the container's filesystem
is to be provided. This can actually be useful for full-machine virt
too such as KVM which have host filesystem pass-through. There are
various ways to configure it:
eg to use '/some/directory' as the root filesystem for a container
<filesystem type='mount'>
<source dir='/some/directory'/>
<target dir='/'/>
</filesystem>
eg to use a template called 'fedora9web' as the root filesystem for
a container
<filesystem type='template'>
<source name='fedora9web'/>
<target dir='/'/>
</filesystem>
eg to use a file containing a filesystem as the root filesystem
<filesystem type='file'>
<source file='/some/file.img'/>
<target dir='/'/>
</filesystem>
eg to use a disk partition or other block device (eg LVM) containing
a filesystem as the root filesystem
<filesystem type='block'>
<source dev='/dev/VolGroup00/Fedora9Web'/>
<target dir='/'/>
</filesystem>
If setting the root filesystem, the target path will be '/', some
container based virt allows the host OS root filesystem to be
used in the guest, and merely specify additive mounts at specific
locations,
eg to override just /home within a container
<filesystem type='mount'>
<source dir='/some/directory'/>
<target dir='/home'/>
</filesystem>
I believe this should satisfy all the OpenVZ, LXC and Linux-VServer
drivers' requirements around filesystems
Daniel
diff -r 5614da5fe9ef src/domain_conf.c
--- a/src/domain_conf.c Fri Jul 25 15:38:46 2008 +0100
+++ b/src/domain_conf.c Tue Jul 29 16:03:38 2008 +0100
@@ -86,6 +86,12 @@
"virtio",
"xen")
+VIR_ENUM_IMPL(virDomainFS, VIR_DOMAIN_FS_TYPE_LAST,
+ "mount",
+ "block",
+ "file",
+ "template")
+
VIR_ENUM_IMPL(virDomainNet, VIR_DOMAIN_NET_TYPE_LAST,
"user",
"ethernet",
@@ -234,6 +240,18 @@
VIR_FREE(def->driverType);
virDomainDiskDefFree(def->next);
+ VIR_FREE(def);
+}
+
+void virDomainFSDefFree(virDomainFSDefPtr def)
+{
+ if (!def)
+ return;
+
+ VIR_FREE(def->src);
+ VIR_FREE(def->dst);
+
+ virDomainFSDefFree(def->next);
VIR_FREE(def);
}
@@ -345,6 +363,7 @@
virDomainGraphicsDefFree(def->graphics);
virDomainInputDefFree(def->inputs);
virDomainDiskDefFree(def->disks);
+ virDomainFSDefFree(def->fss);
virDomainNetDefFree(def->nets);
virDomainChrDefFree(def->serials);
virDomainChrDefFree(def->parallels);
@@ -355,6 +374,7 @@
VIR_FREE(def->os.type);
VIR_FREE(def->os.arch);
VIR_FREE(def->os.machine);
+ VIR_FREE(def->os.init);
VIR_FREE(def->os.kernel);
VIR_FREE(def->os.initrd);
VIR_FREE(def->os.cmdline);
@@ -620,6 +640,89 @@
error:
virDomainDiskDefFree(def);
+ def = NULL;
+ goto cleanup;
+}
+
+
+/* Parse the XML definition for a disk
+ * @param node XML nodeset to parse for disk definition
+ */
+static virDomainFSDefPtr
+virDomainFSDefParseXML(virConnectPtr conn,
+ xmlNodePtr node) {
+ virDomainFSDefPtr def;
+ xmlNodePtr cur;
+ char *type = NULL;
+ char *source = NULL;
+ char *target = NULL;
+
+ if (VIR_ALLOC(def) < 0) {
+ virDomainReportError(conn, VIR_ERR_NO_MEMORY, NULL);
+ return NULL;
+ }
+
+ type = virXMLPropString(node, "type");
+ if (type) {
+ if ((def->type = virDomainFSTypeFromString(type)) < 0) {
+ virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ _("unknown filesystem type '%s'"), type);
+ goto error;
+ }
+ } else {
+ def->type = VIR_DOMAIN_FS_TYPE_MOUNT;
+ }
+
+ cur = node->children;
+ while (cur != NULL) {
+ if (cur->type == XML_ELEMENT_NODE) {
+ if ((source == NULL) &&
+ (xmlStrEqual(cur->name, BAD_CAST "source"))) {
+
+ if (def->type == VIR_DOMAIN_FS_TYPE_MOUNT)
+ source = virXMLPropString(cur, "dir");
+ else if (def->type == VIR_DOMAIN_FS_TYPE_FILE)
+ source = virXMLPropString(cur, "file");
+ else if (def->type == VIR_DOMAIN_FS_TYPE_BLOCK)
+ source = virXMLPropString(cur, "dev");
+ else if (def->type == VIR_DOMAIN_FS_TYPE_TEMPLATE)
+ source = virXMLPropString(cur, "name");
+ } else if ((target == NULL) &&
+ (xmlStrEqual(cur->name, BAD_CAST "target"))) {
+ target = virXMLPropString(cur, "dir");
+ } else if (xmlStrEqual(cur->name, BAD_CAST "readonly")) {
+ def->readonly = 1;
+ }
+ }
+ cur = cur->next;
+ }
+
+ if (source == NULL) {
+ virDomainReportError(conn, VIR_ERR_NO_SOURCE,
+ target ? "%s" : NULL, target);
+ goto error;
+ }
+
+ if (target == NULL) {
+ virDomainReportError(conn, VIR_ERR_NO_TARGET,
+ source ? "%s" : NULL, source);
+ goto error;
+ }
+
+ def->src = source;
+ source = NULL;
+ def->dst = target;
+ target = NULL;
+
+cleanup:
+ VIR_FREE(type);
+ VIR_FREE(target);
+ VIR_FREE(source);
+
+ return def;
+
+ error:
+ virDomainFSDefFree(def);
def = NULL;
goto cleanup;
}
@@ -1351,6 +1454,10 @@
dev->type = VIR_DOMAIN_DEVICE_DISK;
if (!(dev->data.disk = virDomainDiskDefParseXML(conn, node)))
goto error;
+ } else if (xmlStrEqual(node->name, BAD_CAST "filesystem")) {
+ dev->type = VIR_DOMAIN_DEVICE_FS;
+ if (!(dev->data.fs = virDomainFSDefParseXML(conn, node)))
+ goto error;
} else if (xmlStrEqual(node->name, BAD_CAST "interface")) {
dev->type = VIR_DOMAIN_DEVICE_NET;
if (!(dev->data.net = virDomainNetDefParseXML(conn, node)))
@@ -1560,7 +1667,21 @@
}
}
- if (!def->os.bootloader) {
+ /*
+ * Booting options for different OS types....
+ *
+ * - A bootloader (and optional kernel+initrd) (xen)
+ * - A kernel + initrd (xen)
+ * - A boot device (and optional kernel+initrd) (hvm)
+ * - An init script (exe)
+ */
+
+ if (STREQ(def->os.type, "exe")) {
+ def->os.init = virXPathString(conn, "string(./os/init[1])", ctxt);
+ }
+
+ if (STREQ(def->os.type, "xen") ||
+ STREQ(def->os.type, "hvm")) {
def->os.kernel = virXPathString(conn, "string(./os/kernel[1])", ctxt);
def->os.initrd = virXPathString(conn, "string(./os/initrd[1])", ctxt);
def->os.cmdline = virXPathString(conn, "string(./os/cmdline[1])", ctxt);
@@ -1610,12 +1731,9 @@
def->os.type,
def->os.arch,
type);
- if (!emulator) {
- virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
- "%s", _("unsupported guest type"));
- goto error;
- }
- if (!(def->emulator = strdup(emulator))) {
+
+ if (emulator &&
+ !(def->emulator = strdup(emulator))) {
virDomainReportError(conn, VIR_ERR_NO_MEMORY, NULL);
goto error;
}
@@ -1648,6 +1766,23 @@
ptr = ptr->next;
}
}
+ }
+ VIR_FREE(nodes);
+
+ /* analysis of the filesystems */
+ if ((n = virXPathNodeSet(conn, "./devices/filesystem", ctxt, &nodes)) < 0) {
+ virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ "%s", _("cannot extract filesystem devices"));
+ goto error;
+ }
+ for (i = n - 1 ; i >= 0 ; i--) {
+ virDomainFSDefPtr fs = virDomainFSDefParseXML(conn,
+ nodes[i]);
+ if (!fs)
+ goto error;
+
+ fs->next = def->fss;
+ def->fss = fs;
}
VIR_FREE(nodes);
@@ -2202,6 +2337,57 @@
}
static int
+virDomainFSDefFormat(virConnectPtr conn,
+ virBufferPtr buf,
+ virDomainFSDefPtr def)
+{
+ const char *type = virDomainFSTypeToString(def->type);
+
+ if (!type) {
+ virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ _("unexpected filesystem type %d"), def->type);
+ return -1;
+ }
+
+ virBufferVSprintf(buf,
+ " <filesystem type='%s'>\n",
+ type);
+
+ if (def->src) {
+ switch (def->type) {
+ case VIR_DOMAIN_FS_TYPE_MOUNT:
+ virBufferEscapeString(buf, " <source dir='%s'/>\n",
+ def->src);
+ break;
+
+ case VIR_DOMAIN_FS_TYPE_BLOCK:
+ virBufferEscapeString(buf, " <source dev='%s'/>\n",
+ def->src);
+ break;
+
+ case VIR_DOMAIN_FS_TYPE_FILE:
+ virBufferEscapeString(buf, " <source file='%s'/>\n",
+ def->src);
+ break;
+
+ case VIR_DOMAIN_FS_TYPE_TEMPLATE:
+ virBufferEscapeString(buf, " <source name='%s'/>\n",
+ def->src);
+ }
+ }
+
+ virBufferVSprintf(buf, " <target dir='%s'/>\n",
+ def->dst);
+
+ if (def->readonly)
+ virBufferAddLit(buf, " <readonly/>\n");
+
+ virBufferAddLit(buf, " </filesystem>\n");
+
+ return 0;
+}
+
+static int
virDomainNetDefFormat(virConnectPtr conn,
virBufferPtr buf,
virDomainNetDefPtr def)
@@ -2479,6 +2665,7 @@
unsigned char *uuid;
char uuidstr[VIR_UUID_STRING_BUFLEN];
virDomainDiskDefPtr disk;
+ virDomainFSDefPtr fs;
virDomainNetDefPtr net;
virDomainSoundDefPtr sound;
virDomainInputDefPtr input;
@@ -2548,6 +2735,9 @@
else
virBufferVSprintf(&buf, ">%s</type>\n", def->os.type);
+ if (def->os.init)
+ virBufferEscapeString(&buf, " <init>%s</init>\n",
+ def->os.init);
if (def->os.loader)
virBufferEscapeString(&buf, " <loader>%s</loader>\n",
def->os.loader);
@@ -2621,6 +2811,13 @@
if (virDomainDiskDefFormat(conn, &buf, disk) < 0)
goto cleanup;
disk = disk->next;
+ }
+
+ fs = def->fss;
+ while (fs) {
+ if (virDomainFSDefFormat(conn, &buf, fs) < 0)
+ goto cleanup;
+ fs = fs->next;
}
net = def->nets;
diff -r 5614da5fe9ef src/domain_conf.h
--- a/src/domain_conf.h Fri Jul 25 15:38:46 2008 +0100
+++ b/src/domain_conf.h Tue Jul 29 16:03:38 2008 +0100
@@ -91,6 +91,28 @@
unsigned int shared : 1;
virDomainDiskDefPtr next;
+};
+
+
+/* Two types of disk backends */
+enum virDomainFSType {
+ VIR_DOMAIN_FS_TYPE_MOUNT, /* Better named 'bind' */
+ VIR_DOMAIN_FS_TYPE_BLOCK,
+ VIR_DOMAIN_FS_TYPE_FILE,
+ VIR_DOMAIN_FS_TYPE_TEMPLATE,
+
+ VIR_DOMAIN_FS_TYPE_LAST
+};
+
+typedef struct _virDomainFSDef virDomainFSDef;
+typedef virDomainFSDef *virDomainFSDefPtr;
+struct _virDomainFSDef {
+ int type;
+ char *src;
+ char *dst;
+ unsigned int readonly : 1;
+
+ virDomainFSDefPtr next;
};
@@ -262,6 +284,7 @@
/* Flags for the 'type' field in next struct */
enum virDomainDeviceType {
VIR_DOMAIN_DEVICE_DISK,
+ VIR_DOMAIN_DEVICE_FS,
VIR_DOMAIN_DEVICE_NET,
VIR_DOMAIN_DEVICE_INPUT,
VIR_DOMAIN_DEVICE_SOUND,
@@ -273,6 +296,7 @@
int type;
union {
virDomainDiskDefPtr disk;
+ virDomainFSDefPtr fs;
virDomainNetDefPtr net;
virDomainInputDefPtr input;
virDomainSoundDefPtr sound;
@@ -318,6 +342,7 @@
char *machine;
int nBootDevs;
int bootDevs[VIR_DOMAIN_BOOT_LAST];
+ char *init;
char *kernel;
char *initrd;
char *cmdline;
@@ -357,6 +382,7 @@
virDomainGraphicsDefPtr graphics;
virDomainDiskDefPtr disks;
+ virDomainFSDefPtr fss;
virDomainNetDefPtr nets;
virDomainInputDefPtr inputs;
virDomainSoundDefPtr sounds;
@@ -411,6 +437,7 @@
void virDomainGraphicsDefFree(virDomainGraphicsDefPtr def);
void virDomainInputDefFree(virDomainInputDefPtr def);
void virDomainDiskDefFree(virDomainDiskDefPtr def);
+void virDomainFSDefFree(virDomainFSDefPtr def);
void virDomainNetDefFree(virDomainNetDefPtr def);
void virDomainChrDefFree(virDomainChrDefPtr def);
void virDomainSoundDefFree(virDomainSoundDefPtr def);
@@ -481,6 +508,7 @@
VIR_ENUM_DECL(virDomainDisk)
VIR_ENUM_DECL(virDomainDiskDevice)
VIR_ENUM_DECL(virDomainDiskBus)
+VIR_ENUM_DECL(virDomainFS)
VIR_ENUM_DECL(virDomainNet)
VIR_ENUM_DECL(virDomainChr)
VIR_ENUM_DECL(virDomainSoundModel)
--
|: 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, 3 months