 Okay, so hacking OpenStack for part of ones and for those of you that are not aware This is the official Star Wars themed OpenStack summit, right? So I've gone to at least four or five talks where you know some Star Wars is mentioned So this is my little contribution. That's all there are no pictures of Wookiees and whatnot Yeah Copyright infringement and this is already a little bit right so The talk is already up at github pages So I highly recommend you actually open up a browser rental right now on that address there I Know the whole thing like it's it's a QR code. So you're using your phone and then how do you send the phone URL to the computer? So Do your best The actual URL is let me read it out loud AR brandis.github.io hacking OpenStack for padawans no spaces all Small letters The reason is I just threw in some links in there So you might one of it's gonna be easier for you to just click the links instead of typing it out every time I open a web page here the reason of course is OpenStack is contributing to OpenStack is a very much It's part Sherlock Holmes part Talking a lot to people and only a fraction of that is actually writing code. So Yeah, you we're gonna go all over with this Okay, so let me see how this thumb drive is doing It's gonna take a while all right, so Can I may I is did everyone get that? I hope so Is that working by the way? Okay, good. It's it's the exact same thing. You're gonna see here With the exception of the shell in a box thingy So without further ado further ado, what are you going to get from this little workshop? One of the first things we're gonna do is See how to set up a comfortable environment for you to start digging into OpenStack code now Comfortable is a relative term and this in the sense that what I mean by comfortable here is if you have a Five-year beard and you know how to do vi then you're gonna be very very comfortable Especially if you're used to 80 character-wide terminals, okay but If you aren't if you have no Linux experience at all and editing files in Linux and In the command line, especially which is what we're gonna do Bear with me you know, this is OpenStack and It is something that you're gonna want to at least learn a little bit about so If you have questions about specifics such as you know, which is better emacs or Vim or whatnot, you know I'm not gonna answer that by the way, but Feel free to come around and ask. Oh Yeah, sorry about that. It's DevStack DevStack And the user is DevStack the directory where DevStack is is DevStack, so Something else we're gonna do is You know, we don't have a lot of time. This is just an hour and a half. This is actually part of our much of this is part of a course I actually teach and Contributing and learning how to hack and learning your way around the project is our things that take weeks to months what we're gonna do here is just a quick overview of Where to start looking? Okay, so Take how to hack OpenStack with a grain of salt today, you're not gonna come out of this workshop experts and Stay there Okay, but you will know where to start looking and you will know how to start fooling around with Changing OpenStack and to do your bidding Which is really cool if you like programming right and most importantly, of course once we do have something to contribute It's not gonna be something great. It's gonna be something average to medium and We will however Send it up and it's gonna be rejected Probably not in five in the five ten minutes. We're gonna have but you're gonna Be able to follow along and see people reviewing it later. Maybe You're gonna see some people getting pissed off I'll tell you why in a moment Okay, and this is by the end of this Hopefully you're gonna have seen the whole process of contributing a patch to fix a bug All right, I will mention blueprints But we'll of course not have time to get into a lot of those because that's a whole other thing in the sense that Contributing a blueprint is a work in and of itself And then the code comes later. Well, we'll get to that Okay, so a little about me. My name is Adolfo Brandes. I'm Developer by career choice Stacker because it's really cool and currently I do a lot of training with the Hustexo folks I'm a geek and kind of weird than that. I like to run barefoot Even though everybody says it's gonna ruin my legs on my back and everything, but yeah, I like it And I'm of course a senior consultant at Hustexo if you care to you can follow me on Twitter at at AR Brandes All right, how are we doing now? Raise of hands people that already have the VM Yeah, it's going slow Okay Sure. Yeah, this this particular Oh, no space left on device. Who's was this the black IBM? Thumb drive. Yeah, sorry about this Yeah, I'm doing the next one Yeah, just yeah, just keep sending them all Once again, there's no There's nothing special in this VM except for the fact that it has dev stack already installed And you're not gonna be you're not gonna need to download anything off the of the Wi-Fi here Ubuntu this is Ubuntu 204. Okay, so Um Contributing to and hacking open stack. Go ahead. You want the URL? No, no questions are stupid good How do we import it? I'm gonna get there But maybe I should already show you right before So people can Go ahead Where am I? Okay to import the VM You open up virtual box. You should have have virtual box installed. I believe I set it in the description Of the training training actually the workshop so file and port appliance This is gonna look a bit different depending on your platform Just select the OVA that that's in those thumb drives Next you just leave leave it alone. Don't reinitialize the MAC address Because otherwise Ubuntu is gonna complain when it boots Or it's gonna take a long time. So just click import And it's gonna take Some time The art of predicting how long things are gonna take right? No, but nobody gets this right ever What? Especially when you're up on stage No, they have an if case for that like if your own stages fucking all Sorry about that So I'm gonna leave that Completing so I can then it's not what I meant to do. Oh, it's done. Okay, so once you're done You're gonna have a nice little dev stack Entry there Okay, if you want you can go ahead and boot it up Once again the username to log in is dev stack password dev stack. I did make a The default here is to have the VM run on NAT Okay, then add any networks. I did however Add a port forward, I think yeah, there you go To to I forwarded two ports So if you want to SSH into the VM once you boot you SSH into ports 12 to 10 12 to 10 Okay, so I'm gonna show you how to do it from the Linux command line at least if you're in Windows or Mac you're gonna You know Windows you can use putty a Mac. I'm not a big Mac guy. So I don't know probably they're probably alternatives so you can SSH into the VM by by connecting to local host at port 12 to 10 Once it boots up and the reason you're gonna want to do that is that using the virtual box console basically sucks ass So you're not gonna be able to copy and paste correctly what not so So do SSH into the VM and you maybe want to start now. So you by the time I get there you're ready in I'm also forwarding ports 80 into the VM. So once you you're gonna be able to Check out horizon running on dev stack by connecting to local hosts colon One two to 80 once everything is running So yeah, how hard can it be? We're barely booting up our gems and it's already hard. Okay All right, so we know that hundreds at least more than a thousand. I think people do it They what I mean is hundreds of people contribute to Let me see if the internet works here. So There's this thing called Olo where once again, thanks to Florian for this You can check a and any or basically a lot of open source projects as statuses. So We can see that OpenSync has 115,000 commits by over 2,000 contributors ever since it started in December 2006. So, you know, it's doable If you stick to it So as you probably know, it's mostly written in Python about according to this 70% of it Surprisingly 13% of OpenStack is written in XML Which is right What are you gonna do and a little bit of JavaScript? Okay, so this is Olo and We also have where am I something called activity.openstack.org If I can open this Which is really nice because you get the statistics directly from the horse's mouth, so to speak It's gonna take a little while to load, but it's just something you should be aware of. Okay So once again code developers around 2000 5,000 people open tickets and report them which is something you're gonna want to be doing as well And about 3,000 people actually discuss things in the mailing list, which is all very important Okay, so feel free to move around here and explore the the the statistics It's it gives you a broad overview of how OpenStack is evolving one of the things that I noticed just when preparing this talk is OpenStack is roughly doubling in size as far as committers and and Involvement is every year so at every roughly 12 months. So now we have what We had I think 1500 developers over the last 12 months and it's looking like the next year is gonna bring in 3,000 so Yeah, it's it's really an awesome thing to be part of this and I hope you guys are one of the Are part of the new group? Okay? All right Nope, that's not what I want. I basically screwed everything up here. Sorry So how are we doing with the VMs? Let me see read-only file system. That's not gonna work. Where is it? I Wonder why though There's is there's something I can do like Yeah, it's it's it's Linux. I mean I'm gonna try again. No, no, I can see the the oh There it'll there's there are two partitions. So I I tried the wrong one Viruses on Linux, what the hell are you talking about? Okay, so we know hundreds of people do it. So you're gonna be able to do it We know everything is documented or is it actually the documentation is pretty good nowadays If you go to wiki.openstack.org, this is what this link goes to by the way You should see a very brief very excellent in my point of view Overview of how to go and step by step Get down to contributing code. Okay, and a lot of what I got for this presentation came from there. So Yeah, it's great Okay, but everything's documented a lot so people do it but still there are a lot of hopes you have to jump through and With a project of this size it's It's expected and it works very well, but it's still somewhat bureaucratic, okay, so expect to have to jump through a lot of these and Expect of some level of frustration depending on what you're doing. All right It's not all just you know, there's the mechanical stuff of going and signing the CLA and creating accounts on launchpad and installing Garrett learning it and stuff like that, but there's still the human side of Convincing somebody or somebody's that your code is good and that it it needs to be upstream and You know, I've seen I've seen one line patches take 20 iterations and a month to get in so yeah it happens and So you basically have to stick to it Okay, so let's say You're starting from scratch as I believe some of you are today Maybe your developers maybe your sys admins DevOps Let's let's say you know Python or you know how to write documentation And you want to contribute somehow the first step of course is choosing what and it's not as easy as you'd think There as you've seen there are over 2,000 contributors at least 1,500 of those active and It takes More than one active contributor it takes actually a core team member to review a patch and accept it and to get it in open stack, so there are a limited number of those and You need to choose choose things to contribute that makes sense to the project Because if you choose something that only makes sense to you chances are it's not simply not going to be accepted at all Now I'm not talking about bug fixes here If you hit a bug in open stack as I'm sure you've already done how many how many of you have hit a bug in open stack? that You didn't know about before Let's see. Yeah, so Did you actually go and try and find a report and launch pad Yeah Okay, many less hands so The idea is when something like that happens go ahead and Make it a practice of trying to find the actual bug on launch pad and if it isn't there report it Okay, this is a skill that you have to practice in order to Become a proper contributor, okay, so choose what to contribute I the link there goes to a list of Low-hanging fruits so-called which are bugs on open stack that are considered by at least one or maybe two people To be bugs that are easy to fix now if you go there You're probably gonna disagree with that Assertion, okay, they're probably very easy to fix for folks that have been doing this for a while and there are some bugs there that if you know a little bit of python and You know how to read and write Good English right You're gonna be able to fix with a little bit of effort, but those go like that Now we're gonna get to a bug I chose for us today and I had to cheat a little bit because it was already taken Yeah This is this is where I piss off somebody in the open stack community for the sake of This talk, but we'll get there So yeah, first thing choose what to contribute Maybe you have a bug that you want to fix you open the bug you fix it you submit the code Do it again ten times and then it's up there, okay All right, so those are links to actually where you can open a bug and or you can open a blueprint more on blueprints To the end of the presentation now the actual code where the hell does it live? Currently, there's the official open stack get repositories All right, but you might as well just go on hit github, which is a an up-to-date mirror And which is what I usually do now if you want to You can do this on any machine that has gets installed By the way get how many of you know get Excellent So I don't have to convince anybody right get came out of the head of linus torvus. So it's awesome and crazy at the same time You will need it a lot to work with open stack. So make sure you know get there's no way around it get and python Basically, if you want to contribute to open stack, you should be honing your skills there Cloning from github directly is not the only way to do it We can use dev stack, which is the whole point here of this distribution of appliances Which basically fetches all the code for you of the latest master? installs it and slash OPT slash stack and Fires up an open stack cloud based on that all fully automated, which is awesome And the good thing is that the code is what? Oh, yeah, just yeah pass it around Okay, maybe I this one's done as well. Yay There you go. All right Are the files on these are okay? I didn't put up an MD5 some or anything Have have you been able to boot it? Yes, you go ahead Yes, yeah, I'm gonna show you what to do But of course master Currently And for the next three months is gonna be broken a lot, right? Because it's the the implementation cycle So, you know, it depends on what you want to do for instance if you want to Let's say you want a back port to fix them. That's easy, right? You just you can configure dev stack to pull from ice house and hopefully that's not that broken all the time So but you can also configure the dev stack to to pull and this is what we're gonna do You get clone like this Into say your home directory in the dev stack VM and you tell dev stack to use that as a repo See so it fetches from there. So you edit the code in there and then you get pull From from inside the dev stack directory So you have more control over, you know, maybe you're testing something on neutron and then suddenly, you know keystone breaks And that's that's no fun, right? Okay, so you have some control Okay, so this is how you get the code I do encourage you to go on to the dev stack site Which this is linking to and read up a little bit on what you can do with it once you have the code you can finally hack on it and That as I said is gonna take you anything from a few hours to A few weeks of work depending on what you're doing Yeah We're gonna come back to this. This is just an overview. I'm stalling so more people get to Sorry about that You know, we've been discussing in I've been talking to Florian these past few days of a way to If anybody has a suggestion by the way aside from bringing in a hundred notebooks To oh bit torrent, that's not bad That's pretty good. I'd have to talk to the IT guys here to see if the network can handle it, but yeah, that would be awesome Yeah, no, no, that's actually a very good idea There's BT sync now too, right? So that's close source. I know but Yeah, or I can buy a hundred USB sticks For Yeah, this I actually went to the office center now and bought five but Okay, and it took me like an hour to get him on the five things I Forget it. There's who wants Are we all done? Nobody else is gonna There's another one. All right. So once you have the code You spent two weeks on it and it's perfect and it do does exactly what you want And you want to send it up for review? The first thing you need to do is actually Join the the open stack foundation. Okay, so you join the foundation you sign into Garrett you Sign the contributors license agreement agreement, which is essentially giving the foundation the rights To distribute and use your patch It becomes basically theirs so to speak, but you do get credit for it Okay, so nothing's ever forgotten all the patches are on git and you're gonna get credit and this is something important because Part of being a member of a community is you building a little street cred, right? So I I'm not gonna lie. It's easier To get a patch in if people know who you are than the opposite, you know, but isn't this a meritocracy? It's all that it's the technical aspect that matters But at the end you need to trust somebody to say that that patch is good, right? And this is the project technical lead, right? So you you got to trust somebody and this guy While his code does need to get reviews as well people are probably gonna review it like okay This is the ptl. I don't need to you know bother too much. However It does happen that Even ptls get patches rejected and they have to iterate and everything right this this is a community after all it's not a dictatorship so We're gonna go through signing the CLA as well and We're also gonna go through Garrett which is Which is awesome by the way, and it's what makes it possible for all this to work because It's a tough problem To solve how do you get you know a random number of people to review a patch? Then say it's good and then accept it and then test it and then push it upstream You need something to glue all that together and automate it and this is what Garrett does We're also gonna go through how that works in a little while And also as I said, that's not all Once you send the patch upstream to to Garrett for review you you're still gonna need to talk to people and Convince them that the patch is good And you either do it on Garrett itself or on IRC or on the mailing lists It all depends on what you're contributing usually usually if it's a little bug You know not a lot of discussion is required outside launch pad maybe Which usually is strictly regarding the technical merits of the bug But sometimes if you're contributing a blueprint, for instance, you're gonna have lengthy Tens of emails threads on on mailing lists Trying to get buy-in for your blueprint. Okay, so this is something to keep in mind as well There's a lot of communication. You can't be read too shy and Well once again, this is one of the reasons we're all here, right? This is now the design summit, so This is where the folks come to meet the other developers face-to-face and get buy-in like that or to fight or whatever You know design some of the sessions you never know There's also the question of timing which you have to keep in mind If you submit a blueprint during the pre-release phase You're not gonna get much eyes on it because folks are worried about getting the Previous release or the current release ready for production and that means fixing bugs So if you're gonna submit a blueprint, make sure you do it on the proper place in the open stack release cycle Hey, which is as you probably know a six-month release release cycle where in the it starts with a planning phase Which we are now where will prints are submitted discussed and targeted for next release Then we go through an implementation phase where you actually hack on it. And that's where master breaks all the time. Okay, and finally the pre-release phase again and so on and so forth Okay, and you're gonna have to do a lot of these steps many Many many times. Okay, so keep that in mind. It's not a one-shot deal. All right, so Okay, let's Let's get down to setting it all up. I already I'm distributing the Dev Stack OVA to you guys. Hopefully by the end of the tutorial everybody has it You're gonna import import it on virtual box by file import appliance as we as I've just shown you And then we'll boot it up. So There's a thumb drive free here Anybody where's my mouse? There you go. So there it is Let's see boot see it boot up By the way, this OVA if you're running something other than virtual box I guess you can also import it if it supports it. So oh really and then it works Okay, so yeah, turn it off and on That's all we do as IT folks, right turn things off and on and that's it You know if your developer turn bits on and off essentially, right? That was a bad one All right, so I just booted the VM up Where's my awesome? Awesome anybody else? This is a little too pretty. Yeah, you're there So what I'm gonna do the VM has booted up I'm gonna SSH at port One two two ten dev stack at local host and I'm gonna add the dash a here because later on if you have SSH keys and accounts on launchpad Awesome your sets. I will go through a little bit of what we need to do to get this working this dash a here essentially Tells SSH to forward my Authentication agent To should I copy it over here or who's is this? What okay, does anybody yeah, yeah, that's yours. Yeah, I remember this one the one with multiple partitions who who wants No, nobody All right, so the dash is gonna forward my authentication agent to The dev stack VM and you're gonna see why in a minute so password is dev stack. Yeah, I couldn't connect to it So yeah, we'll see So we're in okay, so I hope you're all you've all been able to connect to it Okay, so we put it up we connected to it Now we're gonna take a look at dev stack and what it does So dev stack which I've cloned in Sorry in dev stack so CD dev stack Okay, so dev stack is a set of scripts that Can be configured to your liking to a certain extent through the local Dot com file. So if you check that check that out by the way If you don't want to mess with Vim or vi or whatever, which is a little bit counter-intuitive to beginners You may want to use nano which is a little less a little more like I don't know Notepad I guess except it's completely different, but it's less But it is it is you know, you don't have to you know press I to start Typing and changing things and then escape and you know all the crazy shit that those guys with beards love so Yeah, so I'm gonna go the beard route local.com all right, so this is this is the basically the template and You can set things you can basically configure your open stack installation here Such as for instance setting the admin password Go ahead. The port is one two two ten Okay, one twenty two ten twelve thousand two hundred and ten Don't ask why You set them my sequel password, etc. Etc. Okay, so this is just an example They're all not this is not a full template if you want to full template You might want to look at stack RC, which isn't the same directory Okay, except you're not supposed to edit that one you edit local.com Okay, so this is a pretty extensive list of The available variables you have to configure things one of them is as we were discussing earlier here in front Is you can define what? Repository and what branching that repository dev stack is gonna get the code from Okay, so this is something you're gonna do a lot you're gonna want to have your own repository maybe your own github fork of nova and You're probably gonna want to pull from that depending on what you're doing Okay, so back to local.com let's go to the very end there and Let me just point out that for this class I just enabled offline equals true So I already downloaded dev stack into this box, which is the whole point so we're not gonna use the the Wi-Fi to to actually install it and This is the first hint that the bug. We're gonna fix this in horizon Reason being that it's pretty easy to See stuff happening like get get a feedback loop going with a With fixing a bug or or changing horizon you can easily see what you're doing right, it's not always true with actually, it's never true with other another class of open stack bug which is You know, you know that open stack by now I hope is a project that has many many components and they all they're always synchronous and debugging this is a pain Right, so I picked a bug in horizon Which is easy to you know see what's happening without having to wait Hours days to be able to reproduce the dam bug Yeah, go ahead What it does is if you have already run stack dot sh It won't connect to the internet at all to install package You see what dev stack does is it also installs packages for for the from the Ubuntu repositories from wherever it needs to So if you enable offline equals true that means you you sort of have a stable-ish System to work on you see and it doesn't use the internet Okay, and you you're gonna want to install test only packages equals true Because part of the whole process of contribution is to test things a lot before it fails in public, right? So you want to you want to test your stuff locally before you submit it And then it's rejected because it fails, right? It's just so just to save on resources and to save some face as well Okay, so that's local dot com And Without further ado this dev stack directory was basically just a git clone out of the dev stack repository So it this this was done late last night. So it's probably really recent So what you do now is run stack dot sh like so So it's dot Stack dot sh when you're inside the dev stack directory and You need to enter a password here. I'm just gonna use dev stack because I have no imagination And this is going to take a little while You can follow along a little bit Okay, so as you can see a Lot of the requirements have already been satisfied so if you were running this the first time it would at this point it would be downloading all the packages out of the Ubuntu repositories out of pip out of a Host lube services, I'm sorry It's arbitrary but pick something You're gonna use it to log in to horizon for instance later. Yeah. Yeah, it's just a question Okay, I can make it available. Sure. I Haven't I haven't I didn't worry about it too much because the reason is that You can do this easily at home. It's just install Ubuntu Get clone dev stack That's it. So download Ubuntu server or the minimal Ubuntu CD Whichever and then get clone devs actually apt-get install get Yeah, exactly. Yeah, this is all I'm just repeating. What's what's in the dev stack? Yeah, they have several different use cases so to speak. So this is the standalone Installation basically this is what you'd get if you actually installed it on a server recommendation is to have a VM with at least two gigabytes currently of RAM It's and it's already sort of hitting the limit. So maybe you want three or four to to you know Have a comfortable environment once again comfortable Questions You know what I do I do unstack and then stack again and sometimes I actually remove the directory from OPT stack and And do weird stuff like, you know, that's that's all it's doing. Anyway, it's fetching code into OPT stack and then firing up multiple screens With the services in them. So there's no real mystery there Like if you run on stack, it's just gonna clean up the databases, etc. Which is always good, right? So yeah, that's what I do. We're gonna actually do that in the way No, no, no. Well, at least it shouldn't unless there's a newer version so if offline equals false and There's a newer newer my sequel Package in Ubuntu, then it'll okay, it'll it'll fetch it and upgrade it No, no, no, no, that's just I don't use it that much, but let's take a look at the script Oh, I don't have a screen running yet. So let me let me have let me have this finished Okay, so it's screen. Yeah What I do is screen dash R. So that's what it does Which is why I don't didn't know what it does because I just you know By the way, screen is awesome. You should all use it Always everywhere. Don't ever have a terminal open without a screen running Okay, so learn screen and control a kda, whatever I'm sorry Oh, yeah I've been meaning to to play around with it for a while, but I haven't but I've heard a lot of good things about that one as well I'm not sure. Does it does be able to work with tmux? Yes It makes sense in terms of the sockets and stuff, but yeah Yeah Yeah Okay, so this is running really slow here. Has anybody how are you guys doing there? Finished. Yeah, so it's me obviously Sorry, if you're done, you can basically start fooling around with it When it's done, this means that No, no, it says stack.sh finished in x seconds That's how you know it's done So what you do then you can go on go in the browser and connect to localhost.12280 And If everything went okay You should be able to see the horizon dashboard up. How are we doing on time? Okay, I have 10 minutes to Finish the setup. Actually, I should be done with the setup But What do you know? Stack.sh is not even finished and my horizon's already up. So that's good news, right? What the hell is going on? I mean, I don't have the screens up or anything. I don't know what's magic It's still running Maybe the maybe it's just the delay in the in the terminal updating whatever Shell in a box is complaining. I don't know That does look like It's the case Yeah, three minutes. It's usually around that three minutes Yeah, I think I think this is I hit some form of buffer Just a second folks, let me try and yeah, it's actually already working So Screw that Okay, so once it finishes run screen space dash r Small r and you should see something like that And we're currently I think at the last screen but before then run Control a And then quotation marks. Okay, so control a Release it and shift Whatever it is in your keyboard To get the quotation marks So you get a list of all the windows in a way you can actually read. Okay, so What you can see here is that dev stack created 21 separate screens One for each of the open stack services it manages Okay, so let's say you want to see how nova compute is doing you go to screen six press enter and that's What the output looks like now? This is actually running in the foreground So the way to in dev stack you you restart a given service is you go to its screen you press control c So now nova compute is dead and you then press up arrow And you get the command line to start it back up again. Okay So there you go nova compute is started back up Okay, so once again control a quotation marks window list Now I want heat api You can sort of guess which one is which right? Yeah You know, I don't think there's a map, but let's find one that I don't know what it is C is cinder so c is cinder api cinder scheduler cinder volume I I guess what's happening here once you get a feel for the different sub processes of open stack It's it sort of become becomes pretty obvious which one which ones they are So n is nova right so nova api cpu nova What's con again? Conductor, yeah Notar nova certificate, right Nova network Surprisingly uh nova scheduler nova nova vnc nova xvnc nova out Nova object store blah blah blah blah Where's neutron? Yeah, there is no neutron. It's new it's using nova network apparently boo It was probably easier to configure dev stack for right Okay, and this is glance horizon and keystone and you got a nice little shell to do whatever you want Um, all right. I'm sorry You want to what wait? Oh, you want to leave the screen? So, okay. Oh, yeah screen. Oh, okay a little screen Lesson here so One of the things you do often a screen before I get to that is control a control a you just switch Between the previous screen and the one you are now you can also do Control a d to detach so that's to answer your question control a d you you go back to where you were before and Screen dash are actually I much prefer Dash dr D capital r which means if there's somebody connected to the screen elsewhere You'll basically kick them out and get the screen for yourself and by by someone else. I mean you because this is per user If you forgot your screen logged in somewhere, so I just always use d capital r And you're back in so control a Um Quiltation marks same thing again. All right, so let's stick to horizon for now Um, I'm a little bit worried about time. So let me settle down here and do some actual work Um Okay, so let's get down to a little bit of hacking Let's choose an easy bug. Hopefully you have this open in your browsers there And I'm gonna Open that in So this is bug number 132256 On horizon as I alluded to before let's see what it says here um What this guy's complaining about and this is What's his what's his name? Cindy Lou He or she is complaining that When you go to project image create image The format should not show blank. It should say something like select format and There is a screenshot here, I believe To explain what what he or she means and that's it. So when you on horizon you go and click on create an image um the format Drop down doesn't have sort of a default option to explaining what you should do there As opposed to when you launch an instance and you are selecting from the boot source, okay So what the bug is is asking for here is something like you get in the second Part of the screen here, okay, so that's what we're going to try and do Now I as I said before This bug is Uh, it has been triaged and this means somebody in the open stack community said, okay, this is good. Let's fix this Um, but the importance is low in that this is not a deal breaker for a lot of people Okay, so which is it's a perfect bug bug for us today It's not perfect because somebody is already working on it Okay, um, and you wouldn't usually do what I am about to do All right Which is just, you know Go over their heads and and just try and fix the bug. I'm not too worried because I'm not actually fixing it Um in a in a proper way. It's going to be sort of a one-liner just so we change something and have something to submit Okay, um Now what I did was I I I did this last night and I went through a whole lot of bugs trying to find one That was going to be easy for you to type in etc. And so this was the best one I found so I'm sorry, mr. Andrews Benavides, I hope you're not here right now He works for intel apparently now, okay, this is a good opportunity to to to demonstrate something I mentioned earlier that contributing And in such a community is a bit of a Sherlock Holmes job a little bit of an investigation job. Why if you come up To something like this and you see the bugs assigned, but you'd like the fix you want it today And you want to know what the hell is going on? Why is the fix not up there? Um, you you can go down on the on the on the launch pad launch pad bug and you can see When there's a fix committed for review, it's going to show in one of the comments Okay, so this there's a length to Garrett and everything. So there isn't anything here, but as you can see this, uh Junichi matayoshi guy Are you here by the way? He asked for for for taking over the bug. What was it about a week ago? Okay, I want to I want to do it because this is my first bug in order to contribute to open stack so he was really really polite and um, I recommend you follow this guy's leads, right, so Yeah, don't follow mine and Andrews said Also very politely. Thank you. Uh, Junichi for your help, but I already have the fix I I will push it this sick in short time uh But where is it? It's been a week, man Come on So so this is going to happen all the time You're going to find bugs. You're going to want to fix but you know, I'm working on it I have it. Do you know the story of gimp by the way? uh The story of gimp was somebody, you know, the guy I forgot his name Help me out here. He wanted to to develop gimp and he was like, I'm going to do it and some other guy said No, don't do it. I already have something working Um, don't don't create gimp. I already have something else that does exactly the same thing And you know that thing never showed up. So good thing The other guy ignored it, which is what we're going to do now. Okay, so we're going to ignore uh Andress, sorry Andress and we're going to actually fix it and submit it for review Actually, I'm going to do it. You guys don't press the enter button at the very end. Okay, otherwise Otherwise, you know, then we're just humiliating humiliating the guy. Okay, so All right, so we want to fix this bug. Uh, we chose it. Um The question is now where the hell do I edit the code and we're going to come back to Uh, I'm sorry. What's your name again? Paul All right, we're going to come back to your question as to what do I do? Because you know dev stack is sort of Possessive if you edit the code in place, it's going to do things to it. It's going to go away, etc So you don't want to do that What you want to do Is on your vm Okay, so I'm going to go to oh, yeah another screen trick We know that screen zero is where you get to do whatever you want. So You you type in control a zero So you're back in there or you can go the other control a Quotation mark and choose the shell And if you just cd back into dev stacks home directory and ls That's relatively readable you can see dev stack and horizon and what I did was I get cloned horizon in there okay, um So it's an actual horizon clone And as I've shown you in dev stack local.conf I told dev stack to use home dev stack horizon as a repository for its horizon deployment so If I go on opt stack horizon and I do get remote Dash v I can see that the origin for this get repos get checkout is actually My home dev stack horizon Deployment or checkout where I'm actually going to edit the code Okay, so Let's go in there horizon And Now I'm not going to teach you how to code Sorry Or how to read projects or how to you know, this is something that takes all of you know two weeks in python You know people get degrees for this, but you know python's really easy. So It just needs a little bit of patience So let me you know just out of curiosity. So what did I do? I don't I'm not a big Connoisseur of the Billions of open stack projects and their code. Okay, I know a little bit of of a couple of them But I don't know I didn't know how to fix this Now this is an extra. This is actually a very good example of an excellent bug report. Okay, because It's very clear. There's there's an example and a counter example. So what's the counter example again? Um It's this guy over here So I know that if I grab horizon and for Select source, I'm probably going to find something that works very similar To what what the bug reporter wants. Okay, so that's one of the one of the ways you can go about fixing bugs Okay, if you don't really know what you're doing you sort of feel your way around All right, so that's what I did and I I found a place And then I found out it's completely different from the way The the image dialogue works right because you know open stack It looks standardized, but it isn't Especially where the code is concerned you have all sorts of ages All sorts of styles or all sorts of everything in there. So things don't always work the same Even on on horizon for example So what I ended up finding out to save some time because we're running out of time Is that um, where am I? We actually just need to edit the settings.py file to fix this bug Okay, so it's it's a really really really really low hanging fruit Why because um once again, let me go back here oops So from the root directory cd horizon Open stack dashboard okay and then edit Settings.py in there and then you're going to look for the Open stack image Backend Variable Which simply lists all the open stack image backends available and before I continue Yeah, I'll I'll I'll be right. Let me just first show the the first step in fixing a bug is Finding the bug no reproducing the bug You have to actually yeah, it's part of finding the bug you're right So you actually need to see the bug happening before you can fix it Why because when you fix it you need to be able to tell that it's fixed Okay, it's right So How are you going to do that and this is the reason I chose a bug in horizon because it's pretty easy to do So username admin. So have you all been able to get here? Those of you that are following along so admin password dev stack This probably gonna take 500 years on mine, but The memory is all over committed already. Let me check. Yeah, I'll see that I'm barely I have 100 megs free Question Yeah, see that's where You need to hone your investigative skills your coding skills This is once you get to know the project you're going to start, you know, and by project, I don't mean open stack I mean the like horizon or you as you move along This is this is a tip by the way If you don't know where to contribute choose a project project and learn it don't learn all the projects Because they're huge. Okay, so what I would recommend then maybe I don't know Maybe start with horizon if you have some web experience because horizon is jango Okay, so What happened last night was I did go into all the is it in the database is it in One of the py files weighed down in the middle of the project and I actually Found out that one of these files uses the settings to create the drop down. Okay, so you end up moving in circles and You end up you have to follow the string Of of the the train of thought of the programmers, I guess the collective train train of thought of the programmers So, yeah use the force So, um Where am I You can keep on asking questions guys while I do this Okay, so yay there we go Now let's reproduce the bug Images Yeah, I don't think it matters Okay, so yeah, here's the bug We don't have Something that tells us what we need to do and because we can't see that we don't know what to do, right? So let's fix it So once again, I'm I remember somebody saying that I lost you guys so Once again, I'm on Screen zero here And I'm running cd horizon open stack underscore dashboard And I'm editing the settings dot py file And I'm moving down to line number Line number 80 Which in vi this is super intuitive you type in 80 shift g and it takes you there Oh, right, so vi is awesome It's all muscle memory So open stack image back end and the first entry there and this sucks because this red is horrible You can barely tell these are two ticks here two sets of two ticks And and what you want to do is in the second one If you want to do this right open quote close quote, you use the translation engine, right? So you surround that second pair of ticks in underscore parentheses because you do exactly what the other entries do And you insert something like Miss lew once right what's what's his or her name Shit, this is going to be bad too. Let me try and get back into my Yeah Yeah, except except I can't g vim into the dev stack vm that easily right so Thank you We haven't You know us bearded guys help each other. So thank you. Do you have a beard? Yeah, I could have just used vi or could I I don't know lately in the latest districts It's just a shortcut for for an alias for vim, but So two sets of dash dash dash and I'm going to say what was it? Select format right Select format. Yeah, that was it space So I'm going to colon right this Let's check on the screenshot It's a select source no caps on the second one. So We've got to stick to something people we have to believe in something so So Yeah, yeah blueprint to know we should always capitalize our everything's okay So all right select format Am I losing somebody so far? Is it okay? This is critical to the process So all right right And I'm going to see if horizons smart enough to pick up on it without restarting anything. I doubt it But uh, yeah f5 f5 create image No, it's dumb. So we need to restart Apache Okay, I remember that I did it on purpose Once again, I'm going to find the horizon Window here. I'm going to control c And I need to run a pseudo service Apache to Restarts Okay, so pseudo make me a sandwich remember that one service Apache to restart You can use tab completion for those of you that are new to the command line. So pseudo service app Tab Okay, magic restart The origin is showing what? Oh, yeah, so now the point here is I added to this in and you're right I did it on purpose Um The code is not running live Okay, we edited this on the local Our local directory, so we need a way to push it up All right This is where we need to start Getting Garrett to work and which is fine because we're almost done. So this is important What we need to do is to get config your Uh data basically and by this point you should already have a You will have a get review username which you don't because I don't know if you already Ah, see how hard can it be? Um, where am I? Okay, you need to do This All right So if you haven't go ahead and Create a launchpad account, you know, you can go ahead and go to that slide And you're going to need to create the launchpad account You need to click on the join the foundation link and actually join the foundation It's not as easy as it sounds There are plenty of fields All right, I know because I try to get my friends to vote for this talk And they were all like what? I have to join the foundation. Yeah, so no cheating um And then you finally sign in to review dot open stack dot org and agree to the cla Um by that point You should have a username in garret which is review dot open stack dot org Which you can then use for what i'm going to do right now Which is Where are we? Get to config all of this stuff. Okay, so Think i'm gonna be able to cheat here. Yeah So on screen zero You can run get config global username adolfo brandis And get config What was it user email? I'm gonna use my This text or account here No, no, it won't be It won't be because I added to the code somewhere else. There's no way I could you know if you want to skip a step here Um You can go ahead and edit it. You know, we're in offline mode. Nothing's going to get overwritten. You can go in opt Stack horizon and do the same thing in there Okay Yeah, yeah, no, no, it's I have to do this because this is part of the thing right You're not going to be able to submit the code if you don't do what i'm doing now Okay, you do need to have the the the git configured you need to have the the garret username specially Okay And finally Get review dot username in my case that's Get review dot username That's ar brandis Okay And we need to get review dash s which sets up The repository to insert Among among other things to insert a change id into the commit messages Which is going to be necessary to glue the whole thing together so Once my git config is done And I can check with git config dash l Uh It looks good It's not your launchpad name. It's the garret username. Okay. It's the one you're going to get when you Sign up, okay If you're lucky you can get the same So git review Oh, yeah apt-get install git review I already did that for you So that's one of the things one of the other things for the folks that are going to do this from scratch So you need apt-get install git and git review So git review dash s is going to fail It's going to try and connect to The horizon repository Actually the the the garret repository Could not connect to garret Even though I did set the username All right, could not connect to garret at All right, why the hell not? Yeah, maybe Maybe it's a it's a problem with the The vm and the Okay, let's move on for now Yeah, you got the point right we don't have a lot of time This should work It did work this morning. I promise you It's something with the wi-fi here Nothing to do with me. Yeah, that's that somebody has somebody been able to get this working from from the conference floor Yeah, so there are a couple of errors you can get here and one of them is this one the other one is that You need your private key to be accessible from the vm. There are a couple ways you can do that. You can copy it in manually Which is not something you probably want to do But you can also use the ssh-a capital a thing when you connect into the vm Which gets forwarded into your eight local agent, which is better. Okay, so This should work What oh dropbox Unless you're encrypting that thing don't do it Okay, it's your private key man It's your lightsaber. Hold on to it with your life. What? I did I got an error message because if you do it from inside the screen, which is what I'm doing I'm running a screen on my local notebook. So if you run ssh-a from inside a screen Sometimes works and sometimes fails Beats me. Okay, so you're probably not going to have that problem L Okay, but then what ports are am I forwarding? Yeah, see, okay Let me all right. Let me we don't have a lot of time. Let me I want to I want to at least show what what you do here. So I'm on horizon get diff Oh, where I'm not So get diff This is my needs a little change. So I go get commit And actually gets add Everything because I'm lazy gets add periods get commit And I had a nice commit message prepared somewhere here wait I don't want to have to think right now Oh, and I yeah, I actually skipped a step here Sorry, this is pretty important This is pretty important. So let's not save this so, uh, I actually Didn't save the file And the first thing you need to do is get check out dash b Bug slash and the number of the bug you're fixing Okay, so you're creating a so-called topic branch. All right Okay, so if you run get branch I'm now on bug and the number of the bug. This is this is if you don't do this thing Are gonna fail in interesting ways with garret And then you get commit And I'm gonna be really lazy Okay And you also check the last line out here closes dash bug and the number of the bug This is something else you need to include in your commit message Okay, if you were implementing a blueprint and fixing a bug you'd have implements blueprint bp number Whatever Yes, it's integrated. Yeah, exactly. Yeah It has to The reason you you use that syntax is because it gets scanned by garret In order to integrate everything with launch pad with whatnot. Okay, and uh, this is after gets Sent to the right places and the right people They go and review your your code. You see you don't actually need once you submit the code You don't actually need to Talk to anybody anybody about it the folks that Handle horizon will get a notification that a code was submitted for review and Hopefully they'll go and review it All right But if they don't that's where you head on to to the irc chat room You go on the meetings you come to the open stack summit And the design sessions and you go I want that string committed, right? And I'm in a more polite way than that Hopefully So I'm being really like, yeah, okay So show default text for image formats blah blah blah blah blah Hey, okay closest bug Committed. Yay. And now I go on opti stack horizon And I run git pool Okay, so what happened here is uh I have a new branch, but I need to check it out here because I committed it into a branch, right? So this is where you know, you need to you need to know git There's no way around Bug 1 3 is 0 2 2 5 6 origin bug Okay, so I'm now what this line was was git checkout dash b bug This is the name of the local branch and then the name of the remote branch, which is actually in my other directory okay So I'm there if I run git log dash p I can see my adolfo brand is commit message up there And what I changed right at the bottom Okay, so the codes are is in there. I now I can now go to the horizon uh thingamajig restart Apache to save some time and Run the the log tail whatever Uh in there again, so up arrow And let's see if we fix the model Well, it's yeah, you're creating a new branch with the bug but remember this is Garrett is built in such a way that uh as to minimize conflicts in this kinds of situations, right? So when you push this upstream the branch name is sort of a tag You see what I'm saying when it gets up there So it's used to to identify which bug it is and and and connect the whole the whole thing I pulled down from from my other directory. That's not up anywhere yet. It's it's just inside the vm so far so Maybe you missed this the step where I um Okay, all right, you're asking when you pull stuff back in like when you're updating this branch Okay, uh, this is an important question like If it takes you A week to fix a bug in such a situation. You're going to want to update your branch with master, right? You're going to want to pull back stuff back in And and put your stuff your local fixes on top of that and this is called a rebase Okay, so you're going to have to do that. There are a couple of slides in there, which unfortunately I'm not going to have time to show but they're in there. Okay I Didn't submit anything so far. I just Put the code in there and we're going to check to see if that it worked Yay This is just the beginning right you have a code that works This is where you get into the tough job of actually submitting it. Okay, so um Oh, yeah unit tests Okay, uh, let me just mention it All open stack projects have unit tests and integration tests the unit tests can be run from the project itself um With no extra Infrastructure, okay, uh on davstack though Recently it sets up tempest for you and tempest is open stacks um integration testing components, so once you Write codes you run the unit tests on the project, which is you know run tests usually or you use talks if you want to um, and then you run tempest to integrate everything uh how this works with Jenkins or garret when you upload the code there the unit tests are run automatically whenever as soon as you hit get review the code is sent up there and the um unit tests are run Once a core reviewer approves your code then the tempest Tests are run, which are more expensive, which is why they don't run all the time Okay, but before you submit your code you should you should ideally run those as well all right, so That's what that does And if you find a problem during the tests This is git by the way again You fix it and you amend the same commit you had before and then get review and send it back up again Okay, this is this is what's gonna happen a lot um All right quickly Check go back to these slides Check the garret workflow link, which has a very good explanation of how the garret works um It explains how to pass tests Getting reviewers as I said once again If it's a bug fix and it's high priority Somebody's gonna review review it quickly the problem is getting Getting to actually fix it yourself because probably somebody else already owns it um Try the mailing lists and of course try coming to the open stack summit and talking to the developers right? They're all here right now um You need Plus two reviews from core reviewers to get your patch accepted. This is important You can get as many plus ones from the community as you like, but you still need Two votes or actually one plus two votes from a core reviewer before the patch is accepted And this you can all see on the garret screen as well all right, uh This is how you update a change once you um As I mentioned before you amend the commit You're going to do a bit of rebasing if you have a long live topic branch So make sure and you learn to learn how to rebase properly um All right, just quickly A couple minutes. What about blueprints? Uh, what's the difference between a bug and a blueprint? Well, essentially a bug describes the problem and a blueprint describes the solution so if the problem is big enough that You know, it doesn't fit on launch pad nicely like the bug we just handled did You should probably write a blueprint and when you write a blueprint, there's a whole set of uh Other stuff you have to do in addition to just fixing the bug, right? You have to create it on launchpad Submit it for approval. It gets targeted to a milestone in the open stack release or not Okay, you have to convince people to accept your blueprint Okay, and then convince people to accept your code, which is the whole point Uh, no, you're you're assigned the blueprint, but um You don't need to actually implement it. Okay, it's it makes sense. Most people that submit blueprints either Well depends on the blueprint sometimes teams Submit blueprints and they take on the implementation as well. It makes sense, right? And this is all uh on the launchpad and it's visible. It's all very visible Okay, so when you submit a blueprint, you don't need to necessarily bother the mailing list For somebody to take a look at it, but you do need to discuss it Hopefully, okay, so you either do that on on the summit on irc or on the Blueprint page itself Okay, you wait for the project technically to approve it But you don't stop discussing it in the meantime, right? You you will improve your blueprint as you work with it and last but not least Don't give up because that this is the toughest part of contributing to a project like open stack. It's tough um As I said sometimes it takes weeks for you to get a patch accepted but don't give up because You know the project needs contributors, uh, and you know, hopefully some of you are going to be one of the 1500 new developers this year. Okay. Hope I I could help a little bit in that regard Sorry, my lab failed, you know, it's tough doing live stuff. Sometimes it doesn't work If you liked it feel free to treat it The actual presentation is cc by assay as far as I could make it Which is pretty much everything except the pot of one name so Once again, it's up at Either on github itself. This is the url for the actual present the code of the presentation or Github pages again. Thank you very much. Sorry. Uh, I went over time a little bit Thank you