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
Related
I am looking for a basic thing yet I have not found not even a single good documentation on getting it done.
I want to allocate a floating IP, then associate it to a network interface of a droplet other than eth0.
The reason is I want to have the ability to very easily switch from one IP to the other with a programming language.
In a few words, I want to be able to do these two commands and both should provide a different response.
curl --interface eth0 https://icanhazip.com
curl --interface eth1 https://icanhazip.com
Also, I want to know what to do once I release the Floating IP, how do I roll back to the starting point.
All documentation I read, rely heavily on "ip route" and "route", most did not even work, some worked but replaced completely the old IP by the floating and that's not what I want, and also they did not show how to rollback the introduced configuration changes.
Please help, I spent 1 whole day now trying to get this to work for a project, and no results so far.
I guess there is no need to know DigitalOcean, how to make this work on other Cloud Providers would apply here too I think.
Update
After asking this on DigitalOcean community forum (https://www.digitalocean.com/community/questions/clear-guide-on-outbound-network-through-floating-ip), they claim that is not supported, although there may be some solutions to this if somebody can provide such a "hacky" solution I would take it too. Thanks
In the cloud (AWS. GCP etc.) ARP is emulated by the virtual network layer, meaning that only IPs assigned to VMs by the cloud platform can be resolved. Most of the L2 failover protocols do break for that reason. Even if ARP worked,the IP allocation process for these IPs (often called “floating IPs”) would not integrate with the virtual network in a standard way, so your OS can't just "grab" the IP using ARP and route the packets to itself.
I have not personally done this on Digital Ocean, but I assume that you can call the cloud's proprietary API to do this functionality if you would like to go this route.
See this link on GCP about floating IPs and their implementation. Hope this is helpful.
Here's an idea that needs to be tested:
Let's say you have Node1(10.1.1.1/24) and Node2(10.1.1.2/24)
Create a loopback interface on both VMs and set the same IP address for both like (10.2.1.1/32)
Start a heartbeat send/receive between them
When NodeA starts it automatically makes an API call to create a route for 10.2.1.1/32 and points to itself with preference 2
When NodeB starts it automatically makes an API call to create a route for 10.2.1.1/32 and points to itself with preference 1
The nodes could monitor each other to withdraw the static routes if the other fails. Ideally you would need a 3rd node to reach quorum and prevent split brain scenarios, but you get the idea right?
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.
I'm trying to migrate a Vertica cluster.
The connect statement succeeds:
CONNECT TO VERTICA mydb USER myuser PASSWORD '' on 'private-ip',5433;
The copy does not:
COPY otherdb.whatever FROM VERTICA mydb.table.whatever;
ERROR 4534: Receive on v_otherdb_node0002: Message receipt from v_otherdb_node0005 failed [canceled]
ROLLBACK 4236: One or more nodes did not open a data connection to this node. This may indicate a network configuration problem. Check that the private interfaces used for communication among the cluster hosts reside in the same subnet and are returned first by host address lookup
/etc/hosts on both clusters are configured correctly so that hostname maps to private-ip across all machines. Telnet, ping, netcat connectivity is all good.
I have tried various options:
Use identical catalog and data paths in case a mismatch is not tolerated
Use the same db name and different db names - no difference
The 2 clusters have 6 machines each, and each cluster is healthy and all nodes are up and responsive.
Any suggestions on what else I can try?
The issue was that one of the clusters had been set to EXPORT ON a different subnet than the private subnet.
Doing netcat, I discovered that:
My new cluster was sending the old cluster it's correct private node IPs
The old cluster was responding with it's node public IPs, even though "select * from nodes;" was returning the private IPs
From this I ran:
select * from vs_subnets;
select database_name, export_subnet from databases;
It turns out somebody (long ago) had configured the old cluster to use the public subnet.
You can revert this by running:
ALTER DATABASE <my-db-name> EXPORT ON DEFAULT;
This makes the DB go back to its regular subnet.
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
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.