예제 #1
0
    def introduce(self, sr_uuid, vdi_uuid):
        self.sm_config = self.sr.srcmd.params['vdi_sm_config']
        vdi_path = self.sr._getLUNbySMconfig(self.sm_config)
        self._query(vdi_path, self.sm_config['LUNid'])
        vdi_uuid = self.uuid
        self.sr.vdis[vdi_uuid] = self

        try:
            util._getVDI(self.sr, vdi_uuid)
            self.sr.vdis[vdi_uuid]._db_update()
            # For reasons I don't understand, VDI._db_update() doesn't set the
            # managed flag, so we do that ourselves here.
            vdi_ref = self.sr.session.xenapi.VDI.get_by_uuid(vdi_uuid)
            self.sr.session.xenapi.VDI.set_managed(vdi_ref, self.managed)
        except:
            self.sr.vdis[vdi_uuid]._db_introduce()
        return super(RAWVDI, self).get_params()
예제 #2
0
파일: LUNperVDI.py 프로젝트: xcp-ng/sm
    def introduce(self, sr_uuid, vdi_uuid):
        self.sm_config = self.sr.srcmd.params['vdi_sm_config']
        vdi_path = self.sr._getLUNbySMconfig(self.sm_config)
        self._query(vdi_path, self.sm_config['LUNid'])
        vdi_uuid = self.uuid
        self.sr.vdis[vdi_uuid] = self

        try:
            util._getVDI(self.sr, vdi_uuid)
            self.sr.vdis[vdi_uuid]._db_update()
            # For reasons I don't understand, VDI._db_update() doesn't set the
            # managed flag, so we do that ourselves here.
            vdi_ref = self.sr.session.xenapi.VDI.get_by_uuid(vdi_uuid)
            self.sr.session.xenapi.VDI.set_managed(vdi_ref, self.managed)
        except:
            self.sr.vdis[vdi_uuid]._db_introduce()
        return super(RAWVDI, self).get_params()
예제 #3
0
 def delete(self, sr_uuid, vdi_uuid):
     try:
         vdi = util._getVDI(self.sr, vdi_uuid)
         if not vdi['managed']:
             return
         sm_config = vdi['sm_config']
         self.sr.session.xenapi.VDI.set_managed(vdi['vdi_ref'], False)
     except:
         pass
예제 #4
0
파일: LUNperVDI.py 프로젝트: xcp-ng/sm
 def delete(self, sr_uuid, vdi_uuid):
     try:
         vdi = util._getVDI(self.sr, vdi_uuid)
         if not vdi['managed']:
             return
         sm_config = vdi['sm_config']
         self.sr.session.xenapi.VDI.set_managed(vdi['vdi_ref'], False)
     except:
         pass
예제 #5
0
 def _set_managed(self, vdi_uuid, managed):
     try:
         vdi = util._getVDI(self.sr, vdi_uuid)
         self.sr.session.xenapi.VDI.set_managed(vdi['vdi_ref'], managed)
     except:
         raise xs_errors.XenError('VDIUnavailable')
예제 #6
0
파일: LUNperVDI.py 프로젝트: xcp-ng/sm
 def _set_managed(self, vdi_uuid, managed):
     try:
         vdi = util._getVDI(self.sr, vdi_uuid)
         self.sr.session.xenapi.VDI.set_managed(vdi['vdi_ref'], managed)
     except:
         raise xs_errors.XenError('VDIUnavailable')