Esempio n. 1
0
 def probe(self):
     try:
         self.mount(PROBE_MOUNTPOINT)
         sr_list = filter(util.match_uuid, util.listdir(PROBE_MOUNTPOINT))
         self.unmount(PROBE_MOUNTPOINT, True)
     except (util.CommandException, xs_errors.XenError):
         raise
     # Create a dictionary from the SR uuids to feed SRtoXML()
     sr_dict = {sr_uuid: {} for sr_uuid in sr_list}
     return util.SRtoXML(sr_dict)
Esempio n. 2
0
    def probe(self):
        # N.B. There are no SR references
        self._assertValues(['args','host_ref','session_ref','device_config','command'])
        assert(len(self.srcmd.params['args'])==0)
        
        # Create some Dummy SR records
        entry = {}
        entry['size'] = 1024
        SRlist = {}
        SRlist[util.gen_uuid()] = entry

        # Return the Probe XML
        return util.SRtoXML(SRlist)
Esempio n. 3
0
    def probe(self):
        try:
            err = "SMBMount"
            self.mount(PROBE_MOUNTPOINT)
            sr_list = filter(util.match_uuid, util.listdir(PROBE_MOUNTPOINT))
            err = "SMBUnMount"
            self.unmount(PROBE_MOUNTPOINT, True)
        except SMBException, inst:
            raise xs_errors.XenError(err, opterr=inst.errstr)
        except (util.CommandException, xs_errors.XenError):
            raise

        # Create a dictionary from the SR uuids to feed SRtoXML()
        sr_dict = {sr_uuid: {} for sr_uuid in sr_list}

        return util.SRtoXML(sr_dict)

    def detach(self, sr_uuid):
        """Detach the SR: Unmounts and removes the mountpoint"""
        if not self.checkmount():
            return
        util.SMlog("Aborting GC/coalesce")
        cleanup.abort(self.uuid)

        # Change directory to avoid unmount conflicts
        os.chdir(SR.MOUNT_BASE)

        try:
            self.unmount(self.mountpoint, True)
            os.unlink(self.path)
        except SMBException, exc: