Exemplo n.º 1
0
 def destroy(self):
     xendom = XendDomain.instance()
     dom = xendom.get_vm_by_uuid(self.get_VM())
     if not dom:
         raise InvalidHandleError("VM", self.get_VM())
     XendTask.log_progress(0, 100, \
                           dom.destroy_dscsi, \
                           self.get_uuid())
Exemplo n.º 2
0
 def destroy(self):
     xendom = XendDomain.instance()
     dom = xendom.get_vm_by_uuid(self.get_VM())
     if not dom:
         raise InvalidHandleError("VM", self.get_VM())
     XendTask.log_progress(0, 100, \
                           dom.destroy_dscsi_HBA, \
                           self.get_uuid())
Exemplo n.º 3
0
    def create(self, dscsi_struct):

        # Check if VM is valid
        xendom = XendDomain.instance()
        if not xendom.is_valid_vm(dscsi_struct['VM']):
            raise InvalidHandleError('VM', dscsi_struct['VM'])
        dom = xendom.get_vm_by_uuid(dscsi_struct['VM'])

        # Check if PSCSI is valid
        xennode = XendNode.instance()
        pscsi_uuid = xennode.get_pscsi_by_uuid(dscsi_struct['PSCSI'])
        if not pscsi_uuid:
            raise InvalidHandleError('PSCSI', dscsi_struct['PSCSI'])

        # Assign PSCSI to VM
        try:
            dscsi_ref = XendTask.log_progress(0, 100, \
                                              dom.create_dscsi, \
                                              dscsi_struct)
        except XendError, e:
            log.exception("Error in create_dscsi")
            raise
Exemplo n.º 4
0
    def create(self, dscsi_struct):

        # Check if VM is valid
        xendom = XendDomain.instance()
        if not xendom.is_valid_vm(dscsi_struct['VM']):
            raise InvalidHandleError('VM', dscsi_struct['VM'])
        dom = xendom.get_vm_by_uuid(dscsi_struct['VM'])

        # Check if PSCSI is valid
        xennode = XendNode.instance()
        pscsi_uuid = xennode.get_pscsi_by_uuid(dscsi_struct['PSCSI'])
        if not pscsi_uuid:
            raise InvalidHandleError('PSCSI', dscsi_struct['PSCSI'])

        # Assign PSCSI to VM
        try:
            dscsi_ref = XendTask.log_progress(0, 100, \
                                              dom.create_dscsi, \
                                              dscsi_struct)
        except XendError, e:
            log.exception("Error in create_dscsi")
            raise
Exemplo n.º 5
0
    def create(self, dpci_struct):

        # Check if VM is valid
        xendom = XendDomain.instance()
        if not xendom.is_valid_vm(dpci_struct['VM']):
            raise InvalidHandleError('VM', dpci_struct['VM'])
        dom = xendom.get_vm_by_uuid(dpci_struct['VM'])

        # Check if PPCI is valid
        xennode = XendNode.instance()
        ppci_uuid = xennode.get_ppci_by_uuid(dpci_struct['PPCI'])
        if not ppci_uuid:
            raise InvalidHandleError('PPCI', dpci_struct['PPCI'])
        for existing_dpci in XendAPIStore.get_all('DPCI'):
            if ppci_uuid == existing_dpci.get_PPCI():
                raise DirectPCIError("Device is in use")

        # Assign PPCI to VM
        try:
            dpci_ref = XendTask.log_progress(0, 100, dom.create_dpci,
                                             dpci_struct)
        except XendError, e:
            raise DirectPCIError("Failed to assign device")
Exemplo n.º 6
0
    def create(self, dpci_struct):

        # Check if VM is valid
        xendom = XendDomain.instance()
        if not xendom.is_valid_vm(dpci_struct['VM']):
            raise InvalidHandleError('VM', dpci_struct['VM'])
        dom = xendom.get_vm_by_uuid(dpci_struct['VM'])

        # Check if PPCI is valid
        xennode = XendNode.instance()
        ppci_uuid = xennode.get_ppci_by_uuid(dpci_struct['PPCI'])
        if not ppci_uuid:
            raise InvalidHandleError('PPCI', dpci_struct['PPCI'])
        for existing_dpci in XendAPIStore.get_all('DPCI'):
            if ppci_uuid == existing_dpci.get_PPCI():
                raise DirectPCIError("Device is in use")

        # Assign PPCI to VM
        try:
            dpci_ref = XendTask.log_progress(0, 100, dom.create_dpci,
                                             dpci_struct)
        except XendError, e:
            raise DirectPCIError("Failed to assign device")