コード例 #1
0
    def attach(self, dbg, uri, domain):
        # FIXME: add lvm activation code
        u = urlparse.urlparse(uri)

        (vgname, lvname, scsid) = self._getVgLvScsid(dbg, u.path)
        log.debug("%s Vg=%s Lv=%s Scsid%s" % (dbg, vgname, lvname, scsid))
        vg = self._vgOpen(dbg, vgname, "r", scsid)
        lv = vg.lvFromName(lvname)
        lv.activate()
        vg.close()
        cmd = ["/usr/bin/vhd-util", "query", "-n", u.path, "-P"]
        output = call(dbg, cmd)
        log.debug("%s output=%s" % (dbg, output))
        output = output[:-1]
        if output[-6:] == "parent":
            log.debug("No Parent")
        else:
            output = output.replace("--", "-")
            log.debug("%s" % output[-36:])
            activation_file = "/var/run/nonpersistent/" + vgname + "/" + output[-36:]
            if (not os.path.exists(activation_file)):
                vg = self._vgOpen(dbg, vgname, "r", scsid)
                lv = vg.lvFromName(output[-36:])
                log.debug("Activating %s" % lv.getName())
                lv.activate()
                vg.close()
                open(activation_file, 'a').close()

        tap = tapdisk.create(dbg)
        tapdisk.save_tapdisk_metadata(dbg, u.path, tap)
        return {
            'domain_uuid': '0',
            'implementation': ['Tapdisk3', tap.block_device()],
        }
コード例 #2
0
 def attach(self, dbg, uri, domain):
     tap = tapdisk.create(dbg)
     self.save_tapdisk(dbg, uri, tap)
     return {
         'domain_uuid': '0',
         'implementation': ['Tapdisk3', tap.block_device()],
     }
コード例 #3
0
 def attach(self, dbg, uri, domain):
     tap = tapdisk.create(dbg)
     self.save_tapdisk(dbg, uri, tap)
     return {
         'domain_uuid': '0',
         'implementation': ['Tapdisk3', tap.block_device()],
     }
コード例 #4
0
 def attach(self, dbg, uri, domain):
     u = urlparse.urlparse(uri)
     tap = tapdisk.create(dbg)
     tapdisk.save_tapdisk_metadata(dbg, u.path, tap)
     return {
         'domain_uuid': '0',
         'implementation': ['Tapdisk3', tap.block_device()],
     }
コード例 #5
0
 def attach(self, dbg, uri, domain):
     u = urlparse.urlparse(uri)
     # XXX need some datapath-specific errors below
     if not(os.path.exists(u.path)):
         raise xapi.storage.api.volume.Volume_does_not_exist(u.path)
     if u.scheme[:3] == "vhd":
         img = image.Vhd(u.path)
     elif u.scheme[:3] == "raw":
         img = image.Raw(u.path)
     else:
         raise
     tap = tapdisk.create(dbg)
     tap.open(dbg, img)
     return {
         'domain_uuid': '0',
         'implementation': ['Tapdisk3', tap.block_device()],
     }
コード例 #6
0
 def attach(self, dbg, uri, domain):
     u = urlparse.urlparse(uri)
     # XXX need some datapath-specific errors below
     if not (os.path.exists(u.path)):
         raise xapi.storage.api.volume.Volume_does_not_exist(u.path)
     if u.scheme[:3] == "vhd":
         img = image.Vhd(u.path)
     elif u.scheme[:3] == "raw":
         img = image.Raw(u.path)
     else:
         raise
     tap = tapdisk.create(dbg)
     tap.open(dbg, img)
     return {
         'domain_uuid': '0',
         'implementation': ['Tapdisk3', tap.block_device()],
     }