Example #1
0
    def find(self, args):
        """ Find a virtual datacenter given its name """
        # Parse user input to get the name of the virtual datacenter
        parser = OptionParser(usage="vdc find <options>")
        parser.add_option("-n", "--name",
                help="The name of the virtual datacenter to find", dest="name")
        (options, args) = parser.parse_args(args)
        name = options.name
        if not name:
            parser.print_help()
            return

        # Once user input has been read, find the virtual datacenter
        try:
            cloud = self._context.getCloudService()
            vdc = cloud.findVirtualDatacenter(
                    VirtualDatacenterPredicates.name(name))
            if vdc:
                pprint_vdcs([vdc])
            else:
                print "No virtual datacenter found with name: %s" % name
        except (AbiquoException, AuthorizationException), ex:
            print "Error: %s" % ex.getMessage()
Example #2
0
    def tiers(self, args):
        """ List the tiers available in a virtual datacenter """
        parser = OptionParser(usage="vdc tiers <options>")
        parser.add_option("-n", "--name",
                help="The name of the virtual datacenter", dest="name")
        (options, args) = parser.parse_args(args)
        name = options.name
        if not name:
            parser.print_help()
            return

        # Once user input has been read, find the virtual datacenter
        try:
            cloud = self._context.getCloudService()
            vdc = cloud.findVirtualDatacenter(
                    VirtualDatacenterPredicates.name(name))
            if vdc:
                tiers = vdc.listStorageTiers()
                pprint_tiers(tiers)
            else:
                print "No virtual datacenter found with name: %s" % name
        except (AbiquoException, AuthorizationException), ex:
            print "Error: %s" % ex.getMessage()