def create(cc, args): p = MsgCrtRscDfn() p.rsc_dfn.rsc_name = args.name if args.port: p.rsc_dfn.rsc_dfn_port = args.port # if args.secret: # p.secret = args.secret return Commands._create(cc, API_CRT_RSC_DFN, p, args)
def create(cc, args): p = MsgCrtVlmDfn() p.rsc_name = args.resource_name vlmdf = p.vlm_dfns.add() vlmdf.vlm_size = VolumeDefinitionCommands._get_volume_size(args.size) if args.minor is not None: vlmdf.vlm_minor = args.minor return Commands._create(cc, API_CRT_VLM_DFN, p, args)
def create(cc, args): p = MsgCrtRsc() p.rsc.name = args.resource_name p.rsc.node_name = args.node_name if not args.diskless and args.storage_pool: prop = LinStorMapEntry() prop.key = KEY_STOR_POOL_NAME prop.value = args.storage_pool p.rsc.props.extend([prop]) if args.diskless: p.rsc.rsc_flags.append(FLAG_DISKLESS) return Commands._create(cc, API_CRT_RSC, p, args)
def create(cc, args): p = MsgCrtStorPool() p.stor_pool.stor_pool_name = args.name p.stor_pool.node_name = args.node_name # construct correct driver name if args.driver == 'lvmthin': driver = 'LvmThin' else: driver = args.driver.title() p.stor_pool.driver = '{driver}Driver'.format(driver=driver) # set driver device pool property prop = p.stor_pool.props.add() prop.key = StoragePoolCommands.device_key_map[driver] prop.value = args.driver_device return Commands._create(cc, API_CRT_STOR_POOL, p, args)
def create(cc, args): p = MsgCrtNode() def gen_nif(k, v): prop = LinStorMapEntry() prop.key = "%s/%s/%s" % (NAMESPC_NETIF, args.interface_name, k) prop.value = v p.node.props.extend([prop]) # interface gen_nif(KEY_NETIF_TYPE, args.interface_type) gen_nif(KEY_NETCOM_TYPE, args.communication_type) p.node.name = args.name p.node.type = args.node_type netif = p.node.net_interfaces.add() netif.name = args.interface_name netif.address = args.ip port = args.port if not port: if args.communication_type == VAL_NETCOM_TYPE_PLAIN: port = DFLT_CTRL_PORT_PLAIN if p.node.type == VAL_NODE_TYPE_CTRL else DFLT_STLT_PORT_PLAIN elif args.communication_type == VAL_NETCOM_TYPE_SSL: port = DFLT_CTRL_PORT_SSL else: Output.err( "Communication type %s has no default port" % (args.communication_type), args.no_color) gen_nif(KEY_PORT_NR, str(port)) satcon = p.satellite_connections.add() satcon.net_interface_name = args.interface_name satcon.port = port satcon.encryption_type = args.communication_type return Commands._create(cc, API_CRT_NODE, p, args)
def create(cc, args): p = MsgCrtStorPoolDfn() p.stor_pool_dfn.stor_pool_name = args.name return Commands._create(cc, API_CRT_STOR_POOL_DFN, p, args)