Exemplo n.º 1
0
// vhdMediaLinkPrefix returns the media link prefix for disks
// associated with the environment. gwacl's helper returns
// http scheme URLs; we use https to simplify matching what
// Azure returns. Azure always returns https, even if you
// specified http originally.
func (v *azureVolumeSource) vhdMediaLinkPrefix() string {
	storageAccount := v.env.ecfg.storageAccountName()
	dir := path.Join("vhds", v.envUUID)
	mediaLink := gwacl.CreateVirtualHardDiskMediaLink(storageAccount, dir) + "/"
	mediaLink = "https://" + mediaLink[len("http://"):]
	return mediaLink
}
Exemplo n.º 2
0
// newOSDisk creates a gwacl.OSVirtualHardDisk object suitable for an
// Azure Virtual Machine.
func (env *azureEnviron) newOSDisk(sourceImageName string) *gwacl.OSVirtualHardDisk {
	vhdName := gwacl.MakeRandomDiskName("juju")
	vhdPath := fmt.Sprintf("vhds/%s", vhdName)
	snap := env.getSnapshot()
	storageAccount := snap.ecfg.storageAccountName()
	mediaLink := gwacl.CreateVirtualHardDiskMediaLink(storageAccount, vhdPath)
	// The disk label is optional and the disk name can be omitted if
	// mediaLink is provided.
	return gwacl.NewOSVirtualHardDisk("", "", "", mediaLink, sourceImageName, "Linux")
}
Exemplo n.º 3
0
// newOSDisk creates a gwacl.OSVirtualHardDisk object suitable for an
// Azure Virtual Machine.
func (env *azureEnviron) newOSDisk(sourceImageName string, ser string) (*gwacl.OSVirtualHardDisk, error) {
	vhdName := gwacl.MakeRandomDiskName("juju")
	vhdPath := fmt.Sprintf("vhds/%s", vhdName)
	snap := env.getSnapshot()
	storageAccount := snap.ecfg.storageAccountName()
	mediaLink := gwacl.CreateVirtualHardDiskMediaLink(storageAccount, vhdPath)
	os, err := series.GetOSFromSeries(ser)
	if err != nil {
		return nil, errors.Trace(err)
	}
	var OSType string
	switch os {
	case jujuos.Windows:
		OSType = "Windows"
	default:
		OSType = "Linux"
	}
	// The disk label is optional and the disk name can be omitted if
	// mediaLink is provided.
	return gwacl.NewOSVirtualHardDisk("", "", "", mediaLink, sourceImageName, OSType), nil
}