Starting OpenStack instances programmatically - openstack

I am using OpenStack4J to interact with OpenStack. My goal at this point is simply to launch an instance. I can do this manually using my tenant: rosemend. And when I do this, I have a network called rosemond (Id: a9b097b3-af47-4222-b98e-f1b631f9ec45) that I select and make the instance part of.
However, using OpenStack4J, I am not able to make any progress. OpenStack4j requires a network port that I don't seem to be able to figure out how to set.
The call to set this network port would look like:
serverCreateBuilder.addNetworkPort("0a44eedc-8298-4544-87d7-094c7b34708e")
First I tried the Id of the rosemond network itself (a9b097b3-af47-4222-b98e-f1b631f9ec45). The error message in this case is:
Port id a9b097b3-af47-4222-b98e-f1b631f9ec45 could not be found.
Next, within OpenStack, when I click on the rosemond network, I see a list of 5 items called ports. I then tried using each of them resulting each in error message:
Port 0a44eedc-8298-4544-87d7-094c7b34708e is still in use.
And when I do not pass a network port at all, I get the error:
It is not allowed to create an interface on external network c6fb539b-2013-405c-903a-4700a00d954b
My question is what is the value I should use here?

I will recommend you to go with JClouds instead. In my opinion is easier to use and the documentation is better.
See my answer in Openstack cloud (identity service, nova service and swift service) vs Java application. There is some sample code in GitHub that you can check.

1) To create a vm with an existing port, port id is required.
2) The port you use to boot the vm instance must be in DOWN status (Detached). If the port is attached to an instance (active), Openstack will report conflict. For Openstack4j, it throws a ClientResponseException exception with a message: port xxxis still in use.
See https://developer.openstack.org/api-ref/compute/?expanded=create-server-detail

Related

Greenbone Community Edition (GCE) does not give results

I have installed the Greenbone Community Edition (GCE) ISO mentioned at installation in a virtual box in a Mint Linux with a bridged Adapter over WIFI in a home network. The IP that the virtual box got was 192.168.1.111.
Via advanced task wizard I started a new scan and after some sec it gave me the results:
Actually it didn't give any results.
What am I doing wrong? Should I do something further?
The most common reason for this is that the target is not answering to an ICMP Echo Request which is the default method for deciding if a target is alive.
Please check the "Alive Test" setting of your Target definition (found via Configuration -> Targets) and try some of the other available methods like "TCP Service Ping" or even "Consider Alive".
One additional issue might originate from the initial sync of the NVT feed which could take up to one our or more. Without a fully synced feed (check the availability of the NVTs via SecInfo->NVTs) you also won't get any results.

R3 Corda IOUs: Why 'http://localhost:10013/api/example/ious' is giving empty response even though I created IOUs using web interface

I recently strated exploring Corda. I have installed Corda and sample CorDapp (cordapp_example) on my location machine and ran the nodes and tried to access ious of one of the nodes (Lets say PartyA), by using below URL, it just showing empty []. I also noticed error:
netty.AMQPClient.operationComplete - Failed to connect to 20.198.218.65:10011 {}
Note that this IP address is not my local address.
http://localhost:10013/api/example/ious
[] is the standard output until an IOU has actually been issued onto the ledger. I think port 10013 corresponds to PartyC's webserver, so you'd have to create an IOU involving PartyC first.

openstack: relation between controller & compute nodes

I just started playing with openstack, and many things still don't understand. As I see it, to start a VM instance, we normally execute some commands on the controller e.g.
glance image-create
nova boot
But how does the controller know:
1) on which compute node to start the VM
2) how many compute nodes it has
Where does it take this information?
The controller will boot determine the location to launch the instance based on the information provided by nova-scheduler:
http://docs.openstack.org/juno/config-reference/content/section_compute-scheduler.html
As for how many compute nodes are recognized, this is determined when you register a compute node with nova compute on the controller. Here is a reference for how compute is installed and configured for RHEL/CentOS/Fedora:
http://docs.openstack.org/juno/install-guide/install/yum/content/ch_nova.html
I'd suggest to learn the OpenStack software architecture for such questions, for example, look at this page http://docs.openstack.org/openstack-ops/content/example_architecture.html.
Simply speacking, OpenStack saves all the configurations in database which is by default mysql, so Controller knows all the information. A Nova component named nova-scheduler running as a controller service will decide where to place VM among all available hosts.
A good staring point is to deploy multiple nodes env. You will know how OpenStack works in the deployment procedure.

Machine's uptime in OpenStack

I would like to know (and retrieve via REST API) the uptime of individual VMs running in OpenStack.
I was quite surprised that OpenStack web UI has a colon called "Uptime" but it actually show time since the VM was created. If i stop the VM, the UI shows Status=Shutoff, Power State=Shutdown, but the Uptime is still being incremented...
Is there a "real" uptime (I mean for a machine that is UP)?
Can I retrieve it somehow via the OpenStack's REST API?
I saw the comment at How can I get VM instance running time in openstack via python API? but the page with the extension mentioned there does not exists and it looks to me that this extension will not be available in all OpenStack environment. I would like to have some standard way to retrieve the uptime.
Thanks.
(Version Havana)
I haven't seen any documentation saying this is the reason, but the nova-scheduler doesn't differentiate between a running and powered off instance. So your cloud can't be over-allocated or leave an instance in a position that would be unable to be powered on. I would like to see a metric of actual system runtime as well, but at the moment the only way to gather that would be through ceilometer or via Rackspaces StackTach

Get Ip address of computes nodes in an openstack network

I planned to create a service that sleeps/wakes unused compute nodes in an openstack environment for that i need an ip address of the compute nodes.
Is there any API or command available to get IP address( not the name of the compute node )machines present in the openstack network?
There are two types of IP addresses used in OpenStack cloud environment setup.
Fixed:
Accessed only from the openstack network, That is among VMs.
Floating :
Could be accessed from outside the OpenStack cloud network, basically works on a different interface, and generally this IP is made available to public to access this VM from outside netwrok.
Now, you know this, follow the API given here.
http://api.openstack.org/api-ref.html#ext-os-ext-ips
While getting IP address through the JSON response, first you have to check whether it is fixed or floating.
That should answer your question, I hope. If not then please inform.
You can query the nova database and get the ip of all the compute nodes in the compute_node tables. I wrote a small function in python to do this for one of my tests.
def get_compute_nodes(parameters):
try:
password = parameters['password']
db=_mysql.connect(user="root",passwd=password, db="nova")
query = """select host_ip from compute_nodes where deleted=0"""
db.query(query)
r=db.use_result()
results = r.fetch_row(maxrows=0)
return results
except Exception as exp:
print "Error in accessing the Nova database"
print exp

Resources