bitkeeper revision 1.941 (40c5c3aeUZGucE9_GNi3DXxAGD0Klg)
authormwilli2@equilibrium.research.intel-research.net <mwilli2@equilibrium.research.intel-research.net>
Tue, 8 Jun 2004 13:48:30 +0000 (13:48 +0000)
committermwilli2@equilibrium.research.intel-research.net <mwilli2@equilibrium.research.intel-research.net>
Tue, 8 Jun 2004 13:48:30 +0000 (13:48 +0000)
Merge-related fixups.

tools/examples/xc_dom_create.py
tools/xend/lib/blkif.py

index 1b6fbd0c8fafeebbee991b49f2930a80da48b44f..f1e759d4f6b7234522120ec0816a308e35fd3882 100755 (executable)
@@ -274,7 +274,7 @@ def make_domain():
     # set the expertise level appropriately
     xenctl.utils.VBD_EXPERT_MODE = vbd_expert
 
-    if not (flags & 4): # It's not a block backend (or it's old IO world)
+    if not (flags & 1<<4): # It's not a block backend (or it's old IO world)
         if new_io_world:
             cmsg = 'new_block_interface(dom='+str(id)+')'
             xend_response = xenctl.utils.xend_control_message(cmsg)
@@ -350,7 +350,7 @@ def make_domain():
                 sys.exit()
 
     if new_io_world:
-        if not (flags & 8): # If it's not the net backend, give it a frontend.
+        if not (flags & 1<<5): # If it's not the net backend, give it a frontend.
             cmsg = 'new_network_interface(dom='+str(id)+')'
             xend_response = xenctl.utils.xend_control_message(cmsg)
             if not xend_response['success']:
index 3dd05a0a95e6c3bd8647eb7ceb831da1fb61e341..51431b694a292a75b62ef4dc1b319a55693b614c 100644 (file)
@@ -4,7 +4,7 @@
 ## Copyright (c) 2004, K A Fraser (University of Cambridge)
 #################################################################
 
-import errno, re, os, select, signal, socket, struct, sys
+import errno, re, os, select, signal, socket, sys
 import xend.main, xend.console, xend.manager, xend.utils, Xc
 
 CMSG_BLKIF_BE = 1
@@ -47,7 +47,7 @@ def backend_rx_req(port, msg):
     subtype = (msg.get_header())['subtype']
     print "Received blkif-be request, subtype %d" % subtype
     if subtype == CMSG_BLKIF_BE_DRIVER_STATUS_CHANGED:
-        (status, dummy) = struct.unpack("II", msg.get_payload())
+        status = (msg.get_payload())['status']
         if status == BLKIF_DRIVER_STATUS_UP:
             if xend.blkif.recovery:
                 # Nasty hack: we count the number of VBDs we reattach so that
@@ -107,9 +107,9 @@ def backend_rx_rsp(port, msg):
                for blkif_key in interface.list.keys():
                    blkif = interface.list[blkif_key]
                    print "  Notifying %d" % blkif.dom
-                   msg = xend.utils.message(CMSG_BLKIF_FE,                   \
-                                            CMSG_BLKIF_FE_INTERFACE_STATUS_CHANGED, 0)
-                   msg.append_payload(struct.pack("III", 0,1,0))
+                   msg = xend.utils.message(CMSG_BLKIF_FE,
+                                            CMSG_BLKIF_FE_INTERFACE_STATUS_CHANGED,
+                                            0, { 'handle' : 0, 'status' : 1 })
                    blkif.ctrlif_tx_req(xend.main.port_from_dom(blkif.dom),msg)
                xend.blkif.recovery = False
                print "Done notifying guests"
@@ -158,8 +158,11 @@ class interface:
 
     def reattach_device(self, vdev):
         (pdev, start_sect, nr_sect, readonly) = self.devices[vdev]
-        msg = xend.utils.message(CMSG_BLKIF_BE, CMSG_BLKIF_BE_VBD_CREATE, 0)
-        msg.append_payload(struct.pack("IIHII",self.dom,0,vdev,readonly,0))
+        msg = xend.utils.message(CMSG_BLKIF_BE, CMSG_BLKIF_BE_VBD_CREATE,
+                                 0, { 'domid' : self.dom,
+                                      'blkif_handle' : 0,
+                                      'vdevice' : vdev,
+                                      'readonly' : readonly })
         xend.blkif.pendaddr = xend.main.mgmt_req_addr
         backend_tx_req(msg)
 
@@ -200,9 +203,9 @@ class interface:
             pl = msg.get_payload()
             (hnd, frame) = (pl['handle'], pl['shmem_frame'])
             xc = Xc.new()
-            self.evtchn = xc.evtchn_bind_interdomain( \
-                dom1=xend.blkif.be_port.remote_dom,   \
-                dom2=self.dom)
+            self.evtchn = xc.evtchn_bind_interdomain(
+                                            dom1=xend.blkif.be_port.remote_dom,
+                                            dom2=self.dom)
             msg = xend.utils.message(CMSG_BLKIF_BE,
                                      CMSG_BLKIF_BE_CONNECT, 0,
                                      { 'domid' : self.dom, 'blkif_handle' : 0,