[Libvir] PATCH: Don't make connection read-only when non-root
by Daniel P. Berrange
The virsh commands has long forced the connection to be read-only if running
as non-root. This is bogus because it is perfectly capable of authenticating
full read-write connections as non-root since we gained kerberos/policykit
support. The user can always use the explicit --readonly flag if they only
want a read only connection
Dan.
Index: src/virsh.c
===================================================================
RCS file: /data/cvs/libvirt/src/virsh.c,v
retrieving revision 1.135
diff -r1.135 virsh.c
6048,6054d6047
< #ifndef __MINGW32__
< /* Force a non-root, Xen connection to readonly */
< if ((ctl->name == NULL ||
< !strcasecmp(ctl->name, "xen")) && ctl->uid != 0)
< ctl->readonly = 1;
< #endif
<
--
|: Red Hat, Engineering, Boston -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, 9 months
[Libvir] PATCH: Fix libvirtd to not shutdown at startup
by Daniel P. Berrange
Changes to the daemon to make it called qemudShutdown() broke the network
driver when run in --daemon mode. This is because the main daemon forks
into the background, and the original PID then exits destroying any active
networks & removing the iptables rules.
# /usr/sbin/libvirtd --daemon
Shutting down network 'default'iptables: No chain/target/match by that name
iptables: Bad rule (does a matching rule exist in that chain?)
iptables: Bad rule (does a matching rule exist in that chain?)
iptables: Bad rule (does a matching rule exist in that chain?)
iptables: No chain/target/match by that name
iptables: No chain/target/match by that name
iptables: Bad rule (does a matching rule exist in that chain?)
iptables: Bad rule (does a matching rule exist in that chain?)
iptables: Bad rule (does a matching rule exist in that chain?)
iptables: Bad rule (does a matching rule exist in that chain?)
Failed to bring down bridge 'virbr0' : No such device
Failed to delete bridge 'virbr0' : No such device or address
The core issue is that when forking into daemon mode the original process
should immediately exit & not do invoke cleanup functions. This patch
makes it do that
Dan.
Index: qemud/qemud.c
===================================================================
RCS file: /data/cvs/libvirt/qemud/qemud.c,v
retrieving revision 1.89
diff -u -r1.89 qemud.c
--- qemud/qemud.c 3 Mar 2008 18:10:19 -0000 1.89
+++ qemud/qemud.c 9 Mar 2008 20:56:27 -0000
@@ -393,7 +393,7 @@
case -1:
return -1;
default:
- return nextpid;
+ _exit(0);
}
cleanup:
@@ -418,8 +418,7 @@
status != 0) {
return -1;
}
-
- return pid;
+ _exit(0);
}
}
}
@@ -2116,16 +2115,12 @@
goto error1;
if (godaemon) {
- int pid;
openlog("libvirtd", 0, 0);
- pid = qemudGoDaemon();
- if (pid < 0) {
+ if (qemudGoDaemon() < 0) {
qemudLog(QEMUD_ERR, _("Failed to fork as daemon: %s"),
strerror(errno));
goto error1;
}
- if (pid > 0)
- goto out;
/* Choose the name of the PID file. */
if (!pid_file) {
@@ -2172,7 +2167,6 @@
if (godaemon)
closelog();
- out:
ret = 0;
error2:
--
|: Red Hat, Engineering, Boston -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, 9 months
[Libvir] virsh start problem + patch
by Toth Istvan
Hello!
I've been trying to use virsh to manage my Xen domains on Fedora 8.
I found that I am unable to start any xen managed domains from virsh,
because virsh complains that 'Domain is already running'.
Actually, I am able to start them once, but once they are stopped, they
are impossible to re-start.
steps to reprouce:
1. use virt-install to install HVM domain
2. virsh start domain
3. shut down the domain from within the guest (i.e. Start-> shutdown)
4. virsh start domain -> error
The problem appears with stock F8 (with current updates), but I've also
tried the same with libvirt 4.1, with the same results.
I've looked into the virsh code, and it seems that it was written with
only only old-style xen in mind, and xen 3.1's managed domains break the
logic.
I've attached a simple patch against 0.4.1 that checks the actual domain
state, instead of simply checking if libvirt knows about the domain.
I have experienced a similar problem with virt-manager 0.5.3, where
virt-manager is stuck showing 'running' status even after a domain has
been shut down,
hence it is not able to start the domain.
regards
István Tóth
16 years, 9 months
[Libvir] PATCH: Remove use of polkit-grant
by Daniel P. Berrange
I formerly added support for calling polkit-auth and/or polkit-grant to
get PolicyKit credentials. It turns out that polkit-grant is fundamentally
flawed & unusable, so this patch removes use of polkit-grant. This is not
a big issue, since polkit-auth is more functional and present in 0.7 or
later. Second, it removes use of virRun() and does a direct execve() since
we need to keep stdin & stdout open in all circumstances so the polkit-auth
can prompt for & accept passwords depending on config.
Dan.
Index: configure.in
===================================================================
RCS file: /data/cvs/libvirt/configure.in,v
retrieving revision 1.133
diff -u -p -r1.133 configure.in
--- configure.in 3 Mar 2008 14:42:37 -0000 1.133
+++ configure.in 9 Mar 2008 21:00:21 -0000
@@ -450,10 +450,6 @@ if test "x$with_polkit" = "xyes" -o "x$w
CFLAGS="$old_CFLAGS"
LDFLAGS="$old_LDFLAGS"
- AC_PATH_PROG(POLKIT_GRANT, polkit-grant)
- if test "x$POLKIT_GRANT" != "x"; then
- AC_DEFINE_UNQUOTED([POLKIT_GRANT],["$POLKIT_GRANT"],[Location of polkit-grant program])
- fi
AC_PATH_PROG(POLKIT_AUTH, polkit-auth)
if test "x$POLKIT_AUTH" != "x"; then
AC_DEFINE_UNQUOTED([POLKIT_AUTH],["$POLKIT_AUTH"],[Location of polkit-auth program])
Index: src/libvirt.c
===================================================================
RCS file: /data/cvs/libvirt/src/libvirt.c,v
retrieving revision 1.125
diff -u -p -r1.125 libvirt.c
--- src/libvirt.c 26 Feb 2008 07:06:48 -0000 1.125
+++ src/libvirt.c 9 Mar 2008 21:00:24 -0000
@@ -19,6 +19,7 @@
#include <sys/stat.h>
#include <unistd.h>
#include <assert.h>
+#include <sys/wait.h>
#include <libxml/parser.h>
#include <libxml/xpath.h>
@@ -66,6 +67,39 @@ static int initialized = 0;
int debugFlag = 0;
#endif
+#if defined(POLKIT_AUTH)
+static int virConnectAuthGainPolkit(const char *privilege) {
+ const char *const args[] = {
+ POLKIT_AUTH, "--obtain", privilege, NULL
+ };
+ int childpid, status, ret;
+
+ /* Root has all rights */
+ if (getuid() == 0)
+ return 0;
+
+ if ((childpid = fork()) < 0)
+ return -1;
+
+ if (!childpid) {
+ execvp(args[0], (char **)args);
+ _exit(-1);
+ }
+
+ while ((ret = waitpid(childpid, &status, 0) == -1) && errno == EINTR);
+ if (ret == -1) {
+ return -1;
+ }
+
+ if (!WIFEXITED(status) ||
+ (WEXITSTATUS(status) != 0 && WEXITSTATUS(status) != 1)) {
+ return -1;
+ }
+
+ return 0;
+}
+#endif
+
static int virConnectAuthCallbackDefault(virConnectCredentialPtr cred,
unsigned int ncred,
void *cbdata ATTRIBUTE_UNUSED) {
@@ -77,25 +111,15 @@ static int virConnectAuthCallbackDefault
size_t len;
switch (cred[i].type) {
-#if defined(POLKIT_GRANT) || defined(POLKIT_AUTH)
+#if defined(POLKIT_AUTH)
case VIR_CRED_EXTERNAL: {
int ret;
- const char *const args[] = {
-#if defined(POLKIT_GRANT)
- POLKIT_GRANT, "--gain", cred[i].prompt, NULL
-#else
- POLKIT_AUTH, "--obtain", cred[i].prompt, NULL
-#endif
- };
-
if (STRNEQ(cred[i].challenge, "PolicyKit"))
return -1;
- if (virRun(NULL, (char **) args, &ret) < 0)
- return -1;
- if (!WIFEXITED(ret) ||
- (WEXITSTATUS(ret) != 0 && WEXITSTATUS(ret) != 1))
+ if (virConnectAuthGainPolkit(cred[i].prompt) < 0)
return -1;
+
break;
}
#endif
@@ -158,7 +182,7 @@ static int virConnectCredTypeDefault[] =
VIR_CRED_REALM,
VIR_CRED_PASSPHRASE,
VIR_CRED_NOECHOPROMPT,
-#if defined(POLKIT_AUTH) || defined(POLKIT_GRANT)
+#if defined(POLKIT_AUTH)
VIR_CRED_EXTERNAL,
#endif
};
--
|: Red Hat, Engineering, Boston -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, 9 months
[Libvir] PATCH: Allow Xen HVM kernel+initrd booting
by Daniel P. Berrange
The latest xen-unstable tree has support for booting HVM guests using an
explicit kernel+initrd+cmdline, as an alternative to the traditional BIOS
boot from harddisk/cdrom/network. This gives Xen HVM parity with KVM in
terms of boot methods. The current libvirt Xen driver though assumes that
Xen paravirt is always kernel+initrd or bootloader based, while Xen HVM
is always BIOS based.
This patch re-factors the Xen driver so that it allows kernel+initrd for
both Xen paravirt and HVM guests.
NB, Xen HVM previously abused the 'kernel' parameter in the SEXPR to refer
to the HVM guest firmware (ie /usr/lib/xen/boot/hvmloader). With the new
support for booting kernel+initrd in HVM guests, the firmware can now be
specified using an explicit 'loader' parameter - for backwards compatability
you can still use the old 'kernel' parameter too if doing a BIOS boot.
Second, it is also now possible for a paravirt guest to provide an explicit
patch to a QEMU device model, aka the <emulator> tag in libvirt, so this
pach also enables that functionality for paravirt guests.
Finally, since the paravirt framebuffer is tied up in all this code too, I
also include John's patch to make us deal with <graphics> properly in legacy
guests and old XenD.
Thankfully we have a large test suite of SEXPR/XML files, so while this is
a pretty major refactoring of code, I'm fairly confident we won't cause bad
regressions.
A couple of the existing test cases needed their sample SEXPR tweaked since
we now generate a couple of (...) bits in a different order, the result is
functionally the same though.
Finally as an example, we can create a HVM guest on xen-unstable using this
XML snippet - note how we can now pass parameters to the installer for HVM
too !
<domain type='xen'>
<name>kernel</name>
<uuid>06ed00fe-1162-4fc4-b5d8-11993ee4a8b9</uuid>
<os>
<type>hvm</type>
<loader>/usr/lib/xen/boot/hvmloader</loader>
<kernel>/root/vmlinuz.f864</kernel>
<initrd>/root/initrd.img.f864</initrd>
<cmdline>console=ttyS0 console=tty0</cmdline>
</os>
<memory>540672</memory>
<currentMemory>531456</currentMemory>
<vcpu>1</vcpu>
<on_poweroff>preserve</on_poweroff>
<on_reboot>preserve</on_reboot>
<on_crash>preserve</on_crash>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<devices>
<emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
<interface type='bridge'>
<source bridge='xenbr0'/>
<mac address='00:16:3e:0e:e8:b7'/>
<script path='vif-bridge'/>
</interface>
<disk type='file' device='disk'>
<driver name='file'/>
<source file='/root/kernel.img'/>
<target dev='hda'/>
</disk>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' listen='0.0.0.0'/>
<console tty='pty'/>
</devices>
</domain>
src/xend_internal.c | 122 +++++++------
src/xml.c | 183 ++++++++------------
tests/sexpr2xmldata/sexpr2xml-fv-kernel.sexpr | 1
tests/sexpr2xmldata/sexpr2xml-fv-kernel.xml | 26 ++
tests/sexpr2xmldata/sexpr2xml-fv-legacy-vfb.sexpr | 70 +++++++
tests/sexpr2xmldata/sexpr2xml-fv-legacy-vfb.xml | 33 +++
tests/sexpr2xmltest.c | 20 ++
tests/xml2sexprdata/xml2sexpr-fv-kernel.sexpr | 1
tests/xml2sexprdata/xml2sexpr-fv-kernel.xml | 24 ++
tests/xml2sexprdata/xml2sexpr-fv-localtime.sexpr | 2
tests/xml2sexprdata/xml2sexpr-fv-usbmouse.sexpr | 2
tests/xml2sexprdata/xml2sexpr-fv-usbtablet.sexpr | 2
tests/xml2sexprdata/xml2sexpr-fv-utc.sexpr | 2
tests/xml2sexprdata/xml2sexpr-fv-v2.sexpr | 2
tests/xml2sexprdata/xml2sexpr-fv-vncunused.sexpr | 2
tests/xml2sexprdata/xml2sexpr-fv.sexpr | 2
tests/xml2sexprdata/xml2sexpr-no-source-cdrom.sexpr | 2
tests/xml2sexprtest.c | 11 +
18 files changed, 346 insertions(+), 161 deletions(-)
Dan.
Index: src/xend_internal.c
===================================================================
RCS file: /data/cvs/libvirt/src/xend_internal.c,v
retrieving revision 1.165
diff -u -p -r1.165 xend_internal.c
--- src/xend_internal.c 30 Jan 2008 16:38:18 -0000 1.165
+++ src/xend_internal.c 3 Feb 2008 18:37:17 -0000
@@ -1280,65 +1280,84 @@ xend_log(virConnectPtr xend, char *buffe
static int
xend_parse_sexp_desc_os(virConnectPtr xend, struct sexpr *node, virBufferPtr buf, int hvm, int bootloader)
{
- const char *tmp;
+ const char *loader = NULL;
+ const char *kernel = NULL;
+ const char *initrd = NULL;
+ const char *cmdline = NULL;
+ const char *root = NULL;
if (node == NULL || buf == NULL) {
return(-1);
}
virBufferAdd(buf, " <os>\n", 7);
+ if (hvm)
+ virBufferAdd(buf, " <type>hvm</type>\n", -1);
+ else
+ virBufferAdd(buf, " <type>linux</type>\n", -1);
+
if (hvm) {
- virBufferVSprintf(buf, " <type>hvm</type>\n");
- tmp = sexpr_node(node, "domain/image/hvm/kernel");
- if (tmp == NULL)
- tmp = sexpr_node(node, "domain/image/hvm/loader");
- if (tmp == NULL && !bootloader) {
- virXendError(xend, VIR_ERR_INTERNAL_ERROR,
- _("domain information incomplete, missing kernel & bootloader"));
- return(-1);
- }
- if (tmp)
- virBufferVSprintf(buf, " <loader>%s</loader>\n", tmp);
- tmp = sexpr_node(node, "domain/image/hvm/boot");
- if ((tmp != NULL) && (tmp[0] != 0)) {
- while (*tmp) {
- if (*tmp == 'a')
- /* XXX no way to deal with boot from 2nd floppy */
- virBufferAdd(buf, " <boot dev='fd'/>\n", 21 );
- else if (*tmp == 'c')
- /*
- * Don't know what to put here. Say the vm has been given 3
- * disks - hda, hdb, hdc. How does one identify the boot disk?
- * We're going to assume that first disk is the boot disk since
- * this is most common practice
- */
- virBufferAdd(buf, " <boot dev='hd'/>\n", 21 );
- else if (*tmp == 'd')
- virBufferAdd(buf, " <boot dev='cdrom'/>\n", 24 );
- else if (*tmp == 'n')
- virBufferAdd(buf, " <boot dev='network'/>\n", 26 );
- tmp++;
+ loader = sexpr_node(node, "domain/image/hvm/loader");
+ if (loader == NULL) {
+ loader = sexpr_node(node, "domain/image/hvm/kernel");
+
+ if (loader == NULL) {
+ virXendError(xend, VIR_ERR_INTERNAL_ERROR,
+ _("domain information incomplete, missing HVM loader"));
+ return(-1);
}
+ } else {
+ kernel = sexpr_node(node, "domain/image/hvm/kernel");
+ initrd = sexpr_node(node, "domain/image/hvm/ramdisk");
+ cmdline = sexpr_node(node, "domain/image/hvm/args");
+ root = sexpr_node(node, "domain/image/hvm/root");
}
} else {
- virBufferVSprintf(buf, " <type>linux</type>\n");
- tmp = sexpr_node(node, "domain/image/linux/kernel");
- if (tmp == NULL && !bootloader) {
+ kernel = sexpr_node(node, "domain/image/linux/kernel");
+ initrd = sexpr_node(node, "domain/image/linux/ramdisk");
+ cmdline = sexpr_node(node, "domain/image/linux/args");
+ root = sexpr_node(node, "domain/image/linux/root");
+ }
+
+ if (hvm)
+ virBufferVSprintf(buf, " <loader>%s</loader>\n", loader);
+
+ if (kernel) {
+ virBufferVSprintf(buf, " <kernel>%s</kernel>\n", kernel);
+ if (initrd && initrd[0])
+ virBufferVSprintf(buf, " <initrd>%s</initrd>\n", initrd);
+ if (root && root[0])
+ virBufferVSprintf(buf, " <root>%s</root>\n", root);
+ if (cmdline && cmdline[0])
+ virBufferEscapeString(buf, " <cmdline>%s</cmdline>\n", cmdline);
+ } else {
+ if (hvm) {
+ const char *boot = sexpr_node(node, "domain/image/hvm/boot");
+ if ((boot != NULL) && (boot[0] != 0)) {
+ while (*boot) {
+ if (*boot == 'a')
+ /* XXX no way to deal with boot from 2nd floppy */
+ virBufferAdd(buf, " <boot dev='fd'/>\n", 21 );
+ else if (*boot == 'c')
+ /*
+ * Don't know what to put here. Say the vm has been given 3
+ * disks - hda, hdb, hdc. How does one identify the boot disk?
+ * We're going to assume that first disk is the boot disk since
+ * this is most common practice
+ */
+ virBufferAdd(buf, " <boot dev='hd'/>\n", 21 );
+ else if (*boot == 'd')
+ virBufferAdd(buf, " <boot dev='cdrom'/>\n", 24 );
+ else if (*boot == 'n')
+ virBufferAdd(buf, " <boot dev='network'/>\n", 26 );
+ boot++;
+ }
+ }
+ } else if (!bootloader) {
virXendError(xend, VIR_ERR_INTERNAL_ERROR,
_("domain information incomplete, missing kernel & bootloader"));
return(-1);
}
- if (tmp)
- virBufferVSprintf(buf, " <kernel>%s</kernel>\n", tmp);
- tmp = sexpr_node(node, "domain/image/linux/ramdisk");
- if ((tmp != NULL) && (tmp[0] != 0))
- virBufferVSprintf(buf, " <initrd>%s</initrd>\n", tmp);
- tmp = sexpr_node(node, "domain/image/linux/root");
- if ((tmp != NULL) && (tmp[0] != 0))
- virBufferVSprintf(buf, " <root>%s</root>\n", tmp);
- tmp = sexpr_node(node, "domain/image/linux/args");
- if ((tmp != NULL) && (tmp[0] != 0))
- virBufferEscapeString(buf, " <cmdline>%s</cmdline>\n", tmp);
}
virBufferAdd(buf, " </os>\n", 8);
@@ -1367,7 +1386,7 @@ xend_parse_sexp_desc(virConnectPtr conn,
const char *tmp;
char *tty;
virBuffer buf;
- int hvm = 0, bootloader = 0;
+ int hvm = 0, bootloader = 0, vfb = 0;
int domid = -1;
int max_mem, cur_mem;
unsigned char uuid[VIR_UUID_BUFLEN];
@@ -1487,8 +1506,10 @@ xend_parse_sexp_desc(virConnectPtr conn,
virBufferAdd(&buf, " <devices>\n", 12);
- /* in case of HVM we have devices emulation */
- tmp = sexpr_node(root, "domain/image/hvm/device_model");
+ if (hvm)
+ tmp = sexpr_node(root, "domain/image/hvm/device_model");
+ else
+ tmp = sexpr_node(root, "domain/image/linux/device_model");
if ((tmp != NULL) && (tmp[0] != 0))
virBufferVSprintf(&buf, " <emulator>%s</emulator>\n", tmp);
@@ -1681,6 +1702,7 @@ xend_parse_sexp_desc(virConnectPtr conn,
tmp = sexpr_node(node, "device/vfb/type");
if (tmp && !strcmp(tmp, "sdl")) {
+ vfb = 1;
virBufferVSprintf(&buf, " <input type='mouse' bus='%s'/>\n", hvm ? "ps2": "xen");
virBufferAdd(&buf, " <graphics type='sdl'/>\n", 27);
} else if (tmp && !strcmp(tmp, "vnc")) {
@@ -1688,6 +1710,7 @@ xend_parse_sexp_desc(virConnectPtr conn,
const char *listenAddr = sexpr_node(node, "device/vfb/vnclisten");
const char *vncPasswd = NULL;
const char *keymap = sexpr_node(node, "device/vfb/keymap");
+ vfb = 1;
virBufferVSprintf(&buf, " <input type='mouse' bus='%s'/>\n", hvm ? "ps2": "xen");
virBufferVSprintf(&buf, " <graphics type='vnc' port='%d'", port);
if (listenAddr)
@@ -1751,8 +1774,7 @@ xend_parse_sexp_desc(virConnectPtr conn,
}
/* Graphics device (HVM <= 3.0.4, or PV <= 3.0.3) vnc config */
- if ((hvm && xendConfigVersion < 4) ||
- (!hvm && xendConfigVersion < 3)) {
+ if (!vfb) {
tmp = sexpr_fmt_node(root, "domain/image/%s/vnc", hvm ? "hvm" : "linux");
if (tmp != NULL) {
if (tmp[0] == '1') {
Index: src/xml.c
===================================================================
RCS file: /data/cvs/libvirt/src/xml.c,v
retrieving revision 1.105
diff -u -p -r1.105 xml.c
--- src/xml.c 29 Jan 2008 18:23:43 -0000 1.105
+++ src/xml.c 3 Feb 2008 18:37:17 -0000
@@ -839,22 +839,21 @@ virDomainParseXMLGraphicsDescVFB(virConn
* @ctxt: a path context representing the XML description
* @vcpus: number of virtual CPUs to configure
* @xendConfigVersion: xend configuration file format
+ * @hasKernel: whether the domain is booting from a kernel
*
- * Parse the OS part of the XML description for an HVM domain and add it to
- * the S-Expr in buf. This is a temporary interface as the S-Expr interface
- * will be replaced by XML-RPC in the future. However the XML format should
- * stay valid over time.
+ * Parse the OS part of the XML description for a HVM domain
+ * and add it to the S-Expr in buf.
*
* Returns 0 in case of success, -1 in case of error.
*/
static int
virDomainParseXMLOSDescHVM(virConnectPtr conn, xmlNodePtr node,
virBufferPtr buf, xmlXPathContextPtr ctxt,
- int vcpus, int xendConfigVersion)
+ int vcpus, int xendConfigVersion,
+ int hasKernel)
{
xmlNodePtr cur, txt;
xmlNodePtr *nodes = NULL;
- xmlChar *type = NULL;
xmlChar *loader = NULL;
char bootorder[5];
int nbootorder = 0;
@@ -864,14 +863,8 @@ virDomainParseXMLOSDescHVM(virConnectPtr
cur = node->children;
while (cur != NULL) {
if (cur->type == XML_ELEMENT_NODE) {
- if ((type == NULL) &&
- (xmlStrEqual(cur->name, BAD_CAST "type"))) {
- txt = cur->children;
- if ((txt != NULL) && (txt->type == XML_TEXT_NODE) &&
- (txt->next == NULL))
- type = txt->content;
- } else if ((loader == NULL) &&
- (xmlStrEqual(cur->name, BAD_CAST "loader"))) {
+ if ((loader == NULL) &&
+ (xmlStrEqual(cur->name, BAD_CAST "loader"))) {
txt = cur->children;
if ((txt != NULL) && (txt->type == XML_TEXT_NODE) &&
(txt->next == NULL))
@@ -904,29 +897,31 @@ virDomainParseXMLOSDescHVM(virConnectPtr
}
cur = cur->next;
}
+ /*
+ * XenD always needs boot order defined for HVM, even if
+ * booting off a kernel + initrd, so force to 'c' if nothing
+ * else is specified
+ */
+ if (nbootorder == 0)
+ bootorder[nbootorder++] = 'c';
bootorder[nbootorder] = '\0';
- if ((type == NULL) || (!xmlStrEqual(type, BAD_CAST "hvm"))) {
- /* VIR_ERR_OS_TYPE */
- virXMLError(conn, VIR_ERR_OS_TYPE, (const char *) type, 0);
- return (-1);
- }
- virBufferAdd(buf, "(image (hvm ", 12);
+
if (loader == NULL) {
- virXMLError(conn, VIR_ERR_NO_KERNEL, NULL, 0);
- goto error;
+ virXMLError(conn, VIR_ERR_INTERNAL_ERROR, "no HVM domain loader", 0);
+ return -1;
+ }
+ /*
+ * Originally XenD abused the 'kernel' parameter for the HVM
+ * firmware. New XenD allows HVM guests to boot from a kernel
+ * and if this is enabled, the HVM firmware must use the new
+ * 'loader' parameter
+ */
+ if (hasKernel) {
+ virBufferVSprintf(buf, "(loader '%s')", (const char *) loader);
} else {
virBufferVSprintf(buf, "(kernel '%s')", (const char *) loader);
}
- /* get the device emulation model */
- str = virXPathString("string(/domain/devices/emulator[1])", ctxt);
- if (str == NULL) {
- virXMLError(conn, VIR_ERR_NO_KERNEL, NULL, 0); /* TODO: error */
- goto error;
- }
- virBufferVSprintf(buf, "(device_model '%s')", str);
- xmlFree(str);
-
virBufferVSprintf(buf, "(vcpus %d)", vcpus);
if (nbootorder)
@@ -1047,27 +1042,12 @@ virDomainParseXMLOSDescHVM(virConnectPtr
virBufferAdd(buf, "(serial pty)", 12);
}
- /* HVM graphics for xen <= 3.0.5 */
- if (xendConfigVersion < 4) {
- /* Is a graphics device specified? */
- cur = virXPathNode("/domain/devices/graphics[1]", ctxt);
- if (cur != NULL) {
- res = virDomainParseXMLGraphicsDescImage(conn, cur, buf,
- xendConfigVersion);
- if (res != 0) {
- goto error;
- }
- }
- }
-
str = virXPathString("string(/domain/clock/@offset)", ctxt);
if (str != NULL && !strcmp(str, "localtime")) {
virBufferAdd(buf, "(localtime 1)", 13);
}
free(str);
- virBufferAdd(buf, "))", 2);
-
return (0);
error:
@@ -1075,45 +1055,34 @@ virDomainParseXMLOSDescHVM(virConnectPtr
return (-1);
}
+
/**
- * virDomainParseXMLOSDescPV:
+ * virDomainParseXMLOSDescKernel:
* @conn: pointer to the hypervisor connection
* @node: node containing PV OS description
* @buf: a buffer for the result S-Expr
- * @ctxt: a path context representing the XML description
- * @xendConfigVersion: xend configuration file format
*
- * Parse the OS part of the XML description for a paravirtualized domain
- * and add it to the S-Expr in buf. This is a temporary interface as the
- * S-Expr interface will be replaced by XML-RPC in the future. However
- * the XML format should stay valid over time.
+ * Parse the OS part of the XML description for a domain using a direct
+ * kernel and initrd to boot.
*
* Returns 0 in case of success, -1 in case of error.
*/
static int
-virDomainParseXMLOSDescPV(virConnectPtr conn, xmlNodePtr node,
- virBufferPtr buf, xmlXPathContextPtr ctxt,
- int xendConfigVersion)
+virDomainParseXMLOSDescKernel(virConnectPtr conn ATTRIBUTE_UNUSED,
+ xmlNodePtr node,
+ virBufferPtr buf)
{
xmlNodePtr cur, txt;
- const xmlChar *type = NULL;
const xmlChar *root = NULL;
const xmlChar *kernel = NULL;
const xmlChar *initrd = NULL;
const xmlChar *cmdline = NULL;
- int res;
cur = node->children;
while (cur != NULL) {
if (cur->type == XML_ELEMENT_NODE) {
- if ((type == NULL)
- && (xmlStrEqual(cur->name, BAD_CAST "type"))) {
- txt = cur->children;
- if ((txt != NULL) && (txt->type == XML_TEXT_NODE) &&
- (txt->next == NULL))
- type = txt->content;
- } else if ((kernel == NULL) &&
- (xmlStrEqual(cur->name, BAD_CAST "kernel"))) {
+ if ((kernel == NULL) &&
+ (xmlStrEqual(cur->name, BAD_CAST "kernel"))) {
txt = cur->children;
if ((txt != NULL) && (txt->type == XML_TEXT_NODE) &&
(txt->next == NULL))
@@ -1140,18 +1109,9 @@ virDomainParseXMLOSDescPV(virConnectPtr
}
cur = cur->next;
}
- if ((type != NULL) && (!xmlStrEqual(type, BAD_CAST "linux"))) {
- /* VIR_ERR_OS_TYPE */
- virXMLError(conn, VIR_ERR_OS_TYPE, (const char *) type, 0);
- return (-1);
- }
- virBufferAdd(buf, "(image (linux ", 14);
- if (kernel == NULL) {
- virXMLError(conn, VIR_ERR_NO_KERNEL, NULL, 0);
- return (-1);
- } else {
- virBufferVSprintf(buf, "(kernel '%s')", (const char *) kernel);
- }
+
+ virBufferVSprintf(buf, "(kernel '%s')", (const char *) kernel);
+
if (initrd != NULL)
virBufferVSprintf(buf, "(ramdisk '%s')", (const char *) initrd);
if (root != NULL)
@@ -1159,20 +1119,6 @@ virDomainParseXMLOSDescPV(virConnectPtr
if (cmdline != NULL)
virBufferVSprintf(buf, "(args '%s')", (const char *) cmdline);
- /* PV graphics for xen <= 3.0.4 */
- if (xendConfigVersion < 3) {
- cur = virXPathNode("/domain/devices/graphics[1]", ctxt);
- if (cur != NULL) {
- res = virDomainParseXMLGraphicsDescImage(conn, cur, buf,
- xendConfigVersion);
- if (res != 0) {
- goto error;
- }
- }
- }
-
- error:
- virBufferAdd(buf, "))", 2);
return (0);
}
@@ -1706,23 +1652,54 @@ virDomainParseXMLDesc(virConnectPtr conn
if (!bootloader) {
if ((node = virXPathNode("/domain/os[1]", ctxt)) != NULL) {
+ int has_kernel = 0;
+
/* Analyze of the os description, based on HVM or PV. */
str = virXPathString("string(/domain/os/type[1])", ctxt);
-
- if ((str == NULL) || (strcmp(str, "hvm"))) {
- res = virDomainParseXMLOSDescPV(conn, node,
- &buf, ctxt,
- xendConfigVersion);
- } else {
+ if ((str != NULL) && STREQ(str, "hvm"))
hvm = 1;
- res = virDomainParseXMLOSDescHVM(conn, node, &buf, ctxt,
- vcpus, xendConfigVersion);
- }
+ xmlFree(str);
+ str = NULL;
- free(str);
+ if (hvm)
+ virBufferAdd(&buf, "(image (hvm ", 12);
+ else
+ virBufferAdd(&buf, "(image (linux ", 14);
+
+ if (virXPathBoolean("count(/domain/os/kernel) > 0", ctxt)) {
+ if (virDomainParseXMLOSDescKernel(conn, node,
+ &buf) != 0)
+ goto error;
+ has_kernel = 1;
+ }
- if (res != 0)
+ if (hvm &&
+ virDomainParseXMLOSDescHVM(conn, node,
+ &buf, ctxt, vcpus,
+ xendConfigVersion,
+ has_kernel) != 0)
goto error;
+
+ /* get the device emulation model */
+ str = virXPathString("string(/domain/devices/emulator[1])", ctxt);
+ if (str != NULL) {
+ virBufferVSprintf(&buf, "(device_model '%s')", str);
+ xmlFree(str);
+ str = NULL;
+ }
+
+ /* PV graphics for xen <= 3.0.4, or HVM graphics for xen <= 3.1.0 */
+ if ((!hvm && xendConfigVersion < 3) ||
+ (hvm && xendConfigVersion < 4)) {
+ xmlNodePtr cur;
+ cur = virXPathNode("/domain/devices/graphics[1]", ctxt);
+ if (cur != NULL &&
+ virDomainParseXMLGraphicsDescImage(conn, cur, &buf,
+ xendConfigVersion) != 0)
+ goto error;
+ }
+
+ virBufferAdd(&buf, "))", 2);
} else {
virXMLError(conn, VIR_ERR_NO_OS, nam, 0);
goto error;
Index: tests/sexpr2xmltest.c
===================================================================
RCS file: /data/cvs/libvirt/tests/sexpr2xmltest.c,v
retrieving revision 1.22
diff -u -p -r1.22 sexpr2xmltest.c
--- tests/sexpr2xmltest.c 29 Jan 2008 18:15:54 -0000 1.22
+++ tests/sexpr2xmltest.c 3 Feb 2008 18:37:17 -0000
@@ -178,6 +178,18 @@ static int testCompareFVclockLocaltime(c
1);
}
+static int testCompareFVKernel(const void *data ATTRIBUTE_UNUSED) {
+ return testCompareFiles("sexpr2xmldata/sexpr2xml-fv-kernel.xml",
+ "sexpr2xmldata/sexpr2xml-fv-kernel.sexpr",
+ 1);
+}
+
+static int testCompareFVLegacyVFB(const void *data ATTRIBUTE_UNUSED) {
+ return testCompareFiles("sexpr2xmldata/sexpr2xml-fv-legacy-vfb.xml",
+ "sexpr2xmldata/sexpr2xml-fv-legacy-vfb.sexpr",
+ 4);
+}
+
int
main(int argc, char **argv)
@@ -276,6 +288,14 @@ main(int argc, char **argv)
1, testCompareFVclockLocaltime, NULL) != 0)
ret = -1;
+ if (virtTestRun("SEXPR-2-XML FV kernel",
+ 1, testCompareFVKernel, NULL) != 0)
+ ret = -1;
+
+ if (virtTestRun("SEXPR-2-XML FV legacy VFB",
+ 1, testCompareFVLegacyVFB, NULL) != 0)
+ ret = -1;
+
exit(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
#else /* WITHOUT_XEN */
Index: tests/xml2sexprtest.c
===================================================================
RCS file: /data/cvs/libvirt/tests/xml2sexprtest.c,v
retrieving revision 1.21
diff -u -p -r1.21 xml2sexprtest.c
--- tests/xml2sexprtest.c 29 Jan 2008 18:15:54 -0000 1.21
+++ tests/xml2sexprtest.c 3 Feb 2008 18:37:17 -0000
@@ -235,6 +235,13 @@ static int testCompareFVInputUSBTablet(c
1);
}
+static int testCompareFVKernel(const void *data ATTRIBUTE_UNUSED) {
+ return testCompareFiles("xml2sexprdata/xml2sexpr-fv-kernel.xml",
+ "xml2sexprdata/xml2sexpr-fv-kernel.sexpr",
+ "fvtest",
+ 1);
+}
+
int
@@ -351,6 +358,10 @@ main(int argc, char **argv)
1, testCompareFVclockLocaltime, NULL) != 0)
ret = -1;
+ if (virtTestRun("XML-2-SEXPR FV kernel",
+ 1, testCompareFVKernel, NULL) != 0)
+ ret = -1;
+
exit(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
}
Index: tests/sexpr2xmldata/sexpr2xml-fv-kernel.sexpr
===================================================================
RCS file: tests/sexpr2xmldata/sexpr2xml-fv-kernel.sexpr
diff -N tests/sexpr2xmldata/sexpr2xml-fv-kernel.sexpr
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/sexpr2xmldata/sexpr2xml-fv-kernel.sexpr 3 Feb 2008 18:37:17 -0000
@@ -0,0 +1 @@
+(domain (domid 15)(name 'fvtest')(memory 420)(maxmem 420)(vcpus 2)(uuid '596a5d2171f48fb2e068e2386a5c413e')(on_poweroff 'destroy')(on_reboot 'destroy')(on_crash 'destroy')(image (hvm (kernel '/var/lib/xen/vmlinuz.2Dn2YT')(ramdisk '/var/lib/xen/initrd.img.0u-Vhq')(args ' method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test... ')(loader '/usr/lib/xen/boot/hvmloader')(vcpus 2)(usb 1)(serial pty)))(device (vbd (dev 'ioemu:xvda')(uname 'file:/root/some.img')(mode 'w'))))
\ No newline at end of file
Index: tests/sexpr2xmldata/sexpr2xml-fv-kernel.xml
===================================================================
RCS file: tests/sexpr2xmldata/sexpr2xml-fv-kernel.xml
diff -N tests/sexpr2xmldata/sexpr2xml-fv-kernel.xml
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/sexpr2xmldata/sexpr2xml-fv-kernel.xml 3 Feb 2008 18:37:17 -0000
@@ -0,0 +1,26 @@
+<domain type='xen' id='15'>
+ <name>fvtest</name>
+ <uuid>596a5d21-71f4-8fb2-e068-e2386a5c413e</uuid>
+ <os>
+ <type>hvm</type>
+ <loader>/usr/lib/xen/boot/hvmloader</loader>
+ <kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
+ <initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
+ <cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test... </cmdline>
+ </os>
+ <memory>430080</memory>
+ <vcpu>2</vcpu>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>destroy</on_reboot>
+ <on_crash>destroy</on_crash>
+ <features>
+ </features>
+ <clock offset='utc'/>
+ <devices>
+ <disk type='file' device='disk'>
+ <driver name='file'/>
+ <source file='/root/some.img'/>
+ <target dev='xvda'/>
+ </disk>
+ </devices>
+</domain>
Index: tests/sexpr2xmldata/sexpr2xml-fv-legacy-vfb.sexpr
===================================================================
RCS file: tests/sexpr2xmldata/sexpr2xml-fv-legacy-vfb.sexpr
diff -N tests/sexpr2xmldata/sexpr2xml-fv-legacy-vfb.sexpr
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/sexpr2xmldata/sexpr2xml-fv-legacy-vfb.sexpr 3 Feb 2008 18:37:17 -0000
@@ -0,0 +1,70 @@
+(domain
+ (domid 1)
+ (on_crash restart)
+ (uuid fde0533d-d043-88c6-dfba-4822fa32f309)
+ (bootloader_args )
+ (vcpus 1)
+ (name s10u4)
+ (on_poweroff destroy)
+ (on_reboot restart)
+ (bootloader )
+ (maxmem 1024)
+ (memory 1024)
+ (shadow_memory 9)
+ (cpu_weight 256)
+ (cpu_cap 0)
+ (features )
+ (on_xend_start ignore)
+ (on_xend_stop shutdown)
+ (start_time 1201894394.0)
+ (cpu_time 17.253230349)
+ (online_vcpus 1)
+ (image
+ (hvm
+ (kernel /usr/lib/xen/boot/hvmloader)
+ (boot c)
+ (device_model /usr/lib/xen/bin/qemu-dm)
+ (keymap en-us)
+ (localtime 0)
+ (pae 1)
+ (vnc 1)
+ (vncunused 1)
+ (notes (SUSPEND_CANCEL 1))
+ )
+ )
+ (status 2)
+ (state -b----)
+ (store_mfn 262142)
+ (device
+ (vif
+ (mac 00:16:3e:3b:b9:d7)
+ (script vif-vnic)
+ (uuid 33b87cce-c187-4bdd-8301-6411a48be129)
+ (backend 0)
+ )
+ )
+ (device
+ (vbd
+ (uname phy:/dev/zvol/dsk/export/s10u4-root)
+ (uuid b1d5196f-aae7-74bb-43dc-b4aae943b9bd)
+ (mode w)
+ (dev hda:disk)
+ (backend 0)
+ (bootable 1)
+ )
+ )
+ (device
+ (vfb
+ (vncunused 1)
+ (uuid d45dfd90-c0e0-8851-8f14-f16ba9512d2d)
+ (location localhost:5900)
+ )
+ )
+ (device
+ (console
+ (protocol vt100)
+ (location 3)
+ (uuid 0248d3f7-f3ae-78e8-4829-ad51a6f94efd)
+ )
+ )
+)
Index: tests/sexpr2xmldata/sexpr2xml-fv-legacy-vfb.xml
===================================================================
RCS file: tests/sexpr2xmldata/sexpr2xml-fv-legacy-vfb.xml
diff -N tests/sexpr2xmldata/sexpr2xml-fv-legacy-vfb.xml
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/sexpr2xmldata/sexpr2xml-fv-legacy-vfb.xml 3 Feb 2008 18:37:17 -0000
@@ -0,0 +1,33 @@
+<domain type='xen' id='1'>
+ <name>s10u4</name>
+ <uuid>fde0533d-d043-88c6-dfba-4822fa32f309</uuid>
+ <os>
+ <type>hvm</type>
+ <loader>/usr/lib/xen/boot/hvmloader</loader>
+ <boot dev='hd'/>
+ </os>
+ <memory>1048576</memory>
+ <vcpu>1</vcpu>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>restart</on_crash>
+ <features>
+ <pae/>
+ </features>
+ <clock offset='utc'/>
+ <devices>
+ <emulator>/usr/lib/xen/bin/qemu-dm</emulator>
+ <interface type='ethernet'>
+ <target dev='vif1.0'/>
+ <mac address='00:16:3e:3b:b9:d7'/>
+ <script path='vif-vnic'/>
+ </interface>
+ <disk type='block' device='disk'>
+ <driver name='phy'/>
+ <source dev='/dev/zvol/dsk/export/s10u4-root'/>
+ <target dev='hda'/>
+ </disk>
+ <input type='mouse' bus='ps2'/>
+ <graphics type='vnc' port='-1' keymap='en-us'/>
+ </devices>
+</domain>
Index: tests/xml2sexprdata/xml2sexpr-fv-kernel.sexpr
===================================================================
RCS file: tests/xml2sexprdata/xml2sexpr-fv-kernel.sexpr
diff -N tests/xml2sexprdata/xml2sexpr-fv-kernel.sexpr
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/xml2sexprdata/xml2sexpr-fv-kernel.sexpr 3 Feb 2008 18:37:17 -0000
@@ -0,0 +1 @@
+(vm (name 'fvtest')(memory 420)(maxmem 420)(vcpus 2)(uuid '596a5d2171f48fb2e068e2386a5c413e')(on_poweroff 'destroy')(on_reboot 'destroy')(on_crash 'destroy')(image (hvm (kernel '/var/lib/xen/vmlinuz.2Dn2YT')(ramdisk '/var/lib/xen/initrd.img.0u-Vhq')(args ' method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test... ')(loader '/usr/lib/xen/boot/hvmloader')(vcpus 2)(boot c)(usb 1)(serial pty)))(device (vbd (dev 'ioemu:xvda')(uname 'file:/root/some.img')(mode 'w'))))
\ No newline at end of file
Index: tests/xml2sexprdata/xml2sexpr-fv-kernel.xml
===================================================================
RCS file: tests/xml2sexprdata/xml2sexpr-fv-kernel.xml
diff -N tests/xml2sexprdata/xml2sexpr-fv-kernel.xml
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/xml2sexprdata/xml2sexpr-fv-kernel.xml 3 Feb 2008 18:37:17 -0000
@@ -0,0 +1,24 @@
+<domain type='xen' id='15'>
+ <name>fvtest</name>
+ <uuid>596a5d2171f48fb2e068e2386a5c413e</uuid>
+ <os>
+ <type>hvm</type>
+ <kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
+ <initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
+ <cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test... </cmdline>
+ <loader>/usr/lib/xen/boot/hvmloader</loader>
+ </os>
+ <memory>430080</memory>
+ <vcpu>2</vcpu>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>destroy</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <disk type='file' device='disk'>
+ <source file='/root/some.img'/>
+ <target dev='xvda'/>
+ </disk>
+ <console tty='/dev/pts/4'/>
+ </devices>
+</domain>
+
Index: tests/xml2sexprdata/xml2sexpr-fv-localtime.sexpr
===================================================================
RCS file: /data/cvs/libvirt/tests/xml2sexprdata/xml2sexpr-fv-localtime.sexpr,v
retrieving revision 1.2
diff -u -p -r1.2 xml2sexpr-fv-localtime.sexpr
--- tests/xml2sexprdata/xml2sexpr-fv-localtime.sexpr 18 Jul 2007 21:08:22 -0000 1.2
+++ tests/xml2sexprdata/xml2sexpr-fv-localtime.sexpr 3 Feb 2008 18:37:17 -0000
@@ -1 +1 @@
-(vm (name 'fvtest')(memory 400)(maxmem 400)(vcpus 1)(uuid 'b5d70dd275cdaca517769660b059d8bc')(on_poweroff 'destroy')(on_reboot 'restart')(on_crash 'restart')(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(device_model '/usr/lib64/xen/bin/qemu-dm')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(usb 1)(vnc 1)(localtime 1)))(device (vbd (dev 'ioemu:hda')(uname 'file:/root/foo.img')(mode 'w')))(device (vif (mac '00:16:3e:1b:b1:47')(bridge 'xenbr0')(script 'vif-bridge')(type ioemu))))
\ No newline at end of file
+(vm (name 'fvtest')(memory 400)(maxmem 400)(vcpus 1)(uuid 'b5d70dd275cdaca517769660b059d8bc')(on_poweroff 'destroy')(on_reboot 'restart')(on_crash 'restart')(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(usb 1)(localtime 1)(device_model '/usr/lib64/xen/bin/qemu-dm')(vnc 1)))(device (vbd (dev 'ioemu:hda')(uname 'file:/root/foo.img')(mode 'w')))(device (vif (mac '00:16:3e:1b:b1:47')(bridge 'xenbr0')(script 'vif-bridge')(type ioemu))))
\ No newline at end of file
Index: tests/xml2sexprdata/xml2sexpr-fv-usbmouse.sexpr
===================================================================
RCS file: /data/cvs/libvirt/tests/xml2sexprdata/xml2sexpr-fv-usbmouse.sexpr,v
retrieving revision 1.1
diff -u -p -r1.1 xml2sexpr-fv-usbmouse.sexpr
--- tests/xml2sexprdata/xml2sexpr-fv-usbmouse.sexpr 18 Jul 2007 21:08:22 -0000 1.1
+++ tests/xml2sexprdata/xml2sexpr-fv-usbmouse.sexpr 3 Feb 2008 18:37:17 -0000
@@ -1 +1 @@
-(vm (name 'fvtest')(memory 400)(maxmem 400)(vcpus 1)(uuid 'b5d70dd275cdaca517769660b059d8bc')(on_poweroff 'destroy')(on_reboot 'restart')(on_crash 'restart')(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(device_model '/usr/lib64/xen/bin/qemu-dm')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(usb 1)(usbdevice mouse)(vnc 1)))(device (vbd (dev 'ioemu:hda')(uname 'file:/root/foo.img')(mode 'w')))(device (vif (mac '00:16:3e:1b:b1:47')(bridge 'xenbr0')(script 'vif-bridge')(type ioemu))))
\ No newline at end of file
+(vm (name 'fvtest')(memory 400)(maxmem 400)(vcpus 1)(uuid 'b5d70dd275cdaca517769660b059d8bc')(on_poweroff 'destroy')(on_reboot 'restart')(on_crash 'restart')(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(usb 1)(usbdevice mouse)(device_model '/usr/lib64/xen/bin/qemu-dm')(vnc 1)))(device (vbd (dev 'ioemu:hda')(uname 'file:/root/foo.img')(mode 'w')))(device (vif (mac '00:16:3e:1b:b1:47')(bridge 'xenbr0')(script 'vif-bridge')(type ioemu))))
\ No newline at end of file
Index: tests/xml2sexprdata/xml2sexpr-fv-usbtablet.sexpr
===================================================================
RCS file: /data/cvs/libvirt/tests/xml2sexprdata/xml2sexpr-fv-usbtablet.sexpr,v
retrieving revision 1.1
diff -u -p -r1.1 xml2sexpr-fv-usbtablet.sexpr
--- tests/xml2sexprdata/xml2sexpr-fv-usbtablet.sexpr 18 Jul 2007 21:08:22 -0000 1.1
+++ tests/xml2sexprdata/xml2sexpr-fv-usbtablet.sexpr 3 Feb 2008 18:37:17 -0000
@@ -1 +1 @@
-(vm (name 'fvtest')(memory 400)(maxmem 400)(vcpus 1)(uuid 'b5d70dd275cdaca517769660b059d8bc')(on_poweroff 'destroy')(on_reboot 'restart')(on_crash 'restart')(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(device_model '/usr/lib64/xen/bin/qemu-dm')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(usb 1)(usbdevice tablet)(vnc 1)))(device (vbd (dev 'ioemu:hda')(uname 'file:/root/foo.img')(mode 'w')))(device (vif (mac '00:16:3e:1b:b1:47')(bridge 'xenbr0')(script 'vif-bridge')(type ioemu))))
\ No newline at end of file
+(vm (name 'fvtest')(memory 400)(maxmem 400)(vcpus 1)(uuid 'b5d70dd275cdaca517769660b059d8bc')(on_poweroff 'destroy')(on_reboot 'restart')(on_crash 'restart')(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(usb 1)(usbdevice tablet)(device_model '/usr/lib64/xen/bin/qemu-dm')(vnc 1)))(device (vbd (dev 'ioemu:hda')(uname 'file:/root/foo.img')(mode 'w')))(device (vif (mac '00:16:3e:1b:b1:47')(bridge 'xenbr0')(script 'vif-bridge')(type ioemu))))
\ No newline at end of file
Index: tests/xml2sexprdata/xml2sexpr-fv-utc.sexpr
===================================================================
RCS file: /data/cvs/libvirt/tests/xml2sexprdata/xml2sexpr-fv-utc.sexpr,v
retrieving revision 1.2
diff -u -p -r1.2 xml2sexpr-fv-utc.sexpr
--- tests/xml2sexprdata/xml2sexpr-fv-utc.sexpr 18 Jul 2007 21:08:22 -0000 1.2
+++ tests/xml2sexprdata/xml2sexpr-fv-utc.sexpr 3 Feb 2008 18:37:17 -0000
@@ -1 +1 @@
-(vm (name 'fvtest')(memory 400)(maxmem 400)(vcpus 1)(uuid 'b5d70dd275cdaca517769660b059d8bc')(on_poweroff 'destroy')(on_reboot 'restart')(on_crash 'restart')(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(device_model '/usr/lib64/xen/bin/qemu-dm')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(usb 1)(vnc 1)))(device (vbd (dev 'ioemu:hda')(uname 'file:/root/foo.img')(mode 'w')))(device (vif (mac '00:16:3e:1b:b1:47')(bridge 'xenbr0')(script 'vif-bridge')(type ioemu))))
\ No newline at end of file
+(vm (name 'fvtest')(memory 400)(maxmem 400)(vcpus 1)(uuid 'b5d70dd275cdaca517769660b059d8bc')(on_poweroff 'destroy')(on_reboot 'restart')(on_crash 'restart')(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(usb 1)(device_model '/usr/lib64/xen/bin/qemu-dm')(vnc 1)))(device (vbd (dev 'ioemu:hda')(uname 'file:/root/foo.img')(mode 'w')))(device (vif (mac '00:16:3e:1b:b1:47')(bridge 'xenbr0')(script 'vif-bridge')(type ioemu))))
\ No newline at end of file
Index: tests/xml2sexprdata/xml2sexpr-fv-v2.sexpr
===================================================================
RCS file: /data/cvs/libvirt/tests/xml2sexprdata/xml2sexpr-fv-v2.sexpr,v
retrieving revision 1.6
diff -u -p -r1.6 xml2sexpr-fv-v2.sexpr
--- tests/xml2sexprdata/xml2sexpr-fv-v2.sexpr 18 Jul 2007 21:08:22 -0000 1.6
+++ tests/xml2sexprdata/xml2sexpr-fv-v2.sexpr 3 Feb 2008 18:37:17 -0000
@@ -1 +1 @@
-(vm (name 'fvtest')(memory 400)(maxmem 400)(vcpus 1)(uuid 'b5d70dd275cdaca517769660b059d8bc')(on_poweroff 'destroy')(on_reboot 'restart')(on_crash 'restart')(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(device_model '/usr/lib64/xen/bin/qemu-dm')(vcpus 1)(boot c)(acpi 1)(usb 1)(vnc 1)(vncdisplay 17)(keymap ja)))(device (vbd (dev 'hdc:cdrom')(uname 'file:/root/boot.iso')(mode 'r')))(device (vbd (dev 'hda:disk')(uname 'file:/root/foo.img')(mode 'w')))(device (vif (mac '00:16:3e:1b:b1:47')(bridge 'xenbr0')(script 'vif-bridge')(type ioemu))))
\ No newline at end of file
+(vm (name 'fvtest')(memory 400)(maxmem 400)(vcpus 1)(uuid 'b5d70dd275cdaca517769660b059d8bc')(on_poweroff 'destroy')(on_reboot 'restart')(on_crash 'restart')(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(vcpus 1)(boot c)(acpi 1)(usb 1)(device_model '/usr/lib64/xen/bin/qemu-dm')(vnc 1)(vncdisplay 17)(keymap ja)))(device (vbd (dev 'hdc:cdrom')(uname 'file:/root/boot.iso')(mode 'r')))(device (vbd (dev 'hda:disk')(uname 'file:/root/foo.img')(mode 'w')))(device (vif (mac '00:16:3e:1b:b1:47')(bridge 'xenbr0')(script 'vif-bridge')(type ioemu))))
\ No newline at end of file
Index: tests/xml2sexprdata/xml2sexpr-fv-vncunused.sexpr
===================================================================
RCS file: /data/cvs/libvirt/tests/xml2sexprdata/xml2sexpr-fv-vncunused.sexpr,v
retrieving revision 1.5
diff -u -p -r1.5 xml2sexpr-fv-vncunused.sexpr
--- tests/xml2sexprdata/xml2sexpr-fv-vncunused.sexpr 18 Jul 2007 21:08:22 -0000 1.5
+++ tests/xml2sexprdata/xml2sexpr-fv-vncunused.sexpr 3 Feb 2008 18:37:17 -0000
@@ -1 +1 @@
-(vm (name 'fvtest')(memory 400)(maxmem 400)(vcpus 1)(uuid 'b5d70dd275cdaca517769660b059d8bc')(on_poweroff 'destroy')(on_reboot 'restart')(on_crash 'restart')(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(device_model '/usr/lib64/xen/bin/qemu-dm')(vcpus 1)(boot c)(acpi 1)(usb 1)(vnc 1)(vncunused 1)(keymap ja)))(device (vbd (dev 'hdc:cdrom')(uname 'file:/root/boot.iso')(mode 'r')))(device (vbd (dev 'hda:disk')(uname 'file:/root/foo.img')(mode 'w')))(device (vif (mac '00:16:3e:1b:b1:47')(bridge 'xenbr0')(script 'vif-bridge')(type ioemu))))
\ No newline at end of file
+(vm (name 'fvtest')(memory 400)(maxmem 400)(vcpus 1)(uuid 'b5d70dd275cdaca517769660b059d8bc')(on_poweroff 'destroy')(on_reboot 'restart')(on_crash 'restart')(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(vcpus 1)(boot c)(acpi 1)(usb 1)(device_model '/usr/lib64/xen/bin/qemu-dm')(vnc 1)(vncunused 1)(keymap ja)))(device (vbd (dev 'hdc:cdrom')(uname 'file:/root/boot.iso')(mode 'r')))(device (vbd (dev 'hda:disk')(uname 'file:/root/foo.img')(mode 'w')))(device (vif (mac '00:16:3e:1b:b1:47')(bridge 'xenbr0')(script 'vif-bridge')(type ioemu))))
\ No newline at end of file
Index: tests/xml2sexprdata/xml2sexpr-fv.sexpr
===================================================================
RCS file: /data/cvs/libvirt/tests/xml2sexprdata/xml2sexpr-fv.sexpr,v
retrieving revision 1.3
diff -u -p -r1.3 xml2sexpr-fv.sexpr
--- tests/xml2sexprdata/xml2sexpr-fv.sexpr 18 Jul 2007 21:08:22 -0000 1.3
+++ tests/xml2sexprdata/xml2sexpr-fv.sexpr 3 Feb 2008 18:37:17 -0000
@@ -1 +1 @@
-(vm (name 'fvtest')(memory 400)(maxmem 400)(vcpus 1)(uuid 'b5d70dd275cdaca517769660b059d8bc')(on_poweroff 'destroy')(on_reboot 'restart')(on_crash 'restart')(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(device_model '/usr/lib64/xen/bin/qemu-dm')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(usb 1)(vnc 1)))(device (vbd (dev 'ioemu:hda')(uname 'file:/root/foo.img')(mode 'w')))(device (vif (mac '00:16:3e:1b:b1:47')(bridge 'xenbr0')(script 'vif-bridge')(type ioemu))))
\ No newline at end of file
+(vm (name 'fvtest')(memory 400)(maxmem 400)(vcpus 1)(uuid 'b5d70dd275cdaca517769660b059d8bc')(on_poweroff 'destroy')(on_reboot 'restart')(on_crash 'restart')(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(vcpus 1)(boot c)(cdrom '/root/boot.iso')(acpi 1)(usb 1)(device_model '/usr/lib64/xen/bin/qemu-dm')(vnc 1)))(device (vbd (dev 'ioemu:hda')(uname 'file:/root/foo.img')(mode 'w')))(device (vif (mac '00:16:3e:1b:b1:47')(bridge 'xenbr0')(script 'vif-bridge')(type ioemu))))
\ No newline at end of file
Index: tests/xml2sexprdata/xml2sexpr-no-source-cdrom.sexpr
===================================================================
RCS file: /data/cvs/libvirt/tests/xml2sexprdata/xml2sexpr-no-source-cdrom.sexpr,v
retrieving revision 1.2
diff -u -p -r1.2 xml2sexpr-no-source-cdrom.sexpr
--- tests/xml2sexprdata/xml2sexpr-no-source-cdrom.sexpr 18 Jul 2007 21:08:22 -0000 1.2
+++ tests/xml2sexprdata/xml2sexpr-no-source-cdrom.sexpr 3 Feb 2008 18:37:17 -0000
@@ -1 +1 @@
-(vm (name 'test')(memory 350)(maxmem 382)(vcpus 1)(uuid 'cc2315e7d26a307a438c6d188ec4c09c')(on_poweroff 'destroy')(on_reboot 'destroy')(on_crash 'destroy')(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(device_model '/usr/lib/xen/bin/qemu-dm')(vcpus 1)(boot c)(acpi 1)(apic 1)(pae 1)(usb 1)(vnc 1)(vncdisplay 6)))(device (vbd (dev 'hda:disk:disk')(uname 'phy:/dev/sda8')(mode 'w')))(device (vbd (dev 'hdc:cdrom')(mode 'r')))(device (vif (mac '00:16:3e:0a:7b:39')(type ioemu))))
\ No newline at end of file
+(vm (name 'test')(memory 350)(maxmem 382)(vcpus 1)(uuid 'cc2315e7d26a307a438c6d188ec4c09c')(on_poweroff 'destroy')(on_reboot 'destroy')(on_crash 'destroy')(image (hvm (kernel '/usr/lib/xen/boot/hvmloader')(vcpus 1)(boot c)(acpi 1)(apic 1)(pae 1)(usb 1)(device_model '/usr/lib/xen/bin/qemu-dm')(vnc 1)(vncdisplay 6)))(device (vbd (dev 'hda:disk:disk')(uname 'phy:/dev/sda8')(mode 'w')))(device (vbd (dev 'hdc:cdrom')(mode 'r')))(device (vif (mac '00:16:3e:0a:7b:39')(type ioemu))))
\ No newline at end of file
--
|=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=|
|=- Perl modules: http://search.cpan.org/~danberr/ -=|
|=- Projects: http://freshmeat.net/~danielpb/ -=|
|=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|
16 years, 9 months
[Libvir] Not able to access the network.
by Spencer Parker
I have set up a machine using virsh, but I can't access it over the
network. It has valid IP and everything like that. It is all running
over eth1 and not eth0. Any idea as to why I can't get network access
on it? I have assigned it a valid bridge. I try to ping the IP I gave
it and I get nothing.
16 years, 9 months
[Libvir] [PATCH][Q] tbe ?
by Atsushi SAKAI
Sorry for sending typo patch again.
I want to know the word "tbe".
Are my fixes correct?
libvir.html | 4 ++--
storage.html | 22 +++++++++++-----------
2 files changed, 13 insertions(+), 13 deletions(-)
c.f.
An week ago, I see this word "tbe" in libvir.html
But it is difficult to find correct meaning.
Today I am reading the storage.html
and found the correct meaning.
Thanks
Atsushi SAKAI
16 years, 9 months
[Libvir] Trouble getting console
by Spencer Parker
I have setup a virtual machine, but am not able to connect to the
console for it. I type in virsh console <name> and it give me a new
line with no output...I hit enter a few time to see it kicks in, but
nothing. here is my xml file:
<domain type='xen'>
<name>test1</name>
<uuid>4dea22b31d52d8f32516782e98ab3fa0</uuid>
<os>
<type>hvm</type>
<loader>/usr/lib/xen/boot/hvmloader</loader>
<boot dev='hd'/>
</os>
<memory>262144</memory>
<vcpu>1</vcpu>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<features>
<pae/>
<acpi/>
<apic/>
</features>
<clock sync="localtime"/>
<devices>
<emulator>/usr/lib64/xen/bin/qemu-dm</emulator>
<interface type='bridge'>
<source bridge='xenbr1'/>
<script path='vif-bridge'/>
</interface>
<disk type='file' device='disk'>
<driver name='tap' type='aio'/>
<source file='/xen/domains2/spencertest2/disk.img'/>
<target dev='hda'/>
</disk>
<disk type='file' device='disk'>
<driver name='tap' type='aio'/>
<source file='/xen/domains2/spencertest2/swap.img'/>
<target dev='hdb'/>
</disk>
<graphics type='vnc' port='-1'/>
<console tty='/dev/pts/1'/>
</devices>
</domain>
16 years, 9 months