Correct the URL of openstack and make test case more detail

pull/6/head
jianglingxia 2018-01-30 15:54:52 +08:00
parent 8d9a9dcaf2
commit bf8ebde4d2
2 changed files with 7 additions and 3 deletions

View File

@ -36,7 +36,7 @@ const (
// metadataUrlTemplate allows building an OpenStack Metadata service URL.
// It's a hardcoded IPv4 link-local address as documented in "OpenStack Cloud
// Administrator Guide", chapter Compute - Networking with nova-network.
// https://docs.openstack.org/admin-guide/compute-networking-nova.html#metadata-service
//https://docs.openstack.org/nova/latest/admin/networking-nova.html#metadata-service
defaultMetadataVersion = "2012-08-10"
metadataUrlTemplate = "http://169.254.169.254/openstack/%s/meta_data.json"
@ -45,7 +45,7 @@ const (
// Config drive is defined as an iso9660 or vfat (deprecated) drive
// with the "config-2" label.
// http://docs.openstack.org/user-guide/cli-config-drive.html
//https://docs.openstack.org/nova/latest/user/config-drive.html
configDriveLabel = "config-2"
configDrivePathTemplate = "openstack/%s/meta_data.json"
@ -66,7 +66,7 @@ type DeviceMetadata struct {
}
// Assumes the "2012-08-10" meta_data.json format.
// See http://docs.openstack.org/user-guide/cli_config_drive.html
//https://docs.openstack.org/nova/latest/user/config-drive.html
type Metadata struct {
Uuid string `json:"uuid"`
Hostname string `json:"hostname"`

View File

@ -108,4 +108,8 @@ func TestParseMetadata(t *testing.T) {
if md.Devices[0].Type != "disk" {
t.Errorf("incorrect device type: %s", md.Devices[0].Type)
}
if md.Devices[0].Serial != "6df1888b-f373-41cf-b960-3786e60a28ef" {
t.Errorf("incorrect device serial: %s", md.Devices[0].Serial)
}
}