Package com.cybozu.vmbkp.profile

Examples of com.cybozu.vmbkp.profile.ConfigGlobal


public class TestLock
{
    public static void main(String[] args) {

        try {
            ConfigGlobal cfgGlobal = new ConfigGlobal(args[0]);
            VmdkBkp.lock(cfgGlobal);
            System.out.println("locked");
            Thread.sleep(2000);
            VmdkBkp.unlock();
            System.out.println("unlocked");
View Full Code Here


     */
    public void deleteOldGenerations()
        throws Exception
    {
        /* Used member variables. */
        ConfigGlobal cfgGlobal = cfgGlobal_;
        ProfileVm profVm = profVm_;
       
        /* get keep_generations value */
        int keep = cfgGlobal.getKeepGenerations();
       
        /* get set of id of old generations */
        Set<Integer> oldGenIdSet = profVm.getOldGenerationSet(keep);

        /* debug */
 
View Full Code Here

     */
    public static void readConfigAndProfile()
        throws NotNormalFileException, Exception
    {
        /* Read global config file */
        cfgGlobal_ = new ConfigGlobal(cmdLine_.getGlobalConfigPath());

        /* Initialize all vm profile. */
        profAllVm_ = initializeProfileAllVm();

        /* Read group config if available.  */
 
View Full Code Here

        }

        logger_.info(String.format("mode is %s.", mode.toString()));

        /* Get config/profile. */
        ConfigGlobal cfgGlobal = vmArcMgr.getConfigGlobal();
        ProfileGeneration profGen = vmArcMgr.getTargetGeneration();
        assert cfgGlobal != null;
        assert profGen != null;
       
       
        String vmdkBkp = cfgGlobal.getVmdkBkpPath();
        assert vmdkBkp != null;

        List<String> cmds = new LinkedList<String>();
        //cmds.add("echo");
        cmds.add(vmdkBkp);
        cmds.add("dump");

        cmds.add("--mode");
        if (mode == BackupMode.UNKNOWN) {
            logger_.warning("backup mode is unknown.");
            return false;
        }
        cmds.add(mode.toString());

        cmds.add("--server");
        cmds.add(cfgGlobal.getServername());
        cmds.add("--username");
        cmds.add(cfgGlobal.getUsername());
        cmds.add("--password");
        cmds.add(cfgGlobal.getPassword());

        cmds.add("--vm");
        cmds.add(vmMoref);
       
        cmds.add("--snapshot");
View Full Code Here

            logger_.warning("doRestore(): some parameters are null.");
            return false;
        }

        /* Get config/profile. */
        ConfigGlobal cfgGlobal = vmArcMgr.getConfigGlobal();
        ProfileGeneration profGen = vmArcMgr.getTargetGeneration();

        /* Get the path list of archive files to restore
           the vmdk in the generation. */
        List<String> pathList =
            vmArcMgr.getDumpPathListForRestore(diskId);
        if (pathList == null) {
            logger_.warning("doRestore(): pathList is null" +
                            " then the vmdk restore is failed.");
            return false;
        }
        /* debug */
        StringBuffer sb = new StringBuffer();
        sb.append("-----pathlist-----\n");
        for (String path : pathList) {
            sb.append(path); sb.append("\n");
        }
        sb.append("------------------\n");
        logger_.info(sb.toString());

        /* Prepare vmdkbkp command line. */
        String vmdkBkp = cfgGlobal.getVmdkBkpPath();
        assert vmdkBkp != null;

        List<String> cmds = new LinkedList<String>();
        //cmds.add("echo");
        cmds.add(vmdkBkp);
        cmds.add("restore");

        cmds.add("--server");
        cmds.add(cfgGlobal.getServername());
        cmds.add("--username");
        cmds.add(cfgGlobal.getUsername());
        cmds.add("--password");
        cmds.add(cfgGlobal.getPassword());

        cmds.add("--vm");
        cmds.add(vmMoref);
        cmds.add("--snapshot");
        cmds.add(snapMoref);
View Full Code Here

        if (vmArcMgr == null || diskId < 0 ) {
            logger_.warning("doCheck(): some parameters are null.");
            return false;
        }

        ConfigGlobal cfgGlobal_ = vmArcMgr.getConfigGlobal();
        if (cfgGlobal_ == null) { return false; }
        ProfileGeneration profGen = vmArcMgr.getTargetGeneration();
        if (profGen == null) { return false; }

        String vmMoref = vmArcMgr.getMoref();

        /* Get path list to generate the target vmdk file. */
        List<String> pathList =
            vmArcMgr.getDumpPathListForRestore(diskId);
        /* debug */
        StringBuffer sb = new StringBuffer();
        sb.append
            (String.format("----- Path list for disk %d -----\n", diskId));
        for (String path : pathList) {
            sb.append(path); sb.append("\n");
        }
        sb.append("------------------\n");
        System.out.print(sb.toString());
       
        /* Check all archive files is available. */
        boolean ret = true;
        for (String path: pathList) {
            /* Path string is quated. */
            path = FormatString.toUnquatedString(path);
            if ((new File(path)).canRead() == false) {
                System.out.printf("File %s is not available.\n", path);
                ret = false;
            }
        }

        String digestPath = vmArcMgr.getDigestPathForCheck(diskId);
        if ((digestPath != null &&
             (new File(digestPath)).canRead()) == false) {

            System.out.printf("File %s is not available.\n", digestPath);
            ret &= false;
        }
        if (ret == false) { return false; }


        String vmdkBkp = cfgGlobal_.getVmdkBkpPath();
        assert vmdkBkp != null;
       
        /* Really check archive contents. */
        List<String> cmds = new LinkedList<String>();
        //cmds.add("echo");
View Full Code Here

TOP

Related Classes of com.cybozu.vmbkp.profile.ConfigGlobal

Copyright © 2018 www.massapicom. 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.