# 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)
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']:
## 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
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
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"
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)
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,