}
}
+ priority := compute.Regular
+ evictionPolicy := compute.Deallocate
+ var billingProfile compute.BillingProfile
+ var maxPrice float64
+ if instanceType.Preemptible {
+ priority = compute.Spot
+ evictionPolicy = compute.Delete
+ // Setting maxPrice to -1 is the equivalent of paying spot price, up to the
+ // normal price. This means the node will not be pre-empted for price
+ // reasons. It may still be pre-empted for capacity reasons though. And
+ // Azure offers *no* SLA on spot instances.
+ maxPrice = -1
+ billingProfile = compute.BillingProfile{MaxPrice: &maxPrice}
+ }
+
vmParameters := compute.VirtualMachine{
Location: &az.azconfig.Location,
Tags: tags,
VMSize: compute.VirtualMachineSizeTypes(instanceType.ProviderType),
},
StorageProfile: storageProfile,
+ Priority: priority,
+ EvictionPolicy: evictionPolicy,
+ BillingProfile: &billingProfile,
NetworkProfile: &compute.NetworkProfile{
NetworkInterfaces: &[]compute.NetworkInterfaceReference{
{
Price: .02,
Preemptible: false,
},
+ "tinyp": {
+ Name: "tiny",
+ ProviderType: "Standard_D1_v2",
+ VCPUs: 1,
+ RAM: 4000000000,
+ Scratch: 10000000000,
+ Price: .002,
+ Preemptible: true,
+ },
})}
if *live != "" {
var exampleCfg testConfig
c.Check(tags["TestTagName"], check.Equals, "test tag value")
c.Logf("inst.String()=%v Address()=%v Tags()=%v", inst.String(), inst.Address(), tags)
+ instPreemptable, err := ap.Create(cluster.InstanceTypes["tinyp"],
+ img, map[string]string{
+ "TestTagName": "test tag value",
+ }, "umask 0600; echo -n test-file-data >/var/run/test-file", pk)
+
+ c.Assert(err, check.IsNil)
+
+ tags = instPreemptable.Tags()
+ c.Check(tags["TestTagName"], check.Equals, "test tag value")
+ c.Logf("instPreemptable.String()=%v Address()=%v Tags()=%v", instPreemptable.String(), instPreemptable.Address(), tags)
+
}
func (*AzureInstanceSetSuite) TestListInstances(c *check.C) {