Package com.cloud.utils.script

Examples of com.cloud.utils.script.Script.execute()


        cmd.add("--vif", vif);
        cmd.add("--brname", brname);
        if (rules != null) {
            cmd.add("--rules", newRules);
        }
        String result = cmd.execute();
        if (result != null) {
            return false;
        }
        return true;
    }
View Full Code Here


        if (!_can_bridge_firewall) {
            return false;
        }
        Script cmd = new Script(_securityGroupPath, _timeout, s_logger);
        cmd.add("cleanup_rules");
        String result = cmd.execute();
        if (result != null) {
            return false;
        }
        return true;
    }
View Full Code Here

    private String get_rule_logs_for_vms() {
        Script cmd = new Script(_securityGroupPath, _timeout, s_logger);
        cmd.add("get_rule_logs_for_vms");
        OutputInterpreter.OneLineParser parser = new OutputInterpreter.OneLineParser();
        String result = cmd.execute(parser);
        if (result == null) {
            return parser.getLine();
        }
        return null;
    }
View Full Code Here

        final Script command = new Script(_patchdomrPath, _timeout, s_logger);
        command.add("-l", vmName);
        command.add("-t", "all");
        command.add("-d", dataDiskPath);
        command.add("-p", cmdLine.replaceAll(" ", "%"));
        result = command.execute();
        if (result != null) {
            throw new InternalErrorException(result);
        }
    }
View Full Code Here

        OutputInterpreter.OneLineParser vlanIdParser = new OutputInterpreter.OneLineParser();
        final Script cmd = new Script("/bin/bash", s_logger);
        cmd.add("-c");
        cmd.add("vlanid=$(brctl show |grep " + brName
                + " |awk '{print $4}' | cut -s -d. -f 2);echo $vlanid");
        String result = cmd.execute(vlanIdParser);
        if (result != null) {
            return null;
        }
        String vlanId = vlanIdParser.getLine();
        if (vlanId.equalsIgnoreCase("")) {
View Full Code Here

                } else {
                    command.add("-d", snapshotPath);
                }

                command.add("-n", snapshotName);
                String result = command.execute();
                if (result != null) {
                    s_logger.debug("Failed to manage snapshot: " + result);
                    return new ManageSnapshotAnswer(cmd, false,
                            "Failed to manage snapshot: " + result);
                }
View Full Code Here

                    s_logger);
            command.add("-b", snapshotDisk.getPath());
            command.add("-n", snapshotName);
            command.add("-p", snapshotDestPath);
            command.add("-t", snapshotName);
            String result = command.execute();
            if (result != null) {
                s_logger.debug("Failed to backup snaptshot: " + result);
                return new BackupSnapshotAnswer(cmd, false, result, null, true);
            }
            /* Delete the snapshot on primary */
 
View Full Code Here

            } else {
                command = new Script(_manageSnapshotPath, _cmdsTimeout,
                        s_logger);
                command.add("-d", snapshotDisk.getPath());
                command.add("-n", snapshotName);
                result = command.execute();
                if (result != null) {
                    s_logger.debug("Failed to backup snapshot: " + result);
                    return new BackupSnapshotAnswer(cmd, false,
                            "Failed to backup snapshot: " + result, null, true);
                }
View Full Code Here

            final Script command = new Script(_manageSnapshotPath,
                    _cmdsTimeout, s_logger);
            command.add("-d", snapshotDestPath);
            command.add("-n", cmd.getSnapshotName());

            command.execute();
        } catch (CloudRuntimeException e) {
            return new DeleteSnapshotBackupAnswer(cmd, false, e.toString());
        } finally {
            if (secondaryStoragePool != null) {
                secondaryStoragePool.delete();
View Full Code Here

            final Script command = new Script(_manageSnapshotPath,
                    _cmdsTimeout, s_logger);
            command.add("-d", snapshotDestPath);
            command.add("-f");
            command.execute();
        } catch (CloudRuntimeException e) {
            return new Answer(cmd, false, e.toString());
        } finally {
            if (secondaryStoragePool != null) {
                secondaryStoragePool.delete();
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.