Example #1
0
 def __init__(self, driver, name, pool=None, snapshot=None, read_only=False):
     client, ioctx = driver._connect_to_rados(pool)
     try:
         self.volume = driver.rbd.Image(ioctx, str(name), snapshot=ascii_str(snapshot), read_only=read_only)
     except driver.rbd.Error:
         LOG.exception(_("error opening rbd image %s"), name)
         driver._disconnect_from_rados(client, ioctx)
         raise
     self.driver = driver
     self.client = client
     self.ioctx = ioctx
Example #2
0
 def __init__(self, driver, name, pool=None, snapshot=None,
              read_only=False):
     client, ioctx = driver._connect_to_rados(pool)
     try:
         self.volume = driver.rbd.Image(ioctx, str(name),
                                        snapshot=ascii_str(snapshot),
                                        read_only=read_only)
     except driver.rbd.Error:
         LOG.exception(_("error opening rbd image %s"), name)
         driver._disconnect_from_rados(client, ioctx)
         raise
     self.driver = driver
     self.client = client
     self.ioctx = ioctx
Example #3
0
    def __init__(self, driver, name, pool=None, snapshot=None,
                 read_only=False):
        client, ioctx = driver._connect_to_rados(pool)
        if snapshot is not None:
            snapshot = encodeutils.safe_encode(snapshot)

        try:
            self.volume = driver.rbd.Image(ioctx,
                                           encodeutils.safe_encode(name),
                                           snapshot=snapshot,
                                           read_only=read_only)
        except driver.rbd.Error:
            LOG.exception(_LE("error opening rbd image %s"), name)
            driver._disconnect_from_rados(client, ioctx)
            raise
        self.driver = driver
        self.client = client
        self.ioctx = ioctx
Example #4
0
    def __init__(self, driver, name, pool=None, snapshot=None,
                 read_only=False):
        client, ioctx = driver._connect_to_rados(pool)
        if snapshot is not None:
            snapshot = encodeutils.safe_encode(snapshot)

        try:
            self.volume = driver.rbd.Image(ioctx,
                                           encodeutils.safe_encode(name),
                                           snapshot=snapshot,
                                           read_only=read_only)
        except driver.rbd.Error:
            LOG.exception(_LE("error opening rbd image %s"), name)
            driver._disconnect_from_rados(client, ioctx)
            raise
        self.driver = driver
        self.client = client
        self.ioctx = ioctx