This Confluence has been LDAP enabled, if you are an ASF Committer, please use your LDAP Credentials to login. Any problems file an INFRA jira ticket please.

Child pages
  • CloudStack extra DHCP option support
Skip to end of metadata
Go to start of metadata

Feature Reference

CLOUDSTACK-9776 - Getting issue details... STATUS

Branch

https://github.com/apache/cloudstack/pull/2049

Introduction

Cloudstack currently does not allow users to set extra DHCP options. This feature will add support for adding extra (user defined) DHCP options on every nic of a VM in Cloudstack.

CloudStack currently supports the following DHCP options:

  • 1: netmask

  • 3: router

  • 6: dns-server

  • 15: domain name

Purpose:

This design document proposes an extension of the deploy, update VM and plug nic command in order to support extra DHCP options per nic.

References

  • TBD

Document History


Feature Specifications

Summary: This design document proposes:

  • Extension of deploy, update VM and plug nic command.
  • Extension of the DhcpServiceProvider interface
  • Extension of the CloudStack database

Use cases

Beside the standard DHCP options which are provided by Cloudstack (netmask, router, dns-server and domain name) users can now specify extra DHCP options which are needed on their VM’s. For example the DHCP option for MTU (26).

Architecture and Design description

Storing the extra DHCP options

The extra dhcp options need to be stored in the database (db). We propose to create a nic_extra_dhcp_options containing the nic ref (=nic_id), dhcp code (=code int), dhcp value (=value text).

Alternatives:

  1. Store as metadata of NicVO, all options in one entry, encoded in json

  2. Store as metadata of NicVO, one entry per option, prefixed with eg "extra-dhcp-", and add a listByKeyPrefix method to the DAO

Extension of DhcpServiceProvider

We provide a new capability named EXTRA_DHCP_OPTIONS. Every dhcp service provider who supports extra dhcp options should add this capability to it’s capabilities list.

Furthermore we create a new method in the DhcpServiceProvider interface named:  setExtraDhcpOptionsForVM(...., Map<Integer, String> dhcpOptions)

dhcpOptions is a map for which the key contains the dhcp option code and the value for this key is the dhcp option value.

Extension of API

The deployVirtualMachine, updateVirtualMachine and addNicToVirtualMachine commands need to be extended with a parameter to pass the extra DHCP options. We allow the user to specify the DHCP options with their option code or the name of the DHCP options.

deployVirtualMachine
 https://cloudstack.apache.org/api/apidocs-4.9/apis/deployVirtualMachine.html
Creates and automatically starts a virtual machine based on a service offering, disk offering, and template.


ADD following optional parameter :
 

 

dhcpoptionstonetworklist

dhcp options to network mapping.

Example 1:

dhcpoptionstonetworklist[0].dhcp:<option>=<value>

&dhcpoptionstonetworklist[0].dhcp:<option>=<value >

&dhcpoptionstonetworklist[0].networkid=<uuid network 1>

&dhcpoptionstonetworklist[1].dhcp:<option>=<value>

&dhcpoptionstonetworklist[1].networkid=<uuid network 2>


Example 2 using the DHCP option name:

dhcpoptionstonetworklist[0].server-ip-address=<value>

&dhcpoptionstonetworklist[0].mtu=<value >

&dhcpoptionstonetworklist[0].networkid=<uuid network 1>

&dhcpoptionstonetworklist[1].pop3-server=<value>

&dhcpoptionstonetworklist[1].networkid=<uuid network 2>

 

This API extension allows to pass DHCP options as a list of key-value pairs, for every NIC of the newly deployed VM (or for the primary NIC only). Furthermore, we allow the user to specify the dhcp option with the dhcp option name (example 2) or with the dhcp option code (example 1).


updateVirtualMachine

 https://cloudstack.apache.org/api/apidocs-4.9/apis/updateVirtualMachine.html
Updates properties of a virtual machine. The VM has to be stopped and restarted for the new properties to take effect. UpdateVirtualMachine does not first check whether the VM is stopped. Therefore, stop the VM manually before issuing this call.

ADD following optional parameter :


 

dhcpoptionstonetworklist

dhcp options to network mapping.

Example 1:

dhcpoptionstonetworklist[0].dhcp:<option>=<value>

&dhcpoptionstonetworklist[0].dhcp:<option>=<value >

&dhcpoptionstonetworklist[0].networkid=<uuid network 1>

&dhcpoptionstonetworklist[1].dhcp:<option>=<value>

&dhcpoptionstonetworklist[1].networkid=<uuid network 2>


Example 2 using the DHCP option name:

dhcpoptionstonetworklist[0].server-ip-address=<value>

&dhcpoptionstonetworklist[0].mtu=<value >

&dhcpoptionstonetworklist[0].networkid=<uuid network 1>

&dhcpoptionstonetworklist[1].pop3-server=<value>

&dhcpoptionstonetworklist[1].networkid=<uuid network 2>

 

Dhcp options that are not specified (and were previously set) get deleted.
Other operations same as deployVirtualMachine.

addNicToVirtualMachine

 

https://cloudstack.apache.org/api/apidocs-4.8/user/addNicToVirtualMachine.html
Adds VM to specified network by creating a NIC

ADD following optional parameter :

 

 

 

dhcpoptions

Example 1:

dhcpoptions[0].dhcp:<option>=<value>

&dhcpoptions[0].dhcp:<option>=<value >


Example 2 using the DHCP option name:

dhcpoptions[0].server-ip-address=<value>

&dhcpoptions[0].mtu=<value >




 

The dhcp options will be set on the newly added nic. The option code can be passed as a code (Example 1) or as a name (Example 2).

listNics

We want to return the extra DHCP options that are set for each nic.


Mapping of DHCP option name to DHCP code

Below you find a proposed list of how the DHCP option name maps to the option code (based on dnsmasq https://github.com/imp/dnsmasq/blob/master/src/dhcp-common.c ):

 

      

time-offset

2

trailer-encapsulation

34

mobile-ip-home

68

time-server

4

arp-timeout

35

smtp-server

69

log-server

7

ethernet-encap

36

pop3-server

70

lpr-server

9

tcp-ttl

37

nntp-server

71

 


tcp-keepalive

38

irc-server

74

boot-file-size

13

nis-domain

40

user-class

77

swap-server

16

nis-server

41

client-arch

93

root-path

17

ntp-server

42

client-interface-id

94

extension-path

18

netbios-ns

44

client-machine-id

97

ip-forward-enable

19

netbios-dd

45

url

114

non-local-source-routing

20

netbios-nodetype

46

domain-search

119

policy-filter

21

netbios-scope

47

sip-server

120

max-datagram-reassembly

22

x-windows-fs

48

classless-static-route

121

default-ttl

23

x-windows-dm

49

vendor-id-encap

125

mtu

26

requested-address

50

 

 

all-subnets-local

27

vendor-class

60

 

 

broadcast

28

nis+-domain

64

  

router-discovery

31

nis+-server

65

  

router-solicitation

32

tftp-server

66

  

static-route

33

bootfile-name

67

  

Virtual Router

We will provide the new interface for DhcpServiceProviders but we will not implement the extra DHCP options for networks using VR.

NuageVsp plugin

The NuageVsp plugin will support and set extra DHCP options through the Nuage VSP SDN platform.

UI

It is proposed not to include UI development in the first iteration.

IP Clearance

No changes

Usage Impact

No impact on other components

  • No labels