[libvirt] [PATCH 7/9] Improve debug logging of migration APIs

Daniel P. Berrange berrange at redhat.com
Tue May 24 14:47:47 UTC 2011


* src/libvirt.c: Add further debug lines in helper APIs for
  migration
* src/qemu/qemu_migration.c: Add debug lines for all internal
  migration API parameters
---
 src/libvirt.c             |   19 ++++++++++++++++-
 src/qemu/qemu_migration.c |   47 ++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 63 insertions(+), 3 deletions(-)

diff --git a/src/libvirt.c b/src/libvirt.c
index 4bdcd43..baff80b 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -3514,6 +3514,8 @@ virDomainMigrateVersion1 (virDomainPtr domain,
     char *cookie = NULL;
     int cookielen = 0, ret;
     virDomainInfo info;
+    VIR_DOMAIN_DEBUG(domain, "dconn=%p flags=%lu, dname=%s, uri=%s, bandwidth=%lu",
+                     dconn, flags, NULLSTR(dname), NULLSTR(uri), bandwidth);
 
     ret = virDomainGetInfo (domain, &info);
     if (ret == 0 && info.state == VIR_DOMAIN_PAUSED) {
@@ -3604,6 +3606,8 @@ virDomainMigrateVersion2 (virDomainPtr domain,
     virDomainInfo info;
     virErrorPtr orig_err = NULL;
     int cancelled;
+    VIR_DOMAIN_DEBUG(domain, "dconn=%p flags=%lu, dname=%s, uri=%s, bandwidth=%lu",
+                     dconn, flags, NULLSTR(dname), NULLSTR(uri), bandwidth);
 
     /* Prepare the migration.
      *
@@ -3637,7 +3641,7 @@ virDomainMigrateVersion2 (virDomainPtr domain,
         flags |= VIR_MIGRATE_PAUSED;
     }
 
-    VIR_DEBUG("Prepare2 %p", dconn);
+    VIR_DEBUG("Prepare2 %p flags=%lu", dconn, flags);
     ret = dconn->driver->domainMigratePrepare2
         (dconn, &cookie, &cookielen, uri, &uri_out, flags, dname,
          bandwidth, dom_xml);
@@ -3736,6 +3740,10 @@ virDomainMigrateVersion3(virDomainPtr domain,
     virDomainInfo info;
     virErrorPtr orig_err = NULL;
     int cancelled;
+    VIR_DOMAIN_DEBUG(domain, "dconn=%p xmlin=%s, flags=%lu, "
+                     "dname=%s, uri=%s, bandwidth=%lu",
+                     dconn, NULLSTR(xmlin), flags,
+                     NULLSTR(dname), NULLSTR(uri), bandwidth);
 
     if (!domain->conn->driver->domainMigrateBegin3 ||
         !domain->conn->driver->domainMigratePerform3 ||
@@ -3759,7 +3767,7 @@ virDomainMigrateVersion3(virDomainPtr domain,
         flags |= VIR_MIGRATE_PAUSED;
     }
 
-    VIR_DEBUG("Prepare3 %p", dconn);
+    VIR_DEBUG("Prepare3 %p flags=%lu", dconn, flags);
     cookiein = cookieout;
     cookieinlen = cookieoutlen;
     cookieout = NULL;
@@ -3883,6 +3891,10 @@ virDomainMigratePeer2Peer (virDomainPtr domain,
                            unsigned long bandwidth)
 {
     xmlURIPtr tempuri = NULL;
+    VIR_DOMAIN_DEBUG(domain, "xmlin=%s, flags=%lu, dname=%s, "
+                     "dconnuri=%s, uri=%s, bandwidth=%lu",
+                     NULLSTR(xmlin), flags, NULLSTR(dname),
+                     NULLSTR(dconnuri), NULLSTR(uri), bandwidth);
 
     if (!domain->conn->driver->domainMigratePerform) {
         virLibConnError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
@@ -3964,6 +3976,9 @@ virDomainMigrateDirect (virDomainPtr domain,
                         const char *uri,
                         unsigned long bandwidth)
 {
+    VIR_DOMAIN_DEBUG(domain, "xmlin=%s, flags=%lu, dname=%s, uri=%s, bandwidth=%lu",
+                     NULLSTR(xmlin), flags, NULLSTR(dname), NULLSTR(uri), bandwidth);
+
     if (!domain->conn->driver->domainMigratePerform) {
         virLibConnError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
         virDispatchError(domain->conn);
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 4388214..280b8cb 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -875,6 +875,8 @@ char *qemuMigrationBegin(struct qemud_driver *driver,
 {
     char *rv = NULL;
     qemuMigrationCookiePtr mig = NULL;
+    VIR_DEBUG("driver=%p, vm=%p, xmlin=%s, cookieout=%p, cookieoutlen=%p",
+              driver, vm, NULLSTR(xmlin), cookieout, cookieoutlen);
 
     if (xmlin) {
         qemuReportError(VIR_ERR_INTERNAL_ERROR,
@@ -935,6 +937,10 @@ qemuMigrationPrepareTunnel(struct qemud_driver *driver,
     qemuDomainObjPrivatePtr priv = NULL;
     struct timeval now;
     qemuMigrationCookiePtr mig = NULL;
+    VIR_DEBUG("driver=%p, dconn=%p, cookiein=%s, cookieinlen=%d, "
+              "cookieout=%p, cookieoutlen=%p, st=%p, dname=%s, dom_xml=%s",
+              driver, dconn, NULLSTR(cookiein), cookieinlen,
+              cookieout, cookieoutlen, st, NULLSTR(dname), dom_xml);
 
     if (gettimeofday(&now, NULL) < 0) {
         virReportSystemError(errno, "%s",
@@ -1090,6 +1096,12 @@ qemuMigrationPrepareDirect(struct qemud_driver *driver,
     qemuDomainObjPrivatePtr priv = NULL;
     struct timeval now;
     qemuMigrationCookiePtr mig = NULL;
+    VIR_DEBUG("driver=%p, dconn=%p, cookiein=%s, cookieinlen=%d, "
+              "cookieout=%p, cookieoutlen=%p, uri_in=%s, uri_out=%p, "
+              "dname=%s, dom_xml=%s",
+              driver, dconn, NULLSTR(cookiein), cookieinlen,
+              cookieout, cookieoutlen, NULLSTR(uri_in), uri_out,
+              NULLSTR(dname), dom_xml);
 
     if (gettimeofday(&now, NULL) < 0) {
         virReportSystemError(errno, "%s",
@@ -1292,6 +1304,10 @@ static int doNativeMigrate(struct qemud_driver *driver,
     qemuDomainObjPrivatePtr priv = vm->privateData;
     unsigned int background_flags = QEMU_MONITOR_MIGRATE_BACKGROUND;
     qemuMigrationCookiePtr mig = NULL;
+    VIR_DEBUG("driver=%p, vm=%p, uri=%s, cookiein=%s, cookieinlen=%d, "
+              "cookieout=%p, cookieoutlen=%p, flags=%u, dname=%s, resource=%lu",
+              driver, vm, uri, NULLSTR(cookiein), cookieinlen,
+              cookieout, cookieoutlen, flags, dname, resource);
 
     if (!(mig = qemuMigrationEatCookie(vm, cookiein, cookieinlen,
                                        QEMU_MIGRATION_COOKIE_GRAPHICS)))
@@ -1485,6 +1501,10 @@ static int doTunnelMigrate(struct qemud_driver *driver,
     int ret = -1;
     qemuMigrationCookiePtr mig = NULL;
     qemuMigrationIOThreadPtr iothread = NULL;
+    VIR_DEBUG("driver=%p, vm=%p, st=%p, cookiein=%s, cookieinlen=%d, "
+              "cookieout=%p, cookieoutlen=%p, flags=%lu, resource=%lu",
+              driver, vm, st, NULLSTR(cookiein), cookieinlen,
+              cookieout, cookieoutlen, flags, resource);
 
     if (!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATE_QEMU_UNIX) &&
         !qemuCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATE_QEMU_EXEC)) {
@@ -1685,6 +1705,10 @@ static int doPeer2PeerMigrate2(struct qemud_driver *driver,
     virErrorPtr orig_err = NULL;
     int cancelled;
     virStreamPtr st = NULL;
+    VIR_DEBUG("driver=%p, sconn=%p, dconn=%p, vm=%p, dconnuri=%s, "
+              "flags=%lu, dname=%s, resource=%lu",
+              driver, sconn, dconn, vm, NULLSTR(dconnuri),
+              flags, dname, resource);
 
     /* In version 2 of the protocol, the prepare step is slightly
      * different.  We fetch the domain XML of the source domain
@@ -1824,8 +1848,11 @@ static int doPeer2PeerMigrate3(struct qemud_driver *driver,
     virErrorPtr orig_err = NULL;
     int cancelled;
     virStreamPtr st = NULL;
+    VIR_DEBUG("driver=%p, sconn=%p, dconn=%p, vm=%p, xmlin=%s, "
+              "dconnuri=%s, uri=%s, flags=%lu, dname=%s, resource=%lu",
+              driver, sconn, dconn, vm, NULLSTR(xmlin),
+              NULLSTR(dconnuri), NULLSTR(uri), flags, dname, resource);
 
-    VIR_DEBUG("Begin3 %p", sconn);
     dom_xml = qemuMigrationBegin(driver, vm, xmlin,
                                  &cookieout, &cookieoutlen);
     if (!dom_xml)
@@ -1983,6 +2010,10 @@ static int doPeer2PeerMigrate(struct qemud_driver *driver,
     virConnectPtr dconn = NULL;
     bool p2p;
     bool v3;
+    VIR_DEBUG("driver=%p, sconn=%p, vm=%p, xmlin=%s, dconnuri=%s, "
+              "uri=%s, flags=%lu, dname=%s, resource=%lu",
+              driver, sconn, vm, NULLSTR(xmlin), NULLSTR(dconnuri),
+              NULLSTR(uri), flags, dname, resource);
 
     /* the order of operations is important here; we make sure the
      * destination side is completely setup before we touch the source
@@ -2053,6 +2084,12 @@ int qemuMigrationPerform(struct qemud_driver *driver,
     int ret = -1;
     int resume = 0;
     qemuDomainObjPrivatePtr priv = vm->privateData;
+    VIR_DEBUG("driver=%p, conn=%p, vm=%p, xmlin=%s, dconnuri=%s, "
+              "uri=%s, cookiein=%s, cookieinlen=%d, cookieout=%p, "
+              "cookieoutlen=%p, flags=%lu, dname=%s, resource=%lu, v3proto=%d",
+              driver, conn, vm, NULLSTR(xmlin), NULLSTR(dconnuri),
+              NULLSTR(uri), NULLSTR(cookiein), cookieinlen,
+              cookieout, cookieoutlen, flags, dname, resource, v3proto);
 
     if (qemuDomainObjBeginJobWithDriver(driver, vm) < 0)
         goto cleanup;
@@ -2206,6 +2243,10 @@ qemuMigrationFinish(struct qemud_driver *driver,
     int newVM = 1;
     qemuDomainObjPrivatePtr priv = NULL;
     qemuMigrationCookiePtr mig = NULL;
+    VIR_DEBUG("driver=%p, dconn=%p, vm=%p, cookiein=%s, cookieinlen=%d, "
+              "cookieout=%p, cookieoutlen=%p, flags=%lu, retcode=%d",
+              driver, dconn, vm, NULLSTR(cookiein), cookieinlen,
+              cookieout, cookieoutlen, flags, retcode);
 
     priv = vm->privateData;
     if (priv->jobActive != QEMU_JOB_MIGRATION_IN) {
@@ -2356,6 +2397,10 @@ int qemuMigrationConfirm(struct qemud_driver *driver,
     qemuMigrationCookiePtr mig;
     virDomainEventPtr event = NULL;
     int rv = -1;
+    VIR_DEBUG("driver=%p, conn=%p, vm=%p, cookiein=%s, cookieinlen=%d, "
+              "flags=%u, retcode=%d",
+              driver, conn, vm, NULLSTR(cookiein), cookieinlen,
+              flags, retcode);
 
     if (!(mig = qemuMigrationEatCookie(vm, cookiein, cookieinlen, 0)))
         return -1;
-- 
1.7.4.4




More information about the libvir-list mailing list