openstack interview questions
Top openstack frequently asked interview questions
I am new to cloud programming and want to know, if openstack could be used in my company.
That's why I'd like to see some simple tutorials and other resources for openstack.
Source: (StackOverflow)
I'm having a problem with Python generators while working with the Openstack Swift client library.
The problem at hand is that I am trying to retrieve a large string of data from a specific url (about 7MB), chunk the string into smaller bits, and send a generator class back, with each iteration holding a chunked bit of the string. in the test suite, this is just a string that's sent to a monkeypatched class of the swift client for processing.
The code in the monkeypatched class looks like this:
def monkeypatch_class(name, bases, namespace):
'''Guido's monkeypatch metaclass.'''
assert len(bases) == 1, "Exactly one base class required"
base = bases[0]
for name, value in namespace.iteritems():
if name != "__metaclass__":
setattr(base, name, value)
return base
And in the test suite:
from swiftclient import client
import StringIO
import utils
class Connection(client.Connection):
__metaclass__ = monkeypatch_class
def get_object(self, path, obj, resp_chunk_size=None, ...):
contents = None
headers = {}
# retrieve content from path and store it in 'contents'
...
if resp_chunk_size is not None:
# stream the string into chunks
def _object_body():
stream = StringIO.StringIO(contents)
buf = stream.read(resp_chunk_size)
while buf:
yield buf
buf = stream.read(resp_chunk_size)
contents = _object_body()
return headers, contents
After returning the generator object, it was called by a stream function in the storage class:
class SwiftStorage(Storage):
def get_content(self, path, chunk_size=None):
path = self._init_path(path)
try:
_, obj = self._connection.get_object(
self._container,
path,
resp_chunk_size=chunk_size)
return obj
except Exception:
raise IOError("Could not get content: {}".format(path))
def stream_read(self, path):
try:
return self.get_content(path, chunk_size=self.buffer_size)
except Exception:
raise OSError(
"Could not read content from stream: {}".format(path))
And finally, in my test suite:
def test_stream(self):
filename = self.gen_random_string()
# test 7MB
content = self.gen_random_string(7 * 1024 * 1024)
self._storage.stream_write(filename, io)
io.close()
# test read / write
data = ''
for buf in self._storage.stream_read(filename):
data += buf
self.assertEqual(content,
data,
"stream read failed. output: {}".format(data))
The output ends up with this:
======================================================================
FAIL: test_stream (test_swift_storage.TestSwiftStorage)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/bacongobbler/git/github.com/bacongobbler/docker-registry/test/test_local_storage.py", line 46, in test_stream
"stream read failed. output: {}".format(data))
AssertionError: stream read failed. output: <generator object _object_body at 0x2a6bd20>
I tried isolating this with a simple python script that follows the same flow as the code above, which passed without issues:
def gen_num():
def _object_body():
for i in range(10000000):
yield i
return _object_body()
def get_num():
return gen_num()
def stream_read():
return get_num()
def main():
num = 0
for i in stream_read():
num += i
print num
if __name__ == '__main__':
main()
Any help with this issue is greatly appreciated :)
Source: (StackOverflow)
I am using openstack to create a VM using 'nova boot' command. My image is cloud-init enabled. I pass a --user-data script which is a bash shell format for cloud-init to run during VM boot up time. All this happens successfully.
Now my use-case is to re-run cloud-init to execute the same user-data script without rebooting the VM. I saw /usr/bin/cloud-init options and they do talk about running specific modules but nothing is able to make it execute the same user-data script. How can this be achieved ? Any help would be appreciated.
Source: (StackOverflow)
I am defining Objects broken down from a file to be stored in Object Storage Cloud, as Storage Objects.
What I know:
I have read documents and papers about object storage cloud. Most of the time, the documents assume that storage objects from a file (to be stored) have been already created and rest of the storage process is mostly explained. A Storage Object is a container that has some fixed size data with a numeric ID and some metadata.
what I would like to know is:
- "How" are those storage objects actually created?
- What is the break down process of a file into multiple storage objects?
- What metadata and minimum metadata is saved alongside each object?
- What "key" is (extracted) required to later retrieve that storage object?
- Where is this "key" stored? -- (best if answered in the context of Ceph Object Storage technology)
Source: (StackOverflow)
I want to install openstack client on my machine running OSX 10.8.5. As a prerequisite, i need to install pbr. So, i did the following
git clone git://github.com/openstack-dev/pbr.git
cd pbr
sudo python setup.py install
But im getting the following error trace
Traceback (most recent call last):
File "setup.py", line 22, in <module>
**util.cfg_to_args())
File "/Users/jimcgh/dev/pbr/pbr/util.py", line 241, in cfg_to_args
pbr.hooks.setup_hook(config)
File "/Users/jimcgh/dev/pbr/pbr/hooks/__init__.py", line 27, in setup_hook
metadata_config.run()
File "/Users/jimcgh/dev/pbr/pbr/hooks/base.py", line 29, in run
self.hook()
File "/Users/jimcgh/dev/pbr/pbr/hooks/metadata.py", line 28, in hook
self.config['name'], self.config.get('version', None))
File "/Users/jimcgh/dev/pbr/pbr/packaging.py", line 817, in get_version
version = _get_version_from_git(pre_version)
File "/Users/jimcgh/dev/pbr/pbr/packaging.py", line 776, in _get_version_from_git
"git --git-dir=\"" + git_dir + "\" describe --always").replace(
File "/Users/jimcgh/dev/pbr/pbr/packaging.py", line 220, in _run_shell_command
stderr=err_location)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1228, in _execute_child
raise child_exception
TypeError: must be encoded string without NULL bytes, not str
How can i fix this ?
Please help.
Thank You
Source: (StackOverflow)
I have no experience in openstack and would appreciate anyone who can help and guide me with this issue. I'm installing openstack in virtual environment (Ubuntu 12.04) and this came out:
- git clone git//git.openstack.org/openstack/requirements.git/opt/stack/reqiurements
Cloning into '/opt/stack/requirements'... fatal:unable to connect to
git.openstack.org: git.openstack.org[0: 192.237.223.224]:
errno=Connection refused git.openstack.org[1:
2001:4800:7813:516:3bc3:d7f6:ff04:aacb]: errno=Network is
unreachable
Source: (StackOverflow)
I have installed OpenStack on my local machine. I am able to perform every functionality such as uploading image, creating and launching instance, associating floating ip etc. But I cannot create volume of more than 2 gb. If I create any volume of more than 2 GB then it gives me the status "error" on my dashboard. Less than 2 GBs are getting created.
Source: (StackOverflow)
I have a really strange networking problem. The actual network configuration is quite complex, because I am using Openstack and Docker to build a virtual network. However, the problem is not there, because I am capturing on my host's interface and I see all the packet in the right way.... But for some reasons I do not know, it seems that TCP is ignoring them, though they have been received: it doesn't send ACK for them and it doesn't send the data to the application.
In my trials, I sent HTTP GET request for an html page to a server jetty (IP 192.168.4.3) from an host (192.168.4.100).
What I see capturing on 192.168.4.100 with Wireshark is:
192.168.4.100 -> SYN -> 192.168.4.3
192.168.4.3 -> SYN, ACK -> 192.168.4.100
192.168.4.100 -> ACK -> 192.168.4.3
192.168.4.100 -> GET / HTTP/1.1 -> 192.168.4.3
192.168.4.3 -> ACK -> 192.168.4.100
192.168.4.3 -> Fragment 1 of HTTP 200 OK response -> 192.168.4.100
192.168.4.3 -> Fragment 2 of HTTP 200 OK response -> 192.168.4.100
192.168.4.3 -> Fragment 3 of HTTP 200 OK response (PSH) -> 192.168.4.100
192.168.4.3 -> Retransmission of Fragment 3 of HTTP 200 OK response (PSH) -> 192.168.4.100
192.168.4.3 -> Retransmission of Fragment 1 of HTTP 200 OK response -> 192.168.4.100
192.168.4.3 -> Retransmission of Fragment 1 of HTTP 200 OK response -> 192.168.4.100
192.168.4.3 -> Retransmission of Fragment 1 of HTTP 200 OK response -> 192.168.4.100
192.168.4.3 -> Retransmission of Fragment 1 of HTTP 200 OK response -> 192.168.4.100
192.168.4.3 -> Retransmission of Fragment 1 of HTTP 200 OK response -> 192.168.4.100
192.168.4.3 -> Retransmission of Fragment 1 of HTTP 200 OK response -> 192.168.4.100
192.168.4.100 -> ACK of Fragment 1 -> 192.168.4.3
192.168.4.3 -> Retransmission of Fragment 2 of HTTP 200 OK response -> 192.168.4.100
192.168.4.3 -> Retransmission of Fragment 3 of HTTP 200 OK response (PSH) -> 192.168.4.100
192.168.4.3 -> Retransmission of Fragment 2 of HTTP 200 OK response -> 192.168.4.100
192.168.4.3 -> Retransmission of Fragment 2 of HTTP 200 OK response -> 192.168.4.100
192.168.4.3 -> Retransmission of Fragment 2 of HTTP 200 OK response -> 192.168.4.100
192.168.4.3 -> Retransmission of Fragment 2 of HTTP 200 OK response -> 192.168.4.100
192.168.4.3 -> Retransmission of Fragment 2 of HTTP 200 OK response -> 192.168.4.100
192.168.4.3 -> Retransmission of Fragment 2 of HTTP 200 OK response -> 192.168.4.100
192.168.4.100 -> ACK of Fragment 2 -> 192.168.4.3
192.168.4.3 -> Retransmission of Fragment 3 of HTTP 200 OK response (PSH) -> 192.168.4.100
192.168.4.3 -> Retransmission of Fragment 3 of HTTP 200 OK response (PSH) -> 192.168.4.100
192.168.4.3 -> Retransmission of Fragment 3 of HTTP 200 OK response (PSH) -> 192.168.4.100
192.168.4.3 -> Retransmission of Fragment 3 of HTTP 200 OK response (PSH) -> 192.168.4.100
192.168.4.3 -> Retransmission of Fragment 3 of HTTP 200 OK response (PSH) -> 192.168.4.100
192.168.4.3 -> Retransmission of Fragment 3 of HTTP 200 OK response (PSH) -> 192.168.4.100
192.168.4.100 -> ACK of Fragment 3 -> 192.168.4.3
This is actually a big problem, because there are about 40 seconds between the GET request and the last ACK which coincides with the moment the application (telnet in this case) gets the data.
I have checked all the checksum and they are correct...
So I actually don't know why this happens and what to do! I have tried with different OS as hosts (a Windows 8 mobile phone, a MAC OSX, a Ubuntu 14.04, ...), but nothing changes.
If I send the same request from another docker of the virtual network, everything works fine.
Any idea about what the problem could be?
Thanks!
PS here you can see a screenshot of the capture:
Update
One thing I think can be interesting is that I have made an analogous capture, but when a HTTP request is sent from 192.168.4.3 to 192.168.4.100. The capture is taken again on the 192.168.4.100 interface and it seems again that 192.168.4.100 ignores the packets it receives (look at the three way handshake for example). And I found no reason for this again.
Source: (StackOverflow)
I am unable to find how to install openstack on my macbook.
I tried googling but every where i am getting for ubuntu and not for mac
Kindly help me to install as i am a noob in openstack
Source: (StackOverflow)
I have a question about the images to mount on openStack.
I can use any image of any operative system? I guess not... but why?
I found images already suitable for openStack, but what's the different between an image cloud-ready and a normal image?
For instance, I can create a virtual machine with windows desktop? If not, why?
thank you
Source: (StackOverflow)
I'm getting the following error on my Openstack (DevStack) every time I try to launch an image other than cirrOS. Walking through internet leads me to:
Openstack cannot allocate RAM, CPU resources.
It's not true because I have a lot of RAM, disk space and CPU available.
set in nova.conf -> scheduler_default_filters=AllHostsFilter
Tried without success.
This hapends to any image in any format that is other than cirrOS.
Update: Now it is clear that there is no direct answer to this question. Lets hope Openstack guys will provide more specific information in this error message
Source: (StackOverflow)
I am trying to write a python program to download images from glance service. However, I could not find a way to download images from the cloud using the API. In the documentation which can be found here:
http://docs.openstack.org/user-guide/content/sdk_manage_images.html
they explain how to upload images, but not to download them.
The following code shows how to get image object, but I don't now what to do with this object:
import novaclient.v1_1.client as nvclient
name = "cirros"
nova = nvclient.Client(...)
image = nova.images.find(name=name)
is there any way to download the image file and save it on disk using this object "image"?
Source: (StackOverflow)
I have a question about whether cloud vendors have an inter-operable mechanism. For example, I am developing a WCF service and hosting in Azure successfully. After a pro-long time using Azure, can I use the same code for deploying it in AWS? Will it be possible? Does the API of both matches the same for deploying? If not, what are all the extra care needed for hosting the same service when switching over other Cloud Vendors like Salesforce.com, OpenStack, etc.,
Source: (StackOverflow)
I use linux for my cloud based servers on Amazon-EC2 and openstack.
When trying to run:
sudo chhown ubuntu somepath
I get this error every once in a while:
sudo: unable to resolve host
Most answers to this question on the internet are to edit the /etc/hosts file.
However, I deploy my servers automatically. besides that, I am not logging on using "localhost", but rather my AWS public DNS:
ssh -i mykey.pem ubuntu@ec2-12-34-56-78.eu-central-1.compute.amazonaws.com
So I cannot just trivially insert localhost, not to mention that my IP can change after I reset my machine. (Don't want to "waste" my precious floating IPs for every server)
Also, I deploy tens of servers at a time, so I cannot afford the manual step of editing a text file. Is there an automated fix for this issue?
Recently I've started using openstack, and the issue is present there too.
Source: (StackOverflow)
I have the following quote from docker's latest release note -
Like all major IaaS implementations, Openstack relies heavily on virtual machines. Although there will always be a case for VMs in certain applications, we believe lightweight containers are a great alternative in many scenarios, especially for payloads which are CPU- and memory-intensive and suffer from the performance overhead of VMs.
The above makes it clear that the advantage of docker vs VM's lies in CPU and memory intensive payloads, so my question is what is the advantage VM's have over docker ? Or when should I use VM's ver docker ? As I find that most of my scenarios are well serverd by docker.
Source: (StackOverflow)