Пример #1
0
def main():
    log_config.configure()
    logging.info("=== Starting vmdkops service ====")
    signal.signal(signal.SIGINT, signal_handler_stop)
    signal.signal(signal.SIGTERM, signal_handler_stop)
    try:
        port = 1019
        opts, args = getopt.getopt(sys.argv[1:], 'hp:')
    except getopt.error as msg:
        if msg:
           logging.exception(msg)
        usage()
        return 1
    for a, v in opts:
        if a == '-p':
            port = int(v)
        if a == '-h':
            usage()
            return 0

    try:
        # Load and use DLL with vsocket shim to listen for docker requests
        load_vmci()

        kv.init()
        connectLocal()
        handleVmciRequests(port)
    except Exception as e:
        logging.exception(e)
Пример #2
0
def main():
    log_config.configure()
    logging.info("=== Starting vmdkops service ====")
    signal.signal(signal.SIGINT, signal_handler_stop)
    signal.signal(signal.SIGTERM, signal_handler_stop)
    try:
        port = 1019
        opts, args = getopt.getopt(sys.argv[1:], 'hp:')
    except getopt.error as msg:
        if msg:
           logging.exception(msg)
        usage()
        return 1
    for a, v in opts:
        if a == '-p':
            port = int(v)
        if a == '-h':
            usage()
            return 0

    try:
        # Load and use DLL with vsocket shim to listen for docker requests
        load_vmci()

        kv.init()
        connectLocal()
        handleVmciRequests(port)
    except Exception as e:
        logging.exception(e)
def main():
    log_config.configure()
    kv.init()
    if not vmdk_ops.is_service_available():
       sys.exit('Unable to connect to the host-agent on this host, ensure the ESXi host agent is running before retrying.')
    args = parse_args()
    if args:
       args.func(args)
Пример #4
0
def main():
    log_config.configure()
    logging.info("=== Starting vmdkops service ===")

    signal.signal(signal.SIGINT, signal_handler_stop)
    signal.signal(signal.SIGTERM, signal_handler_stop)

    try:
        kv.init()
        connectLocal()
        handleVmciRequests()
    except Exception, e:
        logging.exception(e)
Пример #5
0
        result = self.tenantMgr.GetTenants(name=TENANT_NAME)
        self.assertTrue(result)

        # Verify the privileges
        privileges = result[0].privileges
        self.assertTrue(privileges)
        self.assertEqual(len(privileges), 2)

        privilege1 = None
        privilege2 = None
        for privilege in privileges:
            if privilege.datastore == self.datastore:
                privilege1 = privilege
            elif privilege.datastore == self.datastore2:
                privilege2 = privilege
        self.assertTrue(privilege1)
        self.assertTrue(privilege2)

        self.assertEqual(privilege1.allow_create, True)
        self.assertEqual(privilege1.volume_max_size, 512)
        self.assertEqual(privilege1.volume_total_size, 1024)

        self.assertEqual(privilege2.allow_create, False)
        self.assertEqual(privilege2.volume_max_size, 1024)
        self.assertEqual(privilege2.volume_total_size, 2048)


if __name__ == "__main__":
    log_config.configure()
    unittest.main()
        policy_string = \
            '(("hostFailuresToTolerate" i0) ("forceProvisioning" i1))'
        # same policy content with different space/tabs:
        same_policy = \
            ' ((  "hostFailuresToTolerate"    \ti0) ("forceProvisioning" i1))'
        # different content:
        notsame_policy = \
            '(("hostFailuresToTolerate" i0) ("forceProvisioning" i0))'
        err = vsan_info.set_policy(self.VMDK_PATH, policy_string)
        self.assertEqual(err, None, "failed to set")
        # get policy and check it
        p = vsan_info.get_policy(self.VMDK_PATH)
        self.assertTrue(
            vsan_info.same_policy(self.VMDK_PATH, p),
            "failed to compare with get_policy")
        self.assertTrue(
            vsan_info.same_policy(self.VMDK_PATH, policy_string),
            "failed to compare with original policy")
        self.assertTrue(
            vsan_info.same_policy(self.VMDK_PATH, same_policy),
            "failed to compare with same policy, different tabs")
        self.assertFalse(
            vsan_info.same_policy(self.VMDK_PATH, notsame_policy),
            "failed to compare with different policy")


if __name__ == "__main__":
    log_config.configure()
    kv.init()
    unittest.main()
def main():
    log_config.configure()
Пример #8
0
def main():
    log_config.configure()
def main():
    log_config.configure()
    kv.init()
    args = parse_args()
    if args:
       args.func(args)