[libvirt] virDomainDefineXML forbidden for read only access
by Kenneth Nagin
I am running an application that invokes the java method
virDomainDefineXML. But virDomainDefineXML is throwing the exception
"forbidden for read only access". I'm running as root. I can
successfully define domain xml and create VMs with virsh.
Any suggestion of what I am do wrong?
Exception details:
exception caught:org.libvirt.LibvirtException: operation virDomainDefineXML
forbidden for read only access
level:VIR_ERR_ERROR
code:VIR_ERR_OPERATION_DENIED
domain:VIR_FROM_NONE
hasConn:false
hasDom:false
hasNet:false
message:operation virDomainDefineXML forbidden for read only access
str1:operation %s forbidden for read only access
str2:virDomainDefineXML
str3:null
int1:0
int2:0
Kenneth Nagin
15 years, 5 months
[libvirt] [PATCH] Add virsh commands for virInterface* functions.
by Laine Stump
I think this is complete (can't really try it out until the test
driver is running), but have a few questions about it:
1) Does the command set look complete?
2) Do you agree with the naming (using "if-", and following the
libvirt convention for if-create/if-destroy, rather than the fedora
convention (if-up/if-down)?
3) I'm all for eliminating unnecessary copy/paste in code, but the way
that cmdNetworkEdit() and cmdPoolEdit() are created (by
awking/seding virsh.c to create a modified version of the cmdEdit
function that lives in a separate .c which is #included by virsh.c)
seems just a bit convoluted to me. I've made it one step worse for
cmdInterfaceEdit because virInterfaceDefineXML has an extra
argument (flags) that virDomainDefineXML doesn't. What are your
opinions? Should I continue on in the tradition for consistency's
sake (as I've done in this patch), or manually put
cmdInterfaceEdit() directly into virsh.c?
---
src/Makefile.am | 18 +++-
src/virsh.c | 398 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 414 insertions(+), 2 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index d4f7ea1..7601611 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -585,7 +585,7 @@ virsh_LDADD = \
../gnulib/lib/libgnu.la \
$(VIRSH_LIBS)
virsh_CFLAGS = $(COVERAGE_CFLAGS) $(READLINE_CFLAGS) $(NUMACTL_CFLAGS)
-BUILT_SOURCES = virsh-net-edit.c virsh-pool-edit.c libvirt.syms
+BUILT_SOURCES = virsh-net-edit.c virsh-if-edit.c virsh-pool-edit.c libvirt.syms
virsh-net-edit.c: virsh.c Makefile.am
rm -f $@-tmp
@@ -602,6 +602,22 @@ virsh-net-edit.c: virsh.c Makefile.am
rm -f $@
mv $@-tmp $@
+virsh-if-edit.c: virsh.c Makefile.am
+ rm -f $@-tmp
+ echo '/* Automatically generated from: $^ */' > $@-tmp
+ echo 'static int' >> $@-tmp
+ awk '/^cmdEdit/, /^}/' $< \
+ | sed -e 's/domain/interface/g' \
+ -e 's/Domain/Interface/g' \
+ -e 's/cmdEdit/cmdInterfaceEdit/g' \
+ -e 's/dom/iface/g' \
+ -e 's/int flags.*/int flags = 0;/g' \
+ -e 's/DefineXML\(.*\))/DefineXML\1, 0)/' \
+ >> $@-tmp
+ chmod a-w $@-tmp
+ rm -f $@
+ mv $@-tmp $@
+
virsh-pool-edit.c: virsh.c Makefile.am
rm -f $@-tmp
echo '/* Automatically generated from: $^ */' > $@-tmp
diff --git a/src/virsh.c b/src/virsh.c
index f5248d9..6fd090c 100644
--- a/src/virsh.c
+++ b/src/virsh.c
@@ -228,6 +228,7 @@ static int vshCommandOptBool(const vshCmd *cmd, const char *name);
#define VSH_BYID (1 << 1)
#define VSH_BYUUID (1 << 2)
#define VSH_BYNAME (1 << 3)
+#define VSH_BYMAC (1 << 4)
static virDomainPtr vshCommandOptDomainBy(vshControl *ctl, const vshCmd *cmd,
char **name, int flag);
@@ -244,6 +245,14 @@ static virNetworkPtr vshCommandOptNetworkBy(vshControl *ctl, const vshCmd *cmd,
vshCommandOptNetworkBy(_ctl, _cmd, _name, \
VSH_BYUUID|VSH_BYNAME)
+static virInterfacePtr vshCommandOptInterfaceBy(vshControl *ctl, const vshCmd *cmd,
+ char **name, int flag);
+
+/* default is lookup by Name and MAC */
+#define vshCommandOptInterface(_ctl, _cmd, _name) \
+ vshCommandOptInterfaceBy(_ctl, _cmd, _name, \
+ VSH_BYMAC|VSH_BYNAME)
+
static virStoragePoolPtr vshCommandOptPoolBy(vshControl *ctl, const vshCmd *cmd,
const char *optname, char **name, int flag);
@@ -2955,6 +2964,325 @@ cmdNetworkUuid(vshControl *ctl, const vshCmd *cmd)
}
+/**************************************************************************/
+/*
+ * "if-list" command
+ */
+static const vshCmdInfo info_interface_list[] = {
+ {"help", gettext_noop("list physical host interfaces")},
+ {"desc", gettext_noop("Returns list of physical host interfaces.")},
+ {NULL, NULL}
+};
+
+static int
+cmdInterfaceList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
+{
+ int ifCount = 0, i;
+ char **ifNames = NULL;
+
+ if (!vshConnectionUsability(ctl, ctl->conn, TRUE))
+ return FALSE;
+
+ ifCount = virConnectNumOfInterfaces(ctl->conn);
+ if (ifCount < 0) {
+ vshError(ctl, FALSE, "%s", _("Failed to list interfaces"));
+ return FALSE;
+ }
+ if (ifCount) {
+ ifNames = vshMalloc(ctl, sizeof(char *) * ifCount);
+
+ if ((ifCount = virConnectListInterfaces(ctl->conn,
+ ifNames, ifCount)) < 0) {
+ vshError(ctl, FALSE, "%s", _("Failed to list interfaces"));
+ free(ifNames);
+ return FALSE;
+ }
+
+ qsort(&ifNames[0], ifCount, sizeof(char *), namesorter);
+ }
+
+ vshPrintExtra(ctl, "%-20s %-30s\n", _("Name"), _("MAC Address"));
+ vshPrintExtra(ctl, "--------------------------------------------------\n");
+
+ for (i = 0; i < ifCount; i++) {
+ virInterfacePtr iface = virInterfaceLookupByName(ctl->conn, ifNames[i]);
+
+ /* this kind of work with interfaces is not atomic operation */
+ if (!iface) {
+ free(ifNames[i]);
+ continue;
+ }
+
+ vshPrint(ctl, "%-20s %-30s\n",
+ virInterfaceGetName(iface),
+ virInterfaceGetMACString(iface));
+ virInterfaceFree(iface);
+ free(ifNames[i]);
+ }
+ free(ifNames);
+ return TRUE;
+}
+
+/*
+ * "if-name" command
+ */
+static const vshCmdInfo info_interface_name[] = {
+ {"help", gettext_noop("convert an interface MAC address to interface name")},
+ {"desc", ""},
+ {NULL, NULL}
+};
+
+static const vshCmdOptDef opts_interface_name[] = {
+ {"interface", VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop("interface mac")},
+ {NULL, 0, 0, NULL}
+};
+
+static int
+cmdInterfaceName(vshControl *ctl, const vshCmd *cmd)
+{
+ virInterfacePtr iface;
+
+ if (!vshConnectionUsability(ctl, ctl->conn, TRUE))
+ return FALSE;
+ if (!(iface = vshCommandOptInterfaceBy(ctl, cmd, NULL,
+ VSH_BYMAC)))
+ return FALSE;
+
+ vshPrint(ctl, "%s\n", virInterfaceGetName(iface));
+ virInterfaceFree(iface);
+ return TRUE;
+}
+
+/*
+ * "if-mac" command
+ */
+static const vshCmdInfo info_interface_mac[] = {
+ {"help", gettext_noop("convert an interface name to interface MAC address")},
+ {"desc", ""},
+ {NULL, NULL}
+};
+
+static const vshCmdOptDef opts_interface_mac[] = {
+ {"interface", VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop("interface name")},
+ {NULL, 0, 0, NULL}
+};
+
+static int
+cmdInterfaceMAC(vshControl *ctl, const vshCmd *cmd)
+{
+ virInterfacePtr iface;
+
+ if (!vshConnectionUsability(ctl, ctl->conn, TRUE))
+ return FALSE;
+ if (!(iface = vshCommandOptInterfaceBy(ctl, cmd, NULL,
+ VSH_BYNAME)))
+ return FALSE;
+
+ vshPrint(ctl, "%s\n", virInterfaceGetMACString(iface));
+ virInterfaceFree(iface);
+ return TRUE;
+}
+
+/*
+ * "if-dumpxml" command
+ */
+static const vshCmdInfo info_interface_dumpxml[] = {
+ {"help", gettext_noop("interface information in XML")},
+ {"desc", gettext_noop("Output the physical host interface information as an XML dump to stdout.")},
+ {NULL, NULL}
+};
+
+static const vshCmdOptDef opts_interface_dumpxml[] = {
+ {"interface", VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop("interface name or MAC address")},
+ {NULL, 0, 0, NULL}
+};
+
+static int
+cmdInterfaceDumpXML(vshControl *ctl, const vshCmd *cmd)
+{
+ virInterfacePtr iface;
+ int ret = TRUE;
+ char *dump;
+
+ if (!vshConnectionUsability(ctl, ctl->conn, TRUE))
+ return FALSE;
+
+ if (!(iface = vshCommandOptInterface(ctl, cmd, NULL)))
+ return FALSE;
+
+ dump = virInterfaceGetXMLDesc(iface, 0);
+ if (dump != NULL) {
+ printf("%s", dump);
+ free(dump);
+ } else {
+ ret = FALSE;
+ }
+
+ virInterfaceFree(iface);
+ return ret;
+}
+
+/*
+ * "if-define" command
+ */
+static const vshCmdInfo info_interface_define[] = {
+ {"help", gettext_noop("define (but don't start) a physical host interface from an XML file")},
+ {"desc", gettext_noop("Define a physical host interface.")},
+ {NULL, NULL}
+};
+
+static const vshCmdOptDef opts_interface_define[] = {
+ {"file", VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop("file containing an XML interface description")},
+ {NULL, 0, 0, NULL}
+};
+
+static int
+cmdInterfaceDefine(vshControl *ctl, const vshCmd *cmd)
+{
+ virInterfacePtr interface;
+ char *from;
+ int found;
+ int ret = TRUE;
+ char *buffer;
+
+ if (!vshConnectionUsability(ctl, ctl->conn, TRUE))
+ return FALSE;
+
+ from = vshCommandOptString(cmd, "file", &found);
+ if (!found)
+ return FALSE;
+
+ if (virFileReadAll(from, VIRSH_MAX_XML_FILE, &buffer) < 0)
+ return FALSE;
+
+ interface = virInterfaceDefineXML(ctl->conn, buffer, 0);
+ free (buffer);
+
+ if (interface != NULL) {
+ vshPrint(ctl, _("Interface %s defined from %s\n"),
+ virInterfaceGetName(interface), from);
+ } else {
+ vshError(ctl, FALSE, _("Failed to define interface from %s"), from);
+ ret = FALSE;
+ }
+ return ret;
+}
+
+/*
+ * "if-undefine" command
+ */
+static const vshCmdInfo info_interface_undefine[] = {
+ {"help", gettext_noop("undefine a physical host interface (remove it from configuration)")},
+ {"desc", gettext_noop("undefine an interface.")},
+ {NULL, NULL}
+};
+
+static const vshCmdOptDef opts_interface_undefine[] = {
+ {"interface", VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop("interface name or MAC address")},
+ {NULL, 0, 0, NULL}
+};
+
+static int
+cmdInterfaceUndefine(vshControl *ctl, const vshCmd *cmd)
+{
+ virInterfacePtr iface;
+ int ret = TRUE;
+ char *name;
+
+ if (!vshConnectionUsability(ctl, ctl->conn, TRUE))
+ return FALSE;
+
+ if (!(iface = vshCommandOptInterface(ctl, cmd, &name)))
+ return FALSE;
+
+ if (virInterfaceUndefine(iface) == 0) {
+ vshPrint(ctl, _("Interface %s undefined\n"), name);
+ } else {
+ vshError(ctl, FALSE, _("Failed to undefine interface %s"), name);
+ ret = FALSE;
+ }
+
+ virInterfaceFree(iface);
+ return ret;
+}
+
+/*
+ * "if-create" command
+ */
+static const vshCmdInfo info_interface_create[] = {
+ {"help", gettext_noop("create a physical host interface (enable it / \"if-up\")")},
+ {"desc", gettext_noop("create a physical host interface.")},
+ {NULL, NULL}
+};
+
+static const vshCmdOptDef opts_interface_create[] = {
+ {"interface", VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop("interface name or MAC address")},
+ {NULL, 0, 0, NULL}
+};
+
+static int
+cmdInterfaceCreate(vshControl *ctl, const vshCmd *cmd)
+{
+ virInterfacePtr iface;
+ int ret = TRUE;
+ char *name;
+
+ if (!vshConnectionUsability(ctl, ctl->conn, TRUE))
+ return FALSE;
+
+ if (!(iface = vshCommandOptInterface(ctl, cmd, &name)))
+ return FALSE;
+
+ if (virInterfaceCreate(iface, 0) == 0) {
+ vshPrint(ctl, _("Interface %s created\n"), name);
+ } else {
+ vshError(ctl, FALSE, _("Failed to create interface %s"), name);
+ ret = FALSE;
+ }
+
+ virInterfaceFree(iface);
+ return ret;
+}
+
+/*
+ * "if-destroy" command
+ */
+static const vshCmdInfo info_interface_destroy[] = {
+ {"help", gettext_noop("destroy a physical host interface (disable it / \"if-down\")")},
+ {"desc", gettext_noop("destroy a physical host interface.")},
+ {NULL, NULL}
+};
+
+static const vshCmdOptDef opts_interface_destroy[] = {
+ {"interface", VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop("interface name or MAC address")},
+ {NULL, 0, 0, NULL}
+};
+
+static int
+cmdInterfaceDestroy(vshControl *ctl, const vshCmd *cmd)
+{
+ virInterfacePtr iface;
+ int ret = TRUE;
+ char *name;
+
+ if (!vshConnectionUsability(ctl, ctl->conn, TRUE))
+ return FALSE;
+
+ if (!(iface = vshCommandOptInterface(ctl, cmd, &name)))
+ return FALSE;
+
+ if (virInterfaceDestroy(iface, 0) == 0) {
+ vshPrint(ctl, _("Interface %s destroyed\n"), name);
+ } else {
+ vshError(ctl, FALSE, _("Failed to destroy interface %s"), name);
+ ret = FALSE;
+ }
+
+ virInterfaceFree(iface);
+ return ret;
+}
+
+/**************************************************************************/
/*
* "pool-autostart" command
*/
@@ -6059,7 +6387,7 @@ static const vshCmdOptDef opts_edit[] = {
};
/* This function also acts as a template to generate cmdNetworkEdit
- * and cmdPoolEdit functions (below) using a sed script in the Makefile.
+ * cmdInterfaceEdit and cmdPoolEdit functions (below) using a sed script in the Makefile.
*/
static int
cmdEdit (vshControl *ctl, const vshCmd *cmd)
@@ -6165,6 +6493,23 @@ static const vshCmdOptDef opts_network_edit[] = {
#include "virsh-net-edit.c"
/*
+ * "if-edit" command
+ */
+static const vshCmdInfo info_interface_edit[] = {
+ {"help", gettext_noop("edit XML configuration for a physical host interface")},
+ {"desc", gettext_noop("Edit the XML configuration for a physical host interface.")},
+ {NULL, NULL}
+};
+
+static const vshCmdOptDef opts_interface_edit[] = {
+ {"interface", VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop("interface name or MAC address")},
+ {NULL, 0, 0, NULL}
+};
+
+/* This is generated from this file by a sed script in the Makefile. */
+#include "virsh-if-edit.c"
+
+/*
* "pool-edit" command
*/
static const vshCmdInfo info_pool_edit[] = {
@@ -6247,6 +6592,17 @@ static const vshCmdDef commands[] = {
{"net-start", cmdNetworkStart, opts_network_start, info_network_start},
{"net-undefine", cmdNetworkUndefine, opts_network_undefine, info_network_undefine},
{"net-uuid", cmdNetworkUuid, opts_network_uuid, info_network_uuid},
+
+ {"if-list", cmdInterfaceList, NULL, info_interface_list},
+ {"if-name", cmdInterfaceName, opts_interface_name, info_interface_name},
+ {"if-mac", cmdInterfaceMAC, opts_interface_mac, info_interface_mac},
+ {"if-dumpxml", cmdInterfaceDumpXML, opts_interface_dumpxml, info_interface_dumpxml},
+ {"if-define", cmdInterfaceDefine, opts_interface_define, info_interface_define},
+ {"if-undefine", cmdInterfaceUndefine, opts_interface_undefine, info_interface_undefine},
+ {"if-edit", cmdInterfaceEdit, opts_interface_edit, info_interface_edit},
+ {"if-create", cmdInterfaceCreate, opts_interface_create, info_interface_create},
+ {"if-destroy", cmdInterfaceDestroy, opts_interface_destroy, info_interface_destroy},
+
{"nodeinfo", cmdNodeinfo, NULL, info_nodeinfo},
{"nodedev-list", cmdNodeListDevices, opts_node_list_devices, info_node_list_devices},
@@ -6698,6 +7054,46 @@ vshCommandOptNetworkBy(vshControl *ctl, const vshCmd *cmd,
return network;
}
+static virInterfacePtr
+vshCommandOptInterfaceBy(vshControl *ctl, const vshCmd *cmd,
+ char **name, int flag)
+{
+ virInterfacePtr iface = NULL;
+ char *n;
+ const char *optname = "interface";
+ if (!cmd_has_option (ctl, cmd, optname))
+ return NULL;
+
+ if (!(n = vshCommandOptString(cmd, optname, NULL))) {
+ vshError(ctl, FALSE, "%s", _("undefined interface identifier"));
+ return NULL;
+ }
+
+ vshDebug(ctl, 5, "%s: found option <%s>: %s\n",
+ cmd->def->name, optname, n);
+
+ if (name)
+ *name = n;
+
+ /* try it by MAC */
+ if ((iface == NULL) && (flag & VSH_BYMAC)) {
+ vshDebug(ctl, 5, "%s: <%s> trying as interface MAC\n",
+ cmd->def->name, optname);
+ iface = virInterfaceLookupByMACString(ctl->conn, n);
+ }
+ /* try it by NAME */
+ if ((iface == NULL) && (flag & VSH_BYNAME)) {
+ vshDebug(ctl, 5, "%s: <%s> trying as interface NAME\n",
+ cmd->def->name, optname);
+ iface = virInterfaceLookupByName(ctl->conn, n);
+ }
+
+ if (!iface)
+ vshError(ctl, FALSE, _("failed to get interface '%s'"), n);
+
+ return iface;
+}
+
static virStoragePoolPtr
vshCommandOptPoolBy(vshControl *ctl, const vshCmd *cmd, const char *optname,
char **name, int flag)
--
1.6.0.6
15 years, 5 months
[libvirt] getFreeMemory reporting incorrectly?
by Hany Fahim
Hi,
I'm currently running 2 CentOS 5.3 systems, one running Xen 3.3 and libvirt
0.6.4 (called node1) and the other running Xen 3.0.3 (stock CentOS) and
libvirt 0.6.4 (called node2). The machines are practically identical except
for the upgraded Xen installation. When using the libvirt-python module, I'm
getting strange values from getFreeMemory() on the Xen 3.3 machine. See
below:
Xen 3.0.3:
[root@node2 ~]# python
Python 2.4.3 (#1, Jan 21 2009, 01:10:13)
[GCC 4.1.2 20071124 (Red Hat 4.1.2-42)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import libvirt
>>> conn = libvirt.open('xen:///')
>>> print(conn.getFreeMemory())
268959744
>>>
Which is correct since there's approximately 256MB free. Now in the Xen 3.3
box:
Xen 3.3:
[root@node1 ~]# python
Python 2.4.3 (#1, Jan 21 2009, 01:10:13)
[GCC 4.1.2 20071124 (Red Hat 4.1.2-42)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import libvirt
>>> conn = libvirt.open('xen:///')
>>> print(conn.getFreeMemory())
576460752303423488
>>>
node1 should actually be reporting 0MB free, but instead I'm getting this
huge number. It would be nice if I had this much memory though... Anybody
else run into this?
Hany
15 years, 5 months
[libvirt] attach-disk (cdrom) requirements
by Francesco Latino
Hello,
if the guest is powered off and I run the following command to attach a
CD-ROM
virsh attach-disk QEmu-fedora-i686-3 myCDROM.iso hdc --driver file --type
cdrom --mode readonly
I got error:
libvir: QEMU error : internal error cannot attach device on inactive domain
Is it a requirement to have the guest running to attach a CDROM ?
Is there a way to attache a CDROM to a guest powered off with VIRSH
I have
Compiled against library: libvir 0.6.0
Using library: libvir 0.6.0
Using API: QEMU 0.6.0
Running hypervisor: QEMU 0.10.0
Consider that the above command works if the guest is running.
Thanks in advance,
Francesco
15 years, 5 months
[libvirt] [PATCH] [v2] Support kvm-img or qemu-img dynamically
by Doug Goldstein
This patch adds a new function virFindFileInPath() and uses it to find
where a binary lives in the PATH environment variable. Using this, we
can dynamically find where utility functions exist (and if they even
exists). So such we remove the build-time check for qemu-img and make it
dynamic for kvm-img and qemu-img. Several distros uses kvm-img over
qemu-img when installing KVM. kvm-img also includes several patches
which Red Hat is trying to upstream with QEMU so this patch supports
those features which are commented out in libvirt when using kvm-img
Signed-off-by: Doug Goldstein <cardoe(a)gentoo.org>
---
configure.in | 15 ---------
src/libvirt_private.syms | 1 +
src/storage_backend_fs.c | 76 ++++++++++++++++++++++++++++++++-------------
src/util.c | 28 +++++++++++++++++
src/util.h | 2 +
5 files changed, 85 insertions(+), 37 deletions(-)
15 years, 5 months
[libvirt] Vserver driver patch for libvirt
by Ajay EP
Hi,
I was looking at Daniels patch for integrating Vserver driver in libvirt
long back in 2007 . Checking libvirt-0.6.4 I find that its not yet
integrated. Is there any issues if I apply the patch to libvirt-0.6.4 &
try using the Vserver driver ?
Also will the below commands work straightforward ? As I new to libvirt ,
any pointers in understanding the support of Vserver on Libvirt is
appreciated
virsh --create ( i dont know if this command is supported)
virsh --connect vserver:/// define v1.xml
Thanks,
Ajay
______________________________________________________________________
15 years, 5 months
[Libvirt] SSH with certificates
by Christian Weyermann
Hello everybody,
We are trying to use libvirt with qemu over ssh and our goal is to have
authentication done by certificates. Therefore I created a keypair on
the client and send the public key to the server. Std. SSH connections
work without an password prompt as expected (ssh <ip> -l user), but if I
try "sudo virsh -c qemu+ssh://user@<ip>/system" it prompts for a
password (Beside that password prompt it works as expected).
Is there anything else I have to do beside registering the public key at
the server?
Thanks for your help and best regards,
Christian
15 years, 5 months
[libvirt] qemu-kvm-0.10.5, kvm-kmod-2.6.30, libvirt-0.6.4 - save/restore still unreliable
by Nikola Ciprich
Hi,
I'm very sorry for crossposting, but I'm not sure whether my problem
is related to libvirt or kvm itself.
I've spent some time testing save/restore and it seems it's still not
really reliable. Starting guest, loading it with some applications
(ie kernel compilation) and saving/restoring it for few times usually leads to error:
[root@vbox4 hibernated]# virsh save vmroo55 /home/LVS/hibernated/vmroo55.vm
Domain vmroo55 saved to /home/LVS/hibernated/vmroo55.vm
[root@vbox4 hibernated]# virsh restore /home/LVS/hibernated/vmroo55.vm
Domain restored from /home/LVS/hibernated/vmroo55.vm
[root@vbox4 hibernated]# virsh save vmroo55 /home/LVS/hibernated/vmroo55.vm
Domain vmroo55 saved to /home/LVS/hibernated/vmroo55.vm
[root@vbox4 hibernated]# virsh restore /home/LVS/hibernated/vmroo55.vm
error: Failed to restore domain from /home/LVS/hibernated/vmroo55.vm
error: internal error unable to start guest: char device redirected to /dev/pts/2
in /var/log/messages, i see:
Jun 12 15:18:30 vbox4 libvirtd: 15:18:30.793: error : qemudReadMonitorOutput:696 : internal error Timed out while reading monitor startup output
Jun 12 15:18:30 vbox4 libvirtd: 15:18:30.820: error : qemudWaitForMonitor:994 : internal error unable to start guest: char device redirected to /dev/pts/2
/var/log/libvirt/vmroo55.log:
LC_ALL=C PATH=/sbin:/usr/sbin:/bin:/usr/bin HOME=/ /usr/bin/qemu-kvm -S -M pc -m 768 -smp 2 -name vmroo55 -uuid 987e7a85-0e15-11de-a522-00304892f672 -monitor pty -boot c -kernel /home/LVS/boot/vmlinuz-2.6.29lb.00_01_PRE14-x86_64 -initrd /home/LVS/boot/kvm-initrd-2.6.29lb.00_01_PRE14-x86_64.cpio.gz -append root=/dev/sda ro vmhostname=vmroo55 -drive file=/dev/vgshared/vmroo55-1,if=ide,index=0,boot=on -drive file=/dev/vgshared/vmroo55-2,if=ide,index=1 -drive file=/dev/vgshared/vmroo55-3,if=virtio,index=0 -net nic,macaddr=00:16:3e:18:37:00,vlan=0,model=virtio -net tap,fd=15,vlan=0 -serial none -parallel none -usb -vnc 0.0.0.0:24155 -incoming exec:cat
char device redirected to /dev/pts/2
qemu_popen: returning result of qemu_fopen_ops
qemu_popen: returning result of qemu_fopen_ops
I wanted to try it using just kvm, but for some reason, I can't figure the proper way to execute it, is the
-incoming exec:cat somewhere properly documented? I tried doing cat .../img.vm | qemu-kvm ... -incoming exec:cat
but this doesn't seem to be the proper way.
Could somebody give me a hint on how to debug this?
thanks a lot in advance!
nik
--
-------------------------------------
Nikola CIPRICH
LinuxBox.cz, s.r.o.
28. rijna 168, 709 01 Ostrava
tel.: +420 596 603 142
fax: +420 596 621 273
mobil: +420 777 093 799
www.linuxbox.cz
mobil servis: +420 737 238 656
email servis: servis(a)linuxbox.cz
-------------------------------------
15 years, 5 months