Examples of DettachAnswer


Examples of org.apache.cloudstack.storage.command.DettachAnswer

            if (!sr.getNameLabel(conn).startsWith("XenServer Tools")) {
                this.hypervisorResource.removeSR(conn, sr);
            }

            return new DettachAnswer(disk);
        } catch (XenAPIException e) {
            String msg = "Failed to dettach volume" + " for uuid: " + data.getPath() + "  due to " + e.toString();
            s_logger.warn(msg, e);
            return new DettachAnswer(msg);
        } catch (Exception e) {
            String msg = "Failed to dettach volume" + " for uuid: " + data.getPath() + "  due to "  + e.getMessage();
            s_logger.warn(msg, e);
            return new DettachAnswer(msg);
        }
    }
View Full Code Here

Examples of org.apache.cloudstack.storage.command.DettachAnswer

            if (!this.hypervisorResource.isRefNull(vgm) && vgm.getPVDriversUpToDate(conn)) {
                pvDrvInstalled = true;
            }
            if (isHVM && !pvDrvInstalled) {
                s_logger.warn(": You attempted an operation on a VM which requires PV drivers to be installed but the drivers were not detected");
                return new DettachAnswer("You attempted an operation that requires PV drivers to be installed on the VM. Please install them by inserting xen-pv-drv.iso.");
            }


            // Look up all VBDs for this VDI
            Set<VBD> vbds = vdi.getVBDs(conn);

            // Detach each VBD from its VM, and then destroy it
            for (VBD vbd : vbds) {
                VBD.Record vbdr = vbd.getRecord(conn);

                if (vbdr.currentlyAttached) {
                    vbd.unplug(conn);
                }

                vbd.destroy(conn);
            }

            // Update the VDI's label to be "detached"
            vdi.setNameLabel(conn, "detached");

            this.hypervisorResource.umount(conn, vdi);

            if (cmd.isManaged()) {
                this.hypervisorResource.handleSrAndVdiDetach(cmd.get_iScsiName());
            }

            return new DettachAnswer(disk);
        } catch(Exception e) {
            s_logger.warn("Failed dettach volume: " + data.getPath());
            return new DettachAnswer("Failed dettach volume: " + data.getPath() + ", due to " + e.toString());
        }
    }
View Full Code Here

Examples of org.apache.cloudstack.storage.command.DettachAnswer

            Connect conn = LibvirtConnection.getConnectionByVmName(vmName);
            KVMPhysicalDisk phyDisk = storagePoolMgr.getPhysicalDisk(primaryStore.getPoolType(), primaryStore.getUuid(), vol.getPath());

            attachOrDetachDisk(conn, false, vmName, phyDisk, disk.getDiskSeq().intValue());

            return new DettachAnswer(disk);
        } catch (LibvirtException e) {
            s_logger.debug("Failed to attach volume: " + vol.getPath() + ", due to " + e.toString());
            return new DettachAnswer(e.toString());
        } catch (InternalErrorException e) {
            s_logger.debug("Failed to attach volume: " + vol.getPath() + ", due to " + e.toString());
            return new DettachAnswer(e.toString());
        }
    }
View Full Code Here

Examples of org.apache.cloudstack.storage.command.DettachAnswer

    }

    @Override
    public Answer dettachVolume(DettachCommand cmd) {
        DiskTO disk = cmd.getDisk();
        return new DettachAnswer(disk);
    }
View Full Code Here

Examples of org.apache.cloudstack.storage.command.DettachAnswer

            if (!sr.getNameLabel(conn).startsWith("XenServer Tools")) {
                this.hypervisorResource.removeSR(conn, sr);
            }

            return new DettachAnswer(disk);
        } catch (XenAPIException e) {
            String msg = "Failed to dettach volume" + " for uuid: " + data.getPath() + "  due to " + e.toString();
            s_logger.warn(msg, e);
            return new DettachAnswer(msg);
        } catch (Exception e) {
            String msg = "Failed to dettach volume" + " for uuid: " + data.getPath() + "  due to "  + e.getMessage();
            s_logger.warn(msg, e);
            return new DettachAnswer(msg);
        }
    }
View Full Code Here

Examples of org.apache.cloudstack.storage.command.DettachAnswer

            if (!this.hypervisorResource.isRefNull(vgm) && vgm.getPVDriversUpToDate(conn)) {
                pvDrvInstalled = true;
            }
            if (isHVM && !pvDrvInstalled) {
                s_logger.warn(": You attempted an operation on a VM which requires PV drivers to be installed but the drivers were not detected");
                return new DettachAnswer("You attempted an operation that requires PV drivers to be installed on the VM. Please install them by inserting xen-pv-drv.iso.");
            }


            // Look up all VBDs for this VDI
            Set<VBD> vbds = vdi.getVBDs(conn);

            // Detach each VBD from its VM, and then destroy it
            for (VBD vbd : vbds) {
                VBD.Record vbdr = vbd.getRecord(conn);

                if (vbdr.currentlyAttached) {
                    vbd.unplug(conn);
                }

                vbd.destroy(conn);
            }

            // Update the VDI's label to be "detached"
            vdi.setNameLabel(conn, "detached");

            this.hypervisorResource.umount(conn, vdi);

            if (cmd.isManaged()) {
                this.hypervisorResource.handleSrAndVdiDetach(cmd.get_iScsiName());
            }

            return new DettachAnswer(disk);
        } catch(Exception e) {
            s_logger.warn("Failed dettach volume: " + data.getPath());
            return new DettachAnswer("Failed dettach volume: " + data.getPath() + ", due to " + e.toString());
        }
    }
View Full Code Here

Examples of org.apache.cloudstack.storage.command.DettachAnswer

            attachOrDetachDisk(conn, false, vmName, phyDisk, disk.getDiskSeq().intValue());

            storagePoolMgr.disconnectPhysicalDisk(primaryStore.getPoolType(), primaryStore.getUuid(), vol.getPath());

            return new DettachAnswer(disk);
        } catch (LibvirtException e) {
            s_logger.debug("Failed to attach volume: " + vol.getPath() + ", due to " + e.toString());
            return new DettachAnswer(e.toString());
        } catch (InternalErrorException e) {
            s_logger.debug("Failed to attach volume: " + vol.getPath() + ", due to " + e.toString());
            return new DettachAnswer(e.toString());
        }
    }
View Full Code Here

Examples of org.apache.cloudstack.storage.command.DettachAnswer

    }

    @Override
    public Answer dettachVolume(DettachCommand cmd) {
        DiskTO disk = cmd.getDisk();
        return new DettachAnswer(disk);
    }
View Full Code Here

Examples of org.apache.cloudstack.storage.command.DettachAnswer

            Connect conn = LibvirtConnection.getConnectionByVmName(vmName);
            KVMPhysicalDisk phyDisk = storagePoolMgr.getPhysicalDisk(primaryStore.getPoolType(), primaryStore.getUuid(), vol.getPath());

            attachOrDetachDisk(conn, false, vmName, phyDisk, disk.getDiskSeq().intValue());

            return new DettachAnswer(disk);
        } catch (LibvirtException e) {
            s_logger.debug("Failed to attach volume: " + vol.getPath() + ", due to " + e.toString());
            return new DettachAnswer(e.toString());
        } catch (InternalErrorException e) {
            s_logger.debug("Failed to attach volume: " + vol.getPath() + ", due to " + e.toString());
            return new DettachAnswer(e.toString());
        }
    }
View Full Code Here

Examples of org.apache.cloudstack.storage.command.DettachAnswer

            if (!sr.getNameLabel(conn).startsWith("XenServer Tools")) {
                hypervisorResource.removeSR(conn, sr);
            }

            return new DettachAnswer(disk);
        } catch (XenAPIException e) {
            String msg = "Failed to dettach volume" + " for uuid: " + data.getPath() + "  due to " + e.toString();
            s_logger.warn(msg, e);
            return new DettachAnswer(msg);
        } catch (Exception e) {
            String msg = "Failed to dettach volume" + " for uuid: " + data.getPath() + "  due to " + e.getMessage();
            s_logger.warn(msg, e);
            return new DettachAnswer(msg);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.