def Run(self, args): compute_holder = base_classes.ComputeApiHolder(self.ReleaseTrack()) self._ValidateInstanceName(args) self._CheckForExistingInstances(args.instance_name, compute_holder.client) instances_flags.ValidateNicFlags(args) instances_flags.ValidateNetworkTierArgs(args) log.warning('Importing OVF. This may take 40 minutes for smaller OVFs ' 'and up to a couple of hours for larger OVFs.') machine_type = None if args.machine_type or args.custom_cpu or args.custom_memory: machine_type = instance_utils.InterpretMachineType( machine_type=args.machine_type, custom_cpu=args.custom_cpu, custom_memory=args.custom_memory, ext=getattr(args, 'custom_extensions', None), vm_type=getattr(args, 'custom_vm_type', None)) try: source_uri = daisy_utils.MakeGcsObjectOrPathUri(args.source_uri) except storage_util.InvalidObjectNameError: raise exceptions.InvalidArgumentException( 'source-uri', 'must be a path to an object or a directory in Google Cloud Storage' ) return daisy_utils.RunOVFImportBuild( args=args, compute_client=compute_holder.client, instance_name=args.instance_name, source_uri=source_uri, no_guest_environment=not args.guest_environment, can_ip_forward=args.can_ip_forward, deletion_protection=args.deletion_protection, description=args.description, labels=args.labels, machine_type=machine_type, network=args.network, network_tier=args.network_tier, subnet=args.subnet, private_network_ip=args.private_network_ip, no_restart_on_failure=not args.restart_on_failure, os=args.os, tags=args.tags, zone=properties.VALUES.compute.zone.Get(), project=args.project, output_filter=_OUTPUT_FILTER, compute_release_track=self.ReleaseTrack().id.lower() if self.ReleaseTrack() else None)
def Run(self, args): compute_holder = base_classes.ComputeApiHolder(self.ReleaseTrack()) self._ValidateInstanceNames(args) self._CheckForExistingInstances(args.instance_names, compute_holder.client) instances_flags.ValidateNicFlags(args) instances_flags.ValidateNetworkTierArgs(args) log.warning('Importing OVF. This may take 40 minutes for smaller OVFs ' 'and up to a couple of hours for larger OVFs.') machine_type = instance_utils.InterpretMachineType( machine_type=args.machine_type, custom_cpu=args.custom_cpu, custom_memory=args.custom_memory, ext=getattr(args, 'custom_extensions', None)) return daisy_utils.RunOVFImportBuild( args=args, instance_names=args.instance_names, source_uri=daisy_utils.MakeGcsUri(args.source_uri), no_guest_environment=not args.guest_environment, can_ip_forward=args.can_ip_forward, deletion_protection=args.deletion_protection, description=args.description, labels=args.labels, machine_type=machine_type, network=args.network, network_tier=args.network_tier, subnet=args.subnet, private_network_ip=args.private_network_ip, no_restart_on_failure=not args.restart_on_failure, os=args.os, tags=args.tags, zone=properties.VALUES.compute.zone.Get(), project=args.project, output_filter=_OUTPUT_FILTER)