ia64/xen-unstable

changeset 1745:3000423a41b1

bitkeeper revision 1.1062.3.3 (40f2a968LOQj8mvu9q6Hipqs_GOEIQ)

Small fixes.
author mjw@wray-m-3.hpl.hp.com
date Mon Jul 12 15:08:24 2004 +0000 (2004-07-12)
parents afd530477bfd
children 2f1d50d10f6f
files tools/python/xen/xend/XendMigrate.py tools/xfrd/xen_domain.c tools/xfrd/xfrd.c
line diff
     1.1 --- a/tools/python/xen/xend/XendMigrate.py	Mon Jul 12 14:24:09 2004 +0000
     1.2 +++ b/tools/python/xen/xend/XendMigrate.py	Mon Jul 12 15:08:24 2004 +0000
     1.3 @@ -50,7 +50,7 @@ class Xfrd(Protocol):
     1.4          self.parser.input(data)
     1.5          if self.parser.ready():
     1.6              val = self.parser.get_val()
     1.7 -            self.xinfo.dispatch(val)
     1.8 +            self.xinfo.dispatch(self, val)
     1.9          if self.parser.at_eof():
    1.10              self.loseConnection()
    1.11              
    1.12 @@ -122,9 +122,9 @@ class XfrdInfo:
    1.13          # If we get an error with non-zero code the operation failed.
    1.14          # An error with code zero indicates hello success.
    1.15          print 'xfr_err>', val
    1.16 -        v = sxp.child(val)
    1.17 +        v = sxp.child0(val)
    1.18          print 'xfr_err>', type(v), v
    1.19 -        err = int(sxp.child(val))
    1.20 +        err = int(sxp.child0(val))
    1.21          if not err: return
    1.22          self.error(err);
    1.23          xfrd.loseConnection()
    1.24 @@ -169,9 +169,9 @@ class XendMigrateInfo(XfrdInfo):
    1.25      """Representation of a migrate in-progress and its interaction with xfrd.
    1.26      """
    1.27  
    1.28 -    def __init__(self, id, dom, host, port):
    1.29 +    def __init__(self, xid, dom, host, port):
    1.30          XfrdInfo.__init__(self)
    1.31 -        self.id = id
    1.32 +        self.xid = xid
    1.33          self.state = 'begin'
    1.34          self.src_host = socket.gethostname()
    1.35          self.src_dom = dom
    1.36 @@ -181,7 +181,7 @@ class XendMigrateInfo(XfrdInfo):
    1.37          self.start = 0
    1.38          
    1.39      def sxpr(self):
    1.40 -        sxpr = ['migrate', ['id', self.id], ['state', self.state] ]
    1.41 +        sxpr = ['migrate', ['id', self.xid], ['state', self.state] ]
    1.42          sxpr_src = ['src', ['host', self.src_host], ['domain', self.src_dom] ]
    1.43          sxpr.append(sxpr_src)
    1.44          sxpr_dst = ['dst', ['host', self.dst_host] ]
    1.45 @@ -220,9 +220,9 @@ class XendSaveInfo(XfrdInfo):
    1.46      """Representation of a save in-progress and its interaction with xfrd.
    1.47      """
    1.48      
    1.49 -    def __init__(self, id, dom, file):
    1.50 +    def __init__(self, xid, dom, file):
    1.51          XfrdInfo.__init__(self)
    1.52 -        self.id = id
    1.53 +        self.xid = xid
    1.54          self.state = 'begin'
    1.55          self.src_dom = dom
    1.56          self.file = file
    1.57 @@ -230,7 +230,7 @@ class XendSaveInfo(XfrdInfo):
    1.58          
    1.59      def sxpr(self):
    1.60          sxpr = ['save',
    1.61 -                ['id', self.id],
    1.62 +                ['id', self.xid],
    1.63                  ['state', self.state],
    1.64                  ['domain', self.src_dom],
    1.65                  ['file', self.file] ]
    1.66 @@ -272,32 +272,33 @@ class XendMigrate:
    1.67          self.db = XendDB.XendDB(self.dbpath)
    1.68          self.session = {}
    1.69          self.session_db = self.db.fetchall("")
    1.70 -        self.id = 0
    1.71 +        self.xid = 0
    1.72  
    1.73      def nextid(self):
    1.74 -        self.id += 1
    1.75 -        return "%d" % self.id
    1.76 +        self.xid += 1
    1.77 +        return "%d" % self.xid
    1.78  
    1.79      def sync(self):
    1.80          self.db.saveall("", self.session_db)
    1.81  
    1.82 -    def sync_session(self, id):
    1.83 -        self.db.save(id, self.session_db[id])
    1.84 +    def sync_session(self, xid):
    1.85 +        print 'sync_session>', type(xid), xid, self.session_db[xid]
    1.86 +        self.db.save(xid, self.session_db[xid])
    1.87  
    1.88      def close(self):
    1.89          pass
    1.90  
    1.91 -    def _add_session(self, id, info):
    1.92 -        self.session[id] = info
    1.93 -        self.session_db[id] = info.sxpr()
    1.94 -        self.sync_session(id)
    1.95 +    def _add_session(self, xid, info):
    1.96 +        self.session[xid] = info
    1.97 +        self.session_db[xid] = info.sxpr()
    1.98 +        self.sync_session(xid)
    1.99          #eserver.inject('xend.migrate.begin', info.sxpr())
   1.100  
   1.101 -    def _delete_session(self, id):
   1.102 -        #eserver.inject('xend.migrate.end', id)
   1.103 -        del self.session[id]
   1.104 -        del self.session_db[id]
   1.105 -        self.db.delete(id)
   1.106 +    def _delete_session(self, xid):
   1.107 +        #eserver.inject('xend.migrate.end', xid)
   1.108 +        del self.session[xid]
   1.109 +        del self.session_db[xid]
   1.110 +        self.db.delete(xid)
   1.111  
   1.112      def session_ls(self):
   1.113          return self.session.keys()
   1.114 @@ -305,11 +306,11 @@ class XendMigrate:
   1.115      def sessions(self):
   1.116          return self.session.values()
   1.117  
   1.118 -    def session_get(self, id):
   1.119 -        return self.session.get(id)
   1.120 +    def session_get(self, xid):
   1.121 +        return self.session.get(xid)
   1.122  
   1.123      def session_begin(self, info):
   1.124 -        self._add_session(id, info)
   1.125 +        self._add_session(info.xid, info)
   1.126          mcf = XfrdClientFactory(info)
   1.127          reactor.connectTCP('localhost', XFRD_PORT, mcf)
   1.128          return info
   1.129 @@ -324,8 +325,8 @@ class XendMigrate:
   1.130          """
   1.131          # Check dom for existence, not migrating already.
   1.132          # Subscribe to migrate notifications (for updating).
   1.133 -        id = self.nextid()
   1.134 -        info = XendMigrateInfo(id, dom, host, port)
   1.135 +        xid = self.nextid()
   1.136 +        info = XendMigrateInfo(xid, dom, host, port)
   1.137          self.session_begin(info)
   1.138          return info.deferred
   1.139  
   1.140 @@ -336,8 +337,8 @@ class XendMigrate:
   1.141          @param file: destination file
   1.142          @return: deferred
   1.143          """
   1.144 -        id = self.nextid()
   1.145 -        info = XendSaveInfo(id, dom, file)
   1.146 +        xid = self.nextid()
   1.147 +        info = XendSaveInfo(xid, dom, file)
   1.148          self.session_begin(info)
   1.149          return info.deferred
   1.150  
     2.1 --- a/tools/xfrd/xen_domain.c	Mon Jul 12 14:24:09 2004 +0000
     2.2 +++ b/tools/xfrd/xen_domain.c	Mon Jul 12 15:08:24 2004 +0000
     2.3 @@ -66,6 +66,8 @@ int xen_domain_snd(Conn *xend, IOStream 
     2.4          dprintf("> k=%d n=%d\n", k, n);
     2.5      }
     2.6      
     2.7 +    dom = 99;
     2.8 +    err = xfr_vm_suspend(xend, dom);
     2.9    exit:
    2.10  #else 
    2.11      XcIOContext _ioctxt = {}, *ioctxt = &_ioctxt;
     3.1 --- a/tools/xfrd/xfrd.c	Mon Jul 12 14:24:09 2004 +0000
     3.2 +++ b/tools/xfrd/xfrd.c	Mon Jul 12 15:08:24 2004 +0000
     3.3 @@ -558,11 +558,13 @@ int xfr_send_suspend(Conn *conn, uint32_
     3.4   */
     3.5  int xfr_vm_suspend(Conn *xend, uint32_t vmid){
     3.6      int err = 0;
     3.7 +    dprintf("> vmid=%u\n", vmid);
     3.8      err = xfr_send_suspend(xend, vmid);
     3.9      if(err) goto exit;
    3.10      IOStream_flush(xend->out);
    3.11      err = xfr_response(xend);
    3.12    exit:
    3.13 +    dprintf("< err=%d\n", err);
    3.14      return err;
    3.15  }
    3.16