Você está na página 1de 20

Solaris Volume Manager: Metaset Creation Example

Overview
Hardware Con iguration Command !"ecution #esulting system con iguration #eplica changes

`
Copyright 2006 Sun Microsystems, Inc. All rights reserved.

Hardware Configuration

Node A
Shared Storage

Node B

Local Replica

Local Replica

Copyright 2006 Sun Microsystems, Inc. All rights reserved.

Commands Executed
Create local replicas on $odeA and $ode% Command&

metaset 's oo 'ah $odeA $ode%

Copyright 2006 Sun Microsystems, Inc. All rights reserved.

Resulting metaconfiguration
$odeA ( $ode%
Set name ) oo, Set num*er ) + Host $odeA $ode% ,wner

Copyright 2006 Sun Microsystems, Inc. All rights reserved.

Replica changes

-he only change will *e the addition o a set record into each o the nodes. local replicas&
RecId 0x00000003: Type:USER [0005] Type2: Set Size = 1212 sr_revision=0x00010000 sr_ !"#s=0x$0000000 sr_se! id=0x00000003 sr_#enid=2 sr_setno=1 sr_setn"%e=& oo& sr_cti%e='ed ("n 11 1):1$:3$ 200* 113+01)31$ [ 35,13,] sr_%-i"r#s.%-_ =1000 sr_%-i"r#s.%-_t/.reinst"te_resv_de!"y=*000 sr_%-i"r#s.%-_t/.%in_o0ners-ip_de!"y=*000 sr_%-i"r#s.%-_t/.%"x_o0ners-ip_de!"y=30000 sr_driverec=0x00000000 sr_%ed.n_cnt=0 sr_%ed.n_!st[0]."_cnt=0 sr_%ed.n_!st[1]."_cnt=0 sr_%ed.n_!st[2]."_cnt=0 sr_nodes[0]=&1ode2& sr_nodes[1]=&1ode3& Copyright 2006 Sun Microsystems, Inc. All rights reserved.

Dis set operations through metaset


,perations to create dis/sets and add0delete nodes, dis/s, and mediators re1uire that all o the nodes in the dis/set contain identical in ormation in their local replicas

-hese operations re1uire additional coordination across hosts 2eg. !nsuring that a set num*er and name are not currently used on any o the potential nodes in a dis/set *e ore allowing creation o that dis/set

-his coordination is done through the daemon, rpc.metad

Copyright 2006 Sun Microsystems, Inc. All rights reserved.

Code Structure for R!C calls in metad


3ersioned

#olling upgrade support in SunCluster was a ma4or actor in ma/ing this change. SunCluster will no longer support rolling upgrade. Inter aces

5hen metarpcopen is called it returns a client handle, C6I!$-. -his contains the inter ace version num*er. A version num*er is included in the over'the'wire structure

,ver'the'wire structures

Code 7low

Calls are very similar 8 wal/ing through one will give great insight into how almost all are structured and operate
Copyright 2006 Sun Microsystems, Inc. All rights reserved.

R!C Code "low


Clnt9:

!ntry point or rpc encapsulation ;i erent classes o rpc calls in rpc.metad


Change state o local replica 2clnt9createset, clnt9adddrvs< =et in ormation 2clnt9devin o, clnt9drvused< Control 2clnt9loc/9set, clnt9unloc/9set<

3ersioned args structure

Copyright 2006 Sun Microsystems, Inc. All rights reserved.

clnt#addhosts
int clnt9addhosts2 char :hostname, mdsetname9t :sp, int node9c, char ::node9v, md9error9t :ep < > C6I!$:clntp? mdrpc9host9args :args? mdrpc9host929args v29args? mdrpc9generic9res res? int version?

0: initiali@e :0 mdclrerror2ep<? 2void< memset2(v29args, 0, si@eo 2v29args<<? 2void< memset2(res, 0, si@eo 2res<<? Copyright 2006 Sun Microsystems, Inc. All rights reserved.

hostname is the name o the node to add the speci ied nodes to node9v is the set o node names *eing added mdrpc9host9args is the version + over the wire structure mdrpc9host929args is the version 2 over the wire structure mdrpc9generic9res is the structure that contains values returned rom this call

clnt#addhosts $ %uild the arguments


0: *uild args :0 v29args.rev ) M;9M!-A;9A#=S9#!39+? args ) (v29args.mdrpc9host929args9u.rev+? args'Asp ) sp? args'Acl9s/ ) cl9get9set/ey2sp'Asetno, sp' Asetname<? args'Ahosts.hosts9len ) node9c? args'Ahosts.hosts9val ) node9v?

-he version 2 args are normally a superset o the version + arguments so encapsulate them

Copyright 2006 Sun Microsystems, Inc. All rights reserved.

clnt#addhosts $ run on current node


0: do it :0 i 2md9in9daemon (( strcmp2mynode2<, hostname< )) 0< > int *ool? *ool ) mdrpc9addhosts929svc2(v29args, (res, $B66<? assert2*ool )) -#B!<? 2void< mdstealerror2ep, (res.status<?

I the hostname is the current node then call the unction directly rather than through rpc

Copyright 2006 Sun Microsystems, Inc. All rights reserved.

clnt#addhosts $ set up for rpc call


C else > i 22clntp ) metarpcopen2hostname, C696,$=9-M,, ep<< )) $B66< return 2'+<? 0: : Chec/ the client handle or the version and invo/e : the appropriate version o the remote procedure :0 C6$-9C,$-#,62clntp, C6=!-93!#S, 2char :<(version<?

Metarpcopen 3eri ies that the core SM7 services are ena*led -ry to create a version 2 client handle *y de ault. I this ails then attempt to create a version + client handle

Copyright 2006 Sun Microsystems, Inc. All rights reserved.

clnt#addhosts $ ma e rpc call


i 2version )) M!-A;93!#SI,$< > 0: version + :0 i 2mdrpc9addhosts9+2args, (res, clntp< D) #EC9SBCC!SS< 2void< mdrpcerror2ep, clntp, hostname, dgette"t2-!F-9;,MAI$, Gmetad add hostsG<<? else 2void< mdstealerror2ep, (res.status<? C else > i 2mdrpc9addhosts922(v29args, (res, clntp< D) #EC9SBCC!SS< 2void< mdrpcerror2ep, clntp, hostname, dgette"t2-!F-9;,MAI$, Gmetad add hostsG<<? else 2void< mdstealerror2ep, (res.status<? C metarpcclose2clntp<? C
Copyright 2006 Sun Microsystems, Inc. All rights reserved.

Main &ine "low


-here are variations in the low *ased upon whether this is an ,*an, autota/e, or traditional dis/set -his code wal/through is or a traditional dis/set

Copyright 2006 Sun Microsystems, Inc. All rights reserved.

Metaset $ setup and cmd line parse


%ind SunCluster li*rary Ero"y commands to primary node i applica*le I the dlopen o the li*sds9sc.so.+ li*rary ails then all o the sdssc9: unctions will *e *ound to .not9*ound. which simply returns S;SSC9$,-9%,B$; ,pen admin device Hernel level called via ioctls Install signal handlers

Copyright 2006 Sun Microsystems, Inc. All rights reserved.

Metaset $ local sanit' chec s


Earse the command line parameters

-est or con licting parameters Must run as root or anything other than printing set in o $ecessary since the local replica will *e updated

Chec/ or root privs

=et a loc/ on the local set

3eri y that all o the nodes speci ied on the command line are uni1ue and valid

Copyright 2006 Sun Microsystems, Inc. All rights reserved.

Metaset $ create#set chec s


3eri y that the current node is in the new dis/set node list 3eri y that the setname is not already *eing used on any o the nodes. -his is done *y chec/ing the setrecord cache in rpc.metad 2clnt9getset< 7ind a set num*er that is not *eing used on any o the nodes Start with the irst availa*le on the current node and chec/ on all nodes until an availa*le set num*er is ound or we run out o set num*ers 2clnt9setnum*usy< Chec/ the setname or valid synta" 3eri y that the lin/, .0dev0md0Idis/setA. does not e"ist on any o the nodes and veri y again that the set name is not in the setrecord cache 2clnt9setnameo/<
Copyright 2006 Sun Microsystems, Inc. All rights reserved.

Metaset $ create#set create the set


=et a loc/ on the set on all nodes 2clnt9loc/9set< Create the set on all o the nodes 2clnt9createset<

=et the ne"t user record num*er *y calling metaioctl with M;9;%9BS!##!J -urn on the S3M dis/set SM7 services i they are not already on Commit the set BS!# record

#elease the loc/ on all o the nodes 2clnt9loc/9KK<

Copyright 2006 Sun Microsystems, Inc. All rights reserved.

SVM Metaset Creation Example

Você também pode gostar